[TS] Update auto-generated TypeScript bindings
[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 uint32_t __attribute__((export_name("TS_LDKBech32Error_ty_from_ptr"))) TS_LDKBech32Error_ty_from_ptr(uint64_t ptr) {
431         LDKBech32Error *obj = (LDKBech32Error*)untag_ptr(ptr);
432         switch(obj->tag) {
433                 case LDKBech32Error_MissingSeparator: return 0;
434                 case LDKBech32Error_InvalidChecksum: return 1;
435                 case LDKBech32Error_InvalidLength: return 2;
436                 case LDKBech32Error_InvalidChar: return 3;
437                 case LDKBech32Error_InvalidData: return 4;
438                 case LDKBech32Error_InvalidPadding: return 5;
439                 case LDKBech32Error_MixedCase: return 6;
440                 default: abort();
441         }
442 }
443 int32_t __attribute__((export_name("TS_LDKBech32Error_InvalidChar_get_invalid_char"))) TS_LDKBech32Error_InvalidChar_get_invalid_char(uint64_t ptr) {
444         LDKBech32Error *obj = (LDKBech32Error*)untag_ptr(ptr);
445         assert(obj->tag == LDKBech32Error_InvalidChar);
446                         int32_t invalid_char_conv = obj->invalid_char;
447         return invalid_char_conv;
448 }
449 int8_t __attribute__((export_name("TS_LDKBech32Error_InvalidData_get_invalid_data"))) TS_LDKBech32Error_InvalidData_get_invalid_data(uint64_t ptr) {
450         LDKBech32Error *obj = (LDKBech32Error*)untag_ptr(ptr);
451         assert(obj->tag == LDKBech32Error_InvalidData);
452                         int8_t invalid_data_conv = obj->invalid_data;
453         return invalid_data_conv;
454 }
455 static inline LDKCVec_u8Z CVec_u8Z_clone(const LDKCVec_u8Z *orig) {
456         LDKCVec_u8Z ret = { .data = MALLOC(sizeof(int8_t) * orig->datalen, "LDKCVec_u8Z clone bytes"), .datalen = orig->datalen };
457         memcpy(ret.data, orig->data, sizeof(int8_t) * ret.datalen);
458         return ret;
459 }
460 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) {
461         LDKTxOut* thing_conv = (LDKTxOut*)untag_ptr(thing);
462         LDKCVec_u8Z ret_var = TxOut_get_script_pubkey(thing_conv);
463         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
464         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
465         CVec_u8Z_free(ret_var);
466         return ret_arr;
467 }
468
469 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) {
470         LDKTxOut* thing_conv = (LDKTxOut*)untag_ptr(thing);
471         int64_t ret_conv = TxOut_get_value(thing_conv);
472         return ret_conv;
473 }
474
475 static inline void CResult_NoneNoneZ_get_ok(LDKCResult_NoneNoneZ *NONNULL_PTR owner){
476 CHECK(owner->result_ok);
477         return *owner->contents.result;
478 }
479 void  __attribute__((export_name("TS_CResult_NoneNoneZ_get_ok"))) TS_CResult_NoneNoneZ_get_ok(uint64_t owner) {
480         LDKCResult_NoneNoneZ* owner_conv = (LDKCResult_NoneNoneZ*)untag_ptr(owner);
481         CResult_NoneNoneZ_get_ok(owner_conv);
482 }
483
484 static inline void CResult_NoneNoneZ_get_err(LDKCResult_NoneNoneZ *NONNULL_PTR owner){
485 CHECK(!owner->result_ok);
486         return *owner->contents.err;
487 }
488 void  __attribute__((export_name("TS_CResult_NoneNoneZ_get_err"))) TS_CResult_NoneNoneZ_get_err(uint64_t owner) {
489         LDKCResult_NoneNoneZ* owner_conv = (LDKCResult_NoneNoneZ*)untag_ptr(owner);
490         CResult_NoneNoneZ_get_err(owner_conv);
491 }
492
493 static inline struct LDKCounterpartyCommitmentSecrets CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_ok(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ *NONNULL_PTR owner){
494         LDKCounterpartyCommitmentSecrets ret = *owner->contents.result;
495         ret.is_owned = false;
496         return ret;
497 }
498 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_ok"))) TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_ok(uint64_t owner) {
499         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)untag_ptr(owner);
500         LDKCounterpartyCommitmentSecrets ret_var = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_ok(owner_conv);
501         uint64_t ret_ref = 0;
502         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
503         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
504         return ret_ref;
505 }
506
507 static inline struct LDKDecodeError CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_err(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ *NONNULL_PTR owner){
508         LDKDecodeError ret = *owner->contents.err;
509         ret.is_owned = false;
510         return ret;
511 }
512 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_err"))) TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_err(uint64_t owner) {
513         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)untag_ptr(owner);
514         LDKDecodeError ret_var = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_err(owner_conv);
515         uint64_t ret_ref = 0;
516         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
517         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
518         return ret_ref;
519 }
520
521 static inline struct LDKSecretKey CResult_SecretKeyErrorZ_get_ok(LDKCResult_SecretKeyErrorZ *NONNULL_PTR owner){
522 CHECK(owner->result_ok);
523         return *owner->contents.result;
524 }
525 int8_tArray  __attribute__((export_name("TS_CResult_SecretKeyErrorZ_get_ok"))) TS_CResult_SecretKeyErrorZ_get_ok(uint64_t owner) {
526         LDKCResult_SecretKeyErrorZ* owner_conv = (LDKCResult_SecretKeyErrorZ*)untag_ptr(owner);
527         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
528         memcpy(ret_arr->elems, CResult_SecretKeyErrorZ_get_ok(owner_conv).bytes, 32);
529         return ret_arr;
530 }
531
532 static inline enum LDKSecp256k1Error CResult_SecretKeyErrorZ_get_err(LDKCResult_SecretKeyErrorZ *NONNULL_PTR owner){
533 CHECK(!owner->result_ok);
534         return *owner->contents.err;
535 }
536 uint32_t  __attribute__((export_name("TS_CResult_SecretKeyErrorZ_get_err"))) TS_CResult_SecretKeyErrorZ_get_err(uint64_t owner) {
537         LDKCResult_SecretKeyErrorZ* owner_conv = (LDKCResult_SecretKeyErrorZ*)untag_ptr(owner);
538         uint32_t ret_conv = LDKSecp256k1Error_to_js(CResult_SecretKeyErrorZ_get_err(owner_conv));
539         return ret_conv;
540 }
541
542 static inline struct LDKPublicKey CResult_PublicKeyErrorZ_get_ok(LDKCResult_PublicKeyErrorZ *NONNULL_PTR owner){
543 CHECK(owner->result_ok);
544         return *owner->contents.result;
545 }
546 int8_tArray  __attribute__((export_name("TS_CResult_PublicKeyErrorZ_get_ok"))) TS_CResult_PublicKeyErrorZ_get_ok(uint64_t owner) {
547         LDKCResult_PublicKeyErrorZ* owner_conv = (LDKCResult_PublicKeyErrorZ*)untag_ptr(owner);
548         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
549         memcpy(ret_arr->elems, CResult_PublicKeyErrorZ_get_ok(owner_conv).compressed_form, 33);
550         return ret_arr;
551 }
552
553 static inline enum LDKSecp256k1Error CResult_PublicKeyErrorZ_get_err(LDKCResult_PublicKeyErrorZ *NONNULL_PTR owner){
554 CHECK(!owner->result_ok);
555         return *owner->contents.err;
556 }
557 uint32_t  __attribute__((export_name("TS_CResult_PublicKeyErrorZ_get_err"))) TS_CResult_PublicKeyErrorZ_get_err(uint64_t owner) {
558         LDKCResult_PublicKeyErrorZ* owner_conv = (LDKCResult_PublicKeyErrorZ*)untag_ptr(owner);
559         uint32_t ret_conv = LDKSecp256k1Error_to_js(CResult_PublicKeyErrorZ_get_err(owner_conv));
560         return ret_conv;
561 }
562
563 static inline struct LDKTxCreationKeys CResult_TxCreationKeysDecodeErrorZ_get_ok(LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR owner){
564         LDKTxCreationKeys ret = *owner->contents.result;
565         ret.is_owned = false;
566         return ret;
567 }
568 uint64_t  __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_get_ok"))) TS_CResult_TxCreationKeysDecodeErrorZ_get_ok(uint64_t owner) {
569         LDKCResult_TxCreationKeysDecodeErrorZ* owner_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)untag_ptr(owner);
570         LDKTxCreationKeys ret_var = CResult_TxCreationKeysDecodeErrorZ_get_ok(owner_conv);
571         uint64_t ret_ref = 0;
572         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
573         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
574         return ret_ref;
575 }
576
577 static inline struct LDKDecodeError CResult_TxCreationKeysDecodeErrorZ_get_err(LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR owner){
578         LDKDecodeError ret = *owner->contents.err;
579         ret.is_owned = false;
580         return ret;
581 }
582 uint64_t  __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_get_err"))) TS_CResult_TxCreationKeysDecodeErrorZ_get_err(uint64_t owner) {
583         LDKCResult_TxCreationKeysDecodeErrorZ* owner_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)untag_ptr(owner);
584         LDKDecodeError ret_var = CResult_TxCreationKeysDecodeErrorZ_get_err(owner_conv);
585         uint64_t ret_ref = 0;
586         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
587         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
588         return ret_ref;
589 }
590
591 static inline struct LDKChannelPublicKeys CResult_ChannelPublicKeysDecodeErrorZ_get_ok(LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR owner){
592         LDKChannelPublicKeys ret = *owner->contents.result;
593         ret.is_owned = false;
594         return ret;
595 }
596 uint64_t  __attribute__((export_name("TS_CResult_ChannelPublicKeysDecodeErrorZ_get_ok"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_get_ok(uint64_t owner) {
597         LDKCResult_ChannelPublicKeysDecodeErrorZ* owner_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)untag_ptr(owner);
598         LDKChannelPublicKeys ret_var = CResult_ChannelPublicKeysDecodeErrorZ_get_ok(owner_conv);
599         uint64_t ret_ref = 0;
600         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
601         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
602         return ret_ref;
603 }
604
605 static inline struct LDKDecodeError CResult_ChannelPublicKeysDecodeErrorZ_get_err(LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR owner){
606         LDKDecodeError ret = *owner->contents.err;
607         ret.is_owned = false;
608         return ret;
609 }
610 uint64_t  __attribute__((export_name("TS_CResult_ChannelPublicKeysDecodeErrorZ_get_err"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_get_err(uint64_t owner) {
611         LDKCResult_ChannelPublicKeysDecodeErrorZ* owner_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)untag_ptr(owner);
612         LDKDecodeError ret_var = CResult_ChannelPublicKeysDecodeErrorZ_get_err(owner_conv);
613         uint64_t ret_ref = 0;
614         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
615         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
616         return ret_ref;
617 }
618
619 static inline struct LDKTxCreationKeys CResult_TxCreationKeysErrorZ_get_ok(LDKCResult_TxCreationKeysErrorZ *NONNULL_PTR owner){
620         LDKTxCreationKeys ret = *owner->contents.result;
621         ret.is_owned = false;
622         return ret;
623 }
624 uint64_t  __attribute__((export_name("TS_CResult_TxCreationKeysErrorZ_get_ok"))) TS_CResult_TxCreationKeysErrorZ_get_ok(uint64_t owner) {
625         LDKCResult_TxCreationKeysErrorZ* owner_conv = (LDKCResult_TxCreationKeysErrorZ*)untag_ptr(owner);
626         LDKTxCreationKeys ret_var = CResult_TxCreationKeysErrorZ_get_ok(owner_conv);
627         uint64_t ret_ref = 0;
628         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
629         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
630         return ret_ref;
631 }
632
633 static inline enum LDKSecp256k1Error CResult_TxCreationKeysErrorZ_get_err(LDKCResult_TxCreationKeysErrorZ *NONNULL_PTR owner){
634 CHECK(!owner->result_ok);
635         return *owner->contents.err;
636 }
637 uint32_t  __attribute__((export_name("TS_CResult_TxCreationKeysErrorZ_get_err"))) TS_CResult_TxCreationKeysErrorZ_get_err(uint64_t owner) {
638         LDKCResult_TxCreationKeysErrorZ* owner_conv = (LDKCResult_TxCreationKeysErrorZ*)untag_ptr(owner);
639         uint32_t ret_conv = LDKSecp256k1Error_to_js(CResult_TxCreationKeysErrorZ_get_err(owner_conv));
640         return ret_conv;
641 }
642
643 uint32_t __attribute__((export_name("TS_LDKCOption_u32Z_ty_from_ptr"))) TS_LDKCOption_u32Z_ty_from_ptr(uint64_t ptr) {
644         LDKCOption_u32Z *obj = (LDKCOption_u32Z*)untag_ptr(ptr);
645         switch(obj->tag) {
646                 case LDKCOption_u32Z_Some: return 0;
647                 case LDKCOption_u32Z_None: return 1;
648                 default: abort();
649         }
650 }
651 int32_t __attribute__((export_name("TS_LDKCOption_u32Z_Some_get_some"))) TS_LDKCOption_u32Z_Some_get_some(uint64_t ptr) {
652         LDKCOption_u32Z *obj = (LDKCOption_u32Z*)untag_ptr(ptr);
653         assert(obj->tag == LDKCOption_u32Z_Some);
654                         int32_t some_conv = obj->some;
655         return some_conv;
656 }
657 static inline struct LDKHTLCOutputInCommitment CResult_HTLCOutputInCommitmentDecodeErrorZ_get_ok(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR owner){
658         LDKHTLCOutputInCommitment ret = *owner->contents.result;
659         ret.is_owned = false;
660         return ret;
661 }
662 uint64_t  __attribute__((export_name("TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_get_ok"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_get_ok(uint64_t owner) {
663         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* owner_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)untag_ptr(owner);
664         LDKHTLCOutputInCommitment ret_var = CResult_HTLCOutputInCommitmentDecodeErrorZ_get_ok(owner_conv);
665         uint64_t ret_ref = 0;
666         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
667         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
668         return ret_ref;
669 }
670
671 static inline struct LDKDecodeError CResult_HTLCOutputInCommitmentDecodeErrorZ_get_err(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR owner){
672         LDKDecodeError ret = *owner->contents.err;
673         ret.is_owned = false;
674         return ret;
675 }
676 uint64_t  __attribute__((export_name("TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_get_err"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_get_err(uint64_t owner) {
677         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* owner_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)untag_ptr(owner);
678         LDKDecodeError ret_var = CResult_HTLCOutputInCommitmentDecodeErrorZ_get_err(owner_conv);
679         uint64_t ret_ref = 0;
680         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
681         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
682         return ret_ref;
683 }
684
685 static inline struct LDKCounterpartyChannelTransactionParameters CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_ok(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR owner){
686         LDKCounterpartyChannelTransactionParameters ret = *owner->contents.result;
687         ret.is_owned = false;
688         return ret;
689 }
690 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_ok"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_ok(uint64_t owner) {
691         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)untag_ptr(owner);
692         LDKCounterpartyChannelTransactionParameters ret_var = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_ok(owner_conv);
693         uint64_t ret_ref = 0;
694         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
695         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
696         return ret_ref;
697 }
698
699 static inline struct LDKDecodeError CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_err(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR owner){
700         LDKDecodeError ret = *owner->contents.err;
701         ret.is_owned = false;
702         return ret;
703 }
704 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_err"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_err(uint64_t owner) {
705         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)untag_ptr(owner);
706         LDKDecodeError ret_var = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_err(owner_conv);
707         uint64_t ret_ref = 0;
708         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
709         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
710         return ret_ref;
711 }
712
713 static inline struct LDKChannelTransactionParameters CResult_ChannelTransactionParametersDecodeErrorZ_get_ok(LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR owner){
714         LDKChannelTransactionParameters ret = *owner->contents.result;
715         ret.is_owned = false;
716         return ret;
717 }
718 uint64_t  __attribute__((export_name("TS_CResult_ChannelTransactionParametersDecodeErrorZ_get_ok"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_get_ok(uint64_t owner) {
719         LDKCResult_ChannelTransactionParametersDecodeErrorZ* owner_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)untag_ptr(owner);
720         LDKChannelTransactionParameters ret_var = CResult_ChannelTransactionParametersDecodeErrorZ_get_ok(owner_conv);
721         uint64_t ret_ref = 0;
722         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
723         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
724         return ret_ref;
725 }
726
727 static inline struct LDKDecodeError CResult_ChannelTransactionParametersDecodeErrorZ_get_err(LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR owner){
728         LDKDecodeError ret = *owner->contents.err;
729         ret.is_owned = false;
730         return ret;
731 }
732 uint64_t  __attribute__((export_name("TS_CResult_ChannelTransactionParametersDecodeErrorZ_get_err"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_get_err(uint64_t owner) {
733         LDKCResult_ChannelTransactionParametersDecodeErrorZ* owner_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)untag_ptr(owner);
734         LDKDecodeError ret_var = CResult_ChannelTransactionParametersDecodeErrorZ_get_err(owner_conv);
735         uint64_t ret_ref = 0;
736         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
737         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
738         return ret_ref;
739 }
740
741 static inline struct LDKHolderCommitmentTransaction CResult_HolderCommitmentTransactionDecodeErrorZ_get_ok(LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
742         LDKHolderCommitmentTransaction ret = *owner->contents.result;
743         ret.is_owned = false;
744         return ret;
745 }
746 uint64_t  __attribute__((export_name("TS_CResult_HolderCommitmentTransactionDecodeErrorZ_get_ok"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_get_ok(uint64_t owner) {
747         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
748         LDKHolderCommitmentTransaction ret_var = CResult_HolderCommitmentTransactionDecodeErrorZ_get_ok(owner_conv);
749         uint64_t ret_ref = 0;
750         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
751         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
752         return ret_ref;
753 }
754
755 static inline struct LDKDecodeError CResult_HolderCommitmentTransactionDecodeErrorZ_get_err(LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
756         LDKDecodeError ret = *owner->contents.err;
757         ret.is_owned = false;
758         return ret;
759 }
760 uint64_t  __attribute__((export_name("TS_CResult_HolderCommitmentTransactionDecodeErrorZ_get_err"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_get_err(uint64_t owner) {
761         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
762         LDKDecodeError ret_var = CResult_HolderCommitmentTransactionDecodeErrorZ_get_err(owner_conv);
763         uint64_t ret_ref = 0;
764         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
765         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
766         return ret_ref;
767 }
768
769 static inline struct LDKBuiltCommitmentTransaction CResult_BuiltCommitmentTransactionDecodeErrorZ_get_ok(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
770         LDKBuiltCommitmentTransaction ret = *owner->contents.result;
771         ret.is_owned = false;
772         return ret;
773 }
774 uint64_t  __attribute__((export_name("TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_get_ok"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_get_ok(uint64_t owner) {
775         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
776         LDKBuiltCommitmentTransaction ret_var = CResult_BuiltCommitmentTransactionDecodeErrorZ_get_ok(owner_conv);
777         uint64_t ret_ref = 0;
778         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
779         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
780         return ret_ref;
781 }
782
783 static inline struct LDKDecodeError CResult_BuiltCommitmentTransactionDecodeErrorZ_get_err(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
784         LDKDecodeError ret = *owner->contents.err;
785         ret.is_owned = false;
786         return ret;
787 }
788 uint64_t  __attribute__((export_name("TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_get_err"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_get_err(uint64_t owner) {
789         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
790         LDKDecodeError ret_var = CResult_BuiltCommitmentTransactionDecodeErrorZ_get_err(owner_conv);
791         uint64_t ret_ref = 0;
792         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
793         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
794         return ret_ref;
795 }
796
797 static inline struct LDKTrustedClosingTransaction CResult_TrustedClosingTransactionNoneZ_get_ok(LDKCResult_TrustedClosingTransactionNoneZ *NONNULL_PTR owner){
798         LDKTrustedClosingTransaction ret = *owner->contents.result;
799         ret.is_owned = false;
800         return ret;
801 }
802 uint64_t  __attribute__((export_name("TS_CResult_TrustedClosingTransactionNoneZ_get_ok"))) TS_CResult_TrustedClosingTransactionNoneZ_get_ok(uint64_t owner) {
803         LDKCResult_TrustedClosingTransactionNoneZ* owner_conv = (LDKCResult_TrustedClosingTransactionNoneZ*)untag_ptr(owner);
804         LDKTrustedClosingTransaction ret_var = CResult_TrustedClosingTransactionNoneZ_get_ok(owner_conv);
805         uint64_t ret_ref = 0;
806         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
807         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
808         return ret_ref;
809 }
810
811 static inline void CResult_TrustedClosingTransactionNoneZ_get_err(LDKCResult_TrustedClosingTransactionNoneZ *NONNULL_PTR owner){
812 CHECK(!owner->result_ok);
813         return *owner->contents.err;
814 }
815 void  __attribute__((export_name("TS_CResult_TrustedClosingTransactionNoneZ_get_err"))) TS_CResult_TrustedClosingTransactionNoneZ_get_err(uint64_t owner) {
816         LDKCResult_TrustedClosingTransactionNoneZ* owner_conv = (LDKCResult_TrustedClosingTransactionNoneZ*)untag_ptr(owner);
817         CResult_TrustedClosingTransactionNoneZ_get_err(owner_conv);
818 }
819
820 static inline struct LDKCommitmentTransaction CResult_CommitmentTransactionDecodeErrorZ_get_ok(LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
821         LDKCommitmentTransaction ret = *owner->contents.result;
822         ret.is_owned = false;
823         return ret;
824 }
825 uint64_t  __attribute__((export_name("TS_CResult_CommitmentTransactionDecodeErrorZ_get_ok"))) TS_CResult_CommitmentTransactionDecodeErrorZ_get_ok(uint64_t owner) {
826         LDKCResult_CommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
827         LDKCommitmentTransaction ret_var = CResult_CommitmentTransactionDecodeErrorZ_get_ok(owner_conv);
828         uint64_t ret_ref = 0;
829         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
830         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
831         return ret_ref;
832 }
833
834 static inline struct LDKDecodeError CResult_CommitmentTransactionDecodeErrorZ_get_err(LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
835         LDKDecodeError ret = *owner->contents.err;
836         ret.is_owned = false;
837         return ret;
838 }
839 uint64_t  __attribute__((export_name("TS_CResult_CommitmentTransactionDecodeErrorZ_get_err"))) TS_CResult_CommitmentTransactionDecodeErrorZ_get_err(uint64_t owner) {
840         LDKCResult_CommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
841         LDKDecodeError ret_var = CResult_CommitmentTransactionDecodeErrorZ_get_err(owner_conv);
842         uint64_t ret_ref = 0;
843         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
844         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
845         return ret_ref;
846 }
847
848 static inline struct LDKTrustedCommitmentTransaction CResult_TrustedCommitmentTransactionNoneZ_get_ok(LDKCResult_TrustedCommitmentTransactionNoneZ *NONNULL_PTR owner){
849         LDKTrustedCommitmentTransaction ret = *owner->contents.result;
850         ret.is_owned = false;
851         return ret;
852 }
853 uint64_t  __attribute__((export_name("TS_CResult_TrustedCommitmentTransactionNoneZ_get_ok"))) TS_CResult_TrustedCommitmentTransactionNoneZ_get_ok(uint64_t owner) {
854         LDKCResult_TrustedCommitmentTransactionNoneZ* owner_conv = (LDKCResult_TrustedCommitmentTransactionNoneZ*)untag_ptr(owner);
855         LDKTrustedCommitmentTransaction ret_var = CResult_TrustedCommitmentTransactionNoneZ_get_ok(owner_conv);
856         uint64_t ret_ref = 0;
857         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
858         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
859         return ret_ref;
860 }
861
862 static inline void CResult_TrustedCommitmentTransactionNoneZ_get_err(LDKCResult_TrustedCommitmentTransactionNoneZ *NONNULL_PTR owner){
863 CHECK(!owner->result_ok);
864         return *owner->contents.err;
865 }
866 void  __attribute__((export_name("TS_CResult_TrustedCommitmentTransactionNoneZ_get_err"))) TS_CResult_TrustedCommitmentTransactionNoneZ_get_err(uint64_t owner) {
867         LDKCResult_TrustedCommitmentTransactionNoneZ* owner_conv = (LDKCResult_TrustedCommitmentTransactionNoneZ*)untag_ptr(owner);
868         CResult_TrustedCommitmentTransactionNoneZ_get_err(owner_conv);
869 }
870
871 static inline struct LDKCVec_SignatureZ CResult_CVec_SignatureZNoneZ_get_ok(LDKCResult_CVec_SignatureZNoneZ *NONNULL_PTR owner){
872 CHECK(owner->result_ok);
873         return *owner->contents.result;
874 }
875 ptrArray  __attribute__((export_name("TS_CResult_CVec_SignatureZNoneZ_get_ok"))) TS_CResult_CVec_SignatureZNoneZ_get_ok(uint64_t owner) {
876         LDKCResult_CVec_SignatureZNoneZ* owner_conv = (LDKCResult_CVec_SignatureZNoneZ*)untag_ptr(owner);
877         LDKCVec_SignatureZ ret_var = CResult_CVec_SignatureZNoneZ_get_ok(owner_conv);
878         ptrArray ret_arr = NULL;
879         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
880         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
881         for (size_t m = 0; m < ret_var.datalen; m++) {
882                 int8_tArray ret_conv_12_arr = init_int8_tArray(64, __LINE__);
883                 memcpy(ret_conv_12_arr->elems, ret_var.data[m].compact_form, 64);
884                 ret_arr_ptr[m] = ret_conv_12_arr;
885         }
886         
887         return ret_arr;
888 }
889
890 static inline void CResult_CVec_SignatureZNoneZ_get_err(LDKCResult_CVec_SignatureZNoneZ *NONNULL_PTR owner){
891 CHECK(!owner->result_ok);
892         return *owner->contents.err;
893 }
894 void  __attribute__((export_name("TS_CResult_CVec_SignatureZNoneZ_get_err"))) TS_CResult_CVec_SignatureZNoneZ_get_err(uint64_t owner) {
895         LDKCResult_CVec_SignatureZNoneZ* owner_conv = (LDKCResult_CVec_SignatureZNoneZ*)untag_ptr(owner);
896         CResult_CVec_SignatureZNoneZ_get_err(owner_conv);
897 }
898
899 static inline struct LDKShutdownScript CResult_ShutdownScriptDecodeErrorZ_get_ok(LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR owner){
900         LDKShutdownScript ret = *owner->contents.result;
901         ret.is_owned = false;
902         return ret;
903 }
904 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptDecodeErrorZ_get_ok"))) TS_CResult_ShutdownScriptDecodeErrorZ_get_ok(uint64_t owner) {
905         LDKCResult_ShutdownScriptDecodeErrorZ* owner_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)untag_ptr(owner);
906         LDKShutdownScript ret_var = CResult_ShutdownScriptDecodeErrorZ_get_ok(owner_conv);
907         uint64_t ret_ref = 0;
908         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
909         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
910         return ret_ref;
911 }
912
913 static inline struct LDKDecodeError CResult_ShutdownScriptDecodeErrorZ_get_err(LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR owner){
914         LDKDecodeError ret = *owner->contents.err;
915         ret.is_owned = false;
916         return ret;
917 }
918 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptDecodeErrorZ_get_err"))) TS_CResult_ShutdownScriptDecodeErrorZ_get_err(uint64_t owner) {
919         LDKCResult_ShutdownScriptDecodeErrorZ* owner_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)untag_ptr(owner);
920         LDKDecodeError ret_var = CResult_ShutdownScriptDecodeErrorZ_get_err(owner_conv);
921         uint64_t ret_ref = 0;
922         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
923         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
924         return ret_ref;
925 }
926
927 static inline struct LDKShutdownScript CResult_ShutdownScriptInvalidShutdownScriptZ_get_ok(LDKCResult_ShutdownScriptInvalidShutdownScriptZ *NONNULL_PTR owner){
928         LDKShutdownScript ret = *owner->contents.result;
929         ret.is_owned = false;
930         return ret;
931 }
932 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptInvalidShutdownScriptZ_get_ok"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_get_ok(uint64_t owner) {
933         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* owner_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)untag_ptr(owner);
934         LDKShutdownScript ret_var = CResult_ShutdownScriptInvalidShutdownScriptZ_get_ok(owner_conv);
935         uint64_t ret_ref = 0;
936         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
937         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
938         return ret_ref;
939 }
940
941 static inline struct LDKInvalidShutdownScript CResult_ShutdownScriptInvalidShutdownScriptZ_get_err(LDKCResult_ShutdownScriptInvalidShutdownScriptZ *NONNULL_PTR owner){
942         LDKInvalidShutdownScript ret = *owner->contents.err;
943         ret.is_owned = false;
944         return ret;
945 }
946 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptInvalidShutdownScriptZ_get_err"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_get_err(uint64_t owner) {
947         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* owner_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)untag_ptr(owner);
948         LDKInvalidShutdownScript ret_var = CResult_ShutdownScriptInvalidShutdownScriptZ_get_err(owner_conv);
949         uint64_t ret_ref = 0;
950         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
951         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
952         return ret_ref;
953 }
954
955 static inline struct LDKRouteHop CResult_RouteHopDecodeErrorZ_get_ok(LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR owner){
956         LDKRouteHop ret = *owner->contents.result;
957         ret.is_owned = false;
958         return ret;
959 }
960 uint64_t  __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_get_ok"))) TS_CResult_RouteHopDecodeErrorZ_get_ok(uint64_t owner) {
961         LDKCResult_RouteHopDecodeErrorZ* owner_conv = (LDKCResult_RouteHopDecodeErrorZ*)untag_ptr(owner);
962         LDKRouteHop ret_var = CResult_RouteHopDecodeErrorZ_get_ok(owner_conv);
963         uint64_t ret_ref = 0;
964         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
965         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
966         return ret_ref;
967 }
968
969 static inline struct LDKDecodeError CResult_RouteHopDecodeErrorZ_get_err(LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR owner){
970         LDKDecodeError ret = *owner->contents.err;
971         ret.is_owned = false;
972         return ret;
973 }
974 uint64_t  __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_get_err"))) TS_CResult_RouteHopDecodeErrorZ_get_err(uint64_t owner) {
975         LDKCResult_RouteHopDecodeErrorZ* owner_conv = (LDKCResult_RouteHopDecodeErrorZ*)untag_ptr(owner);
976         LDKDecodeError ret_var = CResult_RouteHopDecodeErrorZ_get_err(owner_conv);
977         uint64_t ret_ref = 0;
978         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
979         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
980         return ret_ref;
981 }
982
983 static inline LDKCVec_RouteHopZ CVec_RouteHopZ_clone(const LDKCVec_RouteHopZ *orig) {
984         LDKCVec_RouteHopZ ret = { .data = MALLOC(sizeof(LDKRouteHop) * orig->datalen, "LDKCVec_RouteHopZ clone bytes"), .datalen = orig->datalen };
985         for (size_t i = 0; i < ret.datalen; i++) {
986                 ret.data[i] = RouteHop_clone(&orig->data[i]);
987         }
988         return ret;
989 }
990 static inline LDKCVec_CVec_RouteHopZZ CVec_CVec_RouteHopZZ_clone(const LDKCVec_CVec_RouteHopZZ *orig) {
991         LDKCVec_CVec_RouteHopZZ ret = { .data = MALLOC(sizeof(LDKCVec_RouteHopZ) * orig->datalen, "LDKCVec_CVec_RouteHopZZ clone bytes"), .datalen = orig->datalen };
992         for (size_t i = 0; i < ret.datalen; i++) {
993                 ret.data[i] = CVec_RouteHopZ_clone(&orig->data[i]);
994         }
995         return ret;
996 }
997 static inline struct LDKRoute CResult_RouteDecodeErrorZ_get_ok(LDKCResult_RouteDecodeErrorZ *NONNULL_PTR owner){
998         LDKRoute ret = *owner->contents.result;
999         ret.is_owned = false;
1000         return ret;
1001 }
1002 uint64_t  __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_get_ok"))) TS_CResult_RouteDecodeErrorZ_get_ok(uint64_t owner) {
1003         LDKCResult_RouteDecodeErrorZ* owner_conv = (LDKCResult_RouteDecodeErrorZ*)untag_ptr(owner);
1004         LDKRoute ret_var = CResult_RouteDecodeErrorZ_get_ok(owner_conv);
1005         uint64_t ret_ref = 0;
1006         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1007         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1008         return ret_ref;
1009 }
1010
1011 static inline struct LDKDecodeError CResult_RouteDecodeErrorZ_get_err(LDKCResult_RouteDecodeErrorZ *NONNULL_PTR owner){
1012         LDKDecodeError ret = *owner->contents.err;
1013         ret.is_owned = false;
1014         return ret;
1015 }
1016 uint64_t  __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_get_err"))) TS_CResult_RouteDecodeErrorZ_get_err(uint64_t owner) {
1017         LDKCResult_RouteDecodeErrorZ* owner_conv = (LDKCResult_RouteDecodeErrorZ*)untag_ptr(owner);
1018         LDKDecodeError ret_var = CResult_RouteDecodeErrorZ_get_err(owner_conv);
1019         uint64_t ret_ref = 0;
1020         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1021         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1022         return ret_ref;
1023 }
1024
1025 static inline struct LDKRouteParameters CResult_RouteParametersDecodeErrorZ_get_ok(LDKCResult_RouteParametersDecodeErrorZ *NONNULL_PTR owner){
1026         LDKRouteParameters ret = *owner->contents.result;
1027         ret.is_owned = false;
1028         return ret;
1029 }
1030 uint64_t  __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_get_ok"))) TS_CResult_RouteParametersDecodeErrorZ_get_ok(uint64_t owner) {
1031         LDKCResult_RouteParametersDecodeErrorZ* owner_conv = (LDKCResult_RouteParametersDecodeErrorZ*)untag_ptr(owner);
1032         LDKRouteParameters ret_var = CResult_RouteParametersDecodeErrorZ_get_ok(owner_conv);
1033         uint64_t ret_ref = 0;
1034         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1035         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1036         return ret_ref;
1037 }
1038
1039 static inline struct LDKDecodeError CResult_RouteParametersDecodeErrorZ_get_err(LDKCResult_RouteParametersDecodeErrorZ *NONNULL_PTR owner){
1040         LDKDecodeError ret = *owner->contents.err;
1041         ret.is_owned = false;
1042         return ret;
1043 }
1044 uint64_t  __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_get_err"))) TS_CResult_RouteParametersDecodeErrorZ_get_err(uint64_t owner) {
1045         LDKCResult_RouteParametersDecodeErrorZ* owner_conv = (LDKCResult_RouteParametersDecodeErrorZ*)untag_ptr(owner);
1046         LDKDecodeError ret_var = CResult_RouteParametersDecodeErrorZ_get_err(owner_conv);
1047         uint64_t ret_ref = 0;
1048         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1049         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1050         return ret_ref;
1051 }
1052
1053 static inline LDKCVec_RouteHintZ CVec_RouteHintZ_clone(const LDKCVec_RouteHintZ *orig) {
1054         LDKCVec_RouteHintZ ret = { .data = MALLOC(sizeof(LDKRouteHint) * orig->datalen, "LDKCVec_RouteHintZ clone bytes"), .datalen = orig->datalen };
1055         for (size_t i = 0; i < ret.datalen; i++) {
1056                 ret.data[i] = RouteHint_clone(&orig->data[i]);
1057         }
1058         return ret;
1059 }
1060 uint32_t __attribute__((export_name("TS_LDKCOption_u64Z_ty_from_ptr"))) TS_LDKCOption_u64Z_ty_from_ptr(uint64_t ptr) {
1061         LDKCOption_u64Z *obj = (LDKCOption_u64Z*)untag_ptr(ptr);
1062         switch(obj->tag) {
1063                 case LDKCOption_u64Z_Some: return 0;
1064                 case LDKCOption_u64Z_None: return 1;
1065                 default: abort();
1066         }
1067 }
1068 int64_t __attribute__((export_name("TS_LDKCOption_u64Z_Some_get_some"))) TS_LDKCOption_u64Z_Some_get_some(uint64_t ptr) {
1069         LDKCOption_u64Z *obj = (LDKCOption_u64Z*)untag_ptr(ptr);
1070         assert(obj->tag == LDKCOption_u64Z_Some);
1071                         int64_t some_conv = obj->some;
1072         return some_conv;
1073 }
1074 static inline LDKCVec_u64Z CVec_u64Z_clone(const LDKCVec_u64Z *orig) {
1075         LDKCVec_u64Z ret = { .data = MALLOC(sizeof(int64_t) * orig->datalen, "LDKCVec_u64Z clone bytes"), .datalen = orig->datalen };
1076         memcpy(ret.data, orig->data, sizeof(int64_t) * ret.datalen);
1077         return ret;
1078 }
1079 static inline struct LDKPaymentParameters CResult_PaymentParametersDecodeErrorZ_get_ok(LDKCResult_PaymentParametersDecodeErrorZ *NONNULL_PTR owner){
1080         LDKPaymentParameters ret = *owner->contents.result;
1081         ret.is_owned = false;
1082         return ret;
1083 }
1084 uint64_t  __attribute__((export_name("TS_CResult_PaymentParametersDecodeErrorZ_get_ok"))) TS_CResult_PaymentParametersDecodeErrorZ_get_ok(uint64_t owner) {
1085         LDKCResult_PaymentParametersDecodeErrorZ* owner_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)untag_ptr(owner);
1086         LDKPaymentParameters ret_var = CResult_PaymentParametersDecodeErrorZ_get_ok(owner_conv);
1087         uint64_t ret_ref = 0;
1088         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1089         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1090         return ret_ref;
1091 }
1092
1093 static inline struct LDKDecodeError CResult_PaymentParametersDecodeErrorZ_get_err(LDKCResult_PaymentParametersDecodeErrorZ *NONNULL_PTR owner){
1094         LDKDecodeError ret = *owner->contents.err;
1095         ret.is_owned = false;
1096         return ret;
1097 }
1098 uint64_t  __attribute__((export_name("TS_CResult_PaymentParametersDecodeErrorZ_get_err"))) TS_CResult_PaymentParametersDecodeErrorZ_get_err(uint64_t owner) {
1099         LDKCResult_PaymentParametersDecodeErrorZ* owner_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)untag_ptr(owner);
1100         LDKDecodeError ret_var = CResult_PaymentParametersDecodeErrorZ_get_err(owner_conv);
1101         uint64_t ret_ref = 0;
1102         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1103         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1104         return ret_ref;
1105 }
1106
1107 static inline LDKCVec_RouteHintHopZ CVec_RouteHintHopZ_clone(const LDKCVec_RouteHintHopZ *orig) {
1108         LDKCVec_RouteHintHopZ ret = { .data = MALLOC(sizeof(LDKRouteHintHop) * orig->datalen, "LDKCVec_RouteHintHopZ clone bytes"), .datalen = orig->datalen };
1109         for (size_t i = 0; i < ret.datalen; i++) {
1110                 ret.data[i] = RouteHintHop_clone(&orig->data[i]);
1111         }
1112         return ret;
1113 }
1114 static inline struct LDKRouteHint CResult_RouteHintDecodeErrorZ_get_ok(LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR owner){
1115         LDKRouteHint ret = *owner->contents.result;
1116         ret.is_owned = false;
1117         return ret;
1118 }
1119 uint64_t  __attribute__((export_name("TS_CResult_RouteHintDecodeErrorZ_get_ok"))) TS_CResult_RouteHintDecodeErrorZ_get_ok(uint64_t owner) {
1120         LDKCResult_RouteHintDecodeErrorZ* owner_conv = (LDKCResult_RouteHintDecodeErrorZ*)untag_ptr(owner);
1121         LDKRouteHint ret_var = CResult_RouteHintDecodeErrorZ_get_ok(owner_conv);
1122         uint64_t ret_ref = 0;
1123         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1124         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1125         return ret_ref;
1126 }
1127
1128 static inline struct LDKDecodeError CResult_RouteHintDecodeErrorZ_get_err(LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR owner){
1129         LDKDecodeError ret = *owner->contents.err;
1130         ret.is_owned = false;
1131         return ret;
1132 }
1133 uint64_t  __attribute__((export_name("TS_CResult_RouteHintDecodeErrorZ_get_err"))) TS_CResult_RouteHintDecodeErrorZ_get_err(uint64_t owner) {
1134         LDKCResult_RouteHintDecodeErrorZ* owner_conv = (LDKCResult_RouteHintDecodeErrorZ*)untag_ptr(owner);
1135         LDKDecodeError ret_var = CResult_RouteHintDecodeErrorZ_get_err(owner_conv);
1136         uint64_t ret_ref = 0;
1137         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1138         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1139         return ret_ref;
1140 }
1141
1142 static inline struct LDKRouteHintHop CResult_RouteHintHopDecodeErrorZ_get_ok(LDKCResult_RouteHintHopDecodeErrorZ *NONNULL_PTR owner){
1143         LDKRouteHintHop ret = *owner->contents.result;
1144         ret.is_owned = false;
1145         return ret;
1146 }
1147 uint64_t  __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_get_ok"))) TS_CResult_RouteHintHopDecodeErrorZ_get_ok(uint64_t owner) {
1148         LDKCResult_RouteHintHopDecodeErrorZ* owner_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)untag_ptr(owner);
1149         LDKRouteHintHop ret_var = CResult_RouteHintHopDecodeErrorZ_get_ok(owner_conv);
1150         uint64_t ret_ref = 0;
1151         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1152         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1153         return ret_ref;
1154 }
1155
1156 static inline struct LDKDecodeError CResult_RouteHintHopDecodeErrorZ_get_err(LDKCResult_RouteHintHopDecodeErrorZ *NONNULL_PTR owner){
1157         LDKDecodeError ret = *owner->contents.err;
1158         ret.is_owned = false;
1159         return ret;
1160 }
1161 uint64_t  __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_get_err"))) TS_CResult_RouteHintHopDecodeErrorZ_get_err(uint64_t owner) {
1162         LDKCResult_RouteHintHopDecodeErrorZ* owner_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)untag_ptr(owner);
1163         LDKDecodeError ret_var = CResult_RouteHintHopDecodeErrorZ_get_err(owner_conv);
1164         uint64_t ret_ref = 0;
1165         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1166         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1167         return ret_ref;
1168 }
1169
1170 static inline LDKCVec_ChannelDetailsZ CVec_ChannelDetailsZ_clone(const LDKCVec_ChannelDetailsZ *orig) {
1171         LDKCVec_ChannelDetailsZ ret = { .data = MALLOC(sizeof(LDKChannelDetails) * orig->datalen, "LDKCVec_ChannelDetailsZ clone bytes"), .datalen = orig->datalen };
1172         for (size_t i = 0; i < ret.datalen; i++) {
1173                 ret.data[i] = ChannelDetails_clone(&orig->data[i]);
1174         }
1175         return ret;
1176 }
1177 static inline struct LDKRoute CResult_RouteLightningErrorZ_get_ok(LDKCResult_RouteLightningErrorZ *NONNULL_PTR owner){
1178         LDKRoute ret = *owner->contents.result;
1179         ret.is_owned = false;
1180         return ret;
1181 }
1182 uint64_t  __attribute__((export_name("TS_CResult_RouteLightningErrorZ_get_ok"))) TS_CResult_RouteLightningErrorZ_get_ok(uint64_t owner) {
1183         LDKCResult_RouteLightningErrorZ* owner_conv = (LDKCResult_RouteLightningErrorZ*)untag_ptr(owner);
1184         LDKRoute ret_var = CResult_RouteLightningErrorZ_get_ok(owner_conv);
1185         uint64_t ret_ref = 0;
1186         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1187         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1188         return ret_ref;
1189 }
1190
1191 static inline struct LDKLightningError CResult_RouteLightningErrorZ_get_err(LDKCResult_RouteLightningErrorZ *NONNULL_PTR owner){
1192         LDKLightningError ret = *owner->contents.err;
1193         ret.is_owned = false;
1194         return ret;
1195 }
1196 uint64_t  __attribute__((export_name("TS_CResult_RouteLightningErrorZ_get_err"))) TS_CResult_RouteLightningErrorZ_get_err(uint64_t owner) {
1197         LDKCResult_RouteLightningErrorZ* owner_conv = (LDKCResult_RouteLightningErrorZ*)untag_ptr(owner);
1198         LDKLightningError ret_var = CResult_RouteLightningErrorZ_get_err(owner_conv);
1199         uint64_t ret_ref = 0;
1200         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1201         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1202         return ret_ref;
1203 }
1204
1205 uint32_t __attribute__((export_name("TS_LDKPaymentPurpose_ty_from_ptr"))) TS_LDKPaymentPurpose_ty_from_ptr(uint64_t ptr) {
1206         LDKPaymentPurpose *obj = (LDKPaymentPurpose*)untag_ptr(ptr);
1207         switch(obj->tag) {
1208                 case LDKPaymentPurpose_InvoicePayment: return 0;
1209                 case LDKPaymentPurpose_SpontaneousPayment: return 1;
1210                 default: abort();
1211         }
1212 }
1213 int8_tArray __attribute__((export_name("TS_LDKPaymentPurpose_InvoicePayment_get_payment_preimage"))) TS_LDKPaymentPurpose_InvoicePayment_get_payment_preimage(uint64_t ptr) {
1214         LDKPaymentPurpose *obj = (LDKPaymentPurpose*)untag_ptr(ptr);
1215         assert(obj->tag == LDKPaymentPurpose_InvoicePayment);
1216                         int8_tArray payment_preimage_arr = init_int8_tArray(32, __LINE__);
1217                         memcpy(payment_preimage_arr->elems, obj->invoice_payment.payment_preimage.data, 32);
1218         return payment_preimage_arr;
1219 }
1220 int8_tArray __attribute__((export_name("TS_LDKPaymentPurpose_InvoicePayment_get_payment_secret"))) TS_LDKPaymentPurpose_InvoicePayment_get_payment_secret(uint64_t ptr) {
1221         LDKPaymentPurpose *obj = (LDKPaymentPurpose*)untag_ptr(ptr);
1222         assert(obj->tag == LDKPaymentPurpose_InvoicePayment);
1223                         int8_tArray payment_secret_arr = init_int8_tArray(32, __LINE__);
1224                         memcpy(payment_secret_arr->elems, obj->invoice_payment.payment_secret.data, 32);
1225         return payment_secret_arr;
1226 }
1227 int8_tArray __attribute__((export_name("TS_LDKPaymentPurpose_SpontaneousPayment_get_spontaneous_payment"))) TS_LDKPaymentPurpose_SpontaneousPayment_get_spontaneous_payment(uint64_t ptr) {
1228         LDKPaymentPurpose *obj = (LDKPaymentPurpose*)untag_ptr(ptr);
1229         assert(obj->tag == LDKPaymentPurpose_SpontaneousPayment);
1230                         int8_tArray spontaneous_payment_arr = init_int8_tArray(32, __LINE__);
1231                         memcpy(spontaneous_payment_arr->elems, obj->spontaneous_payment.data, 32);
1232         return spontaneous_payment_arr;
1233 }
1234 static inline struct LDKPaymentPurpose CResult_PaymentPurposeDecodeErrorZ_get_ok(LDKCResult_PaymentPurposeDecodeErrorZ *NONNULL_PTR owner){
1235 CHECK(owner->result_ok);
1236         return PaymentPurpose_clone(&*owner->contents.result);
1237 }
1238 uint64_t  __attribute__((export_name("TS_CResult_PaymentPurposeDecodeErrorZ_get_ok"))) TS_CResult_PaymentPurposeDecodeErrorZ_get_ok(uint64_t owner) {
1239         LDKCResult_PaymentPurposeDecodeErrorZ* owner_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)untag_ptr(owner);
1240         LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
1241         *ret_copy = CResult_PaymentPurposeDecodeErrorZ_get_ok(owner_conv);
1242         uint64_t ret_ref = tag_ptr(ret_copy, true);
1243         return ret_ref;
1244 }
1245
1246 static inline struct LDKDecodeError CResult_PaymentPurposeDecodeErrorZ_get_err(LDKCResult_PaymentPurposeDecodeErrorZ *NONNULL_PTR owner){
1247         LDKDecodeError ret = *owner->contents.err;
1248         ret.is_owned = false;
1249         return ret;
1250 }
1251 uint64_t  __attribute__((export_name("TS_CResult_PaymentPurposeDecodeErrorZ_get_err"))) TS_CResult_PaymentPurposeDecodeErrorZ_get_err(uint64_t owner) {
1252         LDKCResult_PaymentPurposeDecodeErrorZ* owner_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)untag_ptr(owner);
1253         LDKDecodeError ret_var = CResult_PaymentPurposeDecodeErrorZ_get_err(owner_conv);
1254         uint64_t ret_ref = 0;
1255         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1256         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1257         return ret_ref;
1258 }
1259
1260 uint32_t __attribute__((export_name("TS_LDKClosureReason_ty_from_ptr"))) TS_LDKClosureReason_ty_from_ptr(uint64_t ptr) {
1261         LDKClosureReason *obj = (LDKClosureReason*)untag_ptr(ptr);
1262         switch(obj->tag) {
1263                 case LDKClosureReason_CounterpartyForceClosed: return 0;
1264                 case LDKClosureReason_HolderForceClosed: return 1;
1265                 case LDKClosureReason_CooperativeClosure: return 2;
1266                 case LDKClosureReason_CommitmentTxConfirmed: return 3;
1267                 case LDKClosureReason_FundingTimedOut: return 4;
1268                 case LDKClosureReason_ProcessingError: return 5;
1269                 case LDKClosureReason_DisconnectedPeer: return 6;
1270                 case LDKClosureReason_OutdatedChannelManager: return 7;
1271                 default: abort();
1272         }
1273 }
1274 jstring __attribute__((export_name("TS_LDKClosureReason_CounterpartyForceClosed_get_peer_msg"))) TS_LDKClosureReason_CounterpartyForceClosed_get_peer_msg(uint64_t ptr) {
1275         LDKClosureReason *obj = (LDKClosureReason*)untag_ptr(ptr);
1276         assert(obj->tag == LDKClosureReason_CounterpartyForceClosed);
1277                         LDKStr peer_msg_str = obj->counterparty_force_closed.peer_msg;
1278                         jstring peer_msg_conv = str_ref_to_ts(peer_msg_str.chars, peer_msg_str.len);
1279         return peer_msg_conv;
1280 }
1281 jstring __attribute__((export_name("TS_LDKClosureReason_ProcessingError_get_err"))) TS_LDKClosureReason_ProcessingError_get_err(uint64_t ptr) {
1282         LDKClosureReason *obj = (LDKClosureReason*)untag_ptr(ptr);
1283         assert(obj->tag == LDKClosureReason_ProcessingError);
1284                         LDKStr err_str = obj->processing_error.err;
1285                         jstring err_conv = str_ref_to_ts(err_str.chars, err_str.len);
1286         return err_conv;
1287 }
1288 uint32_t __attribute__((export_name("TS_LDKCOption_ClosureReasonZ_ty_from_ptr"))) TS_LDKCOption_ClosureReasonZ_ty_from_ptr(uint64_t ptr) {
1289         LDKCOption_ClosureReasonZ *obj = (LDKCOption_ClosureReasonZ*)untag_ptr(ptr);
1290         switch(obj->tag) {
1291                 case LDKCOption_ClosureReasonZ_Some: return 0;
1292                 case LDKCOption_ClosureReasonZ_None: return 1;
1293                 default: abort();
1294         }
1295 }
1296 uint64_t __attribute__((export_name("TS_LDKCOption_ClosureReasonZ_Some_get_some"))) TS_LDKCOption_ClosureReasonZ_Some_get_some(uint64_t ptr) {
1297         LDKCOption_ClosureReasonZ *obj = (LDKCOption_ClosureReasonZ*)untag_ptr(ptr);
1298         assert(obj->tag == LDKCOption_ClosureReasonZ_Some);
1299                         uint64_t some_ref = tag_ptr(&obj->some, false);
1300         return some_ref;
1301 }
1302 static inline struct LDKCOption_ClosureReasonZ CResult_COption_ClosureReasonZDecodeErrorZ_get_ok(LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR owner){
1303 CHECK(owner->result_ok);
1304         return COption_ClosureReasonZ_clone(&*owner->contents.result);
1305 }
1306 uint64_t  __attribute__((export_name("TS_CResult_COption_ClosureReasonZDecodeErrorZ_get_ok"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_get_ok(uint64_t owner) {
1307         LDKCResult_COption_ClosureReasonZDecodeErrorZ* owner_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)untag_ptr(owner);
1308         LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
1309         *ret_copy = CResult_COption_ClosureReasonZDecodeErrorZ_get_ok(owner_conv);
1310         uint64_t ret_ref = tag_ptr(ret_copy, true);
1311         return ret_ref;
1312 }
1313
1314 static inline struct LDKDecodeError CResult_COption_ClosureReasonZDecodeErrorZ_get_err(LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR owner){
1315         LDKDecodeError ret = *owner->contents.err;
1316         ret.is_owned = false;
1317         return ret;
1318 }
1319 uint64_t  __attribute__((export_name("TS_CResult_COption_ClosureReasonZDecodeErrorZ_get_err"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_get_err(uint64_t owner) {
1320         LDKCResult_COption_ClosureReasonZDecodeErrorZ* owner_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)untag_ptr(owner);
1321         LDKDecodeError ret_var = CResult_COption_ClosureReasonZDecodeErrorZ_get_err(owner_conv);
1322         uint64_t ret_ref = 0;
1323         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1324         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1325         return ret_ref;
1326 }
1327
1328 uint32_t __attribute__((export_name("TS_LDKHTLCDestination_ty_from_ptr"))) TS_LDKHTLCDestination_ty_from_ptr(uint64_t ptr) {
1329         LDKHTLCDestination *obj = (LDKHTLCDestination*)untag_ptr(ptr);
1330         switch(obj->tag) {
1331                 case LDKHTLCDestination_NextHopChannel: return 0;
1332                 case LDKHTLCDestination_UnknownNextHop: return 1;
1333                 case LDKHTLCDestination_FailedPayment: return 2;
1334                 default: abort();
1335         }
1336 }
1337 int8_tArray __attribute__((export_name("TS_LDKHTLCDestination_NextHopChannel_get_node_id"))) TS_LDKHTLCDestination_NextHopChannel_get_node_id(uint64_t ptr) {
1338         LDKHTLCDestination *obj = (LDKHTLCDestination*)untag_ptr(ptr);
1339         assert(obj->tag == LDKHTLCDestination_NextHopChannel);
1340                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
1341                         memcpy(node_id_arr->elems, obj->next_hop_channel.node_id.compressed_form, 33);
1342         return node_id_arr;
1343 }
1344 int8_tArray __attribute__((export_name("TS_LDKHTLCDestination_NextHopChannel_get_channel_id"))) TS_LDKHTLCDestination_NextHopChannel_get_channel_id(uint64_t ptr) {
1345         LDKHTLCDestination *obj = (LDKHTLCDestination*)untag_ptr(ptr);
1346         assert(obj->tag == LDKHTLCDestination_NextHopChannel);
1347                         int8_tArray channel_id_arr = init_int8_tArray(32, __LINE__);
1348                         memcpy(channel_id_arr->elems, obj->next_hop_channel.channel_id.data, 32);
1349         return channel_id_arr;
1350 }
1351 int64_t __attribute__((export_name("TS_LDKHTLCDestination_UnknownNextHop_get_requested_forward_scid"))) TS_LDKHTLCDestination_UnknownNextHop_get_requested_forward_scid(uint64_t ptr) {
1352         LDKHTLCDestination *obj = (LDKHTLCDestination*)untag_ptr(ptr);
1353         assert(obj->tag == LDKHTLCDestination_UnknownNextHop);
1354                         int64_t requested_forward_scid_conv = obj->unknown_next_hop.requested_forward_scid;
1355         return requested_forward_scid_conv;
1356 }
1357 int8_tArray __attribute__((export_name("TS_LDKHTLCDestination_FailedPayment_get_payment_hash"))) TS_LDKHTLCDestination_FailedPayment_get_payment_hash(uint64_t ptr) {
1358         LDKHTLCDestination *obj = (LDKHTLCDestination*)untag_ptr(ptr);
1359         assert(obj->tag == LDKHTLCDestination_FailedPayment);
1360                         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
1361                         memcpy(payment_hash_arr->elems, obj->failed_payment.payment_hash.data, 32);
1362         return payment_hash_arr;
1363 }
1364 uint32_t __attribute__((export_name("TS_LDKCOption_HTLCDestinationZ_ty_from_ptr"))) TS_LDKCOption_HTLCDestinationZ_ty_from_ptr(uint64_t ptr) {
1365         LDKCOption_HTLCDestinationZ *obj = (LDKCOption_HTLCDestinationZ*)untag_ptr(ptr);
1366         switch(obj->tag) {
1367                 case LDKCOption_HTLCDestinationZ_Some: return 0;
1368                 case LDKCOption_HTLCDestinationZ_None: return 1;
1369                 default: abort();
1370         }
1371 }
1372 uint64_t __attribute__((export_name("TS_LDKCOption_HTLCDestinationZ_Some_get_some"))) TS_LDKCOption_HTLCDestinationZ_Some_get_some(uint64_t ptr) {
1373         LDKCOption_HTLCDestinationZ *obj = (LDKCOption_HTLCDestinationZ*)untag_ptr(ptr);
1374         assert(obj->tag == LDKCOption_HTLCDestinationZ_Some);
1375                         uint64_t some_ref = tag_ptr(&obj->some, false);
1376         return some_ref;
1377 }
1378 static inline struct LDKCOption_HTLCDestinationZ CResult_COption_HTLCDestinationZDecodeErrorZ_get_ok(LDKCResult_COption_HTLCDestinationZDecodeErrorZ *NONNULL_PTR owner){
1379 CHECK(owner->result_ok);
1380         return COption_HTLCDestinationZ_clone(&*owner->contents.result);
1381 }
1382 uint64_t  __attribute__((export_name("TS_CResult_COption_HTLCDestinationZDecodeErrorZ_get_ok"))) TS_CResult_COption_HTLCDestinationZDecodeErrorZ_get_ok(uint64_t owner) {
1383         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* owner_conv = (LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)untag_ptr(owner);
1384         LDKCOption_HTLCDestinationZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCDestinationZ), "LDKCOption_HTLCDestinationZ");
1385         *ret_copy = CResult_COption_HTLCDestinationZDecodeErrorZ_get_ok(owner_conv);
1386         uint64_t ret_ref = tag_ptr(ret_copy, true);
1387         return ret_ref;
1388 }
1389
1390 static inline struct LDKDecodeError CResult_COption_HTLCDestinationZDecodeErrorZ_get_err(LDKCResult_COption_HTLCDestinationZDecodeErrorZ *NONNULL_PTR owner){
1391         LDKDecodeError ret = *owner->contents.err;
1392         ret.is_owned = false;
1393         return ret;
1394 }
1395 uint64_t  __attribute__((export_name("TS_CResult_COption_HTLCDestinationZDecodeErrorZ_get_err"))) TS_CResult_COption_HTLCDestinationZDecodeErrorZ_get_err(uint64_t owner) {
1396         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* owner_conv = (LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)untag_ptr(owner);
1397         LDKDecodeError ret_var = CResult_COption_HTLCDestinationZDecodeErrorZ_get_err(owner_conv);
1398         uint64_t ret_ref = 0;
1399         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1400         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1401         return ret_ref;
1402 }
1403
1404 uint32_t __attribute__((export_name("TS_LDKNetworkUpdate_ty_from_ptr"))) TS_LDKNetworkUpdate_ty_from_ptr(uint64_t ptr) {
1405         LDKNetworkUpdate *obj = (LDKNetworkUpdate*)untag_ptr(ptr);
1406         switch(obj->tag) {
1407                 case LDKNetworkUpdate_ChannelUpdateMessage: return 0;
1408                 case LDKNetworkUpdate_ChannelFailure: return 1;
1409                 case LDKNetworkUpdate_NodeFailure: return 2;
1410                 default: abort();
1411         }
1412 }
1413 uint64_t __attribute__((export_name("TS_LDKNetworkUpdate_ChannelUpdateMessage_get_msg"))) TS_LDKNetworkUpdate_ChannelUpdateMessage_get_msg(uint64_t ptr) {
1414         LDKNetworkUpdate *obj = (LDKNetworkUpdate*)untag_ptr(ptr);
1415         assert(obj->tag == LDKNetworkUpdate_ChannelUpdateMessage);
1416                         LDKChannelUpdate msg_var = obj->channel_update_message.msg;
1417                         uint64_t msg_ref = 0;
1418                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
1419                         msg_ref = tag_ptr(msg_var.inner, false);
1420         return msg_ref;
1421 }
1422 int64_t __attribute__((export_name("TS_LDKNetworkUpdate_ChannelFailure_get_short_channel_id"))) TS_LDKNetworkUpdate_ChannelFailure_get_short_channel_id(uint64_t ptr) {
1423         LDKNetworkUpdate *obj = (LDKNetworkUpdate*)untag_ptr(ptr);
1424         assert(obj->tag == LDKNetworkUpdate_ChannelFailure);
1425                         int64_t short_channel_id_conv = obj->channel_failure.short_channel_id;
1426         return short_channel_id_conv;
1427 }
1428 jboolean __attribute__((export_name("TS_LDKNetworkUpdate_ChannelFailure_get_is_permanent"))) TS_LDKNetworkUpdate_ChannelFailure_get_is_permanent(uint64_t ptr) {
1429         LDKNetworkUpdate *obj = (LDKNetworkUpdate*)untag_ptr(ptr);
1430         assert(obj->tag == LDKNetworkUpdate_ChannelFailure);
1431                         jboolean is_permanent_conv = obj->channel_failure.is_permanent;
1432         return is_permanent_conv;
1433 }
1434 int8_tArray __attribute__((export_name("TS_LDKNetworkUpdate_NodeFailure_get_node_id"))) TS_LDKNetworkUpdate_NodeFailure_get_node_id(uint64_t ptr) {
1435         LDKNetworkUpdate *obj = (LDKNetworkUpdate*)untag_ptr(ptr);
1436         assert(obj->tag == LDKNetworkUpdate_NodeFailure);
1437                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
1438                         memcpy(node_id_arr->elems, obj->node_failure.node_id.compressed_form, 33);
1439         return node_id_arr;
1440 }
1441 jboolean __attribute__((export_name("TS_LDKNetworkUpdate_NodeFailure_get_is_permanent"))) TS_LDKNetworkUpdate_NodeFailure_get_is_permanent(uint64_t ptr) {
1442         LDKNetworkUpdate *obj = (LDKNetworkUpdate*)untag_ptr(ptr);
1443         assert(obj->tag == LDKNetworkUpdate_NodeFailure);
1444                         jboolean is_permanent_conv = obj->node_failure.is_permanent;
1445         return is_permanent_conv;
1446 }
1447 uint32_t __attribute__((export_name("TS_LDKCOption_NetworkUpdateZ_ty_from_ptr"))) TS_LDKCOption_NetworkUpdateZ_ty_from_ptr(uint64_t ptr) {
1448         LDKCOption_NetworkUpdateZ *obj = (LDKCOption_NetworkUpdateZ*)untag_ptr(ptr);
1449         switch(obj->tag) {
1450                 case LDKCOption_NetworkUpdateZ_Some: return 0;
1451                 case LDKCOption_NetworkUpdateZ_None: return 1;
1452                 default: abort();
1453         }
1454 }
1455 uint64_t __attribute__((export_name("TS_LDKCOption_NetworkUpdateZ_Some_get_some"))) TS_LDKCOption_NetworkUpdateZ_Some_get_some(uint64_t ptr) {
1456         LDKCOption_NetworkUpdateZ *obj = (LDKCOption_NetworkUpdateZ*)untag_ptr(ptr);
1457         assert(obj->tag == LDKCOption_NetworkUpdateZ_Some);
1458                         uint64_t some_ref = tag_ptr(&obj->some, false);
1459         return some_ref;
1460 }
1461 uint32_t __attribute__((export_name("TS_LDKSpendableOutputDescriptor_ty_from_ptr"))) TS_LDKSpendableOutputDescriptor_ty_from_ptr(uint64_t ptr) {
1462         LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)untag_ptr(ptr);
1463         switch(obj->tag) {
1464                 case LDKSpendableOutputDescriptor_StaticOutput: return 0;
1465                 case LDKSpendableOutputDescriptor_DelayedPaymentOutput: return 1;
1466                 case LDKSpendableOutputDescriptor_StaticPaymentOutput: return 2;
1467                 default: abort();
1468         }
1469 }
1470 uint64_t __attribute__((export_name("TS_LDKSpendableOutputDescriptor_StaticOutput_get_outpoint"))) TS_LDKSpendableOutputDescriptor_StaticOutput_get_outpoint(uint64_t ptr) {
1471         LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)untag_ptr(ptr);
1472         assert(obj->tag == LDKSpendableOutputDescriptor_StaticOutput);
1473                         LDKOutPoint outpoint_var = obj->static_output.outpoint;
1474                         uint64_t outpoint_ref = 0;
1475                         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_var);
1476                         outpoint_ref = tag_ptr(outpoint_var.inner, false);
1477         return outpoint_ref;
1478 }
1479 uint64_t __attribute__((export_name("TS_LDKSpendableOutputDescriptor_StaticOutput_get_output"))) TS_LDKSpendableOutputDescriptor_StaticOutput_get_output(uint64_t ptr) {
1480         LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)untag_ptr(ptr);
1481         assert(obj->tag == LDKSpendableOutputDescriptor_StaticOutput);
1482                         LDKTxOut* output_ref = &obj->static_output.output;
1483         return tag_ptr(output_ref, false);
1484 }
1485 uint64_t __attribute__((export_name("TS_LDKSpendableOutputDescriptor_DelayedPaymentOutput_get_delayed_payment_output"))) TS_LDKSpendableOutputDescriptor_DelayedPaymentOutput_get_delayed_payment_output(uint64_t ptr) {
1486         LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)untag_ptr(ptr);
1487         assert(obj->tag == LDKSpendableOutputDescriptor_DelayedPaymentOutput);
1488                         LDKDelayedPaymentOutputDescriptor delayed_payment_output_var = obj->delayed_payment_output;
1489                         uint64_t delayed_payment_output_ref = 0;
1490                         CHECK_INNER_FIELD_ACCESS_OR_NULL(delayed_payment_output_var);
1491                         delayed_payment_output_ref = tag_ptr(delayed_payment_output_var.inner, false);
1492         return delayed_payment_output_ref;
1493 }
1494 uint64_t __attribute__((export_name("TS_LDKSpendableOutputDescriptor_StaticPaymentOutput_get_static_payment_output"))) TS_LDKSpendableOutputDescriptor_StaticPaymentOutput_get_static_payment_output(uint64_t ptr) {
1495         LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)untag_ptr(ptr);
1496         assert(obj->tag == LDKSpendableOutputDescriptor_StaticPaymentOutput);
1497                         LDKStaticPaymentOutputDescriptor static_payment_output_var = obj->static_payment_output;
1498                         uint64_t static_payment_output_ref = 0;
1499                         CHECK_INNER_FIELD_ACCESS_OR_NULL(static_payment_output_var);
1500                         static_payment_output_ref = tag_ptr(static_payment_output_var.inner, false);
1501         return static_payment_output_ref;
1502 }
1503 static inline LDKCVec_SpendableOutputDescriptorZ CVec_SpendableOutputDescriptorZ_clone(const LDKCVec_SpendableOutputDescriptorZ *orig) {
1504         LDKCVec_SpendableOutputDescriptorZ ret = { .data = MALLOC(sizeof(LDKSpendableOutputDescriptor) * orig->datalen, "LDKCVec_SpendableOutputDescriptorZ clone bytes"), .datalen = orig->datalen };
1505         for (size_t i = 0; i < ret.datalen; i++) {
1506                 ret.data[i] = SpendableOutputDescriptor_clone(&orig->data[i]);
1507         }
1508         return ret;
1509 }
1510 uint32_t __attribute__((export_name("TS_LDKEvent_ty_from_ptr"))) TS_LDKEvent_ty_from_ptr(uint64_t ptr) {
1511         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1512         switch(obj->tag) {
1513                 case LDKEvent_FundingGenerationReady: return 0;
1514                 case LDKEvent_PaymentReceived: return 1;
1515                 case LDKEvent_PaymentClaimed: return 2;
1516                 case LDKEvent_PaymentSent: return 3;
1517                 case LDKEvent_PaymentFailed: return 4;
1518                 case LDKEvent_PaymentPathSuccessful: return 5;
1519                 case LDKEvent_PaymentPathFailed: return 6;
1520                 case LDKEvent_ProbeSuccessful: return 7;
1521                 case LDKEvent_ProbeFailed: return 8;
1522                 case LDKEvent_PendingHTLCsForwardable: return 9;
1523                 case LDKEvent_SpendableOutputs: return 10;
1524                 case LDKEvent_PaymentForwarded: return 11;
1525                 case LDKEvent_ChannelClosed: return 12;
1526                 case LDKEvent_DiscardFunding: return 13;
1527                 case LDKEvent_OpenChannelRequest: return 14;
1528                 case LDKEvent_HTLCHandlingFailed: return 15;
1529                 default: abort();
1530         }
1531 }
1532 int8_tArray __attribute__((export_name("TS_LDKEvent_FundingGenerationReady_get_temporary_channel_id"))) TS_LDKEvent_FundingGenerationReady_get_temporary_channel_id(uint64_t ptr) {
1533         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1534         assert(obj->tag == LDKEvent_FundingGenerationReady);
1535                         int8_tArray temporary_channel_id_arr = init_int8_tArray(32, __LINE__);
1536                         memcpy(temporary_channel_id_arr->elems, obj->funding_generation_ready.temporary_channel_id.data, 32);
1537         return temporary_channel_id_arr;
1538 }
1539 int8_tArray __attribute__((export_name("TS_LDKEvent_FundingGenerationReady_get_counterparty_node_id"))) TS_LDKEvent_FundingGenerationReady_get_counterparty_node_id(uint64_t ptr) {
1540         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1541         assert(obj->tag == LDKEvent_FundingGenerationReady);
1542                         int8_tArray counterparty_node_id_arr = init_int8_tArray(33, __LINE__);
1543                         memcpy(counterparty_node_id_arr->elems, obj->funding_generation_ready.counterparty_node_id.compressed_form, 33);
1544         return counterparty_node_id_arr;
1545 }
1546 int64_t __attribute__((export_name("TS_LDKEvent_FundingGenerationReady_get_channel_value_satoshis"))) TS_LDKEvent_FundingGenerationReady_get_channel_value_satoshis(uint64_t ptr) {
1547         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1548         assert(obj->tag == LDKEvent_FundingGenerationReady);
1549                         int64_t channel_value_satoshis_conv = obj->funding_generation_ready.channel_value_satoshis;
1550         return channel_value_satoshis_conv;
1551 }
1552 int8_tArray __attribute__((export_name("TS_LDKEvent_FundingGenerationReady_get_output_script"))) TS_LDKEvent_FundingGenerationReady_get_output_script(uint64_t ptr) {
1553         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1554         assert(obj->tag == LDKEvent_FundingGenerationReady);
1555                         LDKCVec_u8Z output_script_var = obj->funding_generation_ready.output_script;
1556                         int8_tArray output_script_arr = init_int8_tArray(output_script_var.datalen, __LINE__);
1557                         memcpy(output_script_arr->elems, output_script_var.data, output_script_var.datalen);
1558         return output_script_arr;
1559 }
1560 int64_t __attribute__((export_name("TS_LDKEvent_FundingGenerationReady_get_user_channel_id"))) TS_LDKEvent_FundingGenerationReady_get_user_channel_id(uint64_t ptr) {
1561         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1562         assert(obj->tag == LDKEvent_FundingGenerationReady);
1563                         int64_t user_channel_id_conv = obj->funding_generation_ready.user_channel_id;
1564         return user_channel_id_conv;
1565 }
1566 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentReceived_get_payment_hash"))) TS_LDKEvent_PaymentReceived_get_payment_hash(uint64_t ptr) {
1567         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1568         assert(obj->tag == LDKEvent_PaymentReceived);
1569                         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
1570                         memcpy(payment_hash_arr->elems, obj->payment_received.payment_hash.data, 32);
1571         return payment_hash_arr;
1572 }
1573 int64_t __attribute__((export_name("TS_LDKEvent_PaymentReceived_get_amount_msat"))) TS_LDKEvent_PaymentReceived_get_amount_msat(uint64_t ptr) {
1574         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1575         assert(obj->tag == LDKEvent_PaymentReceived);
1576                         int64_t amount_msat_conv = obj->payment_received.amount_msat;
1577         return amount_msat_conv;
1578 }
1579 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentReceived_get_purpose"))) TS_LDKEvent_PaymentReceived_get_purpose(uint64_t ptr) {
1580         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1581         assert(obj->tag == LDKEvent_PaymentReceived);
1582                         uint64_t purpose_ref = tag_ptr(&obj->payment_received.purpose, false);
1583         return purpose_ref;
1584 }
1585 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentClaimed_get_payment_hash"))) TS_LDKEvent_PaymentClaimed_get_payment_hash(uint64_t ptr) {
1586         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1587         assert(obj->tag == LDKEvent_PaymentClaimed);
1588                         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
1589                         memcpy(payment_hash_arr->elems, obj->payment_claimed.payment_hash.data, 32);
1590         return payment_hash_arr;
1591 }
1592 int64_t __attribute__((export_name("TS_LDKEvent_PaymentClaimed_get_amount_msat"))) TS_LDKEvent_PaymentClaimed_get_amount_msat(uint64_t ptr) {
1593         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1594         assert(obj->tag == LDKEvent_PaymentClaimed);
1595                         int64_t amount_msat_conv = obj->payment_claimed.amount_msat;
1596         return amount_msat_conv;
1597 }
1598 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentClaimed_get_purpose"))) TS_LDKEvent_PaymentClaimed_get_purpose(uint64_t ptr) {
1599         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1600         assert(obj->tag == LDKEvent_PaymentClaimed);
1601                         uint64_t purpose_ref = tag_ptr(&obj->payment_claimed.purpose, false);
1602         return purpose_ref;
1603 }
1604 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentSent_get_payment_id"))) TS_LDKEvent_PaymentSent_get_payment_id(uint64_t ptr) {
1605         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1606         assert(obj->tag == LDKEvent_PaymentSent);
1607                         int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
1608                         memcpy(payment_id_arr->elems, obj->payment_sent.payment_id.data, 32);
1609         return payment_id_arr;
1610 }
1611 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentSent_get_payment_preimage"))) TS_LDKEvent_PaymentSent_get_payment_preimage(uint64_t ptr) {
1612         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1613         assert(obj->tag == LDKEvent_PaymentSent);
1614                         int8_tArray payment_preimage_arr = init_int8_tArray(32, __LINE__);
1615                         memcpy(payment_preimage_arr->elems, obj->payment_sent.payment_preimage.data, 32);
1616         return payment_preimage_arr;
1617 }
1618 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentSent_get_payment_hash"))) TS_LDKEvent_PaymentSent_get_payment_hash(uint64_t ptr) {
1619         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1620         assert(obj->tag == LDKEvent_PaymentSent);
1621                         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
1622                         memcpy(payment_hash_arr->elems, obj->payment_sent.payment_hash.data, 32);
1623         return payment_hash_arr;
1624 }
1625 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentSent_get_fee_paid_msat"))) TS_LDKEvent_PaymentSent_get_fee_paid_msat(uint64_t ptr) {
1626         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1627         assert(obj->tag == LDKEvent_PaymentSent);
1628                         uint64_t fee_paid_msat_ref = tag_ptr(&obj->payment_sent.fee_paid_msat, false);
1629         return fee_paid_msat_ref;
1630 }
1631 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentFailed_get_payment_id"))) TS_LDKEvent_PaymentFailed_get_payment_id(uint64_t ptr) {
1632         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1633         assert(obj->tag == LDKEvent_PaymentFailed);
1634                         int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
1635                         memcpy(payment_id_arr->elems, obj->payment_failed.payment_id.data, 32);
1636         return payment_id_arr;
1637 }
1638 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentFailed_get_payment_hash"))) TS_LDKEvent_PaymentFailed_get_payment_hash(uint64_t ptr) {
1639         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1640         assert(obj->tag == LDKEvent_PaymentFailed);
1641                         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
1642                         memcpy(payment_hash_arr->elems, obj->payment_failed.payment_hash.data, 32);
1643         return payment_hash_arr;
1644 }
1645 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentPathSuccessful_get_payment_id"))) TS_LDKEvent_PaymentPathSuccessful_get_payment_id(uint64_t ptr) {
1646         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1647         assert(obj->tag == LDKEvent_PaymentPathSuccessful);
1648                         int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
1649                         memcpy(payment_id_arr->elems, obj->payment_path_successful.payment_id.data, 32);
1650         return payment_id_arr;
1651 }
1652 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentPathSuccessful_get_payment_hash"))) TS_LDKEvent_PaymentPathSuccessful_get_payment_hash(uint64_t ptr) {
1653         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1654         assert(obj->tag == LDKEvent_PaymentPathSuccessful);
1655                         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
1656                         memcpy(payment_hash_arr->elems, obj->payment_path_successful.payment_hash.data, 32);
1657         return payment_hash_arr;
1658 }
1659 uint64_tArray __attribute__((export_name("TS_LDKEvent_PaymentPathSuccessful_get_path"))) TS_LDKEvent_PaymentPathSuccessful_get_path(uint64_t ptr) {
1660         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1661         assert(obj->tag == LDKEvent_PaymentPathSuccessful);
1662                         LDKCVec_RouteHopZ path_var = obj->payment_path_successful.path;
1663                         uint64_tArray path_arr = NULL;
1664                         path_arr = init_uint64_tArray(path_var.datalen, __LINE__);
1665                         uint64_t *path_arr_ptr = (uint64_t*)(((uint8_t*)path_arr) + 8);
1666                         for (size_t k = 0; k < path_var.datalen; k++) {
1667                                 LDKRouteHop path_conv_10_var = path_var.data[k];
1668                                 uint64_t path_conv_10_ref = 0;
1669                                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var);
1670                                 path_conv_10_ref = tag_ptr(path_conv_10_var.inner, false);
1671                                 path_arr_ptr[k] = path_conv_10_ref;
1672                         }
1673                         
1674         return path_arr;
1675 }
1676 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentPathFailed_get_payment_id"))) TS_LDKEvent_PaymentPathFailed_get_payment_id(uint64_t ptr) {
1677         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1678         assert(obj->tag == LDKEvent_PaymentPathFailed);
1679                         int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
1680                         memcpy(payment_id_arr->elems, obj->payment_path_failed.payment_id.data, 32);
1681         return payment_id_arr;
1682 }
1683 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentPathFailed_get_payment_hash"))) TS_LDKEvent_PaymentPathFailed_get_payment_hash(uint64_t ptr) {
1684         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1685         assert(obj->tag == LDKEvent_PaymentPathFailed);
1686                         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
1687                         memcpy(payment_hash_arr->elems, obj->payment_path_failed.payment_hash.data, 32);
1688         return payment_hash_arr;
1689 }
1690 jboolean __attribute__((export_name("TS_LDKEvent_PaymentPathFailed_get_rejected_by_dest"))) TS_LDKEvent_PaymentPathFailed_get_rejected_by_dest(uint64_t ptr) {
1691         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1692         assert(obj->tag == LDKEvent_PaymentPathFailed);
1693                         jboolean rejected_by_dest_conv = obj->payment_path_failed.rejected_by_dest;
1694         return rejected_by_dest_conv;
1695 }
1696 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentPathFailed_get_network_update"))) TS_LDKEvent_PaymentPathFailed_get_network_update(uint64_t ptr) {
1697         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1698         assert(obj->tag == LDKEvent_PaymentPathFailed);
1699                         uint64_t network_update_ref = tag_ptr(&obj->payment_path_failed.network_update, false);
1700         return network_update_ref;
1701 }
1702 jboolean __attribute__((export_name("TS_LDKEvent_PaymentPathFailed_get_all_paths_failed"))) TS_LDKEvent_PaymentPathFailed_get_all_paths_failed(uint64_t ptr) {
1703         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1704         assert(obj->tag == LDKEvent_PaymentPathFailed);
1705                         jboolean all_paths_failed_conv = obj->payment_path_failed.all_paths_failed;
1706         return all_paths_failed_conv;
1707 }
1708 uint64_tArray __attribute__((export_name("TS_LDKEvent_PaymentPathFailed_get_path"))) TS_LDKEvent_PaymentPathFailed_get_path(uint64_t ptr) {
1709         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1710         assert(obj->tag == LDKEvent_PaymentPathFailed);
1711                         LDKCVec_RouteHopZ path_var = obj->payment_path_failed.path;
1712                         uint64_tArray path_arr = NULL;
1713                         path_arr = init_uint64_tArray(path_var.datalen, __LINE__);
1714                         uint64_t *path_arr_ptr = (uint64_t*)(((uint8_t*)path_arr) + 8);
1715                         for (size_t k = 0; k < path_var.datalen; k++) {
1716                                 LDKRouteHop path_conv_10_var = path_var.data[k];
1717                                 uint64_t path_conv_10_ref = 0;
1718                                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var);
1719                                 path_conv_10_ref = tag_ptr(path_conv_10_var.inner, false);
1720                                 path_arr_ptr[k] = path_conv_10_ref;
1721                         }
1722                         
1723         return path_arr;
1724 }
1725 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentPathFailed_get_short_channel_id"))) TS_LDKEvent_PaymentPathFailed_get_short_channel_id(uint64_t ptr) {
1726         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1727         assert(obj->tag == LDKEvent_PaymentPathFailed);
1728                         uint64_t short_channel_id_ref = tag_ptr(&obj->payment_path_failed.short_channel_id, false);
1729         return short_channel_id_ref;
1730 }
1731 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentPathFailed_get_retry"))) TS_LDKEvent_PaymentPathFailed_get_retry(uint64_t ptr) {
1732         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1733         assert(obj->tag == LDKEvent_PaymentPathFailed);
1734                         LDKRouteParameters retry_var = obj->payment_path_failed.retry;
1735                         uint64_t retry_ref = 0;
1736                         CHECK_INNER_FIELD_ACCESS_OR_NULL(retry_var);
1737                         retry_ref = tag_ptr(retry_var.inner, false);
1738         return retry_ref;
1739 }
1740 int8_tArray __attribute__((export_name("TS_LDKEvent_ProbeSuccessful_get_payment_id"))) TS_LDKEvent_ProbeSuccessful_get_payment_id(uint64_t ptr) {
1741         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1742         assert(obj->tag == LDKEvent_ProbeSuccessful);
1743                         int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
1744                         memcpy(payment_id_arr->elems, obj->probe_successful.payment_id.data, 32);
1745         return payment_id_arr;
1746 }
1747 int8_tArray __attribute__((export_name("TS_LDKEvent_ProbeSuccessful_get_payment_hash"))) TS_LDKEvent_ProbeSuccessful_get_payment_hash(uint64_t ptr) {
1748         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1749         assert(obj->tag == LDKEvent_ProbeSuccessful);
1750                         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
1751                         memcpy(payment_hash_arr->elems, obj->probe_successful.payment_hash.data, 32);
1752         return payment_hash_arr;
1753 }
1754 uint64_tArray __attribute__((export_name("TS_LDKEvent_ProbeSuccessful_get_path"))) TS_LDKEvent_ProbeSuccessful_get_path(uint64_t ptr) {
1755         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1756         assert(obj->tag == LDKEvent_ProbeSuccessful);
1757                         LDKCVec_RouteHopZ path_var = obj->probe_successful.path;
1758                         uint64_tArray path_arr = NULL;
1759                         path_arr = init_uint64_tArray(path_var.datalen, __LINE__);
1760                         uint64_t *path_arr_ptr = (uint64_t*)(((uint8_t*)path_arr) + 8);
1761                         for (size_t k = 0; k < path_var.datalen; k++) {
1762                                 LDKRouteHop path_conv_10_var = path_var.data[k];
1763                                 uint64_t path_conv_10_ref = 0;
1764                                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var);
1765                                 path_conv_10_ref = tag_ptr(path_conv_10_var.inner, false);
1766                                 path_arr_ptr[k] = path_conv_10_ref;
1767                         }
1768                         
1769         return path_arr;
1770 }
1771 int8_tArray __attribute__((export_name("TS_LDKEvent_ProbeFailed_get_payment_id"))) TS_LDKEvent_ProbeFailed_get_payment_id(uint64_t ptr) {
1772         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1773         assert(obj->tag == LDKEvent_ProbeFailed);
1774                         int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
1775                         memcpy(payment_id_arr->elems, obj->probe_failed.payment_id.data, 32);
1776         return payment_id_arr;
1777 }
1778 int8_tArray __attribute__((export_name("TS_LDKEvent_ProbeFailed_get_payment_hash"))) TS_LDKEvent_ProbeFailed_get_payment_hash(uint64_t ptr) {
1779         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1780         assert(obj->tag == LDKEvent_ProbeFailed);
1781                         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
1782                         memcpy(payment_hash_arr->elems, obj->probe_failed.payment_hash.data, 32);
1783         return payment_hash_arr;
1784 }
1785 uint64_tArray __attribute__((export_name("TS_LDKEvent_ProbeFailed_get_path"))) TS_LDKEvent_ProbeFailed_get_path(uint64_t ptr) {
1786         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1787         assert(obj->tag == LDKEvent_ProbeFailed);
1788                         LDKCVec_RouteHopZ path_var = obj->probe_failed.path;
1789                         uint64_tArray path_arr = NULL;
1790                         path_arr = init_uint64_tArray(path_var.datalen, __LINE__);
1791                         uint64_t *path_arr_ptr = (uint64_t*)(((uint8_t*)path_arr) + 8);
1792                         for (size_t k = 0; k < path_var.datalen; k++) {
1793                                 LDKRouteHop path_conv_10_var = path_var.data[k];
1794                                 uint64_t path_conv_10_ref = 0;
1795                                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var);
1796                                 path_conv_10_ref = tag_ptr(path_conv_10_var.inner, false);
1797                                 path_arr_ptr[k] = path_conv_10_ref;
1798                         }
1799                         
1800         return path_arr;
1801 }
1802 uint64_t __attribute__((export_name("TS_LDKEvent_ProbeFailed_get_short_channel_id"))) TS_LDKEvent_ProbeFailed_get_short_channel_id(uint64_t ptr) {
1803         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1804         assert(obj->tag == LDKEvent_ProbeFailed);
1805                         uint64_t short_channel_id_ref = tag_ptr(&obj->probe_failed.short_channel_id, false);
1806         return short_channel_id_ref;
1807 }
1808 int64_t __attribute__((export_name("TS_LDKEvent_PendingHTLCsForwardable_get_time_forwardable"))) TS_LDKEvent_PendingHTLCsForwardable_get_time_forwardable(uint64_t ptr) {
1809         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1810         assert(obj->tag == LDKEvent_PendingHTLCsForwardable);
1811                         int64_t time_forwardable_conv = obj->pending_htl_cs_forwardable.time_forwardable;
1812         return time_forwardable_conv;
1813 }
1814 uint64_tArray __attribute__((export_name("TS_LDKEvent_SpendableOutputs_get_outputs"))) TS_LDKEvent_SpendableOutputs_get_outputs(uint64_t ptr) {
1815         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1816         assert(obj->tag == LDKEvent_SpendableOutputs);
1817                         LDKCVec_SpendableOutputDescriptorZ outputs_var = obj->spendable_outputs.outputs;
1818                         uint64_tArray outputs_arr = NULL;
1819                         outputs_arr = init_uint64_tArray(outputs_var.datalen, __LINE__);
1820                         uint64_t *outputs_arr_ptr = (uint64_t*)(((uint8_t*)outputs_arr) + 8);
1821                         for (size_t b = 0; b < outputs_var.datalen; b++) {
1822                                 uint64_t outputs_conv_27_ref = tag_ptr(&outputs_var.data[b], false);
1823                                 outputs_arr_ptr[b] = outputs_conv_27_ref;
1824                         }
1825                         
1826         return outputs_arr;
1827 }
1828 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentForwarded_get_prev_channel_id"))) TS_LDKEvent_PaymentForwarded_get_prev_channel_id(uint64_t ptr) {
1829         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1830         assert(obj->tag == LDKEvent_PaymentForwarded);
1831                         int8_tArray prev_channel_id_arr = init_int8_tArray(32, __LINE__);
1832                         memcpy(prev_channel_id_arr->elems, obj->payment_forwarded.prev_channel_id.data, 32);
1833         return prev_channel_id_arr;
1834 }
1835 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentForwarded_get_next_channel_id"))) TS_LDKEvent_PaymentForwarded_get_next_channel_id(uint64_t ptr) {
1836         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1837         assert(obj->tag == LDKEvent_PaymentForwarded);
1838                         int8_tArray next_channel_id_arr = init_int8_tArray(32, __LINE__);
1839                         memcpy(next_channel_id_arr->elems, obj->payment_forwarded.next_channel_id.data, 32);
1840         return next_channel_id_arr;
1841 }
1842 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentForwarded_get_fee_earned_msat"))) TS_LDKEvent_PaymentForwarded_get_fee_earned_msat(uint64_t ptr) {
1843         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1844         assert(obj->tag == LDKEvent_PaymentForwarded);
1845                         uint64_t fee_earned_msat_ref = tag_ptr(&obj->payment_forwarded.fee_earned_msat, false);
1846         return fee_earned_msat_ref;
1847 }
1848 jboolean __attribute__((export_name("TS_LDKEvent_PaymentForwarded_get_claim_from_onchain_tx"))) TS_LDKEvent_PaymentForwarded_get_claim_from_onchain_tx(uint64_t ptr) {
1849         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1850         assert(obj->tag == LDKEvent_PaymentForwarded);
1851                         jboolean claim_from_onchain_tx_conv = obj->payment_forwarded.claim_from_onchain_tx;
1852         return claim_from_onchain_tx_conv;
1853 }
1854 int8_tArray __attribute__((export_name("TS_LDKEvent_ChannelClosed_get_channel_id"))) TS_LDKEvent_ChannelClosed_get_channel_id(uint64_t ptr) {
1855         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1856         assert(obj->tag == LDKEvent_ChannelClosed);
1857                         int8_tArray channel_id_arr = init_int8_tArray(32, __LINE__);
1858                         memcpy(channel_id_arr->elems, obj->channel_closed.channel_id.data, 32);
1859         return channel_id_arr;
1860 }
1861 int64_t __attribute__((export_name("TS_LDKEvent_ChannelClosed_get_user_channel_id"))) TS_LDKEvent_ChannelClosed_get_user_channel_id(uint64_t ptr) {
1862         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1863         assert(obj->tag == LDKEvent_ChannelClosed);
1864                         int64_t user_channel_id_conv = obj->channel_closed.user_channel_id;
1865         return user_channel_id_conv;
1866 }
1867 uint64_t __attribute__((export_name("TS_LDKEvent_ChannelClosed_get_reason"))) TS_LDKEvent_ChannelClosed_get_reason(uint64_t ptr) {
1868         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1869         assert(obj->tag == LDKEvent_ChannelClosed);
1870                         uint64_t reason_ref = tag_ptr(&obj->channel_closed.reason, false);
1871         return reason_ref;
1872 }
1873 int8_tArray __attribute__((export_name("TS_LDKEvent_DiscardFunding_get_channel_id"))) TS_LDKEvent_DiscardFunding_get_channel_id(uint64_t ptr) {
1874         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1875         assert(obj->tag == LDKEvent_DiscardFunding);
1876                         int8_tArray channel_id_arr = init_int8_tArray(32, __LINE__);
1877                         memcpy(channel_id_arr->elems, obj->discard_funding.channel_id.data, 32);
1878         return channel_id_arr;
1879 }
1880 int8_tArray __attribute__((export_name("TS_LDKEvent_DiscardFunding_get_transaction"))) TS_LDKEvent_DiscardFunding_get_transaction(uint64_t ptr) {
1881         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1882         assert(obj->tag == LDKEvent_DiscardFunding);
1883                         LDKTransaction transaction_var = obj->discard_funding.transaction;
1884                         int8_tArray transaction_arr = init_int8_tArray(transaction_var.datalen, __LINE__);
1885                         memcpy(transaction_arr->elems, transaction_var.data, transaction_var.datalen);
1886         return transaction_arr;
1887 }
1888 int8_tArray __attribute__((export_name("TS_LDKEvent_OpenChannelRequest_get_temporary_channel_id"))) TS_LDKEvent_OpenChannelRequest_get_temporary_channel_id(uint64_t ptr) {
1889         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1890         assert(obj->tag == LDKEvent_OpenChannelRequest);
1891                         int8_tArray temporary_channel_id_arr = init_int8_tArray(32, __LINE__);
1892                         memcpy(temporary_channel_id_arr->elems, obj->open_channel_request.temporary_channel_id.data, 32);
1893         return temporary_channel_id_arr;
1894 }
1895 int8_tArray __attribute__((export_name("TS_LDKEvent_OpenChannelRequest_get_counterparty_node_id"))) TS_LDKEvent_OpenChannelRequest_get_counterparty_node_id(uint64_t ptr) {
1896         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1897         assert(obj->tag == LDKEvent_OpenChannelRequest);
1898                         int8_tArray counterparty_node_id_arr = init_int8_tArray(33, __LINE__);
1899                         memcpy(counterparty_node_id_arr->elems, obj->open_channel_request.counterparty_node_id.compressed_form, 33);
1900         return counterparty_node_id_arr;
1901 }
1902 int64_t __attribute__((export_name("TS_LDKEvent_OpenChannelRequest_get_funding_satoshis"))) TS_LDKEvent_OpenChannelRequest_get_funding_satoshis(uint64_t ptr) {
1903         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1904         assert(obj->tag == LDKEvent_OpenChannelRequest);
1905                         int64_t funding_satoshis_conv = obj->open_channel_request.funding_satoshis;
1906         return funding_satoshis_conv;
1907 }
1908 int64_t __attribute__((export_name("TS_LDKEvent_OpenChannelRequest_get_push_msat"))) TS_LDKEvent_OpenChannelRequest_get_push_msat(uint64_t ptr) {
1909         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1910         assert(obj->tag == LDKEvent_OpenChannelRequest);
1911                         int64_t push_msat_conv = obj->open_channel_request.push_msat;
1912         return push_msat_conv;
1913 }
1914 uint64_t __attribute__((export_name("TS_LDKEvent_OpenChannelRequest_get_channel_type"))) TS_LDKEvent_OpenChannelRequest_get_channel_type(uint64_t ptr) {
1915         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1916         assert(obj->tag == LDKEvent_OpenChannelRequest);
1917                         LDKChannelTypeFeatures channel_type_var = obj->open_channel_request.channel_type;
1918                         uint64_t channel_type_ref = 0;
1919                         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_var);
1920                         channel_type_ref = tag_ptr(channel_type_var.inner, false);
1921         return channel_type_ref;
1922 }
1923 int8_tArray __attribute__((export_name("TS_LDKEvent_HTLCHandlingFailed_get_prev_channel_id"))) TS_LDKEvent_HTLCHandlingFailed_get_prev_channel_id(uint64_t ptr) {
1924         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1925         assert(obj->tag == LDKEvent_HTLCHandlingFailed);
1926                         int8_tArray prev_channel_id_arr = init_int8_tArray(32, __LINE__);
1927                         memcpy(prev_channel_id_arr->elems, obj->htlc_handling_failed.prev_channel_id.data, 32);
1928         return prev_channel_id_arr;
1929 }
1930 uint64_t __attribute__((export_name("TS_LDKEvent_HTLCHandlingFailed_get_failed_next_destination"))) TS_LDKEvent_HTLCHandlingFailed_get_failed_next_destination(uint64_t ptr) {
1931         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1932         assert(obj->tag == LDKEvent_HTLCHandlingFailed);
1933                         uint64_t failed_next_destination_ref = tag_ptr(&obj->htlc_handling_failed.failed_next_destination, false);
1934         return failed_next_destination_ref;
1935 }
1936 uint32_t __attribute__((export_name("TS_LDKCOption_EventZ_ty_from_ptr"))) TS_LDKCOption_EventZ_ty_from_ptr(uint64_t ptr) {
1937         LDKCOption_EventZ *obj = (LDKCOption_EventZ*)untag_ptr(ptr);
1938         switch(obj->tag) {
1939                 case LDKCOption_EventZ_Some: return 0;
1940                 case LDKCOption_EventZ_None: return 1;
1941                 default: abort();
1942         }
1943 }
1944 uint64_t __attribute__((export_name("TS_LDKCOption_EventZ_Some_get_some"))) TS_LDKCOption_EventZ_Some_get_some(uint64_t ptr) {
1945         LDKCOption_EventZ *obj = (LDKCOption_EventZ*)untag_ptr(ptr);
1946         assert(obj->tag == LDKCOption_EventZ_Some);
1947                         uint64_t some_ref = tag_ptr(&obj->some, false);
1948         return some_ref;
1949 }
1950 static inline struct LDKCOption_EventZ CResult_COption_EventZDecodeErrorZ_get_ok(LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR owner){
1951 CHECK(owner->result_ok);
1952         return COption_EventZ_clone(&*owner->contents.result);
1953 }
1954 uint64_t  __attribute__((export_name("TS_CResult_COption_EventZDecodeErrorZ_get_ok"))) TS_CResult_COption_EventZDecodeErrorZ_get_ok(uint64_t owner) {
1955         LDKCResult_COption_EventZDecodeErrorZ* owner_conv = (LDKCResult_COption_EventZDecodeErrorZ*)untag_ptr(owner);
1956         LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
1957         *ret_copy = CResult_COption_EventZDecodeErrorZ_get_ok(owner_conv);
1958         uint64_t ret_ref = tag_ptr(ret_copy, true);
1959         return ret_ref;
1960 }
1961
1962 static inline struct LDKDecodeError CResult_COption_EventZDecodeErrorZ_get_err(LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR owner){
1963         LDKDecodeError ret = *owner->contents.err;
1964         ret.is_owned = false;
1965         return ret;
1966 }
1967 uint64_t  __attribute__((export_name("TS_CResult_COption_EventZDecodeErrorZ_get_err"))) TS_CResult_COption_EventZDecodeErrorZ_get_err(uint64_t owner) {
1968         LDKCResult_COption_EventZDecodeErrorZ* owner_conv = (LDKCResult_COption_EventZDecodeErrorZ*)untag_ptr(owner);
1969         LDKDecodeError ret_var = CResult_COption_EventZDecodeErrorZ_get_err(owner_conv);
1970         uint64_t ret_ref = 0;
1971         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1972         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1973         return ret_ref;
1974 }
1975
1976 uint32_t __attribute__((export_name("TS_LDKErrorAction_ty_from_ptr"))) TS_LDKErrorAction_ty_from_ptr(uint64_t ptr) {
1977         LDKErrorAction *obj = (LDKErrorAction*)untag_ptr(ptr);
1978         switch(obj->tag) {
1979                 case LDKErrorAction_DisconnectPeer: return 0;
1980                 case LDKErrorAction_IgnoreError: return 1;
1981                 case LDKErrorAction_IgnoreAndLog: return 2;
1982                 case LDKErrorAction_IgnoreDuplicateGossip: return 3;
1983                 case LDKErrorAction_SendErrorMessage: return 4;
1984                 case LDKErrorAction_SendWarningMessage: return 5;
1985                 default: abort();
1986         }
1987 }
1988 uint64_t __attribute__((export_name("TS_LDKErrorAction_DisconnectPeer_get_msg"))) TS_LDKErrorAction_DisconnectPeer_get_msg(uint64_t ptr) {
1989         LDKErrorAction *obj = (LDKErrorAction*)untag_ptr(ptr);
1990         assert(obj->tag == LDKErrorAction_DisconnectPeer);
1991                         LDKErrorMessage msg_var = obj->disconnect_peer.msg;
1992                         uint64_t msg_ref = 0;
1993                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
1994                         msg_ref = tag_ptr(msg_var.inner, false);
1995         return msg_ref;
1996 }
1997 uint32_t __attribute__((export_name("TS_LDKErrorAction_IgnoreAndLog_get_ignore_and_log"))) TS_LDKErrorAction_IgnoreAndLog_get_ignore_and_log(uint64_t ptr) {
1998         LDKErrorAction *obj = (LDKErrorAction*)untag_ptr(ptr);
1999         assert(obj->tag == LDKErrorAction_IgnoreAndLog);
2000                         uint32_t ignore_and_log_conv = LDKLevel_to_js(obj->ignore_and_log);
2001         return ignore_and_log_conv;
2002 }
2003 uint64_t __attribute__((export_name("TS_LDKErrorAction_SendErrorMessage_get_msg"))) TS_LDKErrorAction_SendErrorMessage_get_msg(uint64_t ptr) {
2004         LDKErrorAction *obj = (LDKErrorAction*)untag_ptr(ptr);
2005         assert(obj->tag == LDKErrorAction_SendErrorMessage);
2006                         LDKErrorMessage msg_var = obj->send_error_message.msg;
2007                         uint64_t msg_ref = 0;
2008                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2009                         msg_ref = tag_ptr(msg_var.inner, false);
2010         return msg_ref;
2011 }
2012 uint64_t __attribute__((export_name("TS_LDKErrorAction_SendWarningMessage_get_msg"))) TS_LDKErrorAction_SendWarningMessage_get_msg(uint64_t ptr) {
2013         LDKErrorAction *obj = (LDKErrorAction*)untag_ptr(ptr);
2014         assert(obj->tag == LDKErrorAction_SendWarningMessage);
2015                         LDKWarningMessage msg_var = obj->send_warning_message.msg;
2016                         uint64_t msg_ref = 0;
2017                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2018                         msg_ref = tag_ptr(msg_var.inner, false);
2019         return msg_ref;
2020 }
2021 uint32_t __attribute__((export_name("TS_LDKErrorAction_SendWarningMessage_get_log_level"))) TS_LDKErrorAction_SendWarningMessage_get_log_level(uint64_t ptr) {
2022         LDKErrorAction *obj = (LDKErrorAction*)untag_ptr(ptr);
2023         assert(obj->tag == LDKErrorAction_SendWarningMessage);
2024                         uint32_t log_level_conv = LDKLevel_to_js(obj->send_warning_message.log_level);
2025         return log_level_conv;
2026 }
2027 uint32_t __attribute__((export_name("TS_LDKMessageSendEvent_ty_from_ptr"))) TS_LDKMessageSendEvent_ty_from_ptr(uint64_t ptr) {
2028         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2029         switch(obj->tag) {
2030                 case LDKMessageSendEvent_SendAcceptChannel: return 0;
2031                 case LDKMessageSendEvent_SendOpenChannel: return 1;
2032                 case LDKMessageSendEvent_SendFundingCreated: return 2;
2033                 case LDKMessageSendEvent_SendFundingSigned: return 3;
2034                 case LDKMessageSendEvent_SendChannelReady: return 4;
2035                 case LDKMessageSendEvent_SendAnnouncementSignatures: return 5;
2036                 case LDKMessageSendEvent_UpdateHTLCs: return 6;
2037                 case LDKMessageSendEvent_SendRevokeAndACK: return 7;
2038                 case LDKMessageSendEvent_SendClosingSigned: return 8;
2039                 case LDKMessageSendEvent_SendShutdown: return 9;
2040                 case LDKMessageSendEvent_SendChannelReestablish: return 10;
2041                 case LDKMessageSendEvent_BroadcastChannelAnnouncement: return 11;
2042                 case LDKMessageSendEvent_BroadcastNodeAnnouncement: return 12;
2043                 case LDKMessageSendEvent_BroadcastChannelUpdate: return 13;
2044                 case LDKMessageSendEvent_SendChannelUpdate: return 14;
2045                 case LDKMessageSendEvent_HandleError: return 15;
2046                 case LDKMessageSendEvent_SendChannelRangeQuery: return 16;
2047                 case LDKMessageSendEvent_SendShortIdsQuery: return 17;
2048                 case LDKMessageSendEvent_SendReplyChannelRange: return 18;
2049                 case LDKMessageSendEvent_SendGossipTimestampFilter: return 19;
2050                 default: abort();
2051         }
2052 }
2053 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendAcceptChannel_get_node_id"))) TS_LDKMessageSendEvent_SendAcceptChannel_get_node_id(uint64_t ptr) {
2054         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2055         assert(obj->tag == LDKMessageSendEvent_SendAcceptChannel);
2056                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2057                         memcpy(node_id_arr->elems, obj->send_accept_channel.node_id.compressed_form, 33);
2058         return node_id_arr;
2059 }
2060 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendAcceptChannel_get_msg"))) TS_LDKMessageSendEvent_SendAcceptChannel_get_msg(uint64_t ptr) {
2061         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2062         assert(obj->tag == LDKMessageSendEvent_SendAcceptChannel);
2063                         LDKAcceptChannel msg_var = obj->send_accept_channel.msg;
2064                         uint64_t msg_ref = 0;
2065                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2066                         msg_ref = tag_ptr(msg_var.inner, false);
2067         return msg_ref;
2068 }
2069 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendOpenChannel_get_node_id"))) TS_LDKMessageSendEvent_SendOpenChannel_get_node_id(uint64_t ptr) {
2070         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2071         assert(obj->tag == LDKMessageSendEvent_SendOpenChannel);
2072                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2073                         memcpy(node_id_arr->elems, obj->send_open_channel.node_id.compressed_form, 33);
2074         return node_id_arr;
2075 }
2076 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendOpenChannel_get_msg"))) TS_LDKMessageSendEvent_SendOpenChannel_get_msg(uint64_t ptr) {
2077         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2078         assert(obj->tag == LDKMessageSendEvent_SendOpenChannel);
2079                         LDKOpenChannel msg_var = obj->send_open_channel.msg;
2080                         uint64_t msg_ref = 0;
2081                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2082                         msg_ref = tag_ptr(msg_var.inner, false);
2083         return msg_ref;
2084 }
2085 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendFundingCreated_get_node_id"))) TS_LDKMessageSendEvent_SendFundingCreated_get_node_id(uint64_t ptr) {
2086         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2087         assert(obj->tag == LDKMessageSendEvent_SendFundingCreated);
2088                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2089                         memcpy(node_id_arr->elems, obj->send_funding_created.node_id.compressed_form, 33);
2090         return node_id_arr;
2091 }
2092 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendFundingCreated_get_msg"))) TS_LDKMessageSendEvent_SendFundingCreated_get_msg(uint64_t ptr) {
2093         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2094         assert(obj->tag == LDKMessageSendEvent_SendFundingCreated);
2095                         LDKFundingCreated msg_var = obj->send_funding_created.msg;
2096                         uint64_t msg_ref = 0;
2097                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2098                         msg_ref = tag_ptr(msg_var.inner, false);
2099         return msg_ref;
2100 }
2101 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendFundingSigned_get_node_id"))) TS_LDKMessageSendEvent_SendFundingSigned_get_node_id(uint64_t ptr) {
2102         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2103         assert(obj->tag == LDKMessageSendEvent_SendFundingSigned);
2104                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2105                         memcpy(node_id_arr->elems, obj->send_funding_signed.node_id.compressed_form, 33);
2106         return node_id_arr;
2107 }
2108 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendFundingSigned_get_msg"))) TS_LDKMessageSendEvent_SendFundingSigned_get_msg(uint64_t ptr) {
2109         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2110         assert(obj->tag == LDKMessageSendEvent_SendFundingSigned);
2111                         LDKFundingSigned msg_var = obj->send_funding_signed.msg;
2112                         uint64_t msg_ref = 0;
2113                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2114                         msg_ref = tag_ptr(msg_var.inner, false);
2115         return msg_ref;
2116 }
2117 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelReady_get_node_id"))) TS_LDKMessageSendEvent_SendChannelReady_get_node_id(uint64_t ptr) {
2118         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2119         assert(obj->tag == LDKMessageSendEvent_SendChannelReady);
2120                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2121                         memcpy(node_id_arr->elems, obj->send_channel_ready.node_id.compressed_form, 33);
2122         return node_id_arr;
2123 }
2124 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelReady_get_msg"))) TS_LDKMessageSendEvent_SendChannelReady_get_msg(uint64_t ptr) {
2125         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2126         assert(obj->tag == LDKMessageSendEvent_SendChannelReady);
2127                         LDKChannelReady msg_var = obj->send_channel_ready.msg;
2128                         uint64_t msg_ref = 0;
2129                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2130                         msg_ref = tag_ptr(msg_var.inner, false);
2131         return msg_ref;
2132 }
2133 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendAnnouncementSignatures_get_node_id"))) TS_LDKMessageSendEvent_SendAnnouncementSignatures_get_node_id(uint64_t ptr) {
2134         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2135         assert(obj->tag == LDKMessageSendEvent_SendAnnouncementSignatures);
2136                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2137                         memcpy(node_id_arr->elems, obj->send_announcement_signatures.node_id.compressed_form, 33);
2138         return node_id_arr;
2139 }
2140 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendAnnouncementSignatures_get_msg"))) TS_LDKMessageSendEvent_SendAnnouncementSignatures_get_msg(uint64_t ptr) {
2141         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2142         assert(obj->tag == LDKMessageSendEvent_SendAnnouncementSignatures);
2143                         LDKAnnouncementSignatures msg_var = obj->send_announcement_signatures.msg;
2144                         uint64_t msg_ref = 0;
2145                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2146                         msg_ref = tag_ptr(msg_var.inner, false);
2147         return msg_ref;
2148 }
2149 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_UpdateHTLCs_get_node_id"))) TS_LDKMessageSendEvent_UpdateHTLCs_get_node_id(uint64_t ptr) {
2150         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2151         assert(obj->tag == LDKMessageSendEvent_UpdateHTLCs);
2152                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2153                         memcpy(node_id_arr->elems, obj->update_htl_cs.node_id.compressed_form, 33);
2154         return node_id_arr;
2155 }
2156 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_UpdateHTLCs_get_updates"))) TS_LDKMessageSendEvent_UpdateHTLCs_get_updates(uint64_t ptr) {
2157         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2158         assert(obj->tag == LDKMessageSendEvent_UpdateHTLCs);
2159                         LDKCommitmentUpdate updates_var = obj->update_htl_cs.updates;
2160                         uint64_t updates_ref = 0;
2161                         CHECK_INNER_FIELD_ACCESS_OR_NULL(updates_var);
2162                         updates_ref = tag_ptr(updates_var.inner, false);
2163         return updates_ref;
2164 }
2165 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendRevokeAndACK_get_node_id"))) TS_LDKMessageSendEvent_SendRevokeAndACK_get_node_id(uint64_t ptr) {
2166         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2167         assert(obj->tag == LDKMessageSendEvent_SendRevokeAndACK);
2168                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2169                         memcpy(node_id_arr->elems, obj->send_revoke_and_ack.node_id.compressed_form, 33);
2170         return node_id_arr;
2171 }
2172 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendRevokeAndACK_get_msg"))) TS_LDKMessageSendEvent_SendRevokeAndACK_get_msg(uint64_t ptr) {
2173         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2174         assert(obj->tag == LDKMessageSendEvent_SendRevokeAndACK);
2175                         LDKRevokeAndACK msg_var = obj->send_revoke_and_ack.msg;
2176                         uint64_t msg_ref = 0;
2177                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2178                         msg_ref = tag_ptr(msg_var.inner, false);
2179         return msg_ref;
2180 }
2181 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendClosingSigned_get_node_id"))) TS_LDKMessageSendEvent_SendClosingSigned_get_node_id(uint64_t ptr) {
2182         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2183         assert(obj->tag == LDKMessageSendEvent_SendClosingSigned);
2184                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2185                         memcpy(node_id_arr->elems, obj->send_closing_signed.node_id.compressed_form, 33);
2186         return node_id_arr;
2187 }
2188 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendClosingSigned_get_msg"))) TS_LDKMessageSendEvent_SendClosingSigned_get_msg(uint64_t ptr) {
2189         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2190         assert(obj->tag == LDKMessageSendEvent_SendClosingSigned);
2191                         LDKClosingSigned msg_var = obj->send_closing_signed.msg;
2192                         uint64_t msg_ref = 0;
2193                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2194                         msg_ref = tag_ptr(msg_var.inner, false);
2195         return msg_ref;
2196 }
2197 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendShutdown_get_node_id"))) TS_LDKMessageSendEvent_SendShutdown_get_node_id(uint64_t ptr) {
2198         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2199         assert(obj->tag == LDKMessageSendEvent_SendShutdown);
2200                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2201                         memcpy(node_id_arr->elems, obj->send_shutdown.node_id.compressed_form, 33);
2202         return node_id_arr;
2203 }
2204 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendShutdown_get_msg"))) TS_LDKMessageSendEvent_SendShutdown_get_msg(uint64_t ptr) {
2205         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2206         assert(obj->tag == LDKMessageSendEvent_SendShutdown);
2207                         LDKShutdown msg_var = obj->send_shutdown.msg;
2208                         uint64_t msg_ref = 0;
2209                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2210                         msg_ref = tag_ptr(msg_var.inner, false);
2211         return msg_ref;
2212 }
2213 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelReestablish_get_node_id"))) TS_LDKMessageSendEvent_SendChannelReestablish_get_node_id(uint64_t ptr) {
2214         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2215         assert(obj->tag == LDKMessageSendEvent_SendChannelReestablish);
2216                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2217                         memcpy(node_id_arr->elems, obj->send_channel_reestablish.node_id.compressed_form, 33);
2218         return node_id_arr;
2219 }
2220 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelReestablish_get_msg"))) TS_LDKMessageSendEvent_SendChannelReestablish_get_msg(uint64_t ptr) {
2221         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2222         assert(obj->tag == LDKMessageSendEvent_SendChannelReestablish);
2223                         LDKChannelReestablish msg_var = obj->send_channel_reestablish.msg;
2224                         uint64_t msg_ref = 0;
2225                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2226                         msg_ref = tag_ptr(msg_var.inner, false);
2227         return msg_ref;
2228 }
2229 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_BroadcastChannelAnnouncement_get_msg"))) TS_LDKMessageSendEvent_BroadcastChannelAnnouncement_get_msg(uint64_t ptr) {
2230         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2231         assert(obj->tag == LDKMessageSendEvent_BroadcastChannelAnnouncement);
2232                         LDKChannelAnnouncement msg_var = obj->broadcast_channel_announcement.msg;
2233                         uint64_t msg_ref = 0;
2234                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2235                         msg_ref = tag_ptr(msg_var.inner, false);
2236         return msg_ref;
2237 }
2238 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_BroadcastChannelAnnouncement_get_update_msg"))) TS_LDKMessageSendEvent_BroadcastChannelAnnouncement_get_update_msg(uint64_t ptr) {
2239         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2240         assert(obj->tag == LDKMessageSendEvent_BroadcastChannelAnnouncement);
2241                         LDKChannelUpdate update_msg_var = obj->broadcast_channel_announcement.update_msg;
2242                         uint64_t update_msg_ref = 0;
2243                         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_msg_var);
2244                         update_msg_ref = tag_ptr(update_msg_var.inner, false);
2245         return update_msg_ref;
2246 }
2247 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_BroadcastNodeAnnouncement_get_msg"))) TS_LDKMessageSendEvent_BroadcastNodeAnnouncement_get_msg(uint64_t ptr) {
2248         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2249         assert(obj->tag == LDKMessageSendEvent_BroadcastNodeAnnouncement);
2250                         LDKNodeAnnouncement msg_var = obj->broadcast_node_announcement.msg;
2251                         uint64_t msg_ref = 0;
2252                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2253                         msg_ref = tag_ptr(msg_var.inner, false);
2254         return msg_ref;
2255 }
2256 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_BroadcastChannelUpdate_get_msg"))) TS_LDKMessageSendEvent_BroadcastChannelUpdate_get_msg(uint64_t ptr) {
2257         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2258         assert(obj->tag == LDKMessageSendEvent_BroadcastChannelUpdate);
2259                         LDKChannelUpdate msg_var = obj->broadcast_channel_update.msg;
2260                         uint64_t msg_ref = 0;
2261                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2262                         msg_ref = tag_ptr(msg_var.inner, false);
2263         return msg_ref;
2264 }
2265 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelUpdate_get_node_id"))) TS_LDKMessageSendEvent_SendChannelUpdate_get_node_id(uint64_t ptr) {
2266         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2267         assert(obj->tag == LDKMessageSendEvent_SendChannelUpdate);
2268                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2269                         memcpy(node_id_arr->elems, obj->send_channel_update.node_id.compressed_form, 33);
2270         return node_id_arr;
2271 }
2272 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelUpdate_get_msg"))) TS_LDKMessageSendEvent_SendChannelUpdate_get_msg(uint64_t ptr) {
2273         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2274         assert(obj->tag == LDKMessageSendEvent_SendChannelUpdate);
2275                         LDKChannelUpdate msg_var = obj->send_channel_update.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_HandleError_get_node_id"))) TS_LDKMessageSendEvent_HandleError_get_node_id(uint64_t ptr) {
2282         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2283         assert(obj->tag == LDKMessageSendEvent_HandleError);
2284                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2285                         memcpy(node_id_arr->elems, obj->handle_error.node_id.compressed_form, 33);
2286         return node_id_arr;
2287 }
2288 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_HandleError_get_action"))) TS_LDKMessageSendEvent_HandleError_get_action(uint64_t ptr) {
2289         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2290         assert(obj->tag == LDKMessageSendEvent_HandleError);
2291                         uint64_t action_ref = tag_ptr(&obj->handle_error.action, false);
2292         return action_ref;
2293 }
2294 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelRangeQuery_get_node_id"))) TS_LDKMessageSendEvent_SendChannelRangeQuery_get_node_id(uint64_t ptr) {
2295         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2296         assert(obj->tag == LDKMessageSendEvent_SendChannelRangeQuery);
2297                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2298                         memcpy(node_id_arr->elems, obj->send_channel_range_query.node_id.compressed_form, 33);
2299         return node_id_arr;
2300 }
2301 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelRangeQuery_get_msg"))) TS_LDKMessageSendEvent_SendChannelRangeQuery_get_msg(uint64_t ptr) {
2302         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2303         assert(obj->tag == LDKMessageSendEvent_SendChannelRangeQuery);
2304                         LDKQueryChannelRange msg_var = obj->send_channel_range_query.msg;
2305                         uint64_t msg_ref = 0;
2306                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2307                         msg_ref = tag_ptr(msg_var.inner, false);
2308         return msg_ref;
2309 }
2310 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendShortIdsQuery_get_node_id"))) TS_LDKMessageSendEvent_SendShortIdsQuery_get_node_id(uint64_t ptr) {
2311         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2312         assert(obj->tag == LDKMessageSendEvent_SendShortIdsQuery);
2313                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2314                         memcpy(node_id_arr->elems, obj->send_short_ids_query.node_id.compressed_form, 33);
2315         return node_id_arr;
2316 }
2317 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendShortIdsQuery_get_msg"))) TS_LDKMessageSendEvent_SendShortIdsQuery_get_msg(uint64_t ptr) {
2318         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2319         assert(obj->tag == LDKMessageSendEvent_SendShortIdsQuery);
2320                         LDKQueryShortChannelIds msg_var = obj->send_short_ids_query.msg;
2321                         uint64_t msg_ref = 0;
2322                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2323                         msg_ref = tag_ptr(msg_var.inner, false);
2324         return msg_ref;
2325 }
2326 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendReplyChannelRange_get_node_id"))) TS_LDKMessageSendEvent_SendReplyChannelRange_get_node_id(uint64_t ptr) {
2327         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2328         assert(obj->tag == LDKMessageSendEvent_SendReplyChannelRange);
2329                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2330                         memcpy(node_id_arr->elems, obj->send_reply_channel_range.node_id.compressed_form, 33);
2331         return node_id_arr;
2332 }
2333 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendReplyChannelRange_get_msg"))) TS_LDKMessageSendEvent_SendReplyChannelRange_get_msg(uint64_t ptr) {
2334         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2335         assert(obj->tag == LDKMessageSendEvent_SendReplyChannelRange);
2336                         LDKReplyChannelRange msg_var = obj->send_reply_channel_range.msg;
2337                         uint64_t msg_ref = 0;
2338                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2339                         msg_ref = tag_ptr(msg_var.inner, false);
2340         return msg_ref;
2341 }
2342 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendGossipTimestampFilter_get_node_id"))) TS_LDKMessageSendEvent_SendGossipTimestampFilter_get_node_id(uint64_t ptr) {
2343         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2344         assert(obj->tag == LDKMessageSendEvent_SendGossipTimestampFilter);
2345                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2346                         memcpy(node_id_arr->elems, obj->send_gossip_timestamp_filter.node_id.compressed_form, 33);
2347         return node_id_arr;
2348 }
2349 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendGossipTimestampFilter_get_msg"))) TS_LDKMessageSendEvent_SendGossipTimestampFilter_get_msg(uint64_t ptr) {
2350         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2351         assert(obj->tag == LDKMessageSendEvent_SendGossipTimestampFilter);
2352                         LDKGossipTimestampFilter msg_var = obj->send_gossip_timestamp_filter.msg;
2353                         uint64_t msg_ref = 0;
2354                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2355                         msg_ref = tag_ptr(msg_var.inner, false);
2356         return msg_ref;
2357 }
2358 static inline LDKCVec_MessageSendEventZ CVec_MessageSendEventZ_clone(const LDKCVec_MessageSendEventZ *orig) {
2359         LDKCVec_MessageSendEventZ ret = { .data = MALLOC(sizeof(LDKMessageSendEvent) * orig->datalen, "LDKCVec_MessageSendEventZ clone bytes"), .datalen = orig->datalen };
2360         for (size_t i = 0; i < ret.datalen; i++) {
2361                 ret.data[i] = MessageSendEvent_clone(&orig->data[i]);
2362         }
2363         return ret;
2364 }
2365 static inline struct LDKTxOut CResult_TxOutAccessErrorZ_get_ok(LDKCResult_TxOutAccessErrorZ *NONNULL_PTR owner){
2366 CHECK(owner->result_ok);
2367         return TxOut_clone(&*owner->contents.result);
2368 }
2369 uint64_t  __attribute__((export_name("TS_CResult_TxOutAccessErrorZ_get_ok"))) TS_CResult_TxOutAccessErrorZ_get_ok(uint64_t owner) {
2370         LDKCResult_TxOutAccessErrorZ* owner_conv = (LDKCResult_TxOutAccessErrorZ*)untag_ptr(owner);
2371         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
2372         *ret_ref = CResult_TxOutAccessErrorZ_get_ok(owner_conv);
2373         return tag_ptr(ret_ref, true);
2374 }
2375
2376 static inline enum LDKAccessError CResult_TxOutAccessErrorZ_get_err(LDKCResult_TxOutAccessErrorZ *NONNULL_PTR owner){
2377 CHECK(!owner->result_ok);
2378         return AccessError_clone(&*owner->contents.err);
2379 }
2380 uint32_t  __attribute__((export_name("TS_CResult_TxOutAccessErrorZ_get_err"))) TS_CResult_TxOutAccessErrorZ_get_err(uint64_t owner) {
2381         LDKCResult_TxOutAccessErrorZ* owner_conv = (LDKCResult_TxOutAccessErrorZ*)untag_ptr(owner);
2382         uint32_t ret_conv = LDKAccessError_to_js(CResult_TxOutAccessErrorZ_get_err(owner_conv));
2383         return ret_conv;
2384 }
2385
2386 static inline uintptr_t C2Tuple_usizeTransactionZ_get_a(LDKC2Tuple_usizeTransactionZ *NONNULL_PTR owner){
2387         return owner->a;
2388 }
2389 uint32_t  __attribute__((export_name("TS_C2Tuple_usizeTransactionZ_get_a"))) TS_C2Tuple_usizeTransactionZ_get_a(uint64_t owner) {
2390         LDKC2Tuple_usizeTransactionZ* owner_conv = (LDKC2Tuple_usizeTransactionZ*)untag_ptr(owner);
2391         uint32_t ret_conv = C2Tuple_usizeTransactionZ_get_a(owner_conv);
2392         return ret_conv;
2393 }
2394
2395 static inline struct LDKTransaction C2Tuple_usizeTransactionZ_get_b(LDKC2Tuple_usizeTransactionZ *NONNULL_PTR owner){
2396         return owner->b;
2397 }
2398 int8_tArray  __attribute__((export_name("TS_C2Tuple_usizeTransactionZ_get_b"))) TS_C2Tuple_usizeTransactionZ_get_b(uint64_t owner) {
2399         LDKC2Tuple_usizeTransactionZ* owner_conv = (LDKC2Tuple_usizeTransactionZ*)untag_ptr(owner);
2400         LDKTransaction ret_var = C2Tuple_usizeTransactionZ_get_b(owner_conv);
2401         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
2402         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
2403         return ret_arr;
2404 }
2405
2406 static inline LDKCVec_C2Tuple_usizeTransactionZZ CVec_C2Tuple_usizeTransactionZZ_clone(const LDKCVec_C2Tuple_usizeTransactionZZ *orig) {
2407         LDKCVec_C2Tuple_usizeTransactionZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ) * orig->datalen, "LDKCVec_C2Tuple_usizeTransactionZZ clone bytes"), .datalen = orig->datalen };
2408         for (size_t i = 0; i < ret.datalen; i++) {
2409                 ret.data[i] = C2Tuple_usizeTransactionZ_clone(&orig->data[i]);
2410         }
2411         return ret;
2412 }
2413 static inline LDKCVec_TxidZ CVec_TxidZ_clone(const LDKCVec_TxidZ *orig) {
2414         LDKCVec_TxidZ ret = { .data = MALLOC(sizeof(LDKThirtyTwoBytes) * orig->datalen, "LDKCVec_TxidZ clone bytes"), .datalen = orig->datalen };
2415         for (size_t i = 0; i < ret.datalen; i++) {
2416                 ret.data[i] = ThirtyTwoBytes_clone(&orig->data[i]);
2417         }
2418         return ret;
2419 }
2420 static inline void CResult_NoneChannelMonitorUpdateErrZ_get_ok(LDKCResult_NoneChannelMonitorUpdateErrZ *NONNULL_PTR owner){
2421 CHECK(owner->result_ok);
2422         return *owner->contents.result;
2423 }
2424 void  __attribute__((export_name("TS_CResult_NoneChannelMonitorUpdateErrZ_get_ok"))) TS_CResult_NoneChannelMonitorUpdateErrZ_get_ok(uint64_t owner) {
2425         LDKCResult_NoneChannelMonitorUpdateErrZ* owner_conv = (LDKCResult_NoneChannelMonitorUpdateErrZ*)untag_ptr(owner);
2426         CResult_NoneChannelMonitorUpdateErrZ_get_ok(owner_conv);
2427 }
2428
2429 static inline enum LDKChannelMonitorUpdateErr CResult_NoneChannelMonitorUpdateErrZ_get_err(LDKCResult_NoneChannelMonitorUpdateErrZ *NONNULL_PTR owner){
2430 CHECK(!owner->result_ok);
2431         return ChannelMonitorUpdateErr_clone(&*owner->contents.err);
2432 }
2433 uint32_t  __attribute__((export_name("TS_CResult_NoneChannelMonitorUpdateErrZ_get_err"))) TS_CResult_NoneChannelMonitorUpdateErrZ_get_err(uint64_t owner) {
2434         LDKCResult_NoneChannelMonitorUpdateErrZ* owner_conv = (LDKCResult_NoneChannelMonitorUpdateErrZ*)untag_ptr(owner);
2435         uint32_t ret_conv = LDKChannelMonitorUpdateErr_to_js(CResult_NoneChannelMonitorUpdateErrZ_get_err(owner_conv));
2436         return ret_conv;
2437 }
2438
2439 uint32_t __attribute__((export_name("TS_LDKMonitorEvent_ty_from_ptr"))) TS_LDKMonitorEvent_ty_from_ptr(uint64_t ptr) {
2440         LDKMonitorEvent *obj = (LDKMonitorEvent*)untag_ptr(ptr);
2441         switch(obj->tag) {
2442                 case LDKMonitorEvent_HTLCEvent: return 0;
2443                 case LDKMonitorEvent_CommitmentTxConfirmed: return 1;
2444                 case LDKMonitorEvent_UpdateCompleted: return 2;
2445                 case LDKMonitorEvent_UpdateFailed: return 3;
2446                 default: abort();
2447         }
2448 }
2449 uint64_t __attribute__((export_name("TS_LDKMonitorEvent_HTLCEvent_get_htlc_event"))) TS_LDKMonitorEvent_HTLCEvent_get_htlc_event(uint64_t ptr) {
2450         LDKMonitorEvent *obj = (LDKMonitorEvent*)untag_ptr(ptr);
2451         assert(obj->tag == LDKMonitorEvent_HTLCEvent);
2452                         LDKHTLCUpdate htlc_event_var = obj->htlc_event;
2453                         uint64_t htlc_event_ref = 0;
2454                         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_event_var);
2455                         htlc_event_ref = tag_ptr(htlc_event_var.inner, false);
2456         return htlc_event_ref;
2457 }
2458 uint64_t __attribute__((export_name("TS_LDKMonitorEvent_CommitmentTxConfirmed_get_commitment_tx_confirmed"))) TS_LDKMonitorEvent_CommitmentTxConfirmed_get_commitment_tx_confirmed(uint64_t ptr) {
2459         LDKMonitorEvent *obj = (LDKMonitorEvent*)untag_ptr(ptr);
2460         assert(obj->tag == LDKMonitorEvent_CommitmentTxConfirmed);
2461                         LDKOutPoint commitment_tx_confirmed_var = obj->commitment_tx_confirmed;
2462                         uint64_t commitment_tx_confirmed_ref = 0;
2463                         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_confirmed_var);
2464                         commitment_tx_confirmed_ref = tag_ptr(commitment_tx_confirmed_var.inner, false);
2465         return commitment_tx_confirmed_ref;
2466 }
2467 uint64_t __attribute__((export_name("TS_LDKMonitorEvent_UpdateCompleted_get_funding_txo"))) TS_LDKMonitorEvent_UpdateCompleted_get_funding_txo(uint64_t ptr) {
2468         LDKMonitorEvent *obj = (LDKMonitorEvent*)untag_ptr(ptr);
2469         assert(obj->tag == LDKMonitorEvent_UpdateCompleted);
2470                         LDKOutPoint funding_txo_var = obj->update_completed.funding_txo;
2471                         uint64_t funding_txo_ref = 0;
2472                         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_var);
2473                         funding_txo_ref = tag_ptr(funding_txo_var.inner, false);
2474         return funding_txo_ref;
2475 }
2476 int64_t __attribute__((export_name("TS_LDKMonitorEvent_UpdateCompleted_get_monitor_update_id"))) TS_LDKMonitorEvent_UpdateCompleted_get_monitor_update_id(uint64_t ptr) {
2477         LDKMonitorEvent *obj = (LDKMonitorEvent*)untag_ptr(ptr);
2478         assert(obj->tag == LDKMonitorEvent_UpdateCompleted);
2479                         int64_t monitor_update_id_conv = obj->update_completed.monitor_update_id;
2480         return monitor_update_id_conv;
2481 }
2482 uint64_t __attribute__((export_name("TS_LDKMonitorEvent_UpdateFailed_get_update_failed"))) TS_LDKMonitorEvent_UpdateFailed_get_update_failed(uint64_t ptr) {
2483         LDKMonitorEvent *obj = (LDKMonitorEvent*)untag_ptr(ptr);
2484         assert(obj->tag == LDKMonitorEvent_UpdateFailed);
2485                         LDKOutPoint update_failed_var = obj->update_failed;
2486                         uint64_t update_failed_ref = 0;
2487                         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_failed_var);
2488                         update_failed_ref = tag_ptr(update_failed_var.inner, false);
2489         return update_failed_ref;
2490 }
2491 static inline LDKCVec_MonitorEventZ CVec_MonitorEventZ_clone(const LDKCVec_MonitorEventZ *orig) {
2492         LDKCVec_MonitorEventZ ret = { .data = MALLOC(sizeof(LDKMonitorEvent) * orig->datalen, "LDKCVec_MonitorEventZ clone bytes"), .datalen = orig->datalen };
2493         for (size_t i = 0; i < ret.datalen; i++) {
2494                 ret.data[i] = MonitorEvent_clone(&orig->data[i]);
2495         }
2496         return ret;
2497 }
2498 static inline struct LDKOutPoint C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_a(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ *NONNULL_PTR owner){
2499         LDKOutPoint ret = owner->a;
2500         ret.is_owned = false;
2501         return ret;
2502 }
2503 uint64_t  __attribute__((export_name("TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_a"))) TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_a(uint64_t owner) {
2504         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* owner_conv = (LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)untag_ptr(owner);
2505         LDKOutPoint ret_var = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_a(owner_conv);
2506         uint64_t ret_ref = 0;
2507         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2508         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2509         return ret_ref;
2510 }
2511
2512 static inline struct LDKCVec_MonitorEventZ C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_b(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ *NONNULL_PTR owner){
2513         return CVec_MonitorEventZ_clone(&owner->b);
2514 }
2515 uint64_tArray  __attribute__((export_name("TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_b"))) TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_b(uint64_t owner) {
2516         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* owner_conv = (LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)untag_ptr(owner);
2517         LDKCVec_MonitorEventZ ret_var = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_b(owner_conv);
2518         uint64_tArray ret_arr = NULL;
2519         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
2520         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
2521         for (size_t o = 0; o < ret_var.datalen; o++) {
2522                 LDKMonitorEvent *ret_conv_14_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
2523                 *ret_conv_14_copy = ret_var.data[o];
2524                 uint64_t ret_conv_14_ref = tag_ptr(ret_conv_14_copy, true);
2525                 ret_arr_ptr[o] = ret_conv_14_ref;
2526         }
2527         
2528         FREE(ret_var.data);
2529         return ret_arr;
2530 }
2531
2532 static inline struct LDKPublicKey C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_c(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ *NONNULL_PTR owner){
2533         return owner->c;
2534 }
2535 int8_tArray  __attribute__((export_name("TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_c"))) TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_c(uint64_t owner) {
2536         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* owner_conv = (LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)untag_ptr(owner);
2537         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
2538         memcpy(ret_arr->elems, C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_c(owner_conv).compressed_form, 33);
2539         return ret_arr;
2540 }
2541
2542 static inline LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ_clone(const LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ *orig) {
2543         LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ ret = { .data = MALLOC(sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ) * orig->datalen, "LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ clone bytes"), .datalen = orig->datalen };
2544         for (size_t i = 0; i < ret.datalen; i++) {
2545                 ret.data[i] = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone(&orig->data[i]);
2546         }
2547         return ret;
2548 }
2549 uint32_t __attribute__((export_name("TS_LDKCOption_C2Tuple_usizeTransactionZZ_ty_from_ptr"))) TS_LDKCOption_C2Tuple_usizeTransactionZZ_ty_from_ptr(uint64_t ptr) {
2550         LDKCOption_C2Tuple_usizeTransactionZZ *obj = (LDKCOption_C2Tuple_usizeTransactionZZ*)untag_ptr(ptr);
2551         switch(obj->tag) {
2552                 case LDKCOption_C2Tuple_usizeTransactionZZ_Some: return 0;
2553                 case LDKCOption_C2Tuple_usizeTransactionZZ_None: return 1;
2554                 default: abort();
2555         }
2556 }
2557 uint64_t __attribute__((export_name("TS_LDKCOption_C2Tuple_usizeTransactionZZ_Some_get_some"))) TS_LDKCOption_C2Tuple_usizeTransactionZZ_Some_get_some(uint64_t ptr) {
2558         LDKCOption_C2Tuple_usizeTransactionZZ *obj = (LDKCOption_C2Tuple_usizeTransactionZZ*)untag_ptr(ptr);
2559         assert(obj->tag == LDKCOption_C2Tuple_usizeTransactionZZ_Some);
2560                         LDKC2Tuple_usizeTransactionZ* some_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
2561                         *some_conv = obj->some;
2562                         *some_conv = C2Tuple_usizeTransactionZ_clone(some_conv);
2563         return tag_ptr(some_conv, true);
2564 }
2565 static inline struct LDKFixedPenaltyScorer CResult_FixedPenaltyScorerDecodeErrorZ_get_ok(LDKCResult_FixedPenaltyScorerDecodeErrorZ *NONNULL_PTR owner){
2566         LDKFixedPenaltyScorer ret = *owner->contents.result;
2567         ret.is_owned = false;
2568         return ret;
2569 }
2570 uint64_t  __attribute__((export_name("TS_CResult_FixedPenaltyScorerDecodeErrorZ_get_ok"))) TS_CResult_FixedPenaltyScorerDecodeErrorZ_get_ok(uint64_t owner) {
2571         LDKCResult_FixedPenaltyScorerDecodeErrorZ* owner_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)untag_ptr(owner);
2572         LDKFixedPenaltyScorer ret_var = CResult_FixedPenaltyScorerDecodeErrorZ_get_ok(owner_conv);
2573         uint64_t ret_ref = 0;
2574         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2575         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2576         return ret_ref;
2577 }
2578
2579 static inline struct LDKDecodeError CResult_FixedPenaltyScorerDecodeErrorZ_get_err(LDKCResult_FixedPenaltyScorerDecodeErrorZ *NONNULL_PTR owner){
2580         LDKDecodeError ret = *owner->contents.err;
2581         ret.is_owned = false;
2582         return ret;
2583 }
2584 uint64_t  __attribute__((export_name("TS_CResult_FixedPenaltyScorerDecodeErrorZ_get_err"))) TS_CResult_FixedPenaltyScorerDecodeErrorZ_get_err(uint64_t owner) {
2585         LDKCResult_FixedPenaltyScorerDecodeErrorZ* owner_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)untag_ptr(owner);
2586         LDKDecodeError ret_var = CResult_FixedPenaltyScorerDecodeErrorZ_get_err(owner_conv);
2587         uint64_t ret_ref = 0;
2588         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2589         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2590         return ret_ref;
2591 }
2592
2593 static inline uint64_t C2Tuple_u64u64Z_get_a(LDKC2Tuple_u64u64Z *NONNULL_PTR owner){
2594         return owner->a;
2595 }
2596 int64_t  __attribute__((export_name("TS_C2Tuple_u64u64Z_get_a"))) TS_C2Tuple_u64u64Z_get_a(uint64_t owner) {
2597         LDKC2Tuple_u64u64Z* owner_conv = (LDKC2Tuple_u64u64Z*)untag_ptr(owner);
2598         int64_t ret_conv = C2Tuple_u64u64Z_get_a(owner_conv);
2599         return ret_conv;
2600 }
2601
2602 static inline uint64_t C2Tuple_u64u64Z_get_b(LDKC2Tuple_u64u64Z *NONNULL_PTR owner){
2603         return owner->b;
2604 }
2605 int64_t  __attribute__((export_name("TS_C2Tuple_u64u64Z_get_b"))) TS_C2Tuple_u64u64Z_get_b(uint64_t owner) {
2606         LDKC2Tuple_u64u64Z* owner_conv = (LDKC2Tuple_u64u64Z*)untag_ptr(owner);
2607         int64_t ret_conv = C2Tuple_u64u64Z_get_b(owner_conv);
2608         return ret_conv;
2609 }
2610
2611 uint32_t __attribute__((export_name("TS_LDKCOption_C2Tuple_u64u64ZZ_ty_from_ptr"))) TS_LDKCOption_C2Tuple_u64u64ZZ_ty_from_ptr(uint64_t ptr) {
2612         LDKCOption_C2Tuple_u64u64ZZ *obj = (LDKCOption_C2Tuple_u64u64ZZ*)untag_ptr(ptr);
2613         switch(obj->tag) {
2614                 case LDKCOption_C2Tuple_u64u64ZZ_Some: return 0;
2615                 case LDKCOption_C2Tuple_u64u64ZZ_None: return 1;
2616                 default: abort();
2617         }
2618 }
2619 uint64_t __attribute__((export_name("TS_LDKCOption_C2Tuple_u64u64ZZ_Some_get_some"))) TS_LDKCOption_C2Tuple_u64u64ZZ_Some_get_some(uint64_t ptr) {
2620         LDKCOption_C2Tuple_u64u64ZZ *obj = (LDKCOption_C2Tuple_u64u64ZZ*)untag_ptr(ptr);
2621         assert(obj->tag == LDKCOption_C2Tuple_u64u64ZZ_Some);
2622                         LDKC2Tuple_u64u64Z* some_conv = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
2623                         *some_conv = obj->some;
2624                         *some_conv = C2Tuple_u64u64Z_clone(some_conv);
2625         return tag_ptr(some_conv, true);
2626 }
2627 static inline LDKCVec_NodeIdZ CVec_NodeIdZ_clone(const LDKCVec_NodeIdZ *orig) {
2628         LDKCVec_NodeIdZ ret = { .data = MALLOC(sizeof(LDKNodeId) * orig->datalen, "LDKCVec_NodeIdZ clone bytes"), .datalen = orig->datalen };
2629         for (size_t i = 0; i < ret.datalen; i++) {
2630                 ret.data[i] = NodeId_clone(&orig->data[i]);
2631         }
2632         return ret;
2633 }
2634 typedef struct LDKLogger_JCalls {
2635         atomic_size_t refcnt;
2636         uint32_t instance_ptr;
2637 } LDKLogger_JCalls;
2638 static void LDKLogger_JCalls_free(void* this_arg) {
2639         LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
2640         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2641                 FREE(j_calls);
2642         }
2643 }
2644 void log_LDKLogger_jcall(const void* this_arg, const LDKRecord * record) {
2645         LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
2646         LDKRecord record_var = *record;
2647         uint64_t record_ref = 0;
2648         record_var = Record_clone(&record_var);
2649         CHECK_INNER_FIELD_ACCESS_OR_NULL(record_var);
2650         record_ref = tag_ptr(record_var.inner, record_var.is_owned);
2651         js_invoke_function_buuuuu(j_calls->instance_ptr, 0, record_ref, 0, 0, 0, 0, 0);
2652 }
2653 static void LDKLogger_JCalls_cloned(LDKLogger* new_obj) {
2654         LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) new_obj->this_arg;
2655         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2656 }
2657 static inline LDKLogger LDKLogger_init (JSValue o) {
2658         LDKLogger_JCalls *calls = MALLOC(sizeof(LDKLogger_JCalls), "LDKLogger_JCalls");
2659         atomic_init(&calls->refcnt, 1);
2660         calls->instance_ptr = o;
2661
2662         LDKLogger ret = {
2663                 .this_arg = (void*) calls,
2664                 .log = log_LDKLogger_jcall,
2665                 .free = LDKLogger_JCalls_free,
2666         };
2667         return ret;
2668 }
2669 uint64_t  __attribute__((export_name("TS_LDKLogger_new"))) TS_LDKLogger_new(JSValue o) {
2670         LDKLogger *res_ptr = MALLOC(sizeof(LDKLogger), "LDKLogger");
2671         *res_ptr = LDKLogger_init(o);
2672         return tag_ptr(res_ptr, true);
2673 }
2674 static inline struct LDKProbabilisticScorer CResult_ProbabilisticScorerDecodeErrorZ_get_ok(LDKCResult_ProbabilisticScorerDecodeErrorZ *NONNULL_PTR owner){
2675         LDKProbabilisticScorer ret = *owner->contents.result;
2676         ret.is_owned = false;
2677         return ret;
2678 }
2679 uint64_t  __attribute__((export_name("TS_CResult_ProbabilisticScorerDecodeErrorZ_get_ok"))) TS_CResult_ProbabilisticScorerDecodeErrorZ_get_ok(uint64_t owner) {
2680         LDKCResult_ProbabilisticScorerDecodeErrorZ* owner_conv = (LDKCResult_ProbabilisticScorerDecodeErrorZ*)untag_ptr(owner);
2681         LDKProbabilisticScorer ret_var = CResult_ProbabilisticScorerDecodeErrorZ_get_ok(owner_conv);
2682         uint64_t ret_ref = 0;
2683         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2684         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2685         return ret_ref;
2686 }
2687
2688 static inline struct LDKDecodeError CResult_ProbabilisticScorerDecodeErrorZ_get_err(LDKCResult_ProbabilisticScorerDecodeErrorZ *NONNULL_PTR owner){
2689         LDKDecodeError ret = *owner->contents.err;
2690         ret.is_owned = false;
2691         return ret;
2692 }
2693 uint64_t  __attribute__((export_name("TS_CResult_ProbabilisticScorerDecodeErrorZ_get_err"))) TS_CResult_ProbabilisticScorerDecodeErrorZ_get_err(uint64_t owner) {
2694         LDKCResult_ProbabilisticScorerDecodeErrorZ* owner_conv = (LDKCResult_ProbabilisticScorerDecodeErrorZ*)untag_ptr(owner);
2695         LDKDecodeError ret_var = CResult_ProbabilisticScorerDecodeErrorZ_get_err(owner_conv);
2696         uint64_t ret_ref = 0;
2697         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2698         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2699         return ret_ref;
2700 }
2701
2702 static inline struct LDKInitFeatures CResult_InitFeaturesDecodeErrorZ_get_ok(LDKCResult_InitFeaturesDecodeErrorZ *NONNULL_PTR owner){
2703         LDKInitFeatures ret = *owner->contents.result;
2704         ret.is_owned = false;
2705         return ret;
2706 }
2707 uint64_t  __attribute__((export_name("TS_CResult_InitFeaturesDecodeErrorZ_get_ok"))) TS_CResult_InitFeaturesDecodeErrorZ_get_ok(uint64_t owner) {
2708         LDKCResult_InitFeaturesDecodeErrorZ* owner_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)untag_ptr(owner);
2709         LDKInitFeatures ret_var = CResult_InitFeaturesDecodeErrorZ_get_ok(owner_conv);
2710         uint64_t ret_ref = 0;
2711         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2712         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2713         return ret_ref;
2714 }
2715
2716 static inline struct LDKDecodeError CResult_InitFeaturesDecodeErrorZ_get_err(LDKCResult_InitFeaturesDecodeErrorZ *NONNULL_PTR owner){
2717         LDKDecodeError ret = *owner->contents.err;
2718         ret.is_owned = false;
2719         return ret;
2720 }
2721 uint64_t  __attribute__((export_name("TS_CResult_InitFeaturesDecodeErrorZ_get_err"))) TS_CResult_InitFeaturesDecodeErrorZ_get_err(uint64_t owner) {
2722         LDKCResult_InitFeaturesDecodeErrorZ* owner_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)untag_ptr(owner);
2723         LDKDecodeError ret_var = CResult_InitFeaturesDecodeErrorZ_get_err(owner_conv);
2724         uint64_t ret_ref = 0;
2725         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2726         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2727         return ret_ref;
2728 }
2729
2730 static inline struct LDKChannelFeatures CResult_ChannelFeaturesDecodeErrorZ_get_ok(LDKCResult_ChannelFeaturesDecodeErrorZ *NONNULL_PTR owner){
2731         LDKChannelFeatures ret = *owner->contents.result;
2732         ret.is_owned = false;
2733         return ret;
2734 }
2735 uint64_t  __attribute__((export_name("TS_CResult_ChannelFeaturesDecodeErrorZ_get_ok"))) TS_CResult_ChannelFeaturesDecodeErrorZ_get_ok(uint64_t owner) {
2736         LDKCResult_ChannelFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)untag_ptr(owner);
2737         LDKChannelFeatures ret_var = CResult_ChannelFeaturesDecodeErrorZ_get_ok(owner_conv);
2738         uint64_t ret_ref = 0;
2739         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2740         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2741         return ret_ref;
2742 }
2743
2744 static inline struct LDKDecodeError CResult_ChannelFeaturesDecodeErrorZ_get_err(LDKCResult_ChannelFeaturesDecodeErrorZ *NONNULL_PTR owner){
2745         LDKDecodeError ret = *owner->contents.err;
2746         ret.is_owned = false;
2747         return ret;
2748 }
2749 uint64_t  __attribute__((export_name("TS_CResult_ChannelFeaturesDecodeErrorZ_get_err"))) TS_CResult_ChannelFeaturesDecodeErrorZ_get_err(uint64_t owner) {
2750         LDKCResult_ChannelFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)untag_ptr(owner);
2751         LDKDecodeError ret_var = CResult_ChannelFeaturesDecodeErrorZ_get_err(owner_conv);
2752         uint64_t ret_ref = 0;
2753         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2754         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2755         return ret_ref;
2756 }
2757
2758 static inline struct LDKNodeFeatures CResult_NodeFeaturesDecodeErrorZ_get_ok(LDKCResult_NodeFeaturesDecodeErrorZ *NONNULL_PTR owner){
2759         LDKNodeFeatures ret = *owner->contents.result;
2760         ret.is_owned = false;
2761         return ret;
2762 }
2763 uint64_t  __attribute__((export_name("TS_CResult_NodeFeaturesDecodeErrorZ_get_ok"))) TS_CResult_NodeFeaturesDecodeErrorZ_get_ok(uint64_t owner) {
2764         LDKCResult_NodeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)untag_ptr(owner);
2765         LDKNodeFeatures ret_var = CResult_NodeFeaturesDecodeErrorZ_get_ok(owner_conv);
2766         uint64_t ret_ref = 0;
2767         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2768         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2769         return ret_ref;
2770 }
2771
2772 static inline struct LDKDecodeError CResult_NodeFeaturesDecodeErrorZ_get_err(LDKCResult_NodeFeaturesDecodeErrorZ *NONNULL_PTR owner){
2773         LDKDecodeError ret = *owner->contents.err;
2774         ret.is_owned = false;
2775         return ret;
2776 }
2777 uint64_t  __attribute__((export_name("TS_CResult_NodeFeaturesDecodeErrorZ_get_err"))) TS_CResult_NodeFeaturesDecodeErrorZ_get_err(uint64_t owner) {
2778         LDKCResult_NodeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)untag_ptr(owner);
2779         LDKDecodeError ret_var = CResult_NodeFeaturesDecodeErrorZ_get_err(owner_conv);
2780         uint64_t ret_ref = 0;
2781         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2782         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2783         return ret_ref;
2784 }
2785
2786 static inline struct LDKInvoiceFeatures CResult_InvoiceFeaturesDecodeErrorZ_get_ok(LDKCResult_InvoiceFeaturesDecodeErrorZ *NONNULL_PTR owner){
2787         LDKInvoiceFeatures ret = *owner->contents.result;
2788         ret.is_owned = false;
2789         return ret;
2790 }
2791 uint64_t  __attribute__((export_name("TS_CResult_InvoiceFeaturesDecodeErrorZ_get_ok"))) TS_CResult_InvoiceFeaturesDecodeErrorZ_get_ok(uint64_t owner) {
2792         LDKCResult_InvoiceFeaturesDecodeErrorZ* owner_conv = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)untag_ptr(owner);
2793         LDKInvoiceFeatures ret_var = CResult_InvoiceFeaturesDecodeErrorZ_get_ok(owner_conv);
2794         uint64_t ret_ref = 0;
2795         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2796         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2797         return ret_ref;
2798 }
2799
2800 static inline struct LDKDecodeError CResult_InvoiceFeaturesDecodeErrorZ_get_err(LDKCResult_InvoiceFeaturesDecodeErrorZ *NONNULL_PTR owner){
2801         LDKDecodeError ret = *owner->contents.err;
2802         ret.is_owned = false;
2803         return ret;
2804 }
2805 uint64_t  __attribute__((export_name("TS_CResult_InvoiceFeaturesDecodeErrorZ_get_err"))) TS_CResult_InvoiceFeaturesDecodeErrorZ_get_err(uint64_t owner) {
2806         LDKCResult_InvoiceFeaturesDecodeErrorZ* owner_conv = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)untag_ptr(owner);
2807         LDKDecodeError ret_var = CResult_InvoiceFeaturesDecodeErrorZ_get_err(owner_conv);
2808         uint64_t ret_ref = 0;
2809         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2810         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2811         return ret_ref;
2812 }
2813
2814 static inline struct LDKChannelTypeFeatures CResult_ChannelTypeFeaturesDecodeErrorZ_get_ok(LDKCResult_ChannelTypeFeaturesDecodeErrorZ *NONNULL_PTR owner){
2815         LDKChannelTypeFeatures ret = *owner->contents.result;
2816         ret.is_owned = false;
2817         return ret;
2818 }
2819 uint64_t  __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_get_ok"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_get_ok(uint64_t owner) {
2820         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)untag_ptr(owner);
2821         LDKChannelTypeFeatures ret_var = CResult_ChannelTypeFeaturesDecodeErrorZ_get_ok(owner_conv);
2822         uint64_t ret_ref = 0;
2823         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2824         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2825         return ret_ref;
2826 }
2827
2828 static inline struct LDKDecodeError CResult_ChannelTypeFeaturesDecodeErrorZ_get_err(LDKCResult_ChannelTypeFeaturesDecodeErrorZ *NONNULL_PTR owner){
2829         LDKDecodeError ret = *owner->contents.err;
2830         ret.is_owned = false;
2831         return ret;
2832 }
2833 uint64_t  __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_get_err"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_get_err(uint64_t owner) {
2834         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)untag_ptr(owner);
2835         LDKDecodeError ret_var = CResult_ChannelTypeFeaturesDecodeErrorZ_get_err(owner_conv);
2836         uint64_t ret_ref = 0;
2837         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2838         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2839         return ret_ref;
2840 }
2841
2842 static inline struct LDKNodeId CResult_NodeIdDecodeErrorZ_get_ok(LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR owner){
2843         LDKNodeId ret = *owner->contents.result;
2844         ret.is_owned = false;
2845         return ret;
2846 }
2847 uint64_t  __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_get_ok"))) TS_CResult_NodeIdDecodeErrorZ_get_ok(uint64_t owner) {
2848         LDKCResult_NodeIdDecodeErrorZ* owner_conv = (LDKCResult_NodeIdDecodeErrorZ*)untag_ptr(owner);
2849         LDKNodeId ret_var = CResult_NodeIdDecodeErrorZ_get_ok(owner_conv);
2850         uint64_t ret_ref = 0;
2851         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2852         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2853         return ret_ref;
2854 }
2855
2856 static inline struct LDKDecodeError CResult_NodeIdDecodeErrorZ_get_err(LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR owner){
2857         LDKDecodeError ret = *owner->contents.err;
2858         ret.is_owned = false;
2859         return ret;
2860 }
2861 uint64_t  __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_get_err"))) TS_CResult_NodeIdDecodeErrorZ_get_err(uint64_t owner) {
2862         LDKCResult_NodeIdDecodeErrorZ* owner_conv = (LDKCResult_NodeIdDecodeErrorZ*)untag_ptr(owner);
2863         LDKDecodeError ret_var = CResult_NodeIdDecodeErrorZ_get_err(owner_conv);
2864         uint64_t ret_ref = 0;
2865         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2866         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2867         return ret_ref;
2868 }
2869
2870 static inline struct LDKCOption_NetworkUpdateZ CResult_COption_NetworkUpdateZDecodeErrorZ_get_ok(LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR owner){
2871 CHECK(owner->result_ok);
2872         return COption_NetworkUpdateZ_clone(&*owner->contents.result);
2873 }
2874 uint64_t  __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_get_ok"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_get_ok(uint64_t owner) {
2875         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* owner_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)untag_ptr(owner);
2876         LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
2877         *ret_copy = CResult_COption_NetworkUpdateZDecodeErrorZ_get_ok(owner_conv);
2878         uint64_t ret_ref = tag_ptr(ret_copy, true);
2879         return ret_ref;
2880 }
2881
2882 static inline struct LDKDecodeError CResult_COption_NetworkUpdateZDecodeErrorZ_get_err(LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR owner){
2883         LDKDecodeError ret = *owner->contents.err;
2884         ret.is_owned = false;
2885         return ret;
2886 }
2887 uint64_t  __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_get_err"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_get_err(uint64_t owner) {
2888         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* owner_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)untag_ptr(owner);
2889         LDKDecodeError ret_var = CResult_COption_NetworkUpdateZDecodeErrorZ_get_err(owner_conv);
2890         uint64_t ret_ref = 0;
2891         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2892         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2893         return ret_ref;
2894 }
2895
2896 typedef struct LDKAccess_JCalls {
2897         atomic_size_t refcnt;
2898         uint32_t instance_ptr;
2899 } LDKAccess_JCalls;
2900 static void LDKAccess_JCalls_free(void* this_arg) {
2901         LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
2902         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2903                 FREE(j_calls);
2904         }
2905 }
2906 LDKCResult_TxOutAccessErrorZ get_utxo_LDKAccess_jcall(const void* this_arg, const uint8_t (* genesis_hash)[32], uint64_t short_channel_id) {
2907         LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
2908         int8_tArray genesis_hash_arr = init_int8_tArray(32, __LINE__);
2909         memcpy(genesis_hash_arr->elems, *genesis_hash, 32);
2910         int64_t short_channel_id_conv = short_channel_id;
2911         uint32_t ret = js_invoke_function_ubuuuu(j_calls->instance_ptr, 1, (uint32_t)genesis_hash_arr, short_channel_id_conv, 0, 0, 0, 0);
2912         void* ret_ptr = untag_ptr(ret);
2913         CHECK_ACCESS(ret_ptr);
2914         LDKCResult_TxOutAccessErrorZ ret_conv = *(LDKCResult_TxOutAccessErrorZ*)(ret_ptr);
2915         FREE(untag_ptr(ret));
2916         return ret_conv;
2917 }
2918 static void LDKAccess_JCalls_cloned(LDKAccess* new_obj) {
2919         LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) new_obj->this_arg;
2920         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2921 }
2922 static inline LDKAccess LDKAccess_init (JSValue o) {
2923         LDKAccess_JCalls *calls = MALLOC(sizeof(LDKAccess_JCalls), "LDKAccess_JCalls");
2924         atomic_init(&calls->refcnt, 1);
2925         calls->instance_ptr = o;
2926
2927         LDKAccess ret = {
2928                 .this_arg = (void*) calls,
2929                 .get_utxo = get_utxo_LDKAccess_jcall,
2930                 .free = LDKAccess_JCalls_free,
2931         };
2932         return ret;
2933 }
2934 uint64_t  __attribute__((export_name("TS_LDKAccess_new"))) TS_LDKAccess_new(JSValue o) {
2935         LDKAccess *res_ptr = MALLOC(sizeof(LDKAccess), "LDKAccess");
2936         *res_ptr = LDKAccess_init(o);
2937         return tag_ptr(res_ptr, true);
2938 }
2939 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) {
2940         void* this_arg_ptr = untag_ptr(this_arg);
2941         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
2942         LDKAccess* this_arg_conv = (LDKAccess*)this_arg_ptr;
2943         unsigned char genesis_hash_arr[32];
2944         CHECK(genesis_hash->arr_len == 32);
2945         memcpy(genesis_hash_arr, genesis_hash->elems, 32); FREE(genesis_hash);
2946         unsigned char (*genesis_hash_ref)[32] = &genesis_hash_arr;
2947         LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
2948         *ret_conv = (this_arg_conv->get_utxo)(this_arg_conv->this_arg, genesis_hash_ref, short_channel_id);
2949         return tag_ptr(ret_conv, true);
2950 }
2951
2952 uint32_t __attribute__((export_name("TS_LDKCOption_AccessZ_ty_from_ptr"))) TS_LDKCOption_AccessZ_ty_from_ptr(uint64_t ptr) {
2953         LDKCOption_AccessZ *obj = (LDKCOption_AccessZ*)untag_ptr(ptr);
2954         switch(obj->tag) {
2955                 case LDKCOption_AccessZ_Some: return 0;
2956                 case LDKCOption_AccessZ_None: return 1;
2957                 default: abort();
2958         }
2959 }
2960 uint64_t __attribute__((export_name("TS_LDKCOption_AccessZ_Some_get_some"))) TS_LDKCOption_AccessZ_Some_get_some(uint64_t ptr) {
2961         LDKCOption_AccessZ *obj = (LDKCOption_AccessZ*)untag_ptr(ptr);
2962         assert(obj->tag == LDKCOption_AccessZ_Some);
2963                         LDKAccess* some_ret = MALLOC(sizeof(LDKAccess), "LDKAccess");
2964                         *some_ret = obj->some;
2965                         // WARNING: We likely need to clone here, but no clone is available, so we just do it for Java instances
2966                         if ((*some_ret).free == LDKAccess_JCalls_free) {
2967                                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
2968                                 LDKAccess_JCalls_cloned(&(*some_ret));
2969                         }
2970         return tag_ptr(some_ret, true);
2971 }
2972 static inline bool CResult_boolLightningErrorZ_get_ok(LDKCResult_boolLightningErrorZ *NONNULL_PTR owner){
2973 CHECK(owner->result_ok);
2974         return *owner->contents.result;
2975 }
2976 jboolean  __attribute__((export_name("TS_CResult_boolLightningErrorZ_get_ok"))) TS_CResult_boolLightningErrorZ_get_ok(uint64_t owner) {
2977         LDKCResult_boolLightningErrorZ* owner_conv = (LDKCResult_boolLightningErrorZ*)untag_ptr(owner);
2978         jboolean ret_conv = CResult_boolLightningErrorZ_get_ok(owner_conv);
2979         return ret_conv;
2980 }
2981
2982 static inline struct LDKLightningError CResult_boolLightningErrorZ_get_err(LDKCResult_boolLightningErrorZ *NONNULL_PTR owner){
2983         LDKLightningError ret = *owner->contents.err;
2984         ret.is_owned = false;
2985         return ret;
2986 }
2987 uint64_t  __attribute__((export_name("TS_CResult_boolLightningErrorZ_get_err"))) TS_CResult_boolLightningErrorZ_get_err(uint64_t owner) {
2988         LDKCResult_boolLightningErrorZ* owner_conv = (LDKCResult_boolLightningErrorZ*)untag_ptr(owner);
2989         LDKLightningError ret_var = CResult_boolLightningErrorZ_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 static inline struct LDKChannelAnnouncement C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_a(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR owner){
2997         LDKChannelAnnouncement ret = owner->a;
2998         ret.is_owned = false;
2999         return ret;
3000 }
3001 uint64_t  __attribute__((export_name("TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_a"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_a(uint64_t owner) {
3002         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* owner_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(owner);
3003         LDKChannelAnnouncement ret_var = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_a(owner_conv);
3004         uint64_t ret_ref = 0;
3005         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3006         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3007         return ret_ref;
3008 }
3009
3010 static inline struct LDKChannelUpdate C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_b(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR owner){
3011         LDKChannelUpdate ret = owner->b;
3012         ret.is_owned = false;
3013         return ret;
3014 }
3015 uint64_t  __attribute__((export_name("TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_b"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_b(uint64_t owner) {
3016         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* owner_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(owner);
3017         LDKChannelUpdate ret_var = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_b(owner_conv);
3018         uint64_t ret_ref = 0;
3019         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3020         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3021         return ret_ref;
3022 }
3023
3024 static inline struct LDKChannelUpdate C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR owner){
3025         LDKChannelUpdate ret = owner->c;
3026         ret.is_owned = false;
3027         return ret;
3028 }
3029 uint64_t  __attribute__((export_name("TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c(uint64_t owner) {
3030         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* owner_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(owner);
3031         LDKChannelUpdate ret_var = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c(owner_conv);
3032         uint64_t ret_ref = 0;
3033         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3034         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3035         return ret_ref;
3036 }
3037
3038 static inline LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone(const LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *orig) {
3039         LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret = { .data = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) * orig->datalen, "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ clone bytes"), .datalen = orig->datalen };
3040         for (size_t i = 0; i < ret.datalen; i++) {
3041                 ret.data[i] = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(&orig->data[i]);
3042         }
3043         return ret;
3044 }
3045 static inline LDKCVec_NodeAnnouncementZ CVec_NodeAnnouncementZ_clone(const LDKCVec_NodeAnnouncementZ *orig) {
3046         LDKCVec_NodeAnnouncementZ ret = { .data = MALLOC(sizeof(LDKNodeAnnouncement) * orig->datalen, "LDKCVec_NodeAnnouncementZ clone bytes"), .datalen = orig->datalen };
3047         for (size_t i = 0; i < ret.datalen; i++) {
3048                 ret.data[i] = NodeAnnouncement_clone(&orig->data[i]);
3049         }
3050         return ret;
3051 }
3052 static inline void CResult_NoneLightningErrorZ_get_ok(LDKCResult_NoneLightningErrorZ *NONNULL_PTR owner){
3053 CHECK(owner->result_ok);
3054         return *owner->contents.result;
3055 }
3056 void  __attribute__((export_name("TS_CResult_NoneLightningErrorZ_get_ok"))) TS_CResult_NoneLightningErrorZ_get_ok(uint64_t owner) {
3057         LDKCResult_NoneLightningErrorZ* owner_conv = (LDKCResult_NoneLightningErrorZ*)untag_ptr(owner);
3058         CResult_NoneLightningErrorZ_get_ok(owner_conv);
3059 }
3060
3061 static inline struct LDKLightningError CResult_NoneLightningErrorZ_get_err(LDKCResult_NoneLightningErrorZ *NONNULL_PTR owner){
3062         LDKLightningError ret = *owner->contents.err;
3063         ret.is_owned = false;
3064         return ret;
3065 }
3066 uint64_t  __attribute__((export_name("TS_CResult_NoneLightningErrorZ_get_err"))) TS_CResult_NoneLightningErrorZ_get_err(uint64_t owner) {
3067         LDKCResult_NoneLightningErrorZ* owner_conv = (LDKCResult_NoneLightningErrorZ*)untag_ptr(owner);
3068         LDKLightningError ret_var = CResult_NoneLightningErrorZ_get_err(owner_conv);
3069         uint64_t ret_ref = 0;
3070         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3071         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3072         return ret_ref;
3073 }
3074
3075 static inline struct LDKChannelUpdateInfo CResult_ChannelUpdateInfoDecodeErrorZ_get_ok(LDKCResult_ChannelUpdateInfoDecodeErrorZ *NONNULL_PTR owner){
3076         LDKChannelUpdateInfo ret = *owner->contents.result;
3077         ret.is_owned = false;
3078         return ret;
3079 }
3080 uint64_t  __attribute__((export_name("TS_CResult_ChannelUpdateInfoDecodeErrorZ_get_ok"))) TS_CResult_ChannelUpdateInfoDecodeErrorZ_get_ok(uint64_t owner) {
3081         LDKCResult_ChannelUpdateInfoDecodeErrorZ* owner_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)untag_ptr(owner);
3082         LDKChannelUpdateInfo ret_var = CResult_ChannelUpdateInfoDecodeErrorZ_get_ok(owner_conv);
3083         uint64_t ret_ref = 0;
3084         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3085         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3086         return ret_ref;
3087 }
3088
3089 static inline struct LDKDecodeError CResult_ChannelUpdateInfoDecodeErrorZ_get_err(LDKCResult_ChannelUpdateInfoDecodeErrorZ *NONNULL_PTR owner){
3090         LDKDecodeError ret = *owner->contents.err;
3091         ret.is_owned = false;
3092         return ret;
3093 }
3094 uint64_t  __attribute__((export_name("TS_CResult_ChannelUpdateInfoDecodeErrorZ_get_err"))) TS_CResult_ChannelUpdateInfoDecodeErrorZ_get_err(uint64_t owner) {
3095         LDKCResult_ChannelUpdateInfoDecodeErrorZ* owner_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)untag_ptr(owner);
3096         LDKDecodeError ret_var = CResult_ChannelUpdateInfoDecodeErrorZ_get_err(owner_conv);
3097         uint64_t ret_ref = 0;
3098         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3099         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3100         return ret_ref;
3101 }
3102
3103 static inline struct LDKChannelInfo CResult_ChannelInfoDecodeErrorZ_get_ok(LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR owner){
3104         LDKChannelInfo ret = *owner->contents.result;
3105         ret.is_owned = false;
3106         return ret;
3107 }
3108 uint64_t  __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_get_ok"))) TS_CResult_ChannelInfoDecodeErrorZ_get_ok(uint64_t owner) {
3109         LDKCResult_ChannelInfoDecodeErrorZ* owner_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)untag_ptr(owner);
3110         LDKChannelInfo ret_var = CResult_ChannelInfoDecodeErrorZ_get_ok(owner_conv);
3111         uint64_t ret_ref = 0;
3112         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3113         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3114         return ret_ref;
3115 }
3116
3117 static inline struct LDKDecodeError CResult_ChannelInfoDecodeErrorZ_get_err(LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR owner){
3118         LDKDecodeError ret = *owner->contents.err;
3119         ret.is_owned = false;
3120         return ret;
3121 }
3122 uint64_t  __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_get_err"))) TS_CResult_ChannelInfoDecodeErrorZ_get_err(uint64_t owner) {
3123         LDKCResult_ChannelInfoDecodeErrorZ* owner_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)untag_ptr(owner);
3124         LDKDecodeError ret_var = CResult_ChannelInfoDecodeErrorZ_get_err(owner_conv);
3125         uint64_t ret_ref = 0;
3126         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3127         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3128         return ret_ref;
3129 }
3130
3131 static inline struct LDKRoutingFees CResult_RoutingFeesDecodeErrorZ_get_ok(LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR owner){
3132         LDKRoutingFees ret = *owner->contents.result;
3133         ret.is_owned = false;
3134         return ret;
3135 }
3136 uint64_t  __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_get_ok"))) TS_CResult_RoutingFeesDecodeErrorZ_get_ok(uint64_t owner) {
3137         LDKCResult_RoutingFeesDecodeErrorZ* owner_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)untag_ptr(owner);
3138         LDKRoutingFees ret_var = CResult_RoutingFeesDecodeErrorZ_get_ok(owner_conv);
3139         uint64_t ret_ref = 0;
3140         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3141         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3142         return ret_ref;
3143 }
3144
3145 static inline struct LDKDecodeError CResult_RoutingFeesDecodeErrorZ_get_err(LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR owner){
3146         LDKDecodeError ret = *owner->contents.err;
3147         ret.is_owned = false;
3148         return ret;
3149 }
3150 uint64_t  __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_get_err"))) TS_CResult_RoutingFeesDecodeErrorZ_get_err(uint64_t owner) {
3151         LDKCResult_RoutingFeesDecodeErrorZ* owner_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)untag_ptr(owner);
3152         LDKDecodeError ret_var = CResult_RoutingFeesDecodeErrorZ_get_err(owner_conv);
3153         uint64_t ret_ref = 0;
3154         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3155         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3156         return ret_ref;
3157 }
3158
3159 uint32_t __attribute__((export_name("TS_LDKNetAddress_ty_from_ptr"))) TS_LDKNetAddress_ty_from_ptr(uint64_t ptr) {
3160         LDKNetAddress *obj = (LDKNetAddress*)untag_ptr(ptr);
3161         switch(obj->tag) {
3162                 case LDKNetAddress_IPv4: return 0;
3163                 case LDKNetAddress_IPv6: return 1;
3164                 case LDKNetAddress_OnionV2: return 2;
3165                 case LDKNetAddress_OnionV3: return 3;
3166                 case LDKNetAddress_Hostname: return 4;
3167                 default: abort();
3168         }
3169 }
3170 int8_tArray __attribute__((export_name("TS_LDKNetAddress_IPv4_get_addr"))) TS_LDKNetAddress_IPv4_get_addr(uint64_t ptr) {
3171         LDKNetAddress *obj = (LDKNetAddress*)untag_ptr(ptr);
3172         assert(obj->tag == LDKNetAddress_IPv4);
3173                         int8_tArray addr_arr = init_int8_tArray(4, __LINE__);
3174                         memcpy(addr_arr->elems, obj->i_pv4.addr.data, 4);
3175         return addr_arr;
3176 }
3177 int16_t __attribute__((export_name("TS_LDKNetAddress_IPv4_get_port"))) TS_LDKNetAddress_IPv4_get_port(uint64_t ptr) {
3178         LDKNetAddress *obj = (LDKNetAddress*)untag_ptr(ptr);
3179         assert(obj->tag == LDKNetAddress_IPv4);
3180                         int16_t port_conv = obj->i_pv4.port;
3181         return port_conv;
3182 }
3183 int8_tArray __attribute__((export_name("TS_LDKNetAddress_IPv6_get_addr"))) TS_LDKNetAddress_IPv6_get_addr(uint64_t ptr) {
3184         LDKNetAddress *obj = (LDKNetAddress*)untag_ptr(ptr);
3185         assert(obj->tag == LDKNetAddress_IPv6);
3186                         int8_tArray addr_arr = init_int8_tArray(16, __LINE__);
3187                         memcpy(addr_arr->elems, obj->i_pv6.addr.data, 16);
3188         return addr_arr;
3189 }
3190 int16_t __attribute__((export_name("TS_LDKNetAddress_IPv6_get_port"))) TS_LDKNetAddress_IPv6_get_port(uint64_t ptr) {
3191         LDKNetAddress *obj = (LDKNetAddress*)untag_ptr(ptr);
3192         assert(obj->tag == LDKNetAddress_IPv6);
3193                         int16_t port_conv = obj->i_pv6.port;
3194         return port_conv;
3195 }
3196 int8_tArray __attribute__((export_name("TS_LDKNetAddress_OnionV2_get_onion_v2"))) TS_LDKNetAddress_OnionV2_get_onion_v2(uint64_t ptr) {
3197         LDKNetAddress *obj = (LDKNetAddress*)untag_ptr(ptr);
3198         assert(obj->tag == LDKNetAddress_OnionV2);
3199                         int8_tArray onion_v2_arr = init_int8_tArray(12, __LINE__);
3200                         memcpy(onion_v2_arr->elems, obj->onion_v2.data, 12);
3201         return onion_v2_arr;
3202 }
3203 int8_tArray __attribute__((export_name("TS_LDKNetAddress_OnionV3_get_ed25519_pubkey"))) TS_LDKNetAddress_OnionV3_get_ed25519_pubkey(uint64_t ptr) {
3204         LDKNetAddress *obj = (LDKNetAddress*)untag_ptr(ptr);
3205         assert(obj->tag == LDKNetAddress_OnionV3);
3206                         int8_tArray ed25519_pubkey_arr = init_int8_tArray(32, __LINE__);
3207                         memcpy(ed25519_pubkey_arr->elems, obj->onion_v3.ed25519_pubkey.data, 32);
3208         return ed25519_pubkey_arr;
3209 }
3210 int16_t __attribute__((export_name("TS_LDKNetAddress_OnionV3_get_checksum"))) TS_LDKNetAddress_OnionV3_get_checksum(uint64_t ptr) {
3211         LDKNetAddress *obj = (LDKNetAddress*)untag_ptr(ptr);
3212         assert(obj->tag == LDKNetAddress_OnionV3);
3213                         int16_t checksum_conv = obj->onion_v3.checksum;
3214         return checksum_conv;
3215 }
3216 int8_t __attribute__((export_name("TS_LDKNetAddress_OnionV3_get_version"))) TS_LDKNetAddress_OnionV3_get_version(uint64_t ptr) {
3217         LDKNetAddress *obj = (LDKNetAddress*)untag_ptr(ptr);
3218         assert(obj->tag == LDKNetAddress_OnionV3);
3219                         int8_t version_conv = obj->onion_v3.version;
3220         return version_conv;
3221 }
3222 int16_t __attribute__((export_name("TS_LDKNetAddress_OnionV3_get_port"))) TS_LDKNetAddress_OnionV3_get_port(uint64_t ptr) {
3223         LDKNetAddress *obj = (LDKNetAddress*)untag_ptr(ptr);
3224         assert(obj->tag == LDKNetAddress_OnionV3);
3225                         int16_t port_conv = obj->onion_v3.port;
3226         return port_conv;
3227 }
3228 uint64_t __attribute__((export_name("TS_LDKNetAddress_Hostname_get_hostname"))) TS_LDKNetAddress_Hostname_get_hostname(uint64_t ptr) {
3229         LDKNetAddress *obj = (LDKNetAddress*)untag_ptr(ptr);
3230         assert(obj->tag == LDKNetAddress_Hostname);
3231                         LDKHostname hostname_var = obj->hostname.hostname;
3232                         uint64_t hostname_ref = 0;
3233                         CHECK_INNER_FIELD_ACCESS_OR_NULL(hostname_var);
3234                         hostname_ref = tag_ptr(hostname_var.inner, false);
3235         return hostname_ref;
3236 }
3237 int16_t __attribute__((export_name("TS_LDKNetAddress_Hostname_get_port"))) TS_LDKNetAddress_Hostname_get_port(uint64_t ptr) {
3238         LDKNetAddress *obj = (LDKNetAddress*)untag_ptr(ptr);
3239         assert(obj->tag == LDKNetAddress_Hostname);
3240                         int16_t port_conv = obj->hostname.port;
3241         return port_conv;
3242 }
3243 static inline LDKCVec_NetAddressZ CVec_NetAddressZ_clone(const LDKCVec_NetAddressZ *orig) {
3244         LDKCVec_NetAddressZ ret = { .data = MALLOC(sizeof(LDKNetAddress) * orig->datalen, "LDKCVec_NetAddressZ clone bytes"), .datalen = orig->datalen };
3245         for (size_t i = 0; i < ret.datalen; i++) {
3246                 ret.data[i] = NetAddress_clone(&orig->data[i]);
3247         }
3248         return ret;
3249 }
3250 static inline struct LDKNodeAnnouncementInfo CResult_NodeAnnouncementInfoDecodeErrorZ_get_ok(LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR owner){
3251         LDKNodeAnnouncementInfo ret = *owner->contents.result;
3252         ret.is_owned = false;
3253         return ret;
3254 }
3255 uint64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_get_ok"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_get_ok(uint64_t owner) {
3256         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)untag_ptr(owner);
3257         LDKNodeAnnouncementInfo ret_var = CResult_NodeAnnouncementInfoDecodeErrorZ_get_ok(owner_conv);
3258         uint64_t ret_ref = 0;
3259         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3260         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3261         return ret_ref;
3262 }
3263
3264 static inline struct LDKDecodeError CResult_NodeAnnouncementInfoDecodeErrorZ_get_err(LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR owner){
3265         LDKDecodeError ret = *owner->contents.err;
3266         ret.is_owned = false;
3267         return ret;
3268 }
3269 uint64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_get_err"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_get_err(uint64_t owner) {
3270         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)untag_ptr(owner);
3271         LDKDecodeError ret_var = CResult_NodeAnnouncementInfoDecodeErrorZ_get_err(owner_conv);
3272         uint64_t ret_ref = 0;
3273         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3274         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3275         return ret_ref;
3276 }
3277
3278 static inline struct LDKNodeAlias CResult_NodeAliasDecodeErrorZ_get_ok(LDKCResult_NodeAliasDecodeErrorZ *NONNULL_PTR owner){
3279         LDKNodeAlias ret = *owner->contents.result;
3280         ret.is_owned = false;
3281         return ret;
3282 }
3283 uint64_t  __attribute__((export_name("TS_CResult_NodeAliasDecodeErrorZ_get_ok"))) TS_CResult_NodeAliasDecodeErrorZ_get_ok(uint64_t owner) {
3284         LDKCResult_NodeAliasDecodeErrorZ* owner_conv = (LDKCResult_NodeAliasDecodeErrorZ*)untag_ptr(owner);
3285         LDKNodeAlias ret_var = CResult_NodeAliasDecodeErrorZ_get_ok(owner_conv);
3286         uint64_t ret_ref = 0;
3287         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3288         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3289         return ret_ref;
3290 }
3291
3292 static inline struct LDKDecodeError CResult_NodeAliasDecodeErrorZ_get_err(LDKCResult_NodeAliasDecodeErrorZ *NONNULL_PTR owner){
3293         LDKDecodeError ret = *owner->contents.err;
3294         ret.is_owned = false;
3295         return ret;
3296 }
3297 uint64_t  __attribute__((export_name("TS_CResult_NodeAliasDecodeErrorZ_get_err"))) TS_CResult_NodeAliasDecodeErrorZ_get_err(uint64_t owner) {
3298         LDKCResult_NodeAliasDecodeErrorZ* owner_conv = (LDKCResult_NodeAliasDecodeErrorZ*)untag_ptr(owner);
3299         LDKDecodeError ret_var = CResult_NodeAliasDecodeErrorZ_get_err(owner_conv);
3300         uint64_t ret_ref = 0;
3301         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3302         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3303         return ret_ref;
3304 }
3305
3306 static inline struct LDKNodeInfo CResult_NodeInfoDecodeErrorZ_get_ok(LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR owner){
3307         LDKNodeInfo ret = *owner->contents.result;
3308         ret.is_owned = false;
3309         return ret;
3310 }
3311 uint64_t  __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_get_ok"))) TS_CResult_NodeInfoDecodeErrorZ_get_ok(uint64_t owner) {
3312         LDKCResult_NodeInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeInfoDecodeErrorZ*)untag_ptr(owner);
3313         LDKNodeInfo ret_var = CResult_NodeInfoDecodeErrorZ_get_ok(owner_conv);
3314         uint64_t ret_ref = 0;
3315         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3316         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3317         return ret_ref;
3318 }
3319
3320 static inline struct LDKDecodeError CResult_NodeInfoDecodeErrorZ_get_err(LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR owner){
3321         LDKDecodeError ret = *owner->contents.err;
3322         ret.is_owned = false;
3323         return ret;
3324 }
3325 uint64_t  __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_get_err"))) TS_CResult_NodeInfoDecodeErrorZ_get_err(uint64_t owner) {
3326         LDKCResult_NodeInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeInfoDecodeErrorZ*)untag_ptr(owner);
3327         LDKDecodeError ret_var = CResult_NodeInfoDecodeErrorZ_get_err(owner_conv);
3328         uint64_t ret_ref = 0;
3329         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3330         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3331         return ret_ref;
3332 }
3333
3334 static inline struct LDKNetworkGraph CResult_NetworkGraphDecodeErrorZ_get_ok(LDKCResult_NetworkGraphDecodeErrorZ *NONNULL_PTR owner){
3335         LDKNetworkGraph ret = *owner->contents.result;
3336         ret.is_owned = false;
3337         return ret;
3338 }
3339 uint64_t  __attribute__((export_name("TS_CResult_NetworkGraphDecodeErrorZ_get_ok"))) TS_CResult_NetworkGraphDecodeErrorZ_get_ok(uint64_t owner) {
3340         LDKCResult_NetworkGraphDecodeErrorZ* owner_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)untag_ptr(owner);
3341         LDKNetworkGraph ret_var = CResult_NetworkGraphDecodeErrorZ_get_ok(owner_conv);
3342         uint64_t ret_ref = 0;
3343         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3344         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3345         return ret_ref;
3346 }
3347
3348 static inline struct LDKDecodeError CResult_NetworkGraphDecodeErrorZ_get_err(LDKCResult_NetworkGraphDecodeErrorZ *NONNULL_PTR owner){
3349         LDKDecodeError ret = *owner->contents.err;
3350         ret.is_owned = false;
3351         return ret;
3352 }
3353 uint64_t  __attribute__((export_name("TS_CResult_NetworkGraphDecodeErrorZ_get_err"))) TS_CResult_NetworkGraphDecodeErrorZ_get_err(uint64_t owner) {
3354         LDKCResult_NetworkGraphDecodeErrorZ* owner_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)untag_ptr(owner);
3355         LDKDecodeError ret_var = CResult_NetworkGraphDecodeErrorZ_get_err(owner_conv);
3356         uint64_t ret_ref = 0;
3357         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3358         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3359         return ret_ref;
3360 }
3361
3362 uint32_t __attribute__((export_name("TS_LDKCOption_CVec_NetAddressZZ_ty_from_ptr"))) TS_LDKCOption_CVec_NetAddressZZ_ty_from_ptr(uint64_t ptr) {
3363         LDKCOption_CVec_NetAddressZZ *obj = (LDKCOption_CVec_NetAddressZZ*)untag_ptr(ptr);
3364         switch(obj->tag) {
3365                 case LDKCOption_CVec_NetAddressZZ_Some: return 0;
3366                 case LDKCOption_CVec_NetAddressZZ_None: return 1;
3367                 default: abort();
3368         }
3369 }
3370 uint64_tArray __attribute__((export_name("TS_LDKCOption_CVec_NetAddressZZ_Some_get_some"))) TS_LDKCOption_CVec_NetAddressZZ_Some_get_some(uint64_t ptr) {
3371         LDKCOption_CVec_NetAddressZZ *obj = (LDKCOption_CVec_NetAddressZZ*)untag_ptr(ptr);
3372         assert(obj->tag == LDKCOption_CVec_NetAddressZZ_Some);
3373                         LDKCVec_NetAddressZ some_var = obj->some;
3374                         uint64_tArray some_arr = NULL;
3375                         some_arr = init_uint64_tArray(some_var.datalen, __LINE__);
3376                         uint64_t *some_arr_ptr = (uint64_t*)(((uint8_t*)some_arr) + 8);
3377                         for (size_t m = 0; m < some_var.datalen; m++) {
3378                                 uint64_t some_conv_12_ref = tag_ptr(&some_var.data[m], false);
3379                                 some_arr_ptr[m] = some_conv_12_ref;
3380                         }
3381                         
3382         return some_arr;
3383 }
3384 static inline struct LDKDelayedPaymentOutputDescriptor CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_ok(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
3385         LDKDelayedPaymentOutputDescriptor ret = *owner->contents.result;
3386         ret.is_owned = false;
3387         return ret;
3388 }
3389 uint64_t  __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_ok"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_ok(uint64_t owner) {
3390         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
3391         LDKDelayedPaymentOutputDescriptor ret_var = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_ok(owner_conv);
3392         uint64_t ret_ref = 0;
3393         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3394         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3395         return ret_ref;
3396 }
3397
3398 static inline struct LDKDecodeError CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_err(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
3399         LDKDecodeError ret = *owner->contents.err;
3400         ret.is_owned = false;
3401         return ret;
3402 }
3403 uint64_t  __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_err"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_err(uint64_t owner) {
3404         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
3405         LDKDecodeError ret_var = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_err(owner_conv);
3406         uint64_t ret_ref = 0;
3407         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3408         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3409         return ret_ref;
3410 }
3411
3412 static inline struct LDKStaticPaymentOutputDescriptor CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_ok(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
3413         LDKStaticPaymentOutputDescriptor ret = *owner->contents.result;
3414         ret.is_owned = false;
3415         return ret;
3416 }
3417 uint64_t  __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_ok"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_ok(uint64_t owner) {
3418         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
3419         LDKStaticPaymentOutputDescriptor ret_var = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_ok(owner_conv);
3420         uint64_t ret_ref = 0;
3421         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3422         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3423         return ret_ref;
3424 }
3425
3426 static inline struct LDKDecodeError CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_err(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
3427         LDKDecodeError ret = *owner->contents.err;
3428         ret.is_owned = false;
3429         return ret;
3430 }
3431 uint64_t  __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_err"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_err(uint64_t owner) {
3432         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
3433         LDKDecodeError ret_var = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_err(owner_conv);
3434         uint64_t ret_ref = 0;
3435         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3436         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3437         return ret_ref;
3438 }
3439
3440 static inline struct LDKSpendableOutputDescriptor CResult_SpendableOutputDescriptorDecodeErrorZ_get_ok(LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
3441 CHECK(owner->result_ok);
3442         return SpendableOutputDescriptor_clone(&*owner->contents.result);
3443 }
3444 uint64_t  __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_get_ok"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_get_ok(uint64_t owner) {
3445         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
3446         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
3447         *ret_copy = CResult_SpendableOutputDescriptorDecodeErrorZ_get_ok(owner_conv);
3448         uint64_t ret_ref = tag_ptr(ret_copy, true);
3449         return ret_ref;
3450 }
3451
3452 static inline struct LDKDecodeError CResult_SpendableOutputDescriptorDecodeErrorZ_get_err(LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
3453         LDKDecodeError ret = *owner->contents.err;
3454         ret.is_owned = false;
3455         return ret;
3456 }
3457 uint64_t  __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_get_err"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_get_err(uint64_t owner) {
3458         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
3459         LDKDecodeError ret_var = CResult_SpendableOutputDescriptorDecodeErrorZ_get_err(owner_conv);
3460         uint64_t ret_ref = 0;
3461         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3462         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3463         return ret_ref;
3464 }
3465
3466 static inline LDKCVec_PaymentPreimageZ CVec_PaymentPreimageZ_clone(const LDKCVec_PaymentPreimageZ *orig) {
3467         LDKCVec_PaymentPreimageZ ret = { .data = MALLOC(sizeof(LDKThirtyTwoBytes) * orig->datalen, "LDKCVec_PaymentPreimageZ clone bytes"), .datalen = orig->datalen };
3468         for (size_t i = 0; i < ret.datalen; i++) {
3469                 ret.data[i] = ThirtyTwoBytes_clone(&orig->data[i]);
3470         }
3471         return ret;
3472 }
3473 static inline struct LDKSignature C2Tuple_SignatureCVec_SignatureZZ_get_a(LDKC2Tuple_SignatureCVec_SignatureZZ *NONNULL_PTR owner){
3474         return owner->a;
3475 }
3476 int8_tArray  __attribute__((export_name("TS_C2Tuple_SignatureCVec_SignatureZZ_get_a"))) TS_C2Tuple_SignatureCVec_SignatureZZ_get_a(uint64_t owner) {
3477         LDKC2Tuple_SignatureCVec_SignatureZZ* owner_conv = (LDKC2Tuple_SignatureCVec_SignatureZZ*)untag_ptr(owner);
3478         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
3479         memcpy(ret_arr->elems, C2Tuple_SignatureCVec_SignatureZZ_get_a(owner_conv).compact_form, 64);
3480         return ret_arr;
3481 }
3482
3483 static inline struct LDKCVec_SignatureZ C2Tuple_SignatureCVec_SignatureZZ_get_b(LDKC2Tuple_SignatureCVec_SignatureZZ *NONNULL_PTR owner){
3484         return owner->b;
3485 }
3486 ptrArray  __attribute__((export_name("TS_C2Tuple_SignatureCVec_SignatureZZ_get_b"))) TS_C2Tuple_SignatureCVec_SignatureZZ_get_b(uint64_t owner) {
3487         LDKC2Tuple_SignatureCVec_SignatureZZ* owner_conv = (LDKC2Tuple_SignatureCVec_SignatureZZ*)untag_ptr(owner);
3488         LDKCVec_SignatureZ ret_var = C2Tuple_SignatureCVec_SignatureZZ_get_b(owner_conv);
3489         ptrArray ret_arr = NULL;
3490         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
3491         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
3492         for (size_t m = 0; m < ret_var.datalen; m++) {
3493                 int8_tArray ret_conv_12_arr = init_int8_tArray(64, __LINE__);
3494                 memcpy(ret_conv_12_arr->elems, ret_var.data[m].compact_form, 64);
3495                 ret_arr_ptr[m] = ret_conv_12_arr;
3496         }
3497         
3498         return ret_arr;
3499 }
3500
3501 static inline struct LDKC2Tuple_SignatureCVec_SignatureZZ CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_ok(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *NONNULL_PTR owner){
3502 CHECK(owner->result_ok);
3503         return C2Tuple_SignatureCVec_SignatureZZ_clone(&*owner->contents.result);
3504 }
3505 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_ok"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_ok(uint64_t owner) {
3506         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* owner_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)untag_ptr(owner);
3507         LDKC2Tuple_SignatureCVec_SignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
3508         *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_ok(owner_conv);
3509         return tag_ptr(ret_conv, true);
3510 }
3511
3512 static inline void CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_err(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *NONNULL_PTR owner){
3513 CHECK(!owner->result_ok);
3514         return *owner->contents.err;
3515 }
3516 void  __attribute__((export_name("TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_err"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_err(uint64_t owner) {
3517         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* owner_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)untag_ptr(owner);
3518         CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_err(owner_conv);
3519 }
3520
3521 static inline struct LDKSignature CResult_SignatureNoneZ_get_ok(LDKCResult_SignatureNoneZ *NONNULL_PTR owner){
3522 CHECK(owner->result_ok);
3523         return *owner->contents.result;
3524 }
3525 int8_tArray  __attribute__((export_name("TS_CResult_SignatureNoneZ_get_ok"))) TS_CResult_SignatureNoneZ_get_ok(uint64_t owner) {
3526         LDKCResult_SignatureNoneZ* owner_conv = (LDKCResult_SignatureNoneZ*)untag_ptr(owner);
3527         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
3528         memcpy(ret_arr->elems, CResult_SignatureNoneZ_get_ok(owner_conv).compact_form, 64);
3529         return ret_arr;
3530 }
3531
3532 static inline void CResult_SignatureNoneZ_get_err(LDKCResult_SignatureNoneZ *NONNULL_PTR owner){
3533 CHECK(!owner->result_ok);
3534         return *owner->contents.err;
3535 }
3536 void  __attribute__((export_name("TS_CResult_SignatureNoneZ_get_err"))) TS_CResult_SignatureNoneZ_get_err(uint64_t owner) {
3537         LDKCResult_SignatureNoneZ* owner_conv = (LDKCResult_SignatureNoneZ*)untag_ptr(owner);
3538         CResult_SignatureNoneZ_get_err(owner_conv);
3539 }
3540
3541 static inline struct LDKSignature C2Tuple_SignatureSignatureZ_get_a(LDKC2Tuple_SignatureSignatureZ *NONNULL_PTR owner){
3542         return owner->a;
3543 }
3544 int8_tArray  __attribute__((export_name("TS_C2Tuple_SignatureSignatureZ_get_a"))) TS_C2Tuple_SignatureSignatureZ_get_a(uint64_t owner) {
3545         LDKC2Tuple_SignatureSignatureZ* owner_conv = (LDKC2Tuple_SignatureSignatureZ*)untag_ptr(owner);
3546         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
3547         memcpy(ret_arr->elems, C2Tuple_SignatureSignatureZ_get_a(owner_conv).compact_form, 64);
3548         return ret_arr;
3549 }
3550
3551 static inline struct LDKSignature C2Tuple_SignatureSignatureZ_get_b(LDKC2Tuple_SignatureSignatureZ *NONNULL_PTR owner){
3552         return owner->b;
3553 }
3554 int8_tArray  __attribute__((export_name("TS_C2Tuple_SignatureSignatureZ_get_b"))) TS_C2Tuple_SignatureSignatureZ_get_b(uint64_t owner) {
3555         LDKC2Tuple_SignatureSignatureZ* owner_conv = (LDKC2Tuple_SignatureSignatureZ*)untag_ptr(owner);
3556         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
3557         memcpy(ret_arr->elems, C2Tuple_SignatureSignatureZ_get_b(owner_conv).compact_form, 64);
3558         return ret_arr;
3559 }
3560
3561 static inline struct LDKC2Tuple_SignatureSignatureZ CResult_C2Tuple_SignatureSignatureZNoneZ_get_ok(LDKCResult_C2Tuple_SignatureSignatureZNoneZ *NONNULL_PTR owner){
3562 CHECK(owner->result_ok);
3563         return C2Tuple_SignatureSignatureZ_clone(&*owner->contents.result);
3564 }
3565 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_SignatureSignatureZNoneZ_get_ok"))) TS_CResult_C2Tuple_SignatureSignatureZNoneZ_get_ok(uint64_t owner) {
3566         LDKCResult_C2Tuple_SignatureSignatureZNoneZ* owner_conv = (LDKCResult_C2Tuple_SignatureSignatureZNoneZ*)untag_ptr(owner);
3567         LDKC2Tuple_SignatureSignatureZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureSignatureZ), "LDKC2Tuple_SignatureSignatureZ");
3568         *ret_conv = CResult_C2Tuple_SignatureSignatureZNoneZ_get_ok(owner_conv);
3569         return tag_ptr(ret_conv, true);
3570 }
3571
3572 static inline void CResult_C2Tuple_SignatureSignatureZNoneZ_get_err(LDKCResult_C2Tuple_SignatureSignatureZNoneZ *NONNULL_PTR owner){
3573 CHECK(!owner->result_ok);
3574         return *owner->contents.err;
3575 }
3576 void  __attribute__((export_name("TS_CResult_C2Tuple_SignatureSignatureZNoneZ_get_err"))) TS_CResult_C2Tuple_SignatureSignatureZNoneZ_get_err(uint64_t owner) {
3577         LDKCResult_C2Tuple_SignatureSignatureZNoneZ* owner_conv = (LDKCResult_C2Tuple_SignatureSignatureZNoneZ*)untag_ptr(owner);
3578         CResult_C2Tuple_SignatureSignatureZNoneZ_get_err(owner_conv);
3579 }
3580
3581 static inline struct LDKSecretKey CResult_SecretKeyNoneZ_get_ok(LDKCResult_SecretKeyNoneZ *NONNULL_PTR owner){
3582 CHECK(owner->result_ok);
3583         return *owner->contents.result;
3584 }
3585 int8_tArray  __attribute__((export_name("TS_CResult_SecretKeyNoneZ_get_ok"))) TS_CResult_SecretKeyNoneZ_get_ok(uint64_t owner) {
3586         LDKCResult_SecretKeyNoneZ* owner_conv = (LDKCResult_SecretKeyNoneZ*)untag_ptr(owner);
3587         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
3588         memcpy(ret_arr->elems, CResult_SecretKeyNoneZ_get_ok(owner_conv).bytes, 32);
3589         return ret_arr;
3590 }
3591
3592 static inline void CResult_SecretKeyNoneZ_get_err(LDKCResult_SecretKeyNoneZ *NONNULL_PTR owner){
3593 CHECK(!owner->result_ok);
3594         return *owner->contents.err;
3595 }
3596 void  __attribute__((export_name("TS_CResult_SecretKeyNoneZ_get_err"))) TS_CResult_SecretKeyNoneZ_get_err(uint64_t owner) {
3597         LDKCResult_SecretKeyNoneZ* owner_conv = (LDKCResult_SecretKeyNoneZ*)untag_ptr(owner);
3598         CResult_SecretKeyNoneZ_get_err(owner_conv);
3599 }
3600
3601 typedef struct LDKBaseSign_JCalls {
3602         atomic_size_t refcnt;
3603         uint32_t instance_ptr;
3604 } LDKBaseSign_JCalls;
3605 static void LDKBaseSign_JCalls_free(void* this_arg) {
3606         LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
3607         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3608                 FREE(j_calls);
3609         }
3610 }
3611 LDKPublicKey get_per_commitment_point_LDKBaseSign_jcall(const void* this_arg, uint64_t idx) {
3612         LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
3613         int64_t idx_conv = idx;
3614         int8_tArray ret = (int8_tArray)js_invoke_function_buuuuu(j_calls->instance_ptr, 2, idx_conv, 0, 0, 0, 0, 0);
3615         LDKPublicKey ret_ref;
3616         CHECK(ret->arr_len == 33);
3617         memcpy(ret_ref.compressed_form, ret->elems, 33); FREE(ret);
3618         return ret_ref;
3619 }
3620 LDKThirtyTwoBytes release_commitment_secret_LDKBaseSign_jcall(const void* this_arg, uint64_t idx) {
3621         LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
3622         int64_t idx_conv = idx;
3623         int8_tArray ret = (int8_tArray)js_invoke_function_buuuuu(j_calls->instance_ptr, 3, idx_conv, 0, 0, 0, 0, 0);
3624         LDKThirtyTwoBytes ret_ref;
3625         CHECK(ret->arr_len == 32);
3626         memcpy(ret_ref.data, ret->elems, 32); FREE(ret);
3627         return ret_ref;
3628 }
3629 LDKCResult_NoneNoneZ validate_holder_commitment_LDKBaseSign_jcall(const void* this_arg, const LDKHolderCommitmentTransaction * holder_tx, LDKCVec_PaymentPreimageZ preimages) {
3630         LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
3631         LDKHolderCommitmentTransaction holder_tx_var = *holder_tx;
3632         uint64_t holder_tx_ref = 0;
3633         holder_tx_var = HolderCommitmentTransaction_clone(&holder_tx_var);
3634         CHECK_INNER_FIELD_ACCESS_OR_NULL(holder_tx_var);
3635         holder_tx_ref = tag_ptr(holder_tx_var.inner, holder_tx_var.is_owned);
3636         LDKCVec_PaymentPreimageZ preimages_var = preimages;
3637         ptrArray preimages_arr = NULL;
3638         preimages_arr = init_ptrArray(preimages_var.datalen, __LINE__);
3639         int8_tArray *preimages_arr_ptr = (int8_tArray*)(((uint8_t*)preimages_arr) + 8);
3640         for (size_t m = 0; m < preimages_var.datalen; m++) {
3641                 int8_tArray preimages_conv_12_arr = init_int8_tArray(32, __LINE__);
3642                 memcpy(preimages_conv_12_arr->elems, preimages_var.data[m].data, 32);
3643                 preimages_arr_ptr[m] = preimages_conv_12_arr;
3644         }
3645         
3646         FREE(preimages_var.data);
3647         uint32_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 4, holder_tx_ref, (uint32_t)preimages_arr, 0, 0, 0, 0);
3648         void* ret_ptr = untag_ptr(ret);
3649         CHECK_ACCESS(ret_ptr);
3650         LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
3651         FREE(untag_ptr(ret));
3652         return ret_conv;
3653 }
3654 LDKThirtyTwoBytes channel_keys_id_LDKBaseSign_jcall(const void* this_arg) {
3655         LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
3656         int8_tArray ret = (int8_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 5, 0, 0, 0, 0, 0, 0);
3657         LDKThirtyTwoBytes ret_ref;
3658         CHECK(ret->arr_len == 32);
3659         memcpy(ret_ref.data, ret->elems, 32); FREE(ret);
3660         return ret_ref;
3661 }
3662 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_counterparty_commitment_LDKBaseSign_jcall(const void* this_arg, const LDKCommitmentTransaction * commitment_tx, LDKCVec_PaymentPreimageZ preimages) {
3663         LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
3664         LDKCommitmentTransaction commitment_tx_var = *commitment_tx;
3665         uint64_t commitment_tx_ref = 0;
3666         commitment_tx_var = CommitmentTransaction_clone(&commitment_tx_var);
3667         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_var);
3668         commitment_tx_ref = tag_ptr(commitment_tx_var.inner, commitment_tx_var.is_owned);
3669         LDKCVec_PaymentPreimageZ preimages_var = preimages;
3670         ptrArray preimages_arr = NULL;
3671         preimages_arr = init_ptrArray(preimages_var.datalen, __LINE__);
3672         int8_tArray *preimages_arr_ptr = (int8_tArray*)(((uint8_t*)preimages_arr) + 8);
3673         for (size_t m = 0; m < preimages_var.datalen; m++) {
3674                 int8_tArray preimages_conv_12_arr = init_int8_tArray(32, __LINE__);
3675                 memcpy(preimages_conv_12_arr->elems, preimages_var.data[m].data, 32);
3676                 preimages_arr_ptr[m] = preimages_conv_12_arr;
3677         }
3678         
3679         FREE(preimages_var.data);
3680         uint32_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 6, commitment_tx_ref, (uint32_t)preimages_arr, 0, 0, 0, 0);
3681         void* ret_ptr = untag_ptr(ret);
3682         CHECK_ACCESS(ret_ptr);
3683         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ ret_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(ret_ptr);
3684         FREE(untag_ptr(ret));
3685         return ret_conv;
3686 }
3687 LDKCResult_NoneNoneZ validate_counterparty_revocation_LDKBaseSign_jcall(const void* this_arg, uint64_t idx, const uint8_t (* secret)[32]) {
3688         LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
3689         int64_t idx_conv = idx;
3690         int8_tArray secret_arr = init_int8_tArray(32, __LINE__);
3691         memcpy(secret_arr->elems, *secret, 32);
3692         uint32_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 7, idx_conv, (uint32_t)secret_arr, 0, 0, 0, 0);
3693         void* ret_ptr = untag_ptr(ret);
3694         CHECK_ACCESS(ret_ptr);
3695         LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
3696         FREE(untag_ptr(ret));
3697         return ret_conv;
3698 }
3699 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_holder_commitment_and_htlcs_LDKBaseSign_jcall(const void* this_arg, const LDKHolderCommitmentTransaction * commitment_tx) {
3700         LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
3701         LDKHolderCommitmentTransaction commitment_tx_var = *commitment_tx;
3702         uint64_t commitment_tx_ref = 0;
3703         commitment_tx_var = HolderCommitmentTransaction_clone(&commitment_tx_var);
3704         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_var);
3705         commitment_tx_ref = tag_ptr(commitment_tx_var.inner, commitment_tx_var.is_owned);
3706         uint32_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 8, commitment_tx_ref, 0, 0, 0, 0, 0);
3707         void* ret_ptr = untag_ptr(ret);
3708         CHECK_ACCESS(ret_ptr);
3709         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ ret_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(ret_ptr);
3710         FREE(untag_ptr(ret));
3711         return ret_conv;
3712 }
3713 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]) {
3714         LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
3715         LDKTransaction justice_tx_var = justice_tx;
3716         int8_tArray justice_tx_arr = init_int8_tArray(justice_tx_var.datalen, __LINE__);
3717         memcpy(justice_tx_arr->elems, justice_tx_var.data, justice_tx_var.datalen);
3718         Transaction_free(justice_tx_var);
3719         uint32_t input_conv = input;
3720         int64_t amount_conv = amount;
3721         int8_tArray per_commitment_key_arr = init_int8_tArray(32, __LINE__);
3722         memcpy(per_commitment_key_arr->elems, *per_commitment_key, 32);
3723         uint32_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);
3724         void* ret_ptr = untag_ptr(ret);
3725         CHECK_ACCESS(ret_ptr);
3726         LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr);
3727         FREE(untag_ptr(ret));
3728         return ret_conv;
3729 }
3730 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) {
3731         LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
3732         LDKTransaction justice_tx_var = justice_tx;
3733         int8_tArray justice_tx_arr = init_int8_tArray(justice_tx_var.datalen, __LINE__);
3734         memcpy(justice_tx_arr->elems, justice_tx_var.data, justice_tx_var.datalen);
3735         Transaction_free(justice_tx_var);
3736         uint32_t input_conv = input;
3737         int64_t amount_conv = amount;
3738         int8_tArray per_commitment_key_arr = init_int8_tArray(32, __LINE__);
3739         memcpy(per_commitment_key_arr->elems, *per_commitment_key, 32);
3740         LDKHTLCOutputInCommitment htlc_var = *htlc;
3741         uint64_t htlc_ref = 0;
3742         htlc_var = HTLCOutputInCommitment_clone(&htlc_var);
3743         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_var);
3744         htlc_ref = tag_ptr(htlc_var.inner, htlc_var.is_owned);
3745         uint32_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);
3746         void* ret_ptr = untag_ptr(ret);
3747         CHECK_ACCESS(ret_ptr);
3748         LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr);
3749         FREE(untag_ptr(ret));
3750         return ret_conv;
3751 }
3752 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) {
3753         LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
3754         LDKTransaction htlc_tx_var = htlc_tx;
3755         int8_tArray htlc_tx_arr = init_int8_tArray(htlc_tx_var.datalen, __LINE__);
3756         memcpy(htlc_tx_arr->elems, htlc_tx_var.data, htlc_tx_var.datalen);
3757         Transaction_free(htlc_tx_var);
3758         uint32_t input_conv = input;
3759         int64_t amount_conv = amount;
3760         int8_tArray per_commitment_point_arr = init_int8_tArray(33, __LINE__);
3761         memcpy(per_commitment_point_arr->elems, per_commitment_point.compressed_form, 33);
3762         LDKHTLCOutputInCommitment htlc_var = *htlc;
3763         uint64_t htlc_ref = 0;
3764         htlc_var = HTLCOutputInCommitment_clone(&htlc_var);
3765         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_var);
3766         htlc_ref = tag_ptr(htlc_var.inner, htlc_var.is_owned);
3767         uint32_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);
3768         void* ret_ptr = untag_ptr(ret);
3769         CHECK_ACCESS(ret_ptr);
3770         LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr);
3771         FREE(untag_ptr(ret));
3772         return ret_conv;
3773 }
3774 LDKCResult_SignatureNoneZ sign_closing_transaction_LDKBaseSign_jcall(const void* this_arg, const LDKClosingTransaction * closing_tx) {
3775         LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
3776         LDKClosingTransaction closing_tx_var = *closing_tx;
3777         uint64_t closing_tx_ref = 0;
3778         closing_tx_var = ClosingTransaction_clone(&closing_tx_var);
3779         CHECK_INNER_FIELD_ACCESS_OR_NULL(closing_tx_var);
3780         closing_tx_ref = tag_ptr(closing_tx_var.inner, closing_tx_var.is_owned);
3781         uint32_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 12, closing_tx_ref, 0, 0, 0, 0, 0);
3782         void* ret_ptr = untag_ptr(ret);
3783         CHECK_ACCESS(ret_ptr);
3784         LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr);
3785         FREE(untag_ptr(ret));
3786         return ret_conv;
3787 }
3788 LDKCResult_C2Tuple_SignatureSignatureZNoneZ sign_channel_announcement_LDKBaseSign_jcall(const void* this_arg, const LDKUnsignedChannelAnnouncement * msg) {
3789         LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
3790         LDKUnsignedChannelAnnouncement msg_var = *msg;
3791         uint64_t msg_ref = 0;
3792         msg_var = UnsignedChannelAnnouncement_clone(&msg_var);
3793         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3794         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
3795         uint32_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 13, msg_ref, 0, 0, 0, 0, 0);
3796         void* ret_ptr = untag_ptr(ret);
3797         CHECK_ACCESS(ret_ptr);
3798         LDKCResult_C2Tuple_SignatureSignatureZNoneZ ret_conv = *(LDKCResult_C2Tuple_SignatureSignatureZNoneZ*)(ret_ptr);
3799         FREE(untag_ptr(ret));
3800         return ret_conv;
3801 }
3802 void ready_channel_LDKBaseSign_jcall(void* this_arg, const LDKChannelTransactionParameters * channel_parameters) {
3803         LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
3804         LDKChannelTransactionParameters channel_parameters_var = *channel_parameters;
3805         uint64_t channel_parameters_ref = 0;
3806         channel_parameters_var = ChannelTransactionParameters_clone(&channel_parameters_var);
3807         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_var);
3808         channel_parameters_ref = tag_ptr(channel_parameters_var.inner, channel_parameters_var.is_owned);
3809         js_invoke_function_buuuuu(j_calls->instance_ptr, 14, channel_parameters_ref, 0, 0, 0, 0, 0);
3810 }
3811 static void LDKBaseSign_JCalls_cloned(LDKBaseSign* new_obj) {
3812         LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) new_obj->this_arg;
3813         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3814 }
3815 static inline LDKBaseSign LDKBaseSign_init (JSValue o, uint64_t pubkeys) {
3816         LDKBaseSign_JCalls *calls = MALLOC(sizeof(LDKBaseSign_JCalls), "LDKBaseSign_JCalls");
3817         atomic_init(&calls->refcnt, 1);
3818         calls->instance_ptr = o;
3819
3820         LDKChannelPublicKeys pubkeys_conv;
3821         pubkeys_conv.inner = untag_ptr(pubkeys);
3822         pubkeys_conv.is_owned = ptr_is_owned(pubkeys);
3823         CHECK_INNER_FIELD_ACCESS_OR_NULL(pubkeys_conv);
3824
3825         LDKBaseSign ret = {
3826                 .this_arg = (void*) calls,
3827                 .get_per_commitment_point = get_per_commitment_point_LDKBaseSign_jcall,
3828                 .release_commitment_secret = release_commitment_secret_LDKBaseSign_jcall,
3829                 .validate_holder_commitment = validate_holder_commitment_LDKBaseSign_jcall,
3830                 .channel_keys_id = channel_keys_id_LDKBaseSign_jcall,
3831                 .sign_counterparty_commitment = sign_counterparty_commitment_LDKBaseSign_jcall,
3832                 .validate_counterparty_revocation = validate_counterparty_revocation_LDKBaseSign_jcall,
3833                 .sign_holder_commitment_and_htlcs = sign_holder_commitment_and_htlcs_LDKBaseSign_jcall,
3834                 .sign_justice_revoked_output = sign_justice_revoked_output_LDKBaseSign_jcall,
3835                 .sign_justice_revoked_htlc = sign_justice_revoked_htlc_LDKBaseSign_jcall,
3836                 .sign_counterparty_htlc_transaction = sign_counterparty_htlc_transaction_LDKBaseSign_jcall,
3837                 .sign_closing_transaction = sign_closing_transaction_LDKBaseSign_jcall,
3838                 .sign_channel_announcement = sign_channel_announcement_LDKBaseSign_jcall,
3839                 .ready_channel = ready_channel_LDKBaseSign_jcall,
3840                 .free = LDKBaseSign_JCalls_free,
3841                 .pubkeys = pubkeys_conv,
3842                 .set_pubkeys = NULL,
3843         };
3844         return ret;
3845 }
3846 uint64_t  __attribute__((export_name("TS_LDKBaseSign_new"))) TS_LDKBaseSign_new(JSValue o, uint64_t pubkeys) {
3847         LDKBaseSign *res_ptr = MALLOC(sizeof(LDKBaseSign), "LDKBaseSign");
3848         *res_ptr = LDKBaseSign_init(o, pubkeys);
3849         return tag_ptr(res_ptr, true);
3850 }
3851 int8_tArray  __attribute__((export_name("TS_BaseSign_get_per_commitment_point"))) TS_BaseSign_get_per_commitment_point(uint64_t this_arg, int64_t idx) {
3852         void* this_arg_ptr = untag_ptr(this_arg);
3853         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
3854         LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
3855         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
3856         memcpy(ret_arr->elems, (this_arg_conv->get_per_commitment_point)(this_arg_conv->this_arg, idx).compressed_form, 33);
3857         return ret_arr;
3858 }
3859
3860 int8_tArray  __attribute__((export_name("TS_BaseSign_release_commitment_secret"))) TS_BaseSign_release_commitment_secret(uint64_t this_arg, int64_t idx) {
3861         void* this_arg_ptr = untag_ptr(this_arg);
3862         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
3863         LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
3864         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
3865         memcpy(ret_arr->elems, (this_arg_conv->release_commitment_secret)(this_arg_conv->this_arg, idx).data, 32);
3866         return ret_arr;
3867 }
3868
3869 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) {
3870         void* this_arg_ptr = untag_ptr(this_arg);
3871         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
3872         LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
3873         LDKHolderCommitmentTransaction holder_tx_conv;
3874         holder_tx_conv.inner = untag_ptr(holder_tx);
3875         holder_tx_conv.is_owned = ptr_is_owned(holder_tx);
3876         CHECK_INNER_FIELD_ACCESS_OR_NULL(holder_tx_conv);
3877         holder_tx_conv.is_owned = false;
3878         LDKCVec_PaymentPreimageZ preimages_constr;
3879         preimages_constr.datalen = preimages->arr_len;
3880         if (preimages_constr.datalen > 0)
3881                 preimages_constr.data = MALLOC(preimages_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_PaymentPreimageZ Elements");
3882         else
3883                 preimages_constr.data = NULL;
3884         int8_tArray* preimages_vals = (void*) preimages->elems;
3885         for (size_t m = 0; m < preimages_constr.datalen; m++) {
3886                 int8_tArray preimages_conv_12 = preimages_vals[m];
3887                 LDKThirtyTwoBytes preimages_conv_12_ref;
3888                 CHECK(preimages_conv_12->arr_len == 32);
3889                 memcpy(preimages_conv_12_ref.data, preimages_conv_12->elems, 32); FREE(preimages_conv_12);
3890                 preimages_constr.data[m] = preimages_conv_12_ref;
3891         }
3892         FREE(preimages);
3893         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
3894         *ret_conv = (this_arg_conv->validate_holder_commitment)(this_arg_conv->this_arg, &holder_tx_conv, preimages_constr);
3895         return tag_ptr(ret_conv, true);
3896 }
3897
3898 int8_tArray  __attribute__((export_name("TS_BaseSign_channel_keys_id"))) TS_BaseSign_channel_keys_id(uint64_t this_arg) {
3899         void* this_arg_ptr = untag_ptr(this_arg);
3900         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
3901         LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
3902         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
3903         memcpy(ret_arr->elems, (this_arg_conv->channel_keys_id)(this_arg_conv->this_arg).data, 32);
3904         return ret_arr;
3905 }
3906
3907 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) {
3908         void* this_arg_ptr = untag_ptr(this_arg);
3909         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
3910         LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
3911         LDKCommitmentTransaction commitment_tx_conv;
3912         commitment_tx_conv.inner = untag_ptr(commitment_tx);
3913         commitment_tx_conv.is_owned = ptr_is_owned(commitment_tx);
3914         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_conv);
3915         commitment_tx_conv.is_owned = false;
3916         LDKCVec_PaymentPreimageZ preimages_constr;
3917         preimages_constr.datalen = preimages->arr_len;
3918         if (preimages_constr.datalen > 0)
3919                 preimages_constr.data = MALLOC(preimages_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_PaymentPreimageZ Elements");
3920         else
3921                 preimages_constr.data = NULL;
3922         int8_tArray* preimages_vals = (void*) preimages->elems;
3923         for (size_t m = 0; m < preimages_constr.datalen; m++) {
3924                 int8_tArray preimages_conv_12 = preimages_vals[m];
3925                 LDKThirtyTwoBytes preimages_conv_12_ref;
3926                 CHECK(preimages_conv_12->arr_len == 32);
3927                 memcpy(preimages_conv_12_ref.data, preimages_conv_12->elems, 32); FREE(preimages_conv_12);
3928                 preimages_constr.data[m] = preimages_conv_12_ref;
3929         }
3930         FREE(preimages);
3931         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
3932         *ret_conv = (this_arg_conv->sign_counterparty_commitment)(this_arg_conv->this_arg, &commitment_tx_conv, preimages_constr);
3933         return tag_ptr(ret_conv, true);
3934 }
3935
3936 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) {
3937         void* this_arg_ptr = untag_ptr(this_arg);
3938         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
3939         LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
3940         unsigned char secret_arr[32];
3941         CHECK(secret->arr_len == 32);
3942         memcpy(secret_arr, secret->elems, 32); FREE(secret);
3943         unsigned char (*secret_ref)[32] = &secret_arr;
3944         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
3945         *ret_conv = (this_arg_conv->validate_counterparty_revocation)(this_arg_conv->this_arg, idx, secret_ref);
3946         return tag_ptr(ret_conv, true);
3947 }
3948
3949 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) {
3950         void* this_arg_ptr = untag_ptr(this_arg);
3951         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
3952         LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
3953         LDKHolderCommitmentTransaction commitment_tx_conv;
3954         commitment_tx_conv.inner = untag_ptr(commitment_tx);
3955         commitment_tx_conv.is_owned = ptr_is_owned(commitment_tx);
3956         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_conv);
3957         commitment_tx_conv.is_owned = false;
3958         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
3959         *ret_conv = (this_arg_conv->sign_holder_commitment_and_htlcs)(this_arg_conv->this_arg, &commitment_tx_conv);
3960         return tag_ptr(ret_conv, true);
3961 }
3962
3963 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) {
3964         void* this_arg_ptr = untag_ptr(this_arg);
3965         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
3966         LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
3967         LDKTransaction justice_tx_ref;
3968         justice_tx_ref.datalen = justice_tx->arr_len;
3969         justice_tx_ref.data = MALLOC(justice_tx_ref.datalen, "LDKTransaction Bytes");
3970         memcpy(justice_tx_ref.data, justice_tx->elems, justice_tx_ref.datalen); FREE(justice_tx);
3971         justice_tx_ref.data_is_owned = true;
3972         unsigned char per_commitment_key_arr[32];
3973         CHECK(per_commitment_key->arr_len == 32);
3974         memcpy(per_commitment_key_arr, per_commitment_key->elems, 32); FREE(per_commitment_key);
3975         unsigned char (*per_commitment_key_ref)[32] = &per_commitment_key_arr;
3976         LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
3977         *ret_conv = (this_arg_conv->sign_justice_revoked_output)(this_arg_conv->this_arg, justice_tx_ref, input, amount, per_commitment_key_ref);
3978         return tag_ptr(ret_conv, true);
3979 }
3980
3981 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) {
3982         void* this_arg_ptr = untag_ptr(this_arg);
3983         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
3984         LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
3985         LDKTransaction justice_tx_ref;
3986         justice_tx_ref.datalen = justice_tx->arr_len;
3987         justice_tx_ref.data = MALLOC(justice_tx_ref.datalen, "LDKTransaction Bytes");
3988         memcpy(justice_tx_ref.data, justice_tx->elems, justice_tx_ref.datalen); FREE(justice_tx);
3989         justice_tx_ref.data_is_owned = true;
3990         unsigned char per_commitment_key_arr[32];
3991         CHECK(per_commitment_key->arr_len == 32);
3992         memcpy(per_commitment_key_arr, per_commitment_key->elems, 32); FREE(per_commitment_key);
3993         unsigned char (*per_commitment_key_ref)[32] = &per_commitment_key_arr;
3994         LDKHTLCOutputInCommitment htlc_conv;
3995         htlc_conv.inner = untag_ptr(htlc);
3996         htlc_conv.is_owned = ptr_is_owned(htlc);
3997         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
3998         htlc_conv.is_owned = false;
3999         LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
4000         *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);
4001         return tag_ptr(ret_conv, true);
4002 }
4003
4004 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) {
4005         void* this_arg_ptr = untag_ptr(this_arg);
4006         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4007         LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
4008         LDKTransaction htlc_tx_ref;
4009         htlc_tx_ref.datalen = htlc_tx->arr_len;
4010         htlc_tx_ref.data = MALLOC(htlc_tx_ref.datalen, "LDKTransaction Bytes");
4011         memcpy(htlc_tx_ref.data, htlc_tx->elems, htlc_tx_ref.datalen); FREE(htlc_tx);
4012         htlc_tx_ref.data_is_owned = true;
4013         LDKPublicKey per_commitment_point_ref;
4014         CHECK(per_commitment_point->arr_len == 33);
4015         memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33); FREE(per_commitment_point);
4016         LDKHTLCOutputInCommitment htlc_conv;
4017         htlc_conv.inner = untag_ptr(htlc);
4018         htlc_conv.is_owned = ptr_is_owned(htlc);
4019         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
4020         htlc_conv.is_owned = false;
4021         LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
4022         *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);
4023         return tag_ptr(ret_conv, true);
4024 }
4025
4026 uint64_t  __attribute__((export_name("TS_BaseSign_sign_closing_transaction"))) TS_BaseSign_sign_closing_transaction(uint64_t this_arg, uint64_t closing_tx) {
4027         void* this_arg_ptr = untag_ptr(this_arg);
4028         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4029         LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
4030         LDKClosingTransaction closing_tx_conv;
4031         closing_tx_conv.inner = untag_ptr(closing_tx);
4032         closing_tx_conv.is_owned = ptr_is_owned(closing_tx);
4033         CHECK_INNER_FIELD_ACCESS_OR_NULL(closing_tx_conv);
4034         closing_tx_conv.is_owned = false;
4035         LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
4036         *ret_conv = (this_arg_conv->sign_closing_transaction)(this_arg_conv->this_arg, &closing_tx_conv);
4037         return tag_ptr(ret_conv, true);
4038 }
4039
4040 uint64_t  __attribute__((export_name("TS_BaseSign_sign_channel_announcement"))) TS_BaseSign_sign_channel_announcement(uint64_t this_arg, uint64_t msg) {
4041         void* this_arg_ptr = untag_ptr(this_arg);
4042         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4043         LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
4044         LDKUnsignedChannelAnnouncement msg_conv;
4045         msg_conv.inner = untag_ptr(msg);
4046         msg_conv.is_owned = ptr_is_owned(msg);
4047         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
4048         msg_conv.is_owned = false;
4049         LDKCResult_C2Tuple_SignatureSignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureSignatureZNoneZ), "LDKCResult_C2Tuple_SignatureSignatureZNoneZ");
4050         *ret_conv = (this_arg_conv->sign_channel_announcement)(this_arg_conv->this_arg, &msg_conv);
4051         return tag_ptr(ret_conv, true);
4052 }
4053
4054 void  __attribute__((export_name("TS_BaseSign_ready_channel"))) TS_BaseSign_ready_channel(uint64_t this_arg, uint64_t channel_parameters) {
4055         void* this_arg_ptr = untag_ptr(this_arg);
4056         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4057         LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
4058         LDKChannelTransactionParameters channel_parameters_conv;
4059         channel_parameters_conv.inner = untag_ptr(channel_parameters);
4060         channel_parameters_conv.is_owned = ptr_is_owned(channel_parameters);
4061         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_conv);
4062         channel_parameters_conv.is_owned = false;
4063         (this_arg_conv->ready_channel)(this_arg_conv->this_arg, &channel_parameters_conv);
4064 }
4065
4066 LDKChannelPublicKeys LDKBaseSign_set_get_pubkeys(LDKBaseSign* this_arg) {
4067         if (this_arg->set_pubkeys != NULL)
4068                 this_arg->set_pubkeys(this_arg);
4069         return this_arg->pubkeys;
4070 }
4071 uint64_t  __attribute__((export_name("TS_BaseSign_get_pubkeys"))) TS_BaseSign_get_pubkeys(uint64_t this_arg) {
4072         void* this_arg_ptr = untag_ptr(this_arg);
4073         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4074         LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
4075         LDKChannelPublicKeys ret_var = LDKBaseSign_set_get_pubkeys(this_arg_conv);
4076         uint64_t ret_ref = 0;
4077         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4078         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4079         return ret_ref;
4080 }
4081
4082 typedef struct LDKSign_JCalls {
4083         atomic_size_t refcnt;
4084         uint32_t instance_ptr;
4085         LDKBaseSign_JCalls* BaseSign;
4086 } LDKSign_JCalls;
4087 static void LDKSign_JCalls_free(void* this_arg) {
4088         LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg;
4089         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4090                 FREE(j_calls);
4091         }
4092 }
4093 LDKCVec_u8Z write_LDKSign_jcall(const void* this_arg) {
4094         LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg;
4095         int8_tArray ret = (int8_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 15, 0, 0, 0, 0, 0, 0);
4096         LDKCVec_u8Z ret_ref;
4097         ret_ref.datalen = ret->arr_len;
4098         ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
4099         memcpy(ret_ref.data, ret->elems, ret_ref.datalen); FREE(ret);
4100         return ret_ref;
4101 }
4102 static void LDKSign_JCalls_cloned(LDKSign* new_obj) {
4103         LDKSign_JCalls *j_calls = (LDKSign_JCalls*) new_obj->this_arg;
4104         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
4105         atomic_fetch_add_explicit(&j_calls->BaseSign->refcnt, 1, memory_order_release);
4106 }
4107 static inline LDKSign LDKSign_init (JSValue o, JSValue BaseSign, uint64_t pubkeys) {
4108         LDKSign_JCalls *calls = MALLOC(sizeof(LDKSign_JCalls), "LDKSign_JCalls");
4109         atomic_init(&calls->refcnt, 1);
4110         calls->instance_ptr = o;
4111
4112         LDKChannelPublicKeys pubkeys_conv;
4113         pubkeys_conv.inner = untag_ptr(pubkeys);
4114         pubkeys_conv.is_owned = ptr_is_owned(pubkeys);
4115         CHECK_INNER_FIELD_ACCESS_OR_NULL(pubkeys_conv);
4116
4117         LDKSign ret = {
4118                 .this_arg = (void*) calls,
4119                 .write = write_LDKSign_jcall,
4120                 .cloned = LDKSign_JCalls_cloned,
4121                 .free = LDKSign_JCalls_free,
4122                 .BaseSign = LDKBaseSign_init(BaseSign, pubkeys),
4123         };
4124         calls->BaseSign = ret.BaseSign.this_arg;
4125         return ret;
4126 }
4127 uint64_t  __attribute__((export_name("TS_LDKSign_new"))) TS_LDKSign_new(JSValue o, JSValue BaseSign, uint64_t pubkeys) {
4128         LDKSign *res_ptr = MALLOC(sizeof(LDKSign), "LDKSign");
4129         *res_ptr = LDKSign_init(o, BaseSign, pubkeys);
4130         return tag_ptr(res_ptr, true);
4131 }
4132 int8_tArray  __attribute__((export_name("TS_Sign_write"))) TS_Sign_write(uint64_t this_arg) {
4133         void* this_arg_ptr = untag_ptr(this_arg);
4134         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4135         LDKSign* this_arg_conv = (LDKSign*)this_arg_ptr;
4136         LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
4137         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
4138         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
4139         CVec_u8Z_free(ret_var);
4140         return ret_arr;
4141 }
4142
4143 static inline struct LDKSign CResult_SignDecodeErrorZ_get_ok(LDKCResult_SignDecodeErrorZ *NONNULL_PTR owner){
4144 CHECK(owner->result_ok);
4145         return Sign_clone(&*owner->contents.result);
4146 }
4147 uint64_t  __attribute__((export_name("TS_CResult_SignDecodeErrorZ_get_ok"))) TS_CResult_SignDecodeErrorZ_get_ok(uint64_t owner) {
4148         LDKCResult_SignDecodeErrorZ* owner_conv = (LDKCResult_SignDecodeErrorZ*)untag_ptr(owner);
4149         LDKSign* ret_ret = MALLOC(sizeof(LDKSign), "LDKSign");
4150         *ret_ret = CResult_SignDecodeErrorZ_get_ok(owner_conv);
4151         return tag_ptr(ret_ret, true);
4152 }
4153
4154 static inline struct LDKDecodeError CResult_SignDecodeErrorZ_get_err(LDKCResult_SignDecodeErrorZ *NONNULL_PTR owner){
4155         LDKDecodeError ret = *owner->contents.err;
4156         ret.is_owned = false;
4157         return ret;
4158 }
4159 uint64_t  __attribute__((export_name("TS_CResult_SignDecodeErrorZ_get_err"))) TS_CResult_SignDecodeErrorZ_get_err(uint64_t owner) {
4160         LDKCResult_SignDecodeErrorZ* owner_conv = (LDKCResult_SignDecodeErrorZ*)untag_ptr(owner);
4161         LDKDecodeError ret_var = CResult_SignDecodeErrorZ_get_err(owner_conv);
4162         uint64_t ret_ref = 0;
4163         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4164         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4165         return ret_ref;
4166 }
4167
4168 static inline struct LDKRecoverableSignature CResult_RecoverableSignatureNoneZ_get_ok(LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR owner){
4169 CHECK(owner->result_ok);
4170         return *owner->contents.result;
4171 }
4172 int8_tArray  __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_get_ok"))) TS_CResult_RecoverableSignatureNoneZ_get_ok(uint64_t owner) {
4173         LDKCResult_RecoverableSignatureNoneZ* owner_conv = (LDKCResult_RecoverableSignatureNoneZ*)untag_ptr(owner);
4174         int8_tArray ret_arr = init_int8_tArray(68, __LINE__);
4175         memcpy(ret_arr->elems, CResult_RecoverableSignatureNoneZ_get_ok(owner_conv).serialized_form, 68);
4176         return ret_arr;
4177 }
4178
4179 static inline void CResult_RecoverableSignatureNoneZ_get_err(LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR owner){
4180 CHECK(!owner->result_ok);
4181         return *owner->contents.err;
4182 }
4183 void  __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_get_err"))) TS_CResult_RecoverableSignatureNoneZ_get_err(uint64_t owner) {
4184         LDKCResult_RecoverableSignatureNoneZ* owner_conv = (LDKCResult_RecoverableSignatureNoneZ*)untag_ptr(owner);
4185         CResult_RecoverableSignatureNoneZ_get_err(owner_conv);
4186 }
4187
4188 static inline LDKCVec_CVec_u8ZZ CVec_CVec_u8ZZ_clone(const LDKCVec_CVec_u8ZZ *orig) {
4189         LDKCVec_CVec_u8ZZ ret = { .data = MALLOC(sizeof(LDKCVec_u8Z) * orig->datalen, "LDKCVec_CVec_u8ZZ clone bytes"), .datalen = orig->datalen };
4190         for (size_t i = 0; i < ret.datalen; i++) {
4191                 ret.data[i] = CVec_u8Z_clone(&orig->data[i]);
4192         }
4193         return ret;
4194 }
4195 static inline struct LDKCVec_CVec_u8ZZ CResult_CVec_CVec_u8ZZNoneZ_get_ok(LDKCResult_CVec_CVec_u8ZZNoneZ *NONNULL_PTR owner){
4196 CHECK(owner->result_ok);
4197         return CVec_CVec_u8ZZ_clone(&*owner->contents.result);
4198 }
4199 ptrArray  __attribute__((export_name("TS_CResult_CVec_CVec_u8ZZNoneZ_get_ok"))) TS_CResult_CVec_CVec_u8ZZNoneZ_get_ok(uint64_t owner) {
4200         LDKCResult_CVec_CVec_u8ZZNoneZ* owner_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)untag_ptr(owner);
4201         LDKCVec_CVec_u8ZZ ret_var = CResult_CVec_CVec_u8ZZNoneZ_get_ok(owner_conv);
4202         ptrArray ret_arr = NULL;
4203         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
4204         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
4205         for (size_t m = 0; m < ret_var.datalen; m++) {
4206                 LDKCVec_u8Z ret_conv_12_var = ret_var.data[m];
4207                 int8_tArray ret_conv_12_arr = init_int8_tArray(ret_conv_12_var.datalen, __LINE__);
4208                 memcpy(ret_conv_12_arr->elems, ret_conv_12_var.data, ret_conv_12_var.datalen);
4209                 CVec_u8Z_free(ret_conv_12_var);
4210                 ret_arr_ptr[m] = ret_conv_12_arr;
4211         }
4212         
4213         FREE(ret_var.data);
4214         return ret_arr;
4215 }
4216
4217 static inline void CResult_CVec_CVec_u8ZZNoneZ_get_err(LDKCResult_CVec_CVec_u8ZZNoneZ *NONNULL_PTR owner){
4218 CHECK(!owner->result_ok);
4219         return *owner->contents.err;
4220 }
4221 void  __attribute__((export_name("TS_CResult_CVec_CVec_u8ZZNoneZ_get_err"))) TS_CResult_CVec_CVec_u8ZZNoneZ_get_err(uint64_t owner) {
4222         LDKCResult_CVec_CVec_u8ZZNoneZ* owner_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)untag_ptr(owner);
4223         CResult_CVec_CVec_u8ZZNoneZ_get_err(owner_conv);
4224 }
4225
4226 static inline struct LDKInMemorySigner CResult_InMemorySignerDecodeErrorZ_get_ok(LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR owner){
4227         LDKInMemorySigner ret = *owner->contents.result;
4228         ret.is_owned = false;
4229         return ret;
4230 }
4231 uint64_t  __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_get_ok"))) TS_CResult_InMemorySignerDecodeErrorZ_get_ok(uint64_t owner) {
4232         LDKCResult_InMemorySignerDecodeErrorZ* owner_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)untag_ptr(owner);
4233         LDKInMemorySigner ret_var = CResult_InMemorySignerDecodeErrorZ_get_ok(owner_conv);
4234         uint64_t ret_ref = 0;
4235         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4236         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4237         return ret_ref;
4238 }
4239
4240 static inline struct LDKDecodeError CResult_InMemorySignerDecodeErrorZ_get_err(LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR owner){
4241         LDKDecodeError ret = *owner->contents.err;
4242         ret.is_owned = false;
4243         return ret;
4244 }
4245 uint64_t  __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_get_err"))) TS_CResult_InMemorySignerDecodeErrorZ_get_err(uint64_t owner) {
4246         LDKCResult_InMemorySignerDecodeErrorZ* owner_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)untag_ptr(owner);
4247         LDKDecodeError ret_var = CResult_InMemorySignerDecodeErrorZ_get_err(owner_conv);
4248         uint64_t ret_ref = 0;
4249         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4250         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4251         return ret_ref;
4252 }
4253
4254 static inline LDKCVec_TxOutZ CVec_TxOutZ_clone(const LDKCVec_TxOutZ *orig) {
4255         LDKCVec_TxOutZ ret = { .data = MALLOC(sizeof(LDKTxOut) * orig->datalen, "LDKCVec_TxOutZ clone bytes"), .datalen = orig->datalen };
4256         for (size_t i = 0; i < ret.datalen; i++) {
4257                 ret.data[i] = TxOut_clone(&orig->data[i]);
4258         }
4259         return ret;
4260 }
4261 static inline struct LDKTransaction CResult_TransactionNoneZ_get_ok(LDKCResult_TransactionNoneZ *NONNULL_PTR owner){
4262 CHECK(owner->result_ok);
4263         return *owner->contents.result;
4264 }
4265 int8_tArray  __attribute__((export_name("TS_CResult_TransactionNoneZ_get_ok"))) TS_CResult_TransactionNoneZ_get_ok(uint64_t owner) {
4266         LDKCResult_TransactionNoneZ* owner_conv = (LDKCResult_TransactionNoneZ*)untag_ptr(owner);
4267         LDKTransaction ret_var = CResult_TransactionNoneZ_get_ok(owner_conv);
4268         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
4269         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
4270         return ret_arr;
4271 }
4272
4273 static inline void CResult_TransactionNoneZ_get_err(LDKCResult_TransactionNoneZ *NONNULL_PTR owner){
4274 CHECK(!owner->result_ok);
4275         return *owner->contents.err;
4276 }
4277 void  __attribute__((export_name("TS_CResult_TransactionNoneZ_get_err"))) TS_CResult_TransactionNoneZ_get_err(uint64_t owner) {
4278         LDKCResult_TransactionNoneZ* owner_conv = (LDKCResult_TransactionNoneZ*)untag_ptr(owner);
4279         CResult_TransactionNoneZ_get_err(owner_conv);
4280 }
4281
4282 uint32_t __attribute__((export_name("TS_LDKCOption_u16Z_ty_from_ptr"))) TS_LDKCOption_u16Z_ty_from_ptr(uint64_t ptr) {
4283         LDKCOption_u16Z *obj = (LDKCOption_u16Z*)untag_ptr(ptr);
4284         switch(obj->tag) {
4285                 case LDKCOption_u16Z_Some: return 0;
4286                 case LDKCOption_u16Z_None: return 1;
4287                 default: abort();
4288         }
4289 }
4290 int16_t __attribute__((export_name("TS_LDKCOption_u16Z_Some_get_some"))) TS_LDKCOption_u16Z_Some_get_some(uint64_t ptr) {
4291         LDKCOption_u16Z *obj = (LDKCOption_u16Z*)untag_ptr(ptr);
4292         assert(obj->tag == LDKCOption_u16Z_Some);
4293                         int16_t some_conv = obj->some;
4294         return some_conv;
4295 }
4296 uint32_t __attribute__((export_name("TS_LDKAPIError_ty_from_ptr"))) TS_LDKAPIError_ty_from_ptr(uint64_t ptr) {
4297         LDKAPIError *obj = (LDKAPIError*)untag_ptr(ptr);
4298         switch(obj->tag) {
4299                 case LDKAPIError_APIMisuseError: return 0;
4300                 case LDKAPIError_FeeRateTooHigh: return 1;
4301                 case LDKAPIError_RouteError: return 2;
4302                 case LDKAPIError_ChannelUnavailable: return 3;
4303                 case LDKAPIError_MonitorUpdateFailed: return 4;
4304                 case LDKAPIError_IncompatibleShutdownScript: return 5;
4305                 default: abort();
4306         }
4307 }
4308 jstring __attribute__((export_name("TS_LDKAPIError_APIMisuseError_get_err"))) TS_LDKAPIError_APIMisuseError_get_err(uint64_t ptr) {
4309         LDKAPIError *obj = (LDKAPIError*)untag_ptr(ptr);
4310         assert(obj->tag == LDKAPIError_APIMisuseError);
4311                         LDKStr err_str = obj->api_misuse_error.err;
4312                         jstring err_conv = str_ref_to_ts(err_str.chars, err_str.len);
4313         return err_conv;
4314 }
4315 jstring __attribute__((export_name("TS_LDKAPIError_FeeRateTooHigh_get_err"))) TS_LDKAPIError_FeeRateTooHigh_get_err(uint64_t ptr) {
4316         LDKAPIError *obj = (LDKAPIError*)untag_ptr(ptr);
4317         assert(obj->tag == LDKAPIError_FeeRateTooHigh);
4318                         LDKStr err_str = obj->fee_rate_too_high.err;
4319                         jstring err_conv = str_ref_to_ts(err_str.chars, err_str.len);
4320         return err_conv;
4321 }
4322 int32_t __attribute__((export_name("TS_LDKAPIError_FeeRateTooHigh_get_feerate"))) TS_LDKAPIError_FeeRateTooHigh_get_feerate(uint64_t ptr) {
4323         LDKAPIError *obj = (LDKAPIError*)untag_ptr(ptr);
4324         assert(obj->tag == LDKAPIError_FeeRateTooHigh);
4325                         int32_t feerate_conv = obj->fee_rate_too_high.feerate;
4326         return feerate_conv;
4327 }
4328 jstring __attribute__((export_name("TS_LDKAPIError_RouteError_get_err"))) TS_LDKAPIError_RouteError_get_err(uint64_t ptr) {
4329         LDKAPIError *obj = (LDKAPIError*)untag_ptr(ptr);
4330         assert(obj->tag == LDKAPIError_RouteError);
4331                         LDKStr err_str = obj->route_error.err;
4332                         jstring err_conv = str_ref_to_ts(err_str.chars, err_str.len);
4333         return err_conv;
4334 }
4335 jstring __attribute__((export_name("TS_LDKAPIError_ChannelUnavailable_get_err"))) TS_LDKAPIError_ChannelUnavailable_get_err(uint64_t ptr) {
4336         LDKAPIError *obj = (LDKAPIError*)untag_ptr(ptr);
4337         assert(obj->tag == LDKAPIError_ChannelUnavailable);
4338                         LDKStr err_str = obj->channel_unavailable.err;
4339                         jstring err_conv = str_ref_to_ts(err_str.chars, err_str.len);
4340         return err_conv;
4341 }
4342 uint64_t __attribute__((export_name("TS_LDKAPIError_IncompatibleShutdownScript_get_script"))) TS_LDKAPIError_IncompatibleShutdownScript_get_script(uint64_t ptr) {
4343         LDKAPIError *obj = (LDKAPIError*)untag_ptr(ptr);
4344         assert(obj->tag == LDKAPIError_IncompatibleShutdownScript);
4345                         LDKShutdownScript script_var = obj->incompatible_shutdown_script.script;
4346                         uint64_t script_ref = 0;
4347                         CHECK_INNER_FIELD_ACCESS_OR_NULL(script_var);
4348                         script_ref = tag_ptr(script_var.inner, false);
4349         return script_ref;
4350 }
4351 static inline void CResult_NoneAPIErrorZ_get_ok(LDKCResult_NoneAPIErrorZ *NONNULL_PTR owner){
4352 CHECK(owner->result_ok);
4353         return *owner->contents.result;
4354 }
4355 void  __attribute__((export_name("TS_CResult_NoneAPIErrorZ_get_ok"))) TS_CResult_NoneAPIErrorZ_get_ok(uint64_t owner) {
4356         LDKCResult_NoneAPIErrorZ* owner_conv = (LDKCResult_NoneAPIErrorZ*)untag_ptr(owner);
4357         CResult_NoneAPIErrorZ_get_ok(owner_conv);
4358 }
4359
4360 static inline struct LDKAPIError CResult_NoneAPIErrorZ_get_err(LDKCResult_NoneAPIErrorZ *NONNULL_PTR owner){
4361 CHECK(!owner->result_ok);
4362         return APIError_clone(&*owner->contents.err);
4363 }
4364 uint64_t  __attribute__((export_name("TS_CResult_NoneAPIErrorZ_get_err"))) TS_CResult_NoneAPIErrorZ_get_err(uint64_t owner) {
4365         LDKCResult_NoneAPIErrorZ* owner_conv = (LDKCResult_NoneAPIErrorZ*)untag_ptr(owner);
4366         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
4367         *ret_copy = CResult_NoneAPIErrorZ_get_err(owner_conv);
4368         uint64_t ret_ref = tag_ptr(ret_copy, true);
4369         return ret_ref;
4370 }
4371
4372 static inline LDKCVec_CResult_NoneAPIErrorZZ CVec_CResult_NoneAPIErrorZZ_clone(const LDKCVec_CResult_NoneAPIErrorZZ *orig) {
4373         LDKCVec_CResult_NoneAPIErrorZZ ret = { .data = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ) * orig->datalen, "LDKCVec_CResult_NoneAPIErrorZZ clone bytes"), .datalen = orig->datalen };
4374         for (size_t i = 0; i < ret.datalen; i++) {
4375                 ret.data[i] = CResult_NoneAPIErrorZ_clone(&orig->data[i]);
4376         }
4377         return ret;
4378 }
4379 static inline LDKCVec_APIErrorZ CVec_APIErrorZ_clone(const LDKCVec_APIErrorZ *orig) {
4380         LDKCVec_APIErrorZ ret = { .data = MALLOC(sizeof(LDKAPIError) * orig->datalen, "LDKCVec_APIErrorZ clone bytes"), .datalen = orig->datalen };
4381         for (size_t i = 0; i < ret.datalen; i++) {
4382                 ret.data[i] = APIError_clone(&orig->data[i]);
4383         }
4384         return ret;
4385 }
4386 static inline struct LDKThirtyTwoBytes CResult__u832APIErrorZ_get_ok(LDKCResult__u832APIErrorZ *NONNULL_PTR owner){
4387 CHECK(owner->result_ok);
4388         return ThirtyTwoBytes_clone(&*owner->contents.result);
4389 }
4390 int8_tArray  __attribute__((export_name("TS_CResult__u832APIErrorZ_get_ok"))) TS_CResult__u832APIErrorZ_get_ok(uint64_t owner) {
4391         LDKCResult__u832APIErrorZ* owner_conv = (LDKCResult__u832APIErrorZ*)untag_ptr(owner);
4392         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
4393         memcpy(ret_arr->elems, CResult__u832APIErrorZ_get_ok(owner_conv).data, 32);
4394         return ret_arr;
4395 }
4396
4397 static inline struct LDKAPIError CResult__u832APIErrorZ_get_err(LDKCResult__u832APIErrorZ *NONNULL_PTR owner){
4398 CHECK(!owner->result_ok);
4399         return APIError_clone(&*owner->contents.err);
4400 }
4401 uint64_t  __attribute__((export_name("TS_CResult__u832APIErrorZ_get_err"))) TS_CResult__u832APIErrorZ_get_err(uint64_t owner) {
4402         LDKCResult__u832APIErrorZ* owner_conv = (LDKCResult__u832APIErrorZ*)untag_ptr(owner);
4403         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
4404         *ret_copy = CResult__u832APIErrorZ_get_err(owner_conv);
4405         uint64_t ret_ref = tag_ptr(ret_copy, true);
4406         return ret_ref;
4407 }
4408
4409 uint32_t __attribute__((export_name("TS_LDKPaymentSendFailure_ty_from_ptr"))) TS_LDKPaymentSendFailure_ty_from_ptr(uint64_t ptr) {
4410         LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)untag_ptr(ptr);
4411         switch(obj->tag) {
4412                 case LDKPaymentSendFailure_ParameterError: return 0;
4413                 case LDKPaymentSendFailure_PathParameterError: return 1;
4414                 case LDKPaymentSendFailure_AllFailedRetrySafe: return 2;
4415                 case LDKPaymentSendFailure_PartialFailure: return 3;
4416                 default: abort();
4417         }
4418 }
4419 uint64_t __attribute__((export_name("TS_LDKPaymentSendFailure_ParameterError_get_parameter_error"))) TS_LDKPaymentSendFailure_ParameterError_get_parameter_error(uint64_t ptr) {
4420         LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)untag_ptr(ptr);
4421         assert(obj->tag == LDKPaymentSendFailure_ParameterError);
4422                         uint64_t parameter_error_ref = tag_ptr(&obj->parameter_error, false);
4423         return parameter_error_ref;
4424 }
4425 uint64_tArray __attribute__((export_name("TS_LDKPaymentSendFailure_PathParameterError_get_path_parameter_error"))) TS_LDKPaymentSendFailure_PathParameterError_get_path_parameter_error(uint64_t ptr) {
4426         LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)untag_ptr(ptr);
4427         assert(obj->tag == LDKPaymentSendFailure_PathParameterError);
4428                         LDKCVec_CResult_NoneAPIErrorZZ path_parameter_error_var = obj->path_parameter_error;
4429                         uint64_tArray path_parameter_error_arr = NULL;
4430                         path_parameter_error_arr = init_uint64_tArray(path_parameter_error_var.datalen, __LINE__);
4431                         uint64_t *path_parameter_error_arr_ptr = (uint64_t*)(((uint8_t*)path_parameter_error_arr) + 8);
4432                         for (size_t w = 0; w < path_parameter_error_var.datalen; w++) {
4433                                 LDKCResult_NoneAPIErrorZ* path_parameter_error_conv_22_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
4434                                 *path_parameter_error_conv_22_conv = path_parameter_error_var.data[w];
4435                                 *path_parameter_error_conv_22_conv = CResult_NoneAPIErrorZ_clone(path_parameter_error_conv_22_conv);
4436                                 path_parameter_error_arr_ptr[w] = tag_ptr(path_parameter_error_conv_22_conv, true);
4437                         }
4438                         
4439         return path_parameter_error_arr;
4440 }
4441 uint64_tArray __attribute__((export_name("TS_LDKPaymentSendFailure_AllFailedRetrySafe_get_all_failed_retry_safe"))) TS_LDKPaymentSendFailure_AllFailedRetrySafe_get_all_failed_retry_safe(uint64_t ptr) {
4442         LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)untag_ptr(ptr);
4443         assert(obj->tag == LDKPaymentSendFailure_AllFailedRetrySafe);
4444                         LDKCVec_APIErrorZ all_failed_retry_safe_var = obj->all_failed_retry_safe;
4445                         uint64_tArray all_failed_retry_safe_arr = NULL;
4446                         all_failed_retry_safe_arr = init_uint64_tArray(all_failed_retry_safe_var.datalen, __LINE__);
4447                         uint64_t *all_failed_retry_safe_arr_ptr = (uint64_t*)(((uint8_t*)all_failed_retry_safe_arr) + 8);
4448                         for (size_t k = 0; k < all_failed_retry_safe_var.datalen; k++) {
4449                                 uint64_t all_failed_retry_safe_conv_10_ref = tag_ptr(&all_failed_retry_safe_var.data[k], false);
4450                                 all_failed_retry_safe_arr_ptr[k] = all_failed_retry_safe_conv_10_ref;
4451                         }
4452                         
4453         return all_failed_retry_safe_arr;
4454 }
4455 uint64_tArray __attribute__((export_name("TS_LDKPaymentSendFailure_PartialFailure_get_results"))) TS_LDKPaymentSendFailure_PartialFailure_get_results(uint64_t ptr) {
4456         LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)untag_ptr(ptr);
4457         assert(obj->tag == LDKPaymentSendFailure_PartialFailure);
4458                         LDKCVec_CResult_NoneAPIErrorZZ results_var = obj->partial_failure.results;
4459                         uint64_tArray results_arr = NULL;
4460                         results_arr = init_uint64_tArray(results_var.datalen, __LINE__);
4461                         uint64_t *results_arr_ptr = (uint64_t*)(((uint8_t*)results_arr) + 8);
4462                         for (size_t w = 0; w < results_var.datalen; w++) {
4463                                 LDKCResult_NoneAPIErrorZ* results_conv_22_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
4464                                 *results_conv_22_conv = results_var.data[w];
4465                                 *results_conv_22_conv = CResult_NoneAPIErrorZ_clone(results_conv_22_conv);
4466                                 results_arr_ptr[w] = tag_ptr(results_conv_22_conv, true);
4467                         }
4468                         
4469         return results_arr;
4470 }
4471 uint64_t __attribute__((export_name("TS_LDKPaymentSendFailure_PartialFailure_get_failed_paths_retry"))) TS_LDKPaymentSendFailure_PartialFailure_get_failed_paths_retry(uint64_t ptr) {
4472         LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)untag_ptr(ptr);
4473         assert(obj->tag == LDKPaymentSendFailure_PartialFailure);
4474                         LDKRouteParameters failed_paths_retry_var = obj->partial_failure.failed_paths_retry;
4475                         uint64_t failed_paths_retry_ref = 0;
4476                         CHECK_INNER_FIELD_ACCESS_OR_NULL(failed_paths_retry_var);
4477                         failed_paths_retry_ref = tag_ptr(failed_paths_retry_var.inner, false);
4478         return failed_paths_retry_ref;
4479 }
4480 int8_tArray __attribute__((export_name("TS_LDKPaymentSendFailure_PartialFailure_get_payment_id"))) TS_LDKPaymentSendFailure_PartialFailure_get_payment_id(uint64_t ptr) {
4481         LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)untag_ptr(ptr);
4482         assert(obj->tag == LDKPaymentSendFailure_PartialFailure);
4483                         int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
4484                         memcpy(payment_id_arr->elems, obj->partial_failure.payment_id.data, 32);
4485         return payment_id_arr;
4486 }
4487 static inline struct LDKThirtyTwoBytes CResult_PaymentIdPaymentSendFailureZ_get_ok(LDKCResult_PaymentIdPaymentSendFailureZ *NONNULL_PTR owner){
4488 CHECK(owner->result_ok);
4489         return ThirtyTwoBytes_clone(&*owner->contents.result);
4490 }
4491 int8_tArray  __attribute__((export_name("TS_CResult_PaymentIdPaymentSendFailureZ_get_ok"))) TS_CResult_PaymentIdPaymentSendFailureZ_get_ok(uint64_t owner) {
4492         LDKCResult_PaymentIdPaymentSendFailureZ* owner_conv = (LDKCResult_PaymentIdPaymentSendFailureZ*)untag_ptr(owner);
4493         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
4494         memcpy(ret_arr->elems, CResult_PaymentIdPaymentSendFailureZ_get_ok(owner_conv).data, 32);
4495         return ret_arr;
4496 }
4497
4498 static inline struct LDKPaymentSendFailure CResult_PaymentIdPaymentSendFailureZ_get_err(LDKCResult_PaymentIdPaymentSendFailureZ *NONNULL_PTR owner){
4499 CHECK(!owner->result_ok);
4500         return PaymentSendFailure_clone(&*owner->contents.err);
4501 }
4502 uint64_t  __attribute__((export_name("TS_CResult_PaymentIdPaymentSendFailureZ_get_err"))) TS_CResult_PaymentIdPaymentSendFailureZ_get_err(uint64_t owner) {
4503         LDKCResult_PaymentIdPaymentSendFailureZ* owner_conv = (LDKCResult_PaymentIdPaymentSendFailureZ*)untag_ptr(owner);
4504         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
4505         *ret_copy = CResult_PaymentIdPaymentSendFailureZ_get_err(owner_conv);
4506         uint64_t ret_ref = tag_ptr(ret_copy, true);
4507         return ret_ref;
4508 }
4509
4510 static inline void CResult_NonePaymentSendFailureZ_get_ok(LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR owner){
4511 CHECK(owner->result_ok);
4512         return *owner->contents.result;
4513 }
4514 void  __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_get_ok"))) TS_CResult_NonePaymentSendFailureZ_get_ok(uint64_t owner) {
4515         LDKCResult_NonePaymentSendFailureZ* owner_conv = (LDKCResult_NonePaymentSendFailureZ*)untag_ptr(owner);
4516         CResult_NonePaymentSendFailureZ_get_ok(owner_conv);
4517 }
4518
4519 static inline struct LDKPaymentSendFailure CResult_NonePaymentSendFailureZ_get_err(LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR owner){
4520 CHECK(!owner->result_ok);
4521         return PaymentSendFailure_clone(&*owner->contents.err);
4522 }
4523 uint64_t  __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_get_err"))) TS_CResult_NonePaymentSendFailureZ_get_err(uint64_t owner) {
4524         LDKCResult_NonePaymentSendFailureZ* owner_conv = (LDKCResult_NonePaymentSendFailureZ*)untag_ptr(owner);
4525         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
4526         *ret_copy = CResult_NonePaymentSendFailureZ_get_err(owner_conv);
4527         uint64_t ret_ref = tag_ptr(ret_copy, true);
4528         return ret_ref;
4529 }
4530
4531 static inline struct LDKThirtyTwoBytes C2Tuple_PaymentHashPaymentIdZ_get_a(LDKC2Tuple_PaymentHashPaymentIdZ *NONNULL_PTR owner){
4532         return ThirtyTwoBytes_clone(&owner->a);
4533 }
4534 int8_tArray  __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentIdZ_get_a"))) TS_C2Tuple_PaymentHashPaymentIdZ_get_a(uint64_t owner) {
4535         LDKC2Tuple_PaymentHashPaymentIdZ* owner_conv = (LDKC2Tuple_PaymentHashPaymentIdZ*)untag_ptr(owner);
4536         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
4537         memcpy(ret_arr->elems, C2Tuple_PaymentHashPaymentIdZ_get_a(owner_conv).data, 32);
4538         return ret_arr;
4539 }
4540
4541 static inline struct LDKThirtyTwoBytes C2Tuple_PaymentHashPaymentIdZ_get_b(LDKC2Tuple_PaymentHashPaymentIdZ *NONNULL_PTR owner){
4542         return ThirtyTwoBytes_clone(&owner->b);
4543 }
4544 int8_tArray  __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentIdZ_get_b"))) TS_C2Tuple_PaymentHashPaymentIdZ_get_b(uint64_t owner) {
4545         LDKC2Tuple_PaymentHashPaymentIdZ* owner_conv = (LDKC2Tuple_PaymentHashPaymentIdZ*)untag_ptr(owner);
4546         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
4547         memcpy(ret_arr->elems, C2Tuple_PaymentHashPaymentIdZ_get_b(owner_conv).data, 32);
4548         return ret_arr;
4549 }
4550
4551 static inline struct LDKC2Tuple_PaymentHashPaymentIdZ CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_ok(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ *NONNULL_PTR owner){
4552 CHECK(owner->result_ok);
4553         return C2Tuple_PaymentHashPaymentIdZ_clone(&*owner->contents.result);
4554 }
4555 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_ok"))) TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_ok(uint64_t owner) {
4556         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* owner_conv = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)untag_ptr(owner);
4557         LDKC2Tuple_PaymentHashPaymentIdZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentIdZ), "LDKC2Tuple_PaymentHashPaymentIdZ");
4558         *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_ok(owner_conv);
4559         return tag_ptr(ret_conv, true);
4560 }
4561
4562 static inline struct LDKPaymentSendFailure CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_err(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ *NONNULL_PTR owner){
4563 CHECK(!owner->result_ok);
4564         return PaymentSendFailure_clone(&*owner->contents.err);
4565 }
4566 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_err"))) TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_err(uint64_t owner) {
4567         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* owner_conv = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)untag_ptr(owner);
4568         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
4569         *ret_copy = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_err(owner_conv);
4570         uint64_t ret_ref = tag_ptr(ret_copy, true);
4571         return ret_ref;
4572 }
4573
4574 static inline LDKCVec_ThirtyTwoBytesZ CVec_ThirtyTwoBytesZ_clone(const LDKCVec_ThirtyTwoBytesZ *orig) {
4575         LDKCVec_ThirtyTwoBytesZ ret = { .data = MALLOC(sizeof(LDKThirtyTwoBytes) * orig->datalen, "LDKCVec_ThirtyTwoBytesZ clone bytes"), .datalen = orig->datalen };
4576         for (size_t i = 0; i < ret.datalen; i++) {
4577                 ret.data[i] = ThirtyTwoBytes_clone(&orig->data[i]);
4578         }
4579         return ret;
4580 }
4581 static inline struct LDKThirtyTwoBytes C2Tuple_PaymentHashPaymentSecretZ_get_a(LDKC2Tuple_PaymentHashPaymentSecretZ *NONNULL_PTR owner){
4582         return ThirtyTwoBytes_clone(&owner->a);
4583 }
4584 int8_tArray  __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentSecretZ_get_a"))) TS_C2Tuple_PaymentHashPaymentSecretZ_get_a(uint64_t owner) {
4585         LDKC2Tuple_PaymentHashPaymentSecretZ* owner_conv = (LDKC2Tuple_PaymentHashPaymentSecretZ*)untag_ptr(owner);
4586         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
4587         memcpy(ret_arr->elems, C2Tuple_PaymentHashPaymentSecretZ_get_a(owner_conv).data, 32);
4588         return ret_arr;
4589 }
4590
4591 static inline struct LDKThirtyTwoBytes C2Tuple_PaymentHashPaymentSecretZ_get_b(LDKC2Tuple_PaymentHashPaymentSecretZ *NONNULL_PTR owner){
4592         return ThirtyTwoBytes_clone(&owner->b);
4593 }
4594 int8_tArray  __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentSecretZ_get_b"))) TS_C2Tuple_PaymentHashPaymentSecretZ_get_b(uint64_t owner) {
4595         LDKC2Tuple_PaymentHashPaymentSecretZ* owner_conv = (LDKC2Tuple_PaymentHashPaymentSecretZ*)untag_ptr(owner);
4596         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
4597         memcpy(ret_arr->elems, C2Tuple_PaymentHashPaymentSecretZ_get_b(owner_conv).data, 32);
4598         return ret_arr;
4599 }
4600
4601 static inline struct LDKC2Tuple_PaymentHashPaymentSecretZ CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_ok(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ *NONNULL_PTR owner){
4602 CHECK(owner->result_ok);
4603         return C2Tuple_PaymentHashPaymentSecretZ_clone(&*owner->contents.result);
4604 }
4605 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_ok"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_ok(uint64_t owner) {
4606         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* owner_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)untag_ptr(owner);
4607         LDKC2Tuple_PaymentHashPaymentSecretZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
4608         *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_ok(owner_conv);
4609         return tag_ptr(ret_conv, true);
4610 }
4611
4612 static inline void CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_err(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ *NONNULL_PTR owner){
4613 CHECK(!owner->result_ok);
4614         return *owner->contents.err;
4615 }
4616 void  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_err"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_err(uint64_t owner) {
4617         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* owner_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)untag_ptr(owner);
4618         CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_err(owner_conv);
4619 }
4620
4621 static inline struct LDKC2Tuple_PaymentHashPaymentSecretZ CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_get_ok(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ *NONNULL_PTR owner){
4622 CHECK(owner->result_ok);
4623         return C2Tuple_PaymentHashPaymentSecretZ_clone(&*owner->contents.result);
4624 }
4625 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_get_ok"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_get_ok(uint64_t owner) {
4626         LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* owner_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)untag_ptr(owner);
4627         LDKC2Tuple_PaymentHashPaymentSecretZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
4628         *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_get_ok(owner_conv);
4629         return tag_ptr(ret_conv, true);
4630 }
4631
4632 static inline struct LDKAPIError CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_get_err(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ *NONNULL_PTR owner){
4633 CHECK(!owner->result_ok);
4634         return APIError_clone(&*owner->contents.err);
4635 }
4636 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_get_err"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_get_err(uint64_t owner) {
4637         LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* owner_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)untag_ptr(owner);
4638         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
4639         *ret_copy = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_get_err(owner_conv);
4640         uint64_t ret_ref = tag_ptr(ret_copy, true);
4641         return ret_ref;
4642 }
4643
4644 static inline struct LDKThirtyTwoBytes CResult_PaymentSecretNoneZ_get_ok(LDKCResult_PaymentSecretNoneZ *NONNULL_PTR owner){
4645 CHECK(owner->result_ok);
4646         return ThirtyTwoBytes_clone(&*owner->contents.result);
4647 }
4648 int8_tArray  __attribute__((export_name("TS_CResult_PaymentSecretNoneZ_get_ok"))) TS_CResult_PaymentSecretNoneZ_get_ok(uint64_t owner) {
4649         LDKCResult_PaymentSecretNoneZ* owner_conv = (LDKCResult_PaymentSecretNoneZ*)untag_ptr(owner);
4650         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
4651         memcpy(ret_arr->elems, CResult_PaymentSecretNoneZ_get_ok(owner_conv).data, 32);
4652         return ret_arr;
4653 }
4654
4655 static inline void CResult_PaymentSecretNoneZ_get_err(LDKCResult_PaymentSecretNoneZ *NONNULL_PTR owner){
4656 CHECK(!owner->result_ok);
4657         return *owner->contents.err;
4658 }
4659 void  __attribute__((export_name("TS_CResult_PaymentSecretNoneZ_get_err"))) TS_CResult_PaymentSecretNoneZ_get_err(uint64_t owner) {
4660         LDKCResult_PaymentSecretNoneZ* owner_conv = (LDKCResult_PaymentSecretNoneZ*)untag_ptr(owner);
4661         CResult_PaymentSecretNoneZ_get_err(owner_conv);
4662 }
4663
4664 static inline struct LDKThirtyTwoBytes CResult_PaymentSecretAPIErrorZ_get_ok(LDKCResult_PaymentSecretAPIErrorZ *NONNULL_PTR owner){
4665 CHECK(owner->result_ok);
4666         return ThirtyTwoBytes_clone(&*owner->contents.result);
4667 }
4668 int8_tArray  __attribute__((export_name("TS_CResult_PaymentSecretAPIErrorZ_get_ok"))) TS_CResult_PaymentSecretAPIErrorZ_get_ok(uint64_t owner) {
4669         LDKCResult_PaymentSecretAPIErrorZ* owner_conv = (LDKCResult_PaymentSecretAPIErrorZ*)untag_ptr(owner);
4670         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
4671         memcpy(ret_arr->elems, CResult_PaymentSecretAPIErrorZ_get_ok(owner_conv).data, 32);
4672         return ret_arr;
4673 }
4674
4675 static inline struct LDKAPIError CResult_PaymentSecretAPIErrorZ_get_err(LDKCResult_PaymentSecretAPIErrorZ *NONNULL_PTR owner){
4676 CHECK(!owner->result_ok);
4677         return APIError_clone(&*owner->contents.err);
4678 }
4679 uint64_t  __attribute__((export_name("TS_CResult_PaymentSecretAPIErrorZ_get_err"))) TS_CResult_PaymentSecretAPIErrorZ_get_err(uint64_t owner) {
4680         LDKCResult_PaymentSecretAPIErrorZ* owner_conv = (LDKCResult_PaymentSecretAPIErrorZ*)untag_ptr(owner);
4681         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
4682         *ret_copy = CResult_PaymentSecretAPIErrorZ_get_err(owner_conv);
4683         uint64_t ret_ref = tag_ptr(ret_copy, true);
4684         return ret_ref;
4685 }
4686
4687 static inline struct LDKThirtyTwoBytes CResult_PaymentPreimageAPIErrorZ_get_ok(LDKCResult_PaymentPreimageAPIErrorZ *NONNULL_PTR owner){
4688 CHECK(owner->result_ok);
4689         return ThirtyTwoBytes_clone(&*owner->contents.result);
4690 }
4691 int8_tArray  __attribute__((export_name("TS_CResult_PaymentPreimageAPIErrorZ_get_ok"))) TS_CResult_PaymentPreimageAPIErrorZ_get_ok(uint64_t owner) {
4692         LDKCResult_PaymentPreimageAPIErrorZ* owner_conv = (LDKCResult_PaymentPreimageAPIErrorZ*)untag_ptr(owner);
4693         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
4694         memcpy(ret_arr->elems, CResult_PaymentPreimageAPIErrorZ_get_ok(owner_conv).data, 32);
4695         return ret_arr;
4696 }
4697
4698 static inline struct LDKAPIError CResult_PaymentPreimageAPIErrorZ_get_err(LDKCResult_PaymentPreimageAPIErrorZ *NONNULL_PTR owner){
4699 CHECK(!owner->result_ok);
4700         return APIError_clone(&*owner->contents.err);
4701 }
4702 uint64_t  __attribute__((export_name("TS_CResult_PaymentPreimageAPIErrorZ_get_err"))) TS_CResult_PaymentPreimageAPIErrorZ_get_err(uint64_t owner) {
4703         LDKCResult_PaymentPreimageAPIErrorZ* owner_conv = (LDKCResult_PaymentPreimageAPIErrorZ*)untag_ptr(owner);
4704         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
4705         *ret_copy = CResult_PaymentPreimageAPIErrorZ_get_err(owner_conv);
4706         uint64_t ret_ref = tag_ptr(ret_copy, true);
4707         return ret_ref;
4708 }
4709
4710 static inline struct LDKCounterpartyForwardingInfo CResult_CounterpartyForwardingInfoDecodeErrorZ_get_ok(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ *NONNULL_PTR owner){
4711         LDKCounterpartyForwardingInfo ret = *owner->contents.result;
4712         ret.is_owned = false;
4713         return ret;
4714 }
4715 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_get_ok"))) TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_get_ok(uint64_t owner) {
4716         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)untag_ptr(owner);
4717         LDKCounterpartyForwardingInfo ret_var = CResult_CounterpartyForwardingInfoDecodeErrorZ_get_ok(owner_conv);
4718         uint64_t ret_ref = 0;
4719         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4720         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4721         return ret_ref;
4722 }
4723
4724 static inline struct LDKDecodeError CResult_CounterpartyForwardingInfoDecodeErrorZ_get_err(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ *NONNULL_PTR owner){
4725         LDKDecodeError ret = *owner->contents.err;
4726         ret.is_owned = false;
4727         return ret;
4728 }
4729 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_get_err"))) TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_get_err(uint64_t owner) {
4730         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)untag_ptr(owner);
4731         LDKDecodeError ret_var = CResult_CounterpartyForwardingInfoDecodeErrorZ_get_err(owner_conv);
4732         uint64_t ret_ref = 0;
4733         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4734         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4735         return ret_ref;
4736 }
4737
4738 static inline struct LDKChannelCounterparty CResult_ChannelCounterpartyDecodeErrorZ_get_ok(LDKCResult_ChannelCounterpartyDecodeErrorZ *NONNULL_PTR owner){
4739         LDKChannelCounterparty ret = *owner->contents.result;
4740         ret.is_owned = false;
4741         return ret;
4742 }
4743 uint64_t  __attribute__((export_name("TS_CResult_ChannelCounterpartyDecodeErrorZ_get_ok"))) TS_CResult_ChannelCounterpartyDecodeErrorZ_get_ok(uint64_t owner) {
4744         LDKCResult_ChannelCounterpartyDecodeErrorZ* owner_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)untag_ptr(owner);
4745         LDKChannelCounterparty ret_var = CResult_ChannelCounterpartyDecodeErrorZ_get_ok(owner_conv);
4746         uint64_t ret_ref = 0;
4747         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4748         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4749         return ret_ref;
4750 }
4751
4752 static inline struct LDKDecodeError CResult_ChannelCounterpartyDecodeErrorZ_get_err(LDKCResult_ChannelCounterpartyDecodeErrorZ *NONNULL_PTR owner){
4753         LDKDecodeError ret = *owner->contents.err;
4754         ret.is_owned = false;
4755         return ret;
4756 }
4757 uint64_t  __attribute__((export_name("TS_CResult_ChannelCounterpartyDecodeErrorZ_get_err"))) TS_CResult_ChannelCounterpartyDecodeErrorZ_get_err(uint64_t owner) {
4758         LDKCResult_ChannelCounterpartyDecodeErrorZ* owner_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)untag_ptr(owner);
4759         LDKDecodeError ret_var = CResult_ChannelCounterpartyDecodeErrorZ_get_err(owner_conv);
4760         uint64_t ret_ref = 0;
4761         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4762         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4763         return ret_ref;
4764 }
4765
4766 static inline struct LDKChannelDetails CResult_ChannelDetailsDecodeErrorZ_get_ok(LDKCResult_ChannelDetailsDecodeErrorZ *NONNULL_PTR owner){
4767         LDKChannelDetails ret = *owner->contents.result;
4768         ret.is_owned = false;
4769         return ret;
4770 }
4771 uint64_t  __attribute__((export_name("TS_CResult_ChannelDetailsDecodeErrorZ_get_ok"))) TS_CResult_ChannelDetailsDecodeErrorZ_get_ok(uint64_t owner) {
4772         LDKCResult_ChannelDetailsDecodeErrorZ* owner_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)untag_ptr(owner);
4773         LDKChannelDetails ret_var = CResult_ChannelDetailsDecodeErrorZ_get_ok(owner_conv);
4774         uint64_t ret_ref = 0;
4775         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4776         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4777         return ret_ref;
4778 }
4779
4780 static inline struct LDKDecodeError CResult_ChannelDetailsDecodeErrorZ_get_err(LDKCResult_ChannelDetailsDecodeErrorZ *NONNULL_PTR owner){
4781         LDKDecodeError ret = *owner->contents.err;
4782         ret.is_owned = false;
4783         return ret;
4784 }
4785 uint64_t  __attribute__((export_name("TS_CResult_ChannelDetailsDecodeErrorZ_get_err"))) TS_CResult_ChannelDetailsDecodeErrorZ_get_err(uint64_t owner) {
4786         LDKCResult_ChannelDetailsDecodeErrorZ* owner_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)untag_ptr(owner);
4787         LDKDecodeError ret_var = CResult_ChannelDetailsDecodeErrorZ_get_err(owner_conv);
4788         uint64_t ret_ref = 0;
4789         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4790         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4791         return ret_ref;
4792 }
4793
4794 static inline struct LDKPhantomRouteHints CResult_PhantomRouteHintsDecodeErrorZ_get_ok(LDKCResult_PhantomRouteHintsDecodeErrorZ *NONNULL_PTR owner){
4795         LDKPhantomRouteHints ret = *owner->contents.result;
4796         ret.is_owned = false;
4797         return ret;
4798 }
4799 uint64_t  __attribute__((export_name("TS_CResult_PhantomRouteHintsDecodeErrorZ_get_ok"))) TS_CResult_PhantomRouteHintsDecodeErrorZ_get_ok(uint64_t owner) {
4800         LDKCResult_PhantomRouteHintsDecodeErrorZ* owner_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)untag_ptr(owner);
4801         LDKPhantomRouteHints ret_var = CResult_PhantomRouteHintsDecodeErrorZ_get_ok(owner_conv);
4802         uint64_t ret_ref = 0;
4803         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4804         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4805         return ret_ref;
4806 }
4807
4808 static inline struct LDKDecodeError CResult_PhantomRouteHintsDecodeErrorZ_get_err(LDKCResult_PhantomRouteHintsDecodeErrorZ *NONNULL_PTR owner){
4809         LDKDecodeError ret = *owner->contents.err;
4810         ret.is_owned = false;
4811         return ret;
4812 }
4813 uint64_t  __attribute__((export_name("TS_CResult_PhantomRouteHintsDecodeErrorZ_get_err"))) TS_CResult_PhantomRouteHintsDecodeErrorZ_get_err(uint64_t owner) {
4814         LDKCResult_PhantomRouteHintsDecodeErrorZ* owner_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)untag_ptr(owner);
4815         LDKDecodeError ret_var = CResult_PhantomRouteHintsDecodeErrorZ_get_err(owner_conv);
4816         uint64_t ret_ref = 0;
4817         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4818         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4819         return ret_ref;
4820 }
4821
4822 static inline LDKCVec_ChannelMonitorZ CVec_ChannelMonitorZ_clone(const LDKCVec_ChannelMonitorZ *orig) {
4823         LDKCVec_ChannelMonitorZ ret = { .data = MALLOC(sizeof(LDKChannelMonitor) * orig->datalen, "LDKCVec_ChannelMonitorZ clone bytes"), .datalen = orig->datalen };
4824         for (size_t i = 0; i < ret.datalen; i++) {
4825                 ret.data[i] = ChannelMonitor_clone(&orig->data[i]);
4826         }
4827         return ret;
4828 }
4829 typedef struct LDKWatch_JCalls {
4830         atomic_size_t refcnt;
4831         uint32_t instance_ptr;
4832 } LDKWatch_JCalls;
4833 static void LDKWatch_JCalls_free(void* this_arg) {
4834         LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
4835         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4836                 FREE(j_calls);
4837         }
4838 }
4839 LDKCResult_NoneChannelMonitorUpdateErrZ watch_channel_LDKWatch_jcall(const void* this_arg, LDKOutPoint funding_txo, LDKChannelMonitor monitor) {
4840         LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
4841         LDKOutPoint funding_txo_var = funding_txo;
4842         uint64_t funding_txo_ref = 0;
4843         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_var);
4844         funding_txo_ref = tag_ptr(funding_txo_var.inner, funding_txo_var.is_owned);
4845         LDKChannelMonitor monitor_var = monitor;
4846         uint64_t monitor_ref = 0;
4847         CHECK_INNER_FIELD_ACCESS_OR_NULL(monitor_var);
4848         monitor_ref = tag_ptr(monitor_var.inner, monitor_var.is_owned);
4849         uint32_t ret = js_invoke_function_bbuuuu(j_calls->instance_ptr, 16, funding_txo_ref, monitor_ref, 0, 0, 0, 0);
4850         void* ret_ptr = untag_ptr(ret);
4851         CHECK_ACCESS(ret_ptr);
4852         LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(ret_ptr);
4853         FREE(untag_ptr(ret));
4854         return ret_conv;
4855 }
4856 LDKCResult_NoneChannelMonitorUpdateErrZ update_channel_LDKWatch_jcall(const void* this_arg, LDKOutPoint funding_txo, LDKChannelMonitorUpdate update) {
4857         LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
4858         LDKOutPoint funding_txo_var = funding_txo;
4859         uint64_t funding_txo_ref = 0;
4860         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_var);
4861         funding_txo_ref = tag_ptr(funding_txo_var.inner, funding_txo_var.is_owned);
4862         LDKChannelMonitorUpdate update_var = update;
4863         uint64_t update_ref = 0;
4864         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_var);
4865         update_ref = tag_ptr(update_var.inner, update_var.is_owned);
4866         uint32_t ret = js_invoke_function_bbuuuu(j_calls->instance_ptr, 17, funding_txo_ref, update_ref, 0, 0, 0, 0);
4867         void* ret_ptr = untag_ptr(ret);
4868         CHECK_ACCESS(ret_ptr);
4869         LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(ret_ptr);
4870         FREE(untag_ptr(ret));
4871         return ret_conv;
4872 }
4873 LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ release_pending_monitor_events_LDKWatch_jcall(const void* this_arg) {
4874         LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
4875         uint64_tArray ret = (uint64_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 18, 0, 0, 0, 0, 0, 0);
4876         LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ ret_constr;
4877         ret_constr.datalen = ret->arr_len;
4878         if (ret_constr.datalen > 0)
4879                 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ), "LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ Elements");
4880         else
4881                 ret_constr.data = NULL;
4882         uint64_t* ret_vals = ret->elems;
4883         for (size_t x = 0; x < ret_constr.datalen; x++) {
4884                 uint64_t ret_conv_49 = ret_vals[x];
4885                 void* ret_conv_49_ptr = untag_ptr(ret_conv_49);
4886                 CHECK_ACCESS(ret_conv_49_ptr);
4887                 LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ ret_conv_49_conv = *(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)(ret_conv_49_ptr);
4888                 FREE(untag_ptr(ret_conv_49));
4889                 ret_constr.data[x] = ret_conv_49_conv;
4890         }
4891         FREE(ret);
4892         return ret_constr;
4893 }
4894 static void LDKWatch_JCalls_cloned(LDKWatch* new_obj) {
4895         LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) new_obj->this_arg;
4896         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
4897 }
4898 static inline LDKWatch LDKWatch_init (JSValue o) {
4899         LDKWatch_JCalls *calls = MALLOC(sizeof(LDKWatch_JCalls), "LDKWatch_JCalls");
4900         atomic_init(&calls->refcnt, 1);
4901         calls->instance_ptr = o;
4902
4903         LDKWatch ret = {
4904                 .this_arg = (void*) calls,
4905                 .watch_channel = watch_channel_LDKWatch_jcall,
4906                 .update_channel = update_channel_LDKWatch_jcall,
4907                 .release_pending_monitor_events = release_pending_monitor_events_LDKWatch_jcall,
4908                 .free = LDKWatch_JCalls_free,
4909         };
4910         return ret;
4911 }
4912 uint64_t  __attribute__((export_name("TS_LDKWatch_new"))) TS_LDKWatch_new(JSValue o) {
4913         LDKWatch *res_ptr = MALLOC(sizeof(LDKWatch), "LDKWatch");
4914         *res_ptr = LDKWatch_init(o);
4915         return tag_ptr(res_ptr, true);
4916 }
4917 uint64_t  __attribute__((export_name("TS_Watch_watch_channel"))) TS_Watch_watch_channel(uint64_t this_arg, uint64_t funding_txo, uint64_t monitor) {
4918         void* this_arg_ptr = untag_ptr(this_arg);
4919         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4920         LDKWatch* this_arg_conv = (LDKWatch*)this_arg_ptr;
4921         LDKOutPoint funding_txo_conv;
4922         funding_txo_conv.inner = untag_ptr(funding_txo);
4923         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
4924         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
4925         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
4926         LDKChannelMonitor monitor_conv;
4927         monitor_conv.inner = untag_ptr(monitor);
4928         monitor_conv.is_owned = ptr_is_owned(monitor);
4929         CHECK_INNER_FIELD_ACCESS_OR_NULL(monitor_conv);
4930         monitor_conv = ChannelMonitor_clone(&monitor_conv);
4931         LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
4932         *ret_conv = (this_arg_conv->watch_channel)(this_arg_conv->this_arg, funding_txo_conv, monitor_conv);
4933         return tag_ptr(ret_conv, true);
4934 }
4935
4936 uint64_t  __attribute__((export_name("TS_Watch_update_channel"))) TS_Watch_update_channel(uint64_t this_arg, uint64_t funding_txo, uint64_t update) {
4937         void* this_arg_ptr = untag_ptr(this_arg);
4938         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4939         LDKWatch* this_arg_conv = (LDKWatch*)this_arg_ptr;
4940         LDKOutPoint funding_txo_conv;
4941         funding_txo_conv.inner = untag_ptr(funding_txo);
4942         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
4943         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
4944         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
4945         LDKChannelMonitorUpdate update_conv;
4946         update_conv.inner = untag_ptr(update);
4947         update_conv.is_owned = ptr_is_owned(update);
4948         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_conv);
4949         update_conv = ChannelMonitorUpdate_clone(&update_conv);
4950         LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
4951         *ret_conv = (this_arg_conv->update_channel)(this_arg_conv->this_arg, funding_txo_conv, update_conv);
4952         return tag_ptr(ret_conv, true);
4953 }
4954
4955 uint64_tArray  __attribute__((export_name("TS_Watch_release_pending_monitor_events"))) TS_Watch_release_pending_monitor_events(uint64_t this_arg) {
4956         void* this_arg_ptr = untag_ptr(this_arg);
4957         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4958         LDKWatch* this_arg_conv = (LDKWatch*)this_arg_ptr;
4959         LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ ret_var = (this_arg_conv->release_pending_monitor_events)(this_arg_conv->this_arg);
4960         uint64_tArray ret_arr = NULL;
4961         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
4962         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
4963         for (size_t x = 0; x < ret_var.datalen; x++) {
4964                 LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* ret_conv_49_conv = MALLOC(sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ), "LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ");
4965                 *ret_conv_49_conv = ret_var.data[x];
4966                 ret_arr_ptr[x] = tag_ptr(ret_conv_49_conv, true);
4967         }
4968         
4969         FREE(ret_var.data);
4970         return ret_arr;
4971 }
4972
4973 typedef struct LDKBroadcasterInterface_JCalls {
4974         atomic_size_t refcnt;
4975         uint32_t instance_ptr;
4976 } LDKBroadcasterInterface_JCalls;
4977 static void LDKBroadcasterInterface_JCalls_free(void* this_arg) {
4978         LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
4979         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4980                 FREE(j_calls);
4981         }
4982 }
4983 void broadcast_transaction_LDKBroadcasterInterface_jcall(const void* this_arg, LDKTransaction tx) {
4984         LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
4985         LDKTransaction tx_var = tx;
4986         int8_tArray tx_arr = init_int8_tArray(tx_var.datalen, __LINE__);
4987         memcpy(tx_arr->elems, tx_var.data, tx_var.datalen);
4988         Transaction_free(tx_var);
4989         js_invoke_function_uuuuuu(j_calls->instance_ptr, 19, (uint32_t)tx_arr, 0, 0, 0, 0, 0);
4990 }
4991 static void LDKBroadcasterInterface_JCalls_cloned(LDKBroadcasterInterface* new_obj) {
4992         LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) new_obj->this_arg;
4993         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
4994 }
4995 static inline LDKBroadcasterInterface LDKBroadcasterInterface_init (JSValue o) {
4996         LDKBroadcasterInterface_JCalls *calls = MALLOC(sizeof(LDKBroadcasterInterface_JCalls), "LDKBroadcasterInterface_JCalls");
4997         atomic_init(&calls->refcnt, 1);
4998         calls->instance_ptr = o;
4999
5000         LDKBroadcasterInterface ret = {
5001                 .this_arg = (void*) calls,
5002                 .broadcast_transaction = broadcast_transaction_LDKBroadcasterInterface_jcall,
5003                 .free = LDKBroadcasterInterface_JCalls_free,
5004         };
5005         return ret;
5006 }
5007 uint64_t  __attribute__((export_name("TS_LDKBroadcasterInterface_new"))) TS_LDKBroadcasterInterface_new(JSValue o) {
5008         LDKBroadcasterInterface *res_ptr = MALLOC(sizeof(LDKBroadcasterInterface), "LDKBroadcasterInterface");
5009         *res_ptr = LDKBroadcasterInterface_init(o);
5010         return tag_ptr(res_ptr, true);
5011 }
5012 void  __attribute__((export_name("TS_BroadcasterInterface_broadcast_transaction"))) TS_BroadcasterInterface_broadcast_transaction(uint64_t this_arg, int8_tArray tx) {
5013         void* this_arg_ptr = untag_ptr(this_arg);
5014         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5015         LDKBroadcasterInterface* this_arg_conv = (LDKBroadcasterInterface*)this_arg_ptr;
5016         LDKTransaction tx_ref;
5017         tx_ref.datalen = tx->arr_len;
5018         tx_ref.data = MALLOC(tx_ref.datalen, "LDKTransaction Bytes");
5019         memcpy(tx_ref.data, tx->elems, tx_ref.datalen); FREE(tx);
5020         tx_ref.data_is_owned = true;
5021         (this_arg_conv->broadcast_transaction)(this_arg_conv->this_arg, tx_ref);
5022 }
5023
5024 typedef struct LDKKeysInterface_JCalls {
5025         atomic_size_t refcnt;
5026         uint32_t instance_ptr;
5027 } LDKKeysInterface_JCalls;
5028 static void LDKKeysInterface_JCalls_free(void* this_arg) {
5029         LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
5030         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5031                 FREE(j_calls);
5032         }
5033 }
5034 LDKCResult_SecretKeyNoneZ get_node_secret_LDKKeysInterface_jcall(const void* this_arg, LDKRecipient recipient) {
5035         LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
5036         uint32_t recipient_conv = LDKRecipient_to_js(recipient);
5037         uint32_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 20, recipient_conv, 0, 0, 0, 0, 0);
5038         void* ret_ptr = untag_ptr(ret);
5039         CHECK_ACCESS(ret_ptr);
5040         LDKCResult_SecretKeyNoneZ ret_conv = *(LDKCResult_SecretKeyNoneZ*)(ret_ptr);
5041         FREE(untag_ptr(ret));
5042         return ret_conv;
5043 }
5044 LDKCVec_u8Z get_destination_script_LDKKeysInterface_jcall(const void* this_arg) {
5045         LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
5046         int8_tArray ret = (int8_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 21, 0, 0, 0, 0, 0, 0);
5047         LDKCVec_u8Z ret_ref;
5048         ret_ref.datalen = ret->arr_len;
5049         ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
5050         memcpy(ret_ref.data, ret->elems, ret_ref.datalen); FREE(ret);
5051         return ret_ref;
5052 }
5053 LDKShutdownScript get_shutdown_scriptpubkey_LDKKeysInterface_jcall(const void* this_arg) {
5054         LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
5055         uint32_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 22, 0, 0, 0, 0, 0, 0);
5056         LDKShutdownScript ret_conv;
5057         ret_conv.inner = untag_ptr(ret);
5058         ret_conv.is_owned = ptr_is_owned(ret);
5059         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
5060         return ret_conv;
5061 }
5062 LDKSign get_channel_signer_LDKKeysInterface_jcall(const void* this_arg, bool inbound, uint64_t channel_value_satoshis) {
5063         LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
5064         jboolean inbound_conv = inbound;
5065         int64_t channel_value_satoshis_conv = channel_value_satoshis;
5066         uint32_t ret = js_invoke_function_ubuuuu(j_calls->instance_ptr, 23, inbound_conv, channel_value_satoshis_conv, 0, 0, 0, 0);
5067         void* ret_ptr = untag_ptr(ret);
5068         CHECK_ACCESS(ret_ptr);
5069         LDKSign ret_conv = *(LDKSign*)(ret_ptr);
5070         FREE(untag_ptr(ret));
5071         return ret_conv;
5072 }
5073 LDKThirtyTwoBytes get_secure_random_bytes_LDKKeysInterface_jcall(const void* this_arg) {
5074         LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
5075         int8_tArray ret = (int8_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 24, 0, 0, 0, 0, 0, 0);
5076         LDKThirtyTwoBytes ret_ref;
5077         CHECK(ret->arr_len == 32);
5078         memcpy(ret_ref.data, ret->elems, 32); FREE(ret);
5079         return ret_ref;
5080 }
5081 LDKCResult_SignDecodeErrorZ read_chan_signer_LDKKeysInterface_jcall(const void* this_arg, LDKu8slice reader) {
5082         LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
5083         LDKu8slice reader_var = reader;
5084         int8_tArray reader_arr = init_int8_tArray(reader_var.datalen, __LINE__);
5085         memcpy(reader_arr->elems, reader_var.data, reader_var.datalen);
5086         uint32_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 25, (uint32_t)reader_arr, 0, 0, 0, 0, 0);
5087         void* ret_ptr = untag_ptr(ret);
5088         CHECK_ACCESS(ret_ptr);
5089         LDKCResult_SignDecodeErrorZ ret_conv = *(LDKCResult_SignDecodeErrorZ*)(ret_ptr);
5090         FREE(untag_ptr(ret));
5091         return ret_conv;
5092 }
5093 LDKCResult_RecoverableSignatureNoneZ sign_invoice_LDKKeysInterface_jcall(const void* this_arg, LDKu8slice hrp_bytes, LDKCVec_u5Z invoice_data, LDKRecipient receipient) {
5094         LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
5095         LDKu8slice hrp_bytes_var = hrp_bytes;
5096         int8_tArray hrp_bytes_arr = init_int8_tArray(hrp_bytes_var.datalen, __LINE__);
5097         memcpy(hrp_bytes_arr->elems, hrp_bytes_var.data, hrp_bytes_var.datalen);
5098         LDKCVec_u5Z invoice_data_var = invoice_data;
5099         ptrArray invoice_data_arr = NULL;
5100         invoice_data_arr = init_ptrArray(invoice_data_var.datalen, __LINE__);
5101         int8_t *invoice_data_arr_ptr = (int8_t*)(((uint8_t*)invoice_data_arr) + 8);
5102         for (size_t h = 0; h < invoice_data_var.datalen; h++) {
5103                 uint8_t invoice_data_conv_7_val = invoice_data_var.data[h]._0;
5104                 invoice_data_arr_ptr[h] = invoice_data_conv_7_val;
5105         }
5106         
5107         FREE(invoice_data_var.data);
5108         uint32_t receipient_conv = LDKRecipient_to_js(receipient);
5109         uint32_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 26, (uint32_t)hrp_bytes_arr, (uint32_t)invoice_data_arr, receipient_conv, 0, 0, 0);
5110         void* ret_ptr = untag_ptr(ret);
5111         CHECK_ACCESS(ret_ptr);
5112         LDKCResult_RecoverableSignatureNoneZ ret_conv = *(LDKCResult_RecoverableSignatureNoneZ*)(ret_ptr);
5113         FREE(untag_ptr(ret));
5114         return ret_conv;
5115 }
5116 LDKThirtyTwoBytes get_inbound_payment_key_material_LDKKeysInterface_jcall(const void* this_arg) {
5117         LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
5118         int8_tArray ret = (int8_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 27, 0, 0, 0, 0, 0, 0);
5119         LDKThirtyTwoBytes ret_ref;
5120         CHECK(ret->arr_len == 32);
5121         memcpy(ret_ref.data, ret->elems, 32); FREE(ret);
5122         return ret_ref;
5123 }
5124 static void LDKKeysInterface_JCalls_cloned(LDKKeysInterface* new_obj) {
5125         LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) new_obj->this_arg;
5126         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5127 }
5128 static inline LDKKeysInterface LDKKeysInterface_init (JSValue o) {
5129         LDKKeysInterface_JCalls *calls = MALLOC(sizeof(LDKKeysInterface_JCalls), "LDKKeysInterface_JCalls");
5130         atomic_init(&calls->refcnt, 1);
5131         calls->instance_ptr = o;
5132
5133         LDKKeysInterface ret = {
5134                 .this_arg = (void*) calls,
5135                 .get_node_secret = get_node_secret_LDKKeysInterface_jcall,
5136                 .get_destination_script = get_destination_script_LDKKeysInterface_jcall,
5137                 .get_shutdown_scriptpubkey = get_shutdown_scriptpubkey_LDKKeysInterface_jcall,
5138                 .get_channel_signer = get_channel_signer_LDKKeysInterface_jcall,
5139                 .get_secure_random_bytes = get_secure_random_bytes_LDKKeysInterface_jcall,
5140                 .read_chan_signer = read_chan_signer_LDKKeysInterface_jcall,
5141                 .sign_invoice = sign_invoice_LDKKeysInterface_jcall,
5142                 .get_inbound_payment_key_material = get_inbound_payment_key_material_LDKKeysInterface_jcall,
5143                 .free = LDKKeysInterface_JCalls_free,
5144         };
5145         return ret;
5146 }
5147 uint64_t  __attribute__((export_name("TS_LDKKeysInterface_new"))) TS_LDKKeysInterface_new(JSValue o) {
5148         LDKKeysInterface *res_ptr = MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface");
5149         *res_ptr = LDKKeysInterface_init(o);
5150         return tag_ptr(res_ptr, true);
5151 }
5152 uint64_t  __attribute__((export_name("TS_KeysInterface_get_node_secret"))) TS_KeysInterface_get_node_secret(uint64_t this_arg, uint32_t recipient) {
5153         void* this_arg_ptr = untag_ptr(this_arg);
5154         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5155         LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
5156         LDKRecipient recipient_conv = LDKRecipient_from_js(recipient);
5157         LDKCResult_SecretKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyNoneZ), "LDKCResult_SecretKeyNoneZ");
5158         *ret_conv = (this_arg_conv->get_node_secret)(this_arg_conv->this_arg, recipient_conv);
5159         return tag_ptr(ret_conv, true);
5160 }
5161
5162 int8_tArray  __attribute__((export_name("TS_KeysInterface_get_destination_script"))) TS_KeysInterface_get_destination_script(uint64_t this_arg) {
5163         void* this_arg_ptr = untag_ptr(this_arg);
5164         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5165         LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
5166         LDKCVec_u8Z ret_var = (this_arg_conv->get_destination_script)(this_arg_conv->this_arg);
5167         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
5168         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
5169         CVec_u8Z_free(ret_var);
5170         return ret_arr;
5171 }
5172
5173 uint64_t  __attribute__((export_name("TS_KeysInterface_get_shutdown_scriptpubkey"))) TS_KeysInterface_get_shutdown_scriptpubkey(uint64_t this_arg) {
5174         void* this_arg_ptr = untag_ptr(this_arg);
5175         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5176         LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
5177         LDKShutdownScript ret_var = (this_arg_conv->get_shutdown_scriptpubkey)(this_arg_conv->this_arg);
5178         uint64_t ret_ref = 0;
5179         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5180         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5181         return ret_ref;
5182 }
5183
5184 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) {
5185         void* this_arg_ptr = untag_ptr(this_arg);
5186         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5187         LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
5188         LDKSign* ret_ret = MALLOC(sizeof(LDKSign), "LDKSign");
5189         *ret_ret = (this_arg_conv->get_channel_signer)(this_arg_conv->this_arg, inbound, channel_value_satoshis);
5190         return tag_ptr(ret_ret, true);
5191 }
5192
5193 int8_tArray  __attribute__((export_name("TS_KeysInterface_get_secure_random_bytes"))) TS_KeysInterface_get_secure_random_bytes(uint64_t this_arg) {
5194         void* this_arg_ptr = untag_ptr(this_arg);
5195         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5196         LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
5197         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
5198         memcpy(ret_arr->elems, (this_arg_conv->get_secure_random_bytes)(this_arg_conv->this_arg).data, 32);
5199         return ret_arr;
5200 }
5201
5202 uint64_t  __attribute__((export_name("TS_KeysInterface_read_chan_signer"))) TS_KeysInterface_read_chan_signer(uint64_t this_arg, int8_tArray reader) {
5203         void* this_arg_ptr = untag_ptr(this_arg);
5204         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5205         LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
5206         LDKu8slice reader_ref;
5207         reader_ref.datalen = reader->arr_len;
5208         reader_ref.data = reader->elems;
5209         LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
5210         *ret_conv = (this_arg_conv->read_chan_signer)(this_arg_conv->this_arg, reader_ref);
5211         FREE(reader);
5212         return tag_ptr(ret_conv, true);
5213 }
5214
5215 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) {
5216         void* this_arg_ptr = untag_ptr(this_arg);
5217         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5218         LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
5219         LDKu8slice hrp_bytes_ref;
5220         hrp_bytes_ref.datalen = hrp_bytes->arr_len;
5221         hrp_bytes_ref.data = hrp_bytes->elems;
5222         LDKCVec_u5Z invoice_data_constr;
5223         invoice_data_constr.datalen = invoice_data->arr_len;
5224         if (invoice_data_constr.datalen > 0)
5225                 invoice_data_constr.data = MALLOC(invoice_data_constr.datalen * sizeof(LDKu5), "LDKCVec_u5Z Elements");
5226         else
5227                 invoice_data_constr.data = NULL;
5228         int8_t* invoice_data_vals = (void*) invoice_data->elems;
5229         for (size_t h = 0; h < invoice_data_constr.datalen; h++) {
5230                 int8_t invoice_data_conv_7 = invoice_data_vals[h];
5231                 
5232                 invoice_data_constr.data[h] = (LDKu5){ ._0 = invoice_data_conv_7 };
5233         }
5234         FREE(invoice_data);
5235         LDKRecipient receipient_conv = LDKRecipient_from_js(receipient);
5236         LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
5237         *ret_conv = (this_arg_conv->sign_invoice)(this_arg_conv->this_arg, hrp_bytes_ref, invoice_data_constr, receipient_conv);
5238         FREE(hrp_bytes);
5239         return tag_ptr(ret_conv, true);
5240 }
5241
5242 int8_tArray  __attribute__((export_name("TS_KeysInterface_get_inbound_payment_key_material"))) TS_KeysInterface_get_inbound_payment_key_material(uint64_t this_arg) {
5243         void* this_arg_ptr = untag_ptr(this_arg);
5244         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5245         LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
5246         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
5247         memcpy(ret_arr->elems, (this_arg_conv->get_inbound_payment_key_material)(this_arg_conv->this_arg).data, 32);
5248         return ret_arr;
5249 }
5250
5251 typedef struct LDKFeeEstimator_JCalls {
5252         atomic_size_t refcnt;
5253         uint32_t instance_ptr;
5254 } LDKFeeEstimator_JCalls;
5255 static void LDKFeeEstimator_JCalls_free(void* this_arg) {
5256         LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
5257         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5258                 FREE(j_calls);
5259         }
5260 }
5261 uint32_t get_est_sat_per_1000_weight_LDKFeeEstimator_jcall(const void* this_arg, LDKConfirmationTarget confirmation_target) {
5262         LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
5263         uint32_t confirmation_target_conv = LDKConfirmationTarget_to_js(confirmation_target);
5264         return js_invoke_function_uuuuuu(j_calls->instance_ptr, 28, confirmation_target_conv, 0, 0, 0, 0, 0);
5265 }
5266 static void LDKFeeEstimator_JCalls_cloned(LDKFeeEstimator* new_obj) {
5267         LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) new_obj->this_arg;
5268         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5269 }
5270 static inline LDKFeeEstimator LDKFeeEstimator_init (JSValue o) {
5271         LDKFeeEstimator_JCalls *calls = MALLOC(sizeof(LDKFeeEstimator_JCalls), "LDKFeeEstimator_JCalls");
5272         atomic_init(&calls->refcnt, 1);
5273         calls->instance_ptr = o;
5274
5275         LDKFeeEstimator ret = {
5276                 .this_arg = (void*) calls,
5277                 .get_est_sat_per_1000_weight = get_est_sat_per_1000_weight_LDKFeeEstimator_jcall,
5278                 .free = LDKFeeEstimator_JCalls_free,
5279         };
5280         return ret;
5281 }
5282 uint64_t  __attribute__((export_name("TS_LDKFeeEstimator_new"))) TS_LDKFeeEstimator_new(JSValue o) {
5283         LDKFeeEstimator *res_ptr = MALLOC(sizeof(LDKFeeEstimator), "LDKFeeEstimator");
5284         *res_ptr = LDKFeeEstimator_init(o);
5285         return tag_ptr(res_ptr, true);
5286 }
5287 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) {
5288         void* this_arg_ptr = untag_ptr(this_arg);
5289         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5290         LDKFeeEstimator* this_arg_conv = (LDKFeeEstimator*)this_arg_ptr;
5291         LDKConfirmationTarget confirmation_target_conv = LDKConfirmationTarget_from_js(confirmation_target);
5292         int32_t ret_conv = (this_arg_conv->get_est_sat_per_1000_weight)(this_arg_conv->this_arg, confirmation_target_conv);
5293         return ret_conv;
5294 }
5295
5296 static inline struct LDKThirtyTwoBytes C2Tuple_BlockHashChannelManagerZ_get_a(LDKC2Tuple_BlockHashChannelManagerZ *NONNULL_PTR owner){
5297         return ThirtyTwoBytes_clone(&owner->a);
5298 }
5299 int8_tArray  __attribute__((export_name("TS_C2Tuple_BlockHashChannelManagerZ_get_a"))) TS_C2Tuple_BlockHashChannelManagerZ_get_a(uint64_t owner) {
5300         LDKC2Tuple_BlockHashChannelManagerZ* owner_conv = (LDKC2Tuple_BlockHashChannelManagerZ*)untag_ptr(owner);
5301         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
5302         memcpy(ret_arr->elems, C2Tuple_BlockHashChannelManagerZ_get_a(owner_conv).data, 32);
5303         return ret_arr;
5304 }
5305
5306 static inline struct LDKChannelManager C2Tuple_BlockHashChannelManagerZ_get_b(LDKC2Tuple_BlockHashChannelManagerZ *NONNULL_PTR owner){
5307         LDKChannelManager ret = owner->b;
5308         ret.is_owned = false;
5309         return ret;
5310 }
5311 uint64_t  __attribute__((export_name("TS_C2Tuple_BlockHashChannelManagerZ_get_b"))) TS_C2Tuple_BlockHashChannelManagerZ_get_b(uint64_t owner) {
5312         LDKC2Tuple_BlockHashChannelManagerZ* owner_conv = (LDKC2Tuple_BlockHashChannelManagerZ*)untag_ptr(owner);
5313         LDKChannelManager ret_var = C2Tuple_BlockHashChannelManagerZ_get_b(owner_conv);
5314         uint64_t ret_ref = 0;
5315         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5316         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5317         return ret_ref;
5318 }
5319
5320 static inline struct LDKC2Tuple_BlockHashChannelManagerZ *CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_ok(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ *NONNULL_PTR owner){
5321 CHECK(owner->result_ok);
5322         return &*owner->contents.result;
5323 }
5324 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_ok"))) TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_ok(uint64_t owner) {
5325         LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)untag_ptr(owner);
5326         uint64_t ret_ret = tag_ptr(CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_ok(owner_conv), false);
5327         return ret_ret;
5328 }
5329
5330 static inline struct LDKDecodeError CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_err(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ *NONNULL_PTR owner){
5331         LDKDecodeError ret = *owner->contents.err;
5332         ret.is_owned = false;
5333         return ret;
5334 }
5335 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_err"))) TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_err(uint64_t owner) {
5336         LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)untag_ptr(owner);
5337         LDKDecodeError ret_var = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_err(owner_conv);
5338         uint64_t ret_ref = 0;
5339         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5340         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5341         return ret_ref;
5342 }
5343
5344 static inline struct LDKChannelConfig CResult_ChannelConfigDecodeErrorZ_get_ok(LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR owner){
5345         LDKChannelConfig ret = *owner->contents.result;
5346         ret.is_owned = false;
5347         return ret;
5348 }
5349 uint64_t  __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_get_ok"))) TS_CResult_ChannelConfigDecodeErrorZ_get_ok(uint64_t owner) {
5350         LDKCResult_ChannelConfigDecodeErrorZ* owner_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)untag_ptr(owner);
5351         LDKChannelConfig ret_var = CResult_ChannelConfigDecodeErrorZ_get_ok(owner_conv);
5352         uint64_t ret_ref = 0;
5353         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5354         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5355         return ret_ref;
5356 }
5357
5358 static inline struct LDKDecodeError CResult_ChannelConfigDecodeErrorZ_get_err(LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR owner){
5359         LDKDecodeError ret = *owner->contents.err;
5360         ret.is_owned = false;
5361         return ret;
5362 }
5363 uint64_t  __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_get_err"))) TS_CResult_ChannelConfigDecodeErrorZ_get_err(uint64_t owner) {
5364         LDKCResult_ChannelConfigDecodeErrorZ* owner_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)untag_ptr(owner);
5365         LDKDecodeError ret_var = CResult_ChannelConfigDecodeErrorZ_get_err(owner_conv);
5366         uint64_t ret_ref = 0;
5367         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5368         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5369         return ret_ref;
5370 }
5371
5372 static inline struct LDKOutPoint CResult_OutPointDecodeErrorZ_get_ok(LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR owner){
5373         LDKOutPoint ret = *owner->contents.result;
5374         ret.is_owned = false;
5375         return ret;
5376 }
5377 uint64_t  __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_get_ok"))) TS_CResult_OutPointDecodeErrorZ_get_ok(uint64_t owner) {
5378         LDKCResult_OutPointDecodeErrorZ* owner_conv = (LDKCResult_OutPointDecodeErrorZ*)untag_ptr(owner);
5379         LDKOutPoint ret_var = CResult_OutPointDecodeErrorZ_get_ok(owner_conv);
5380         uint64_t ret_ref = 0;
5381         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5382         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5383         return ret_ref;
5384 }
5385
5386 static inline struct LDKDecodeError CResult_OutPointDecodeErrorZ_get_err(LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR owner){
5387         LDKDecodeError ret = *owner->contents.err;
5388         ret.is_owned = false;
5389         return ret;
5390 }
5391 uint64_t  __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_get_err"))) TS_CResult_OutPointDecodeErrorZ_get_err(uint64_t owner) {
5392         LDKCResult_OutPointDecodeErrorZ* owner_conv = (LDKCResult_OutPointDecodeErrorZ*)untag_ptr(owner);
5393         LDKDecodeError ret_var = CResult_OutPointDecodeErrorZ_get_err(owner_conv);
5394         uint64_t ret_ref = 0;
5395         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5396         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5397         return ret_ref;
5398 }
5399
5400 typedef struct LDKType_JCalls {
5401         atomic_size_t refcnt;
5402         uint32_t instance_ptr;
5403 } LDKType_JCalls;
5404 static void LDKType_JCalls_free(void* this_arg) {
5405         LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
5406         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5407                 FREE(j_calls);
5408         }
5409 }
5410 uint16_t type_id_LDKType_jcall(const void* this_arg) {
5411         LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
5412         return js_invoke_function_uuuuuu(j_calls->instance_ptr, 29, 0, 0, 0, 0, 0, 0);
5413 }
5414 LDKStr debug_str_LDKType_jcall(const void* this_arg) {
5415         LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
5416         jstring ret = (jstring)js_invoke_function_uuuuuu(j_calls->instance_ptr, 30, 0, 0, 0, 0, 0, 0);
5417         LDKStr ret_conv = str_ref_to_owned_c(ret);
5418         return ret_conv;
5419 }
5420 LDKCVec_u8Z write_LDKType_jcall(const void* this_arg) {
5421         LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
5422         int8_tArray ret = (int8_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 31, 0, 0, 0, 0, 0, 0);
5423         LDKCVec_u8Z ret_ref;
5424         ret_ref.datalen = ret->arr_len;
5425         ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
5426         memcpy(ret_ref.data, ret->elems, ret_ref.datalen); FREE(ret);
5427         return ret_ref;
5428 }
5429 static void LDKType_JCalls_cloned(LDKType* new_obj) {
5430         LDKType_JCalls *j_calls = (LDKType_JCalls*) new_obj->this_arg;
5431         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5432 }
5433 static inline LDKType LDKType_init (JSValue o) {
5434         LDKType_JCalls *calls = MALLOC(sizeof(LDKType_JCalls), "LDKType_JCalls");
5435         atomic_init(&calls->refcnt, 1);
5436         calls->instance_ptr = o;
5437
5438         LDKType ret = {
5439                 .this_arg = (void*) calls,
5440                 .type_id = type_id_LDKType_jcall,
5441                 .debug_str = debug_str_LDKType_jcall,
5442                 .write = write_LDKType_jcall,
5443                 .cloned = LDKType_JCalls_cloned,
5444                 .free = LDKType_JCalls_free,
5445         };
5446         return ret;
5447 }
5448 uint64_t  __attribute__((export_name("TS_LDKType_new"))) TS_LDKType_new(JSValue o) {
5449         LDKType *res_ptr = MALLOC(sizeof(LDKType), "LDKType");
5450         *res_ptr = LDKType_init(o);
5451         return tag_ptr(res_ptr, true);
5452 }
5453 int16_t  __attribute__((export_name("TS_Type_type_id"))) TS_Type_type_id(uint64_t this_arg) {
5454         void* this_arg_ptr = untag_ptr(this_arg);
5455         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5456         LDKType* this_arg_conv = (LDKType*)this_arg_ptr;
5457         int16_t ret_conv = (this_arg_conv->type_id)(this_arg_conv->this_arg);
5458         return ret_conv;
5459 }
5460
5461 jstring  __attribute__((export_name("TS_Type_debug_str"))) TS_Type_debug_str(uint64_t this_arg) {
5462         void* this_arg_ptr = untag_ptr(this_arg);
5463         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5464         LDKType* this_arg_conv = (LDKType*)this_arg_ptr;
5465         LDKStr ret_str = (this_arg_conv->debug_str)(this_arg_conv->this_arg);
5466         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
5467         Str_free(ret_str);
5468         return ret_conv;
5469 }
5470
5471 int8_tArray  __attribute__((export_name("TS_Type_write"))) TS_Type_write(uint64_t this_arg) {
5472         void* this_arg_ptr = untag_ptr(this_arg);
5473         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5474         LDKType* this_arg_conv = (LDKType*)this_arg_ptr;
5475         LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
5476         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
5477         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
5478         CVec_u8Z_free(ret_var);
5479         return ret_arr;
5480 }
5481
5482 uint32_t __attribute__((export_name("TS_LDKCOption_TypeZ_ty_from_ptr"))) TS_LDKCOption_TypeZ_ty_from_ptr(uint64_t ptr) {
5483         LDKCOption_TypeZ *obj = (LDKCOption_TypeZ*)untag_ptr(ptr);
5484         switch(obj->tag) {
5485                 case LDKCOption_TypeZ_Some: return 0;
5486                 case LDKCOption_TypeZ_None: return 1;
5487                 default: abort();
5488         }
5489 }
5490 uint64_t __attribute__((export_name("TS_LDKCOption_TypeZ_Some_get_some"))) TS_LDKCOption_TypeZ_Some_get_some(uint64_t ptr) {
5491         LDKCOption_TypeZ *obj = (LDKCOption_TypeZ*)untag_ptr(ptr);
5492         assert(obj->tag == LDKCOption_TypeZ_Some);
5493                         LDKType* some_ret = MALLOC(sizeof(LDKType), "LDKType");
5494                         *some_ret = Type_clone(&obj->some);
5495         return tag_ptr(some_ret, true);
5496 }
5497 static inline struct LDKCOption_TypeZ CResult_COption_TypeZDecodeErrorZ_get_ok(LDKCResult_COption_TypeZDecodeErrorZ *NONNULL_PTR owner){
5498 CHECK(owner->result_ok);
5499         return COption_TypeZ_clone(&*owner->contents.result);
5500 }
5501 uint64_t  __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_get_ok"))) TS_CResult_COption_TypeZDecodeErrorZ_get_ok(uint64_t owner) {
5502         LDKCResult_COption_TypeZDecodeErrorZ* owner_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)untag_ptr(owner);
5503         LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
5504         *ret_copy = CResult_COption_TypeZDecodeErrorZ_get_ok(owner_conv);
5505         uint64_t ret_ref = tag_ptr(ret_copy, true);
5506         return ret_ref;
5507 }
5508
5509 static inline struct LDKDecodeError CResult_COption_TypeZDecodeErrorZ_get_err(LDKCResult_COption_TypeZDecodeErrorZ *NONNULL_PTR owner){
5510         LDKDecodeError ret = *owner->contents.err;
5511         ret.is_owned = false;
5512         return ret;
5513 }
5514 uint64_t  __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_get_err"))) TS_CResult_COption_TypeZDecodeErrorZ_get_err(uint64_t owner) {
5515         LDKCResult_COption_TypeZDecodeErrorZ* owner_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)untag_ptr(owner);
5516         LDKDecodeError ret_var = CResult_COption_TypeZDecodeErrorZ_get_err(owner_conv);
5517         uint64_t ret_ref = 0;
5518         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5519         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5520         return ret_ref;
5521 }
5522
5523 uint32_t __attribute__((export_name("TS_LDKPaymentError_ty_from_ptr"))) TS_LDKPaymentError_ty_from_ptr(uint64_t ptr) {
5524         LDKPaymentError *obj = (LDKPaymentError*)untag_ptr(ptr);
5525         switch(obj->tag) {
5526                 case LDKPaymentError_Invoice: return 0;
5527                 case LDKPaymentError_Routing: return 1;
5528                 case LDKPaymentError_Sending: return 2;
5529                 default: abort();
5530         }
5531 }
5532 jstring __attribute__((export_name("TS_LDKPaymentError_Invoice_get_invoice"))) TS_LDKPaymentError_Invoice_get_invoice(uint64_t ptr) {
5533         LDKPaymentError *obj = (LDKPaymentError*)untag_ptr(ptr);
5534         assert(obj->tag == LDKPaymentError_Invoice);
5535                         LDKStr invoice_str = obj->invoice;
5536                         jstring invoice_conv = str_ref_to_ts(invoice_str.chars, invoice_str.len);
5537         return invoice_conv;
5538 }
5539 uint64_t __attribute__((export_name("TS_LDKPaymentError_Routing_get_routing"))) TS_LDKPaymentError_Routing_get_routing(uint64_t ptr) {
5540         LDKPaymentError *obj = (LDKPaymentError*)untag_ptr(ptr);
5541         assert(obj->tag == LDKPaymentError_Routing);
5542                         LDKLightningError routing_var = obj->routing;
5543                         uint64_t routing_ref = 0;
5544                         CHECK_INNER_FIELD_ACCESS_OR_NULL(routing_var);
5545                         routing_ref = tag_ptr(routing_var.inner, false);
5546         return routing_ref;
5547 }
5548 uint64_t __attribute__((export_name("TS_LDKPaymentError_Sending_get_sending"))) TS_LDKPaymentError_Sending_get_sending(uint64_t ptr) {
5549         LDKPaymentError *obj = (LDKPaymentError*)untag_ptr(ptr);
5550         assert(obj->tag == LDKPaymentError_Sending);
5551                         uint64_t sending_ref = tag_ptr(&obj->sending, false);
5552         return sending_ref;
5553 }
5554 static inline struct LDKThirtyTwoBytes CResult_PaymentIdPaymentErrorZ_get_ok(LDKCResult_PaymentIdPaymentErrorZ *NONNULL_PTR owner){
5555 CHECK(owner->result_ok);
5556         return ThirtyTwoBytes_clone(&*owner->contents.result);
5557 }
5558 int8_tArray  __attribute__((export_name("TS_CResult_PaymentIdPaymentErrorZ_get_ok"))) TS_CResult_PaymentIdPaymentErrorZ_get_ok(uint64_t owner) {
5559         LDKCResult_PaymentIdPaymentErrorZ* owner_conv = (LDKCResult_PaymentIdPaymentErrorZ*)untag_ptr(owner);
5560         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
5561         memcpy(ret_arr->elems, CResult_PaymentIdPaymentErrorZ_get_ok(owner_conv).data, 32);
5562         return ret_arr;
5563 }
5564
5565 static inline struct LDKPaymentError CResult_PaymentIdPaymentErrorZ_get_err(LDKCResult_PaymentIdPaymentErrorZ *NONNULL_PTR owner){
5566 CHECK(!owner->result_ok);
5567         return PaymentError_clone(&*owner->contents.err);
5568 }
5569 uint64_t  __attribute__((export_name("TS_CResult_PaymentIdPaymentErrorZ_get_err"))) TS_CResult_PaymentIdPaymentErrorZ_get_err(uint64_t owner) {
5570         LDKCResult_PaymentIdPaymentErrorZ* owner_conv = (LDKCResult_PaymentIdPaymentErrorZ*)untag_ptr(owner);
5571         LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
5572         *ret_copy = CResult_PaymentIdPaymentErrorZ_get_err(owner_conv);
5573         uint64_t ret_ref = tag_ptr(ret_copy, true);
5574         return ret_ref;
5575 }
5576
5577 uint32_t __attribute__((export_name("TS_LDKParseError_ty_from_ptr"))) TS_LDKParseError_ty_from_ptr(uint64_t ptr) {
5578         LDKParseError *obj = (LDKParseError*)untag_ptr(ptr);
5579         switch(obj->tag) {
5580                 case LDKParseError_Bech32Error: return 0;
5581                 case LDKParseError_ParseAmountError: return 1;
5582                 case LDKParseError_MalformedSignature: return 2;
5583                 case LDKParseError_BadPrefix: return 3;
5584                 case LDKParseError_UnknownCurrency: return 4;
5585                 case LDKParseError_UnknownSiPrefix: return 5;
5586                 case LDKParseError_MalformedHRP: return 6;
5587                 case LDKParseError_TooShortDataPart: return 7;
5588                 case LDKParseError_UnexpectedEndOfTaggedFields: return 8;
5589                 case LDKParseError_DescriptionDecodeError: return 9;
5590                 case LDKParseError_PaddingError: return 10;
5591                 case LDKParseError_IntegerOverflowError: return 11;
5592                 case LDKParseError_InvalidSegWitProgramLength: return 12;
5593                 case LDKParseError_InvalidPubKeyHashLength: return 13;
5594                 case LDKParseError_InvalidScriptHashLength: return 14;
5595                 case LDKParseError_InvalidRecoveryId: return 15;
5596                 case LDKParseError_InvalidSliceLength: return 16;
5597                 case LDKParseError_Skip: return 17;
5598                 default: abort();
5599         }
5600 }
5601 uint64_t __attribute__((export_name("TS_LDKParseError_Bech32Error_get_bech32_error"))) TS_LDKParseError_Bech32Error_get_bech32_error(uint64_t ptr) {
5602         LDKParseError *obj = (LDKParseError*)untag_ptr(ptr);
5603         assert(obj->tag == LDKParseError_Bech32Error);
5604                         uint64_t bech32_error_ref = tag_ptr(&obj->bech32_error, false);
5605         return bech32_error_ref;
5606 }
5607 int32_t __attribute__((export_name("TS_LDKParseError_ParseAmountError_get_parse_amount_error"))) TS_LDKParseError_ParseAmountError_get_parse_amount_error(uint64_t ptr) {
5608         LDKParseError *obj = (LDKParseError*)untag_ptr(ptr);
5609         assert(obj->tag == LDKParseError_ParseAmountError);
5610                         /*obj->parse_amount_error*/
5611         return 0;
5612 }
5613 uint32_t __attribute__((export_name("TS_LDKParseError_MalformedSignature_get_malformed_signature"))) TS_LDKParseError_MalformedSignature_get_malformed_signature(uint64_t ptr) {
5614         LDKParseError *obj = (LDKParseError*)untag_ptr(ptr);
5615         assert(obj->tag == LDKParseError_MalformedSignature);
5616                         uint32_t malformed_signature_conv = LDKSecp256k1Error_to_js(obj->malformed_signature);
5617         return malformed_signature_conv;
5618 }
5619 int32_t __attribute__((export_name("TS_LDKParseError_DescriptionDecodeError_get_description_decode_error"))) TS_LDKParseError_DescriptionDecodeError_get_description_decode_error(uint64_t ptr) {
5620         LDKParseError *obj = (LDKParseError*)untag_ptr(ptr);
5621         assert(obj->tag == LDKParseError_DescriptionDecodeError);
5622                         /*obj->description_decode_error*/
5623         return 0;
5624 }
5625 jstring __attribute__((export_name("TS_LDKParseError_InvalidSliceLength_get_invalid_slice_length"))) TS_LDKParseError_InvalidSliceLength_get_invalid_slice_length(uint64_t ptr) {
5626         LDKParseError *obj = (LDKParseError*)untag_ptr(ptr);
5627         assert(obj->tag == LDKParseError_InvalidSliceLength);
5628                         LDKStr invalid_slice_length_str = obj->invalid_slice_length;
5629                         jstring invalid_slice_length_conv = str_ref_to_ts(invalid_slice_length_str.chars, invalid_slice_length_str.len);
5630         return invalid_slice_length_conv;
5631 }
5632 static inline enum LDKSiPrefix CResult_SiPrefixParseErrorZ_get_ok(LDKCResult_SiPrefixParseErrorZ *NONNULL_PTR owner){
5633 CHECK(owner->result_ok);
5634         return SiPrefix_clone(&*owner->contents.result);
5635 }
5636 uint32_t  __attribute__((export_name("TS_CResult_SiPrefixParseErrorZ_get_ok"))) TS_CResult_SiPrefixParseErrorZ_get_ok(uint64_t owner) {
5637         LDKCResult_SiPrefixParseErrorZ* owner_conv = (LDKCResult_SiPrefixParseErrorZ*)untag_ptr(owner);
5638         uint32_t ret_conv = LDKSiPrefix_to_js(CResult_SiPrefixParseErrorZ_get_ok(owner_conv));
5639         return ret_conv;
5640 }
5641
5642 static inline struct LDKParseError CResult_SiPrefixParseErrorZ_get_err(LDKCResult_SiPrefixParseErrorZ *NONNULL_PTR owner){
5643 CHECK(!owner->result_ok);
5644         return ParseError_clone(&*owner->contents.err);
5645 }
5646 uint64_t  __attribute__((export_name("TS_CResult_SiPrefixParseErrorZ_get_err"))) TS_CResult_SiPrefixParseErrorZ_get_err(uint64_t owner) {
5647         LDKCResult_SiPrefixParseErrorZ* owner_conv = (LDKCResult_SiPrefixParseErrorZ*)untag_ptr(owner);
5648         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
5649         *ret_copy = CResult_SiPrefixParseErrorZ_get_err(owner_conv);
5650         uint64_t ret_ref = tag_ptr(ret_copy, true);
5651         return ret_ref;
5652 }
5653
5654 uint32_t __attribute__((export_name("TS_LDKParseOrSemanticError_ty_from_ptr"))) TS_LDKParseOrSemanticError_ty_from_ptr(uint64_t ptr) {
5655         LDKParseOrSemanticError *obj = (LDKParseOrSemanticError*)untag_ptr(ptr);
5656         switch(obj->tag) {
5657                 case LDKParseOrSemanticError_ParseError: return 0;
5658                 case LDKParseOrSemanticError_SemanticError: return 1;
5659                 default: abort();
5660         }
5661 }
5662 uint64_t __attribute__((export_name("TS_LDKParseOrSemanticError_ParseError_get_parse_error"))) TS_LDKParseOrSemanticError_ParseError_get_parse_error(uint64_t ptr) {
5663         LDKParseOrSemanticError *obj = (LDKParseOrSemanticError*)untag_ptr(ptr);
5664         assert(obj->tag == LDKParseOrSemanticError_ParseError);
5665                         uint64_t parse_error_ref = tag_ptr(&obj->parse_error, false);
5666         return parse_error_ref;
5667 }
5668 uint32_t __attribute__((export_name("TS_LDKParseOrSemanticError_SemanticError_get_semantic_error"))) TS_LDKParseOrSemanticError_SemanticError_get_semantic_error(uint64_t ptr) {
5669         LDKParseOrSemanticError *obj = (LDKParseOrSemanticError*)untag_ptr(ptr);
5670         assert(obj->tag == LDKParseOrSemanticError_SemanticError);
5671                         uint32_t semantic_error_conv = LDKSemanticError_to_js(obj->semantic_error);
5672         return semantic_error_conv;
5673 }
5674 static inline struct LDKInvoice CResult_InvoiceParseOrSemanticErrorZ_get_ok(LDKCResult_InvoiceParseOrSemanticErrorZ *NONNULL_PTR owner){
5675         LDKInvoice ret = *owner->contents.result;
5676         ret.is_owned = false;
5677         return ret;
5678 }
5679 uint64_t  __attribute__((export_name("TS_CResult_InvoiceParseOrSemanticErrorZ_get_ok"))) TS_CResult_InvoiceParseOrSemanticErrorZ_get_ok(uint64_t owner) {
5680         LDKCResult_InvoiceParseOrSemanticErrorZ* owner_conv = (LDKCResult_InvoiceParseOrSemanticErrorZ*)untag_ptr(owner);
5681         LDKInvoice ret_var = CResult_InvoiceParseOrSemanticErrorZ_get_ok(owner_conv);
5682         uint64_t ret_ref = 0;
5683         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5684         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5685         return ret_ref;
5686 }
5687
5688 static inline struct LDKParseOrSemanticError CResult_InvoiceParseOrSemanticErrorZ_get_err(LDKCResult_InvoiceParseOrSemanticErrorZ *NONNULL_PTR owner){
5689 CHECK(!owner->result_ok);
5690         return ParseOrSemanticError_clone(&*owner->contents.err);
5691 }
5692 uint64_t  __attribute__((export_name("TS_CResult_InvoiceParseOrSemanticErrorZ_get_err"))) TS_CResult_InvoiceParseOrSemanticErrorZ_get_err(uint64_t owner) {
5693         LDKCResult_InvoiceParseOrSemanticErrorZ* owner_conv = (LDKCResult_InvoiceParseOrSemanticErrorZ*)untag_ptr(owner);
5694         LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
5695         *ret_copy = CResult_InvoiceParseOrSemanticErrorZ_get_err(owner_conv);
5696         uint64_t ret_ref = tag_ptr(ret_copy, true);
5697         return ret_ref;
5698 }
5699
5700 static inline struct LDKSignedRawInvoice CResult_SignedRawInvoiceParseErrorZ_get_ok(LDKCResult_SignedRawInvoiceParseErrorZ *NONNULL_PTR owner){
5701         LDKSignedRawInvoice ret = *owner->contents.result;
5702         ret.is_owned = false;
5703         return ret;
5704 }
5705 uint64_t  __attribute__((export_name("TS_CResult_SignedRawInvoiceParseErrorZ_get_ok"))) TS_CResult_SignedRawInvoiceParseErrorZ_get_ok(uint64_t owner) {
5706         LDKCResult_SignedRawInvoiceParseErrorZ* owner_conv = (LDKCResult_SignedRawInvoiceParseErrorZ*)untag_ptr(owner);
5707         LDKSignedRawInvoice ret_var = CResult_SignedRawInvoiceParseErrorZ_get_ok(owner_conv);
5708         uint64_t ret_ref = 0;
5709         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5710         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5711         return ret_ref;
5712 }
5713
5714 static inline struct LDKParseError CResult_SignedRawInvoiceParseErrorZ_get_err(LDKCResult_SignedRawInvoiceParseErrorZ *NONNULL_PTR owner){
5715 CHECK(!owner->result_ok);
5716         return ParseError_clone(&*owner->contents.err);
5717 }
5718 uint64_t  __attribute__((export_name("TS_CResult_SignedRawInvoiceParseErrorZ_get_err"))) TS_CResult_SignedRawInvoiceParseErrorZ_get_err(uint64_t owner) {
5719         LDKCResult_SignedRawInvoiceParseErrorZ* owner_conv = (LDKCResult_SignedRawInvoiceParseErrorZ*)untag_ptr(owner);
5720         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
5721         *ret_copy = CResult_SignedRawInvoiceParseErrorZ_get_err(owner_conv);
5722         uint64_t ret_ref = tag_ptr(ret_copy, true);
5723         return ret_ref;
5724 }
5725
5726 static inline struct LDKRawInvoice C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_a(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *NONNULL_PTR owner){
5727         LDKRawInvoice ret = owner->a;
5728         ret.is_owned = false;
5729         return ret;
5730 }
5731 uint64_t  __attribute__((export_name("TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_a"))) TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_a(uint64_t owner) {
5732         LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* owner_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)untag_ptr(owner);
5733         LDKRawInvoice ret_var = C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_a(owner_conv);
5734         uint64_t ret_ref = 0;
5735         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5736         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5737         return ret_ref;
5738 }
5739
5740 static inline struct LDKThirtyTwoBytes C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_b(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *NONNULL_PTR owner){
5741         return ThirtyTwoBytes_clone(&owner->b);
5742 }
5743 int8_tArray  __attribute__((export_name("TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_b"))) TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_b(uint64_t owner) {
5744         LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* owner_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)untag_ptr(owner);
5745         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
5746         memcpy(ret_arr->elems, C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_b(owner_conv).data, 32);
5747         return ret_arr;
5748 }
5749
5750 static inline struct LDKInvoiceSignature C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_c(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *NONNULL_PTR owner){
5751         LDKInvoiceSignature ret = owner->c;
5752         ret.is_owned = false;
5753         return ret;
5754 }
5755 uint64_t  __attribute__((export_name("TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_c"))) TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_c(uint64_t owner) {
5756         LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* owner_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)untag_ptr(owner);
5757         LDKInvoiceSignature ret_var = C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_c(owner_conv);
5758         uint64_t ret_ref = 0;
5759         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5760         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5761         return ret_ref;
5762 }
5763
5764 static inline struct LDKPayeePubKey CResult_PayeePubKeyErrorZ_get_ok(LDKCResult_PayeePubKeyErrorZ *NONNULL_PTR owner){
5765         LDKPayeePubKey ret = *owner->contents.result;
5766         ret.is_owned = false;
5767         return ret;
5768 }
5769 uint64_t  __attribute__((export_name("TS_CResult_PayeePubKeyErrorZ_get_ok"))) TS_CResult_PayeePubKeyErrorZ_get_ok(uint64_t owner) {
5770         LDKCResult_PayeePubKeyErrorZ* owner_conv = (LDKCResult_PayeePubKeyErrorZ*)untag_ptr(owner);
5771         LDKPayeePubKey ret_var = CResult_PayeePubKeyErrorZ_get_ok(owner_conv);
5772         uint64_t ret_ref = 0;
5773         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5774         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5775         return ret_ref;
5776 }
5777
5778 static inline enum LDKSecp256k1Error CResult_PayeePubKeyErrorZ_get_err(LDKCResult_PayeePubKeyErrorZ *NONNULL_PTR owner){
5779 CHECK(!owner->result_ok);
5780         return *owner->contents.err;
5781 }
5782 uint32_t  __attribute__((export_name("TS_CResult_PayeePubKeyErrorZ_get_err"))) TS_CResult_PayeePubKeyErrorZ_get_err(uint64_t owner) {
5783         LDKCResult_PayeePubKeyErrorZ* owner_conv = (LDKCResult_PayeePubKeyErrorZ*)untag_ptr(owner);
5784         uint32_t ret_conv = LDKSecp256k1Error_to_js(CResult_PayeePubKeyErrorZ_get_err(owner_conv));
5785         return ret_conv;
5786 }
5787
5788 static inline LDKCVec_PrivateRouteZ CVec_PrivateRouteZ_clone(const LDKCVec_PrivateRouteZ *orig) {
5789         LDKCVec_PrivateRouteZ ret = { .data = MALLOC(sizeof(LDKPrivateRoute) * orig->datalen, "LDKCVec_PrivateRouteZ clone bytes"), .datalen = orig->datalen };
5790         for (size_t i = 0; i < ret.datalen; i++) {
5791                 ret.data[i] = PrivateRoute_clone(&orig->data[i]);
5792         }
5793         return ret;
5794 }
5795 static inline struct LDKPositiveTimestamp CResult_PositiveTimestampCreationErrorZ_get_ok(LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR owner){
5796         LDKPositiveTimestamp ret = *owner->contents.result;
5797         ret.is_owned = false;
5798         return ret;
5799 }
5800 uint64_t  __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_get_ok"))) TS_CResult_PositiveTimestampCreationErrorZ_get_ok(uint64_t owner) {
5801         LDKCResult_PositiveTimestampCreationErrorZ* owner_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)untag_ptr(owner);
5802         LDKPositiveTimestamp ret_var = CResult_PositiveTimestampCreationErrorZ_get_ok(owner_conv);
5803         uint64_t ret_ref = 0;
5804         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5805         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5806         return ret_ref;
5807 }
5808
5809 static inline enum LDKCreationError CResult_PositiveTimestampCreationErrorZ_get_err(LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR owner){
5810 CHECK(!owner->result_ok);
5811         return CreationError_clone(&*owner->contents.err);
5812 }
5813 uint32_t  __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_get_err"))) TS_CResult_PositiveTimestampCreationErrorZ_get_err(uint64_t owner) {
5814         LDKCResult_PositiveTimestampCreationErrorZ* owner_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)untag_ptr(owner);
5815         uint32_t ret_conv = LDKCreationError_to_js(CResult_PositiveTimestampCreationErrorZ_get_err(owner_conv));
5816         return ret_conv;
5817 }
5818
5819 static inline void CResult_NoneSemanticErrorZ_get_ok(LDKCResult_NoneSemanticErrorZ *NONNULL_PTR owner){
5820 CHECK(owner->result_ok);
5821         return *owner->contents.result;
5822 }
5823 void  __attribute__((export_name("TS_CResult_NoneSemanticErrorZ_get_ok"))) TS_CResult_NoneSemanticErrorZ_get_ok(uint64_t owner) {
5824         LDKCResult_NoneSemanticErrorZ* owner_conv = (LDKCResult_NoneSemanticErrorZ*)untag_ptr(owner);
5825         CResult_NoneSemanticErrorZ_get_ok(owner_conv);
5826 }
5827
5828 static inline enum LDKSemanticError CResult_NoneSemanticErrorZ_get_err(LDKCResult_NoneSemanticErrorZ *NONNULL_PTR owner){
5829 CHECK(!owner->result_ok);
5830         return SemanticError_clone(&*owner->contents.err);
5831 }
5832 uint32_t  __attribute__((export_name("TS_CResult_NoneSemanticErrorZ_get_err"))) TS_CResult_NoneSemanticErrorZ_get_err(uint64_t owner) {
5833         LDKCResult_NoneSemanticErrorZ* owner_conv = (LDKCResult_NoneSemanticErrorZ*)untag_ptr(owner);
5834         uint32_t ret_conv = LDKSemanticError_to_js(CResult_NoneSemanticErrorZ_get_err(owner_conv));
5835         return ret_conv;
5836 }
5837
5838 static inline struct LDKInvoice CResult_InvoiceSemanticErrorZ_get_ok(LDKCResult_InvoiceSemanticErrorZ *NONNULL_PTR owner){
5839         LDKInvoice ret = *owner->contents.result;
5840         ret.is_owned = false;
5841         return ret;
5842 }
5843 uint64_t  __attribute__((export_name("TS_CResult_InvoiceSemanticErrorZ_get_ok"))) TS_CResult_InvoiceSemanticErrorZ_get_ok(uint64_t owner) {
5844         LDKCResult_InvoiceSemanticErrorZ* owner_conv = (LDKCResult_InvoiceSemanticErrorZ*)untag_ptr(owner);
5845         LDKInvoice ret_var = CResult_InvoiceSemanticErrorZ_get_ok(owner_conv);
5846         uint64_t ret_ref = 0;
5847         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5848         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5849         return ret_ref;
5850 }
5851
5852 static inline enum LDKSemanticError CResult_InvoiceSemanticErrorZ_get_err(LDKCResult_InvoiceSemanticErrorZ *NONNULL_PTR owner){
5853 CHECK(!owner->result_ok);
5854         return SemanticError_clone(&*owner->contents.err);
5855 }
5856 uint32_t  __attribute__((export_name("TS_CResult_InvoiceSemanticErrorZ_get_err"))) TS_CResult_InvoiceSemanticErrorZ_get_err(uint64_t owner) {
5857         LDKCResult_InvoiceSemanticErrorZ* owner_conv = (LDKCResult_InvoiceSemanticErrorZ*)untag_ptr(owner);
5858         uint32_t ret_conv = LDKSemanticError_to_js(CResult_InvoiceSemanticErrorZ_get_err(owner_conv));
5859         return ret_conv;
5860 }
5861
5862 static inline struct LDKDescription CResult_DescriptionCreationErrorZ_get_ok(LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR owner){
5863         LDKDescription ret = *owner->contents.result;
5864         ret.is_owned = false;
5865         return ret;
5866 }
5867 uint64_t  __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_get_ok"))) TS_CResult_DescriptionCreationErrorZ_get_ok(uint64_t owner) {
5868         LDKCResult_DescriptionCreationErrorZ* owner_conv = (LDKCResult_DescriptionCreationErrorZ*)untag_ptr(owner);
5869         LDKDescription ret_var = CResult_DescriptionCreationErrorZ_get_ok(owner_conv);
5870         uint64_t ret_ref = 0;
5871         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5872         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5873         return ret_ref;
5874 }
5875
5876 static inline enum LDKCreationError CResult_DescriptionCreationErrorZ_get_err(LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR owner){
5877 CHECK(!owner->result_ok);
5878         return CreationError_clone(&*owner->contents.err);
5879 }
5880 uint32_t  __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_get_err"))) TS_CResult_DescriptionCreationErrorZ_get_err(uint64_t owner) {
5881         LDKCResult_DescriptionCreationErrorZ* owner_conv = (LDKCResult_DescriptionCreationErrorZ*)untag_ptr(owner);
5882         uint32_t ret_conv = LDKCreationError_to_js(CResult_DescriptionCreationErrorZ_get_err(owner_conv));
5883         return ret_conv;
5884 }
5885
5886 static inline struct LDKPrivateRoute CResult_PrivateRouteCreationErrorZ_get_ok(LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR owner){
5887         LDKPrivateRoute ret = *owner->contents.result;
5888         ret.is_owned = false;
5889         return ret;
5890 }
5891 uint64_t  __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_get_ok"))) TS_CResult_PrivateRouteCreationErrorZ_get_ok(uint64_t owner) {
5892         LDKCResult_PrivateRouteCreationErrorZ* owner_conv = (LDKCResult_PrivateRouteCreationErrorZ*)untag_ptr(owner);
5893         LDKPrivateRoute ret_var = CResult_PrivateRouteCreationErrorZ_get_ok(owner_conv);
5894         uint64_t ret_ref = 0;
5895         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5896         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5897         return ret_ref;
5898 }
5899
5900 static inline enum LDKCreationError CResult_PrivateRouteCreationErrorZ_get_err(LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR owner){
5901 CHECK(!owner->result_ok);
5902         return CreationError_clone(&*owner->contents.err);
5903 }
5904 uint32_t  __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_get_err"))) TS_CResult_PrivateRouteCreationErrorZ_get_err(uint64_t owner) {
5905         LDKCResult_PrivateRouteCreationErrorZ* owner_conv = (LDKCResult_PrivateRouteCreationErrorZ*)untag_ptr(owner);
5906         uint32_t ret_conv = LDKCreationError_to_js(CResult_PrivateRouteCreationErrorZ_get_err(owner_conv));
5907         return ret_conv;
5908 }
5909
5910 static inline struct LDKStr CResult_StringErrorZ_get_ok(LDKCResult_StringErrorZ *NONNULL_PTR owner){
5911 CHECK(owner->result_ok);
5912         return *owner->contents.result;
5913 }
5914 jstring  __attribute__((export_name("TS_CResult_StringErrorZ_get_ok"))) TS_CResult_StringErrorZ_get_ok(uint64_t owner) {
5915         LDKCResult_StringErrorZ* owner_conv = (LDKCResult_StringErrorZ*)untag_ptr(owner);
5916         LDKStr ret_str = CResult_StringErrorZ_get_ok(owner_conv);
5917         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
5918         return ret_conv;
5919 }
5920
5921 static inline enum LDKSecp256k1Error CResult_StringErrorZ_get_err(LDKCResult_StringErrorZ *NONNULL_PTR owner){
5922 CHECK(!owner->result_ok);
5923         return *owner->contents.err;
5924 }
5925 uint32_t  __attribute__((export_name("TS_CResult_StringErrorZ_get_err"))) TS_CResult_StringErrorZ_get_err(uint64_t owner) {
5926         LDKCResult_StringErrorZ* owner_conv = (LDKCResult_StringErrorZ*)untag_ptr(owner);
5927         uint32_t ret_conv = LDKSecp256k1Error_to_js(CResult_StringErrorZ_get_err(owner_conv));
5928         return ret_conv;
5929 }
5930
5931 static inline struct LDKChannelMonitorUpdate CResult_ChannelMonitorUpdateDecodeErrorZ_get_ok(LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR owner){
5932         LDKChannelMonitorUpdate ret = *owner->contents.result;
5933         ret.is_owned = false;
5934         return ret;
5935 }
5936 uint64_t  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_get_ok"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_get_ok(uint64_t owner) {
5937         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)untag_ptr(owner);
5938         LDKChannelMonitorUpdate ret_var = CResult_ChannelMonitorUpdateDecodeErrorZ_get_ok(owner_conv);
5939         uint64_t ret_ref = 0;
5940         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5941         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5942         return ret_ref;
5943 }
5944
5945 static inline struct LDKDecodeError CResult_ChannelMonitorUpdateDecodeErrorZ_get_err(LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR owner){
5946         LDKDecodeError ret = *owner->contents.err;
5947         ret.is_owned = false;
5948         return ret;
5949 }
5950 uint64_t  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_get_err"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_get_err(uint64_t owner) {
5951         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)untag_ptr(owner);
5952         LDKDecodeError ret_var = CResult_ChannelMonitorUpdateDecodeErrorZ_get_err(owner_conv);
5953         uint64_t ret_ref = 0;
5954         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5955         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5956         return ret_ref;
5957 }
5958
5959 uint32_t __attribute__((export_name("TS_LDKCOption_MonitorEventZ_ty_from_ptr"))) TS_LDKCOption_MonitorEventZ_ty_from_ptr(uint64_t ptr) {
5960         LDKCOption_MonitorEventZ *obj = (LDKCOption_MonitorEventZ*)untag_ptr(ptr);
5961         switch(obj->tag) {
5962                 case LDKCOption_MonitorEventZ_Some: return 0;
5963                 case LDKCOption_MonitorEventZ_None: return 1;
5964                 default: abort();
5965         }
5966 }
5967 uint64_t __attribute__((export_name("TS_LDKCOption_MonitorEventZ_Some_get_some"))) TS_LDKCOption_MonitorEventZ_Some_get_some(uint64_t ptr) {
5968         LDKCOption_MonitorEventZ *obj = (LDKCOption_MonitorEventZ*)untag_ptr(ptr);
5969         assert(obj->tag == LDKCOption_MonitorEventZ_Some);
5970                         uint64_t some_ref = tag_ptr(&obj->some, false);
5971         return some_ref;
5972 }
5973 static inline struct LDKCOption_MonitorEventZ CResult_COption_MonitorEventZDecodeErrorZ_get_ok(LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR owner){
5974 CHECK(owner->result_ok);
5975         return COption_MonitorEventZ_clone(&*owner->contents.result);
5976 }
5977 uint64_t  __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_get_ok"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_get_ok(uint64_t owner) {
5978         LDKCResult_COption_MonitorEventZDecodeErrorZ* owner_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)untag_ptr(owner);
5979         LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
5980         *ret_copy = CResult_COption_MonitorEventZDecodeErrorZ_get_ok(owner_conv);
5981         uint64_t ret_ref = tag_ptr(ret_copy, true);
5982         return ret_ref;
5983 }
5984
5985 static inline struct LDKDecodeError CResult_COption_MonitorEventZDecodeErrorZ_get_err(LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR owner){
5986         LDKDecodeError ret = *owner->contents.err;
5987         ret.is_owned = false;
5988         return ret;
5989 }
5990 uint64_t  __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_get_err"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_get_err(uint64_t owner) {
5991         LDKCResult_COption_MonitorEventZDecodeErrorZ* owner_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)untag_ptr(owner);
5992         LDKDecodeError ret_var = CResult_COption_MonitorEventZDecodeErrorZ_get_err(owner_conv);
5993         uint64_t ret_ref = 0;
5994         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5995         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5996         return ret_ref;
5997 }
5998
5999 static inline struct LDKHTLCUpdate CResult_HTLCUpdateDecodeErrorZ_get_ok(LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR owner){
6000         LDKHTLCUpdate ret = *owner->contents.result;
6001         ret.is_owned = false;
6002         return ret;
6003 }
6004 uint64_t  __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_get_ok"))) TS_CResult_HTLCUpdateDecodeErrorZ_get_ok(uint64_t owner) {
6005         LDKCResult_HTLCUpdateDecodeErrorZ* owner_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)untag_ptr(owner);
6006         LDKHTLCUpdate ret_var = CResult_HTLCUpdateDecodeErrorZ_get_ok(owner_conv);
6007         uint64_t ret_ref = 0;
6008         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6009         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6010         return ret_ref;
6011 }
6012
6013 static inline struct LDKDecodeError CResult_HTLCUpdateDecodeErrorZ_get_err(LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR owner){
6014         LDKDecodeError ret = *owner->contents.err;
6015         ret.is_owned = false;
6016         return ret;
6017 }
6018 uint64_t  __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_get_err"))) TS_CResult_HTLCUpdateDecodeErrorZ_get_err(uint64_t owner) {
6019         LDKCResult_HTLCUpdateDecodeErrorZ* owner_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)untag_ptr(owner);
6020         LDKDecodeError ret_var = CResult_HTLCUpdateDecodeErrorZ_get_err(owner_conv);
6021         uint64_t ret_ref = 0;
6022         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6023         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6024         return ret_ref;
6025 }
6026
6027 static inline struct LDKOutPoint C2Tuple_OutPointScriptZ_get_a(LDKC2Tuple_OutPointScriptZ *NONNULL_PTR owner){
6028         LDKOutPoint ret = owner->a;
6029         ret.is_owned = false;
6030         return ret;
6031 }
6032 uint64_t  __attribute__((export_name("TS_C2Tuple_OutPointScriptZ_get_a"))) TS_C2Tuple_OutPointScriptZ_get_a(uint64_t owner) {
6033         LDKC2Tuple_OutPointScriptZ* owner_conv = (LDKC2Tuple_OutPointScriptZ*)untag_ptr(owner);
6034         LDKOutPoint ret_var = C2Tuple_OutPointScriptZ_get_a(owner_conv);
6035         uint64_t ret_ref = 0;
6036         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6037         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6038         return ret_ref;
6039 }
6040
6041 static inline struct LDKCVec_u8Z C2Tuple_OutPointScriptZ_get_b(LDKC2Tuple_OutPointScriptZ *NONNULL_PTR owner){
6042         return CVec_u8Z_clone(&owner->b);
6043 }
6044 int8_tArray  __attribute__((export_name("TS_C2Tuple_OutPointScriptZ_get_b"))) TS_C2Tuple_OutPointScriptZ_get_b(uint64_t owner) {
6045         LDKC2Tuple_OutPointScriptZ* owner_conv = (LDKC2Tuple_OutPointScriptZ*)untag_ptr(owner);
6046         LDKCVec_u8Z ret_var = C2Tuple_OutPointScriptZ_get_b(owner_conv);
6047         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
6048         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
6049         CVec_u8Z_free(ret_var);
6050         return ret_arr;
6051 }
6052
6053 static inline uint32_t C2Tuple_u32ScriptZ_get_a(LDKC2Tuple_u32ScriptZ *NONNULL_PTR owner){
6054         return owner->a;
6055 }
6056 int32_t  __attribute__((export_name("TS_C2Tuple_u32ScriptZ_get_a"))) TS_C2Tuple_u32ScriptZ_get_a(uint64_t owner) {
6057         LDKC2Tuple_u32ScriptZ* owner_conv = (LDKC2Tuple_u32ScriptZ*)untag_ptr(owner);
6058         int32_t ret_conv = C2Tuple_u32ScriptZ_get_a(owner_conv);
6059         return ret_conv;
6060 }
6061
6062 static inline struct LDKCVec_u8Z C2Tuple_u32ScriptZ_get_b(LDKC2Tuple_u32ScriptZ *NONNULL_PTR owner){
6063         return CVec_u8Z_clone(&owner->b);
6064 }
6065 int8_tArray  __attribute__((export_name("TS_C2Tuple_u32ScriptZ_get_b"))) TS_C2Tuple_u32ScriptZ_get_b(uint64_t owner) {
6066         LDKC2Tuple_u32ScriptZ* owner_conv = (LDKC2Tuple_u32ScriptZ*)untag_ptr(owner);
6067         LDKCVec_u8Z ret_var = C2Tuple_u32ScriptZ_get_b(owner_conv);
6068         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
6069         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
6070         CVec_u8Z_free(ret_var);
6071         return ret_arr;
6072 }
6073
6074 static inline LDKCVec_C2Tuple_u32ScriptZZ CVec_C2Tuple_u32ScriptZZ_clone(const LDKCVec_C2Tuple_u32ScriptZZ *orig) {
6075         LDKCVec_C2Tuple_u32ScriptZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ) * orig->datalen, "LDKCVec_C2Tuple_u32ScriptZZ clone bytes"), .datalen = orig->datalen };
6076         for (size_t i = 0; i < ret.datalen; i++) {
6077                 ret.data[i] = C2Tuple_u32ScriptZ_clone(&orig->data[i]);
6078         }
6079         return ret;
6080 }
6081 static inline struct LDKThirtyTwoBytes C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_a(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *NONNULL_PTR owner){
6082         return ThirtyTwoBytes_clone(&owner->a);
6083 }
6084 int8_tArray  __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_a"))) TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_a(uint64_t owner) {
6085         LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* owner_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)untag_ptr(owner);
6086         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
6087         memcpy(ret_arr->elems, C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_a(owner_conv).data, 32);
6088         return ret_arr;
6089 }
6090
6091 static inline struct LDKCVec_C2Tuple_u32ScriptZZ C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_b(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *NONNULL_PTR owner){
6092         return CVec_C2Tuple_u32ScriptZZ_clone(&owner->b);
6093 }
6094 uint64_tArray  __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_b"))) TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_b(uint64_t owner) {
6095         LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* owner_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)untag_ptr(owner);
6096         LDKCVec_C2Tuple_u32ScriptZZ ret_var = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_b(owner_conv);
6097         uint64_tArray ret_arr = NULL;
6098         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
6099         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
6100         for (size_t v = 0; v < ret_var.datalen; v++) {
6101                 LDKC2Tuple_u32ScriptZ* ret_conv_21_conv = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
6102                 *ret_conv_21_conv = ret_var.data[v];
6103                 ret_arr_ptr[v] = tag_ptr(ret_conv_21_conv, true);
6104         }
6105         
6106         FREE(ret_var.data);
6107         return ret_arr;
6108 }
6109
6110 static inline LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_clone(const LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ *orig) {
6111         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 };
6112         for (size_t i = 0; i < ret.datalen; i++) {
6113                 ret.data[i] = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(&orig->data[i]);
6114         }
6115         return ret;
6116 }
6117 static inline LDKCVec_EventZ CVec_EventZ_clone(const LDKCVec_EventZ *orig) {
6118         LDKCVec_EventZ ret = { .data = MALLOC(sizeof(LDKEvent) * orig->datalen, "LDKCVec_EventZ clone bytes"), .datalen = orig->datalen };
6119         for (size_t i = 0; i < ret.datalen; i++) {
6120                 ret.data[i] = Event_clone(&orig->data[i]);
6121         }
6122         return ret;
6123 }
6124 static inline uint32_t C2Tuple_u32TxOutZ_get_a(LDKC2Tuple_u32TxOutZ *NONNULL_PTR owner){
6125         return owner->a;
6126 }
6127 int32_t  __attribute__((export_name("TS_C2Tuple_u32TxOutZ_get_a"))) TS_C2Tuple_u32TxOutZ_get_a(uint64_t owner) {
6128         LDKC2Tuple_u32TxOutZ* owner_conv = (LDKC2Tuple_u32TxOutZ*)untag_ptr(owner);
6129         int32_t ret_conv = C2Tuple_u32TxOutZ_get_a(owner_conv);
6130         return ret_conv;
6131 }
6132
6133 static inline struct LDKTxOut C2Tuple_u32TxOutZ_get_b(LDKC2Tuple_u32TxOutZ *NONNULL_PTR owner){
6134         return TxOut_clone(&owner->b);
6135 }
6136 uint64_t  __attribute__((export_name("TS_C2Tuple_u32TxOutZ_get_b"))) TS_C2Tuple_u32TxOutZ_get_b(uint64_t owner) {
6137         LDKC2Tuple_u32TxOutZ* owner_conv = (LDKC2Tuple_u32TxOutZ*)untag_ptr(owner);
6138         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
6139         *ret_ref = C2Tuple_u32TxOutZ_get_b(owner_conv);
6140         return tag_ptr(ret_ref, true);
6141 }
6142
6143 static inline LDKCVec_C2Tuple_u32TxOutZZ CVec_C2Tuple_u32TxOutZZ_clone(const LDKCVec_C2Tuple_u32TxOutZZ *orig) {
6144         LDKCVec_C2Tuple_u32TxOutZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ) * orig->datalen, "LDKCVec_C2Tuple_u32TxOutZZ clone bytes"), .datalen = orig->datalen };
6145         for (size_t i = 0; i < ret.datalen; i++) {
6146                 ret.data[i] = C2Tuple_u32TxOutZ_clone(&orig->data[i]);
6147         }
6148         return ret;
6149 }
6150 static inline struct LDKThirtyTwoBytes C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_a(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR owner){
6151         return ThirtyTwoBytes_clone(&owner->a);
6152 }
6153 int8_tArray  __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_a"))) TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_a(uint64_t owner) {
6154         LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* owner_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)untag_ptr(owner);
6155         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
6156         memcpy(ret_arr->elems, C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_a(owner_conv).data, 32);
6157         return ret_arr;
6158 }
6159
6160 static inline struct LDKCVec_C2Tuple_u32TxOutZZ C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_b(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR owner){
6161         return CVec_C2Tuple_u32TxOutZZ_clone(&owner->b);
6162 }
6163 uint64_tArray  __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_b"))) TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_b(uint64_t owner) {
6164         LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* owner_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)untag_ptr(owner);
6165         LDKCVec_C2Tuple_u32TxOutZZ ret_var = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_b(owner_conv);
6166         uint64_tArray ret_arr = NULL;
6167         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
6168         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
6169         for (size_t u = 0; u < ret_var.datalen; u++) {
6170                 LDKC2Tuple_u32TxOutZ* ret_conv_20_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
6171                 *ret_conv_20_conv = ret_var.data[u];
6172                 ret_arr_ptr[u] = tag_ptr(ret_conv_20_conv, true);
6173         }
6174         
6175         FREE(ret_var.data);
6176         return ret_arr;
6177 }
6178
6179 static inline LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_clone(const LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ *orig) {
6180         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 };
6181         for (size_t i = 0; i < ret.datalen; i++) {
6182                 ret.data[i] = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(&orig->data[i]);
6183         }
6184         return ret;
6185 }
6186 uint32_t __attribute__((export_name("TS_LDKBalance_ty_from_ptr"))) TS_LDKBalance_ty_from_ptr(uint64_t ptr) {
6187         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
6188         switch(obj->tag) {
6189                 case LDKBalance_ClaimableOnChannelClose: return 0;
6190                 case LDKBalance_ClaimableAwaitingConfirmations: return 1;
6191                 case LDKBalance_ContentiousClaimable: return 2;
6192                 case LDKBalance_MaybeClaimableHTLCAwaitingTimeout: return 3;
6193                 default: abort();
6194         }
6195 }
6196 int64_t __attribute__((export_name("TS_LDKBalance_ClaimableOnChannelClose_get_claimable_amount_satoshis"))) TS_LDKBalance_ClaimableOnChannelClose_get_claimable_amount_satoshis(uint64_t ptr) {
6197         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
6198         assert(obj->tag == LDKBalance_ClaimableOnChannelClose);
6199                         int64_t claimable_amount_satoshis_conv = obj->claimable_on_channel_close.claimable_amount_satoshis;
6200         return claimable_amount_satoshis_conv;
6201 }
6202 int64_t __attribute__((export_name("TS_LDKBalance_ClaimableAwaitingConfirmations_get_claimable_amount_satoshis"))) TS_LDKBalance_ClaimableAwaitingConfirmations_get_claimable_amount_satoshis(uint64_t ptr) {
6203         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
6204         assert(obj->tag == LDKBalance_ClaimableAwaitingConfirmations);
6205                         int64_t claimable_amount_satoshis_conv = obj->claimable_awaiting_confirmations.claimable_amount_satoshis;
6206         return claimable_amount_satoshis_conv;
6207 }
6208 int32_t __attribute__((export_name("TS_LDKBalance_ClaimableAwaitingConfirmations_get_confirmation_height"))) TS_LDKBalance_ClaimableAwaitingConfirmations_get_confirmation_height(uint64_t ptr) {
6209         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
6210         assert(obj->tag == LDKBalance_ClaimableAwaitingConfirmations);
6211                         int32_t confirmation_height_conv = obj->claimable_awaiting_confirmations.confirmation_height;
6212         return confirmation_height_conv;
6213 }
6214 int64_t __attribute__((export_name("TS_LDKBalance_ContentiousClaimable_get_claimable_amount_satoshis"))) TS_LDKBalance_ContentiousClaimable_get_claimable_amount_satoshis(uint64_t ptr) {
6215         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
6216         assert(obj->tag == LDKBalance_ContentiousClaimable);
6217                         int64_t claimable_amount_satoshis_conv = obj->contentious_claimable.claimable_amount_satoshis;
6218         return claimable_amount_satoshis_conv;
6219 }
6220 int32_t __attribute__((export_name("TS_LDKBalance_ContentiousClaimable_get_timeout_height"))) TS_LDKBalance_ContentiousClaimable_get_timeout_height(uint64_t ptr) {
6221         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
6222         assert(obj->tag == LDKBalance_ContentiousClaimable);
6223                         int32_t timeout_height_conv = obj->contentious_claimable.timeout_height;
6224         return timeout_height_conv;
6225 }
6226 int64_t __attribute__((export_name("TS_LDKBalance_MaybeClaimableHTLCAwaitingTimeout_get_claimable_amount_satoshis"))) TS_LDKBalance_MaybeClaimableHTLCAwaitingTimeout_get_claimable_amount_satoshis(uint64_t ptr) {
6227         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
6228         assert(obj->tag == LDKBalance_MaybeClaimableHTLCAwaitingTimeout);
6229                         int64_t claimable_amount_satoshis_conv = obj->maybe_claimable_htlc_awaiting_timeout.claimable_amount_satoshis;
6230         return claimable_amount_satoshis_conv;
6231 }
6232 int32_t __attribute__((export_name("TS_LDKBalance_MaybeClaimableHTLCAwaitingTimeout_get_claimable_height"))) TS_LDKBalance_MaybeClaimableHTLCAwaitingTimeout_get_claimable_height(uint64_t ptr) {
6233         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
6234         assert(obj->tag == LDKBalance_MaybeClaimableHTLCAwaitingTimeout);
6235                         int32_t claimable_height_conv = obj->maybe_claimable_htlc_awaiting_timeout.claimable_height;
6236         return claimable_height_conv;
6237 }
6238 static inline LDKCVec_BalanceZ CVec_BalanceZ_clone(const LDKCVec_BalanceZ *orig) {
6239         LDKCVec_BalanceZ ret = { .data = MALLOC(sizeof(LDKBalance) * orig->datalen, "LDKCVec_BalanceZ clone bytes"), .datalen = orig->datalen };
6240         for (size_t i = 0; i < ret.datalen; i++) {
6241                 ret.data[i] = Balance_clone(&orig->data[i]);
6242         }
6243         return ret;
6244 }
6245 static inline struct LDKThirtyTwoBytes C2Tuple_BlockHashChannelMonitorZ_get_a(LDKC2Tuple_BlockHashChannelMonitorZ *NONNULL_PTR owner){
6246         return ThirtyTwoBytes_clone(&owner->a);
6247 }
6248 int8_tArray  __attribute__((export_name("TS_C2Tuple_BlockHashChannelMonitorZ_get_a"))) TS_C2Tuple_BlockHashChannelMonitorZ_get_a(uint64_t owner) {
6249         LDKC2Tuple_BlockHashChannelMonitorZ* owner_conv = (LDKC2Tuple_BlockHashChannelMonitorZ*)untag_ptr(owner);
6250         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
6251         memcpy(ret_arr->elems, C2Tuple_BlockHashChannelMonitorZ_get_a(owner_conv).data, 32);
6252         return ret_arr;
6253 }
6254
6255 static inline struct LDKChannelMonitor C2Tuple_BlockHashChannelMonitorZ_get_b(LDKC2Tuple_BlockHashChannelMonitorZ *NONNULL_PTR owner){
6256         LDKChannelMonitor ret = owner->b;
6257         ret.is_owned = false;
6258         return ret;
6259 }
6260 uint64_t  __attribute__((export_name("TS_C2Tuple_BlockHashChannelMonitorZ_get_b"))) TS_C2Tuple_BlockHashChannelMonitorZ_get_b(uint64_t owner) {
6261         LDKC2Tuple_BlockHashChannelMonitorZ* owner_conv = (LDKC2Tuple_BlockHashChannelMonitorZ*)untag_ptr(owner);
6262         LDKChannelMonitor ret_var = C2Tuple_BlockHashChannelMonitorZ_get_b(owner_conv);
6263         uint64_t ret_ref = 0;
6264         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6265         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6266         return ret_ref;
6267 }
6268
6269 static inline struct LDKC2Tuple_BlockHashChannelMonitorZ CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_ok(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *NONNULL_PTR owner){
6270 CHECK(owner->result_ok);
6271         return C2Tuple_BlockHashChannelMonitorZ_clone(&*owner->contents.result);
6272 }
6273 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_ok"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_ok(uint64_t owner) {
6274         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)untag_ptr(owner);
6275         LDKC2Tuple_BlockHashChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
6276         *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_ok(owner_conv);
6277         return tag_ptr(ret_conv, true);
6278 }
6279
6280 static inline struct LDKDecodeError CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_err(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *NONNULL_PTR owner){
6281         LDKDecodeError ret = *owner->contents.err;
6282         ret.is_owned = false;
6283         return ret;
6284 }
6285 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_err"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_err(uint64_t owner) {
6286         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)untag_ptr(owner);
6287         LDKDecodeError ret_var = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_err(owner_conv);
6288         uint64_t ret_ref = 0;
6289         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6290         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6291         return ret_ref;
6292 }
6293
6294 static inline struct LDKPublicKey C2Tuple_PublicKeyTypeZ_get_a(LDKC2Tuple_PublicKeyTypeZ *NONNULL_PTR owner){
6295         return owner->a;
6296 }
6297 int8_tArray  __attribute__((export_name("TS_C2Tuple_PublicKeyTypeZ_get_a"))) TS_C2Tuple_PublicKeyTypeZ_get_a(uint64_t owner) {
6298         LDKC2Tuple_PublicKeyTypeZ* owner_conv = (LDKC2Tuple_PublicKeyTypeZ*)untag_ptr(owner);
6299         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
6300         memcpy(ret_arr->elems, C2Tuple_PublicKeyTypeZ_get_a(owner_conv).compressed_form, 33);
6301         return ret_arr;
6302 }
6303
6304 static inline struct LDKType C2Tuple_PublicKeyTypeZ_get_b(LDKC2Tuple_PublicKeyTypeZ *NONNULL_PTR owner){
6305         return Type_clone(&owner->b);
6306 }
6307 uint64_t  __attribute__((export_name("TS_C2Tuple_PublicKeyTypeZ_get_b"))) TS_C2Tuple_PublicKeyTypeZ_get_b(uint64_t owner) {
6308         LDKC2Tuple_PublicKeyTypeZ* owner_conv = (LDKC2Tuple_PublicKeyTypeZ*)untag_ptr(owner);
6309         LDKType* ret_ret = MALLOC(sizeof(LDKType), "LDKType");
6310         *ret_ret = C2Tuple_PublicKeyTypeZ_get_b(owner_conv);
6311         return tag_ptr(ret_ret, true);
6312 }
6313
6314 static inline LDKCVec_C2Tuple_PublicKeyTypeZZ CVec_C2Tuple_PublicKeyTypeZZ_clone(const LDKCVec_C2Tuple_PublicKeyTypeZZ *orig) {
6315         LDKCVec_C2Tuple_PublicKeyTypeZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ) * orig->datalen, "LDKCVec_C2Tuple_PublicKeyTypeZZ clone bytes"), .datalen = orig->datalen };
6316         for (size_t i = 0; i < ret.datalen; i++) {
6317                 ret.data[i] = C2Tuple_PublicKeyTypeZ_clone(&orig->data[i]);
6318         }
6319         return ret;
6320 }
6321 uint32_t __attribute__((export_name("TS_LDKCOption_NetAddressZ_ty_from_ptr"))) TS_LDKCOption_NetAddressZ_ty_from_ptr(uint64_t ptr) {
6322         LDKCOption_NetAddressZ *obj = (LDKCOption_NetAddressZ*)untag_ptr(ptr);
6323         switch(obj->tag) {
6324                 case LDKCOption_NetAddressZ_Some: return 0;
6325                 case LDKCOption_NetAddressZ_None: return 1;
6326                 default: abort();
6327         }
6328 }
6329 uint64_t __attribute__((export_name("TS_LDKCOption_NetAddressZ_Some_get_some"))) TS_LDKCOption_NetAddressZ_Some_get_some(uint64_t ptr) {
6330         LDKCOption_NetAddressZ *obj = (LDKCOption_NetAddressZ*)untag_ptr(ptr);
6331         assert(obj->tag == LDKCOption_NetAddressZ_Some);
6332                         uint64_t some_ref = tag_ptr(&obj->some, false);
6333         return some_ref;
6334 }
6335 static inline struct LDKCVec_u8Z CResult_CVec_u8ZPeerHandleErrorZ_get_ok(LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR owner){
6336 CHECK(owner->result_ok);
6337         return CVec_u8Z_clone(&*owner->contents.result);
6338 }
6339 int8_tArray  __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_get_ok"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_get_ok(uint64_t owner) {
6340         LDKCResult_CVec_u8ZPeerHandleErrorZ* owner_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)untag_ptr(owner);
6341         LDKCVec_u8Z ret_var = CResult_CVec_u8ZPeerHandleErrorZ_get_ok(owner_conv);
6342         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
6343         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
6344         CVec_u8Z_free(ret_var);
6345         return ret_arr;
6346 }
6347
6348 static inline struct LDKPeerHandleError CResult_CVec_u8ZPeerHandleErrorZ_get_err(LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR owner){
6349         LDKPeerHandleError ret = *owner->contents.err;
6350         ret.is_owned = false;
6351         return ret;
6352 }
6353 uint64_t  __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_get_err"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_get_err(uint64_t owner) {
6354         LDKCResult_CVec_u8ZPeerHandleErrorZ* owner_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)untag_ptr(owner);
6355         LDKPeerHandleError ret_var = CResult_CVec_u8ZPeerHandleErrorZ_get_err(owner_conv);
6356         uint64_t ret_ref = 0;
6357         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6358         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6359         return ret_ref;
6360 }
6361
6362 static inline void CResult_NonePeerHandleErrorZ_get_ok(LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR owner){
6363 CHECK(owner->result_ok);
6364         return *owner->contents.result;
6365 }
6366 void  __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_get_ok"))) TS_CResult_NonePeerHandleErrorZ_get_ok(uint64_t owner) {
6367         LDKCResult_NonePeerHandleErrorZ* owner_conv = (LDKCResult_NonePeerHandleErrorZ*)untag_ptr(owner);
6368         CResult_NonePeerHandleErrorZ_get_ok(owner_conv);
6369 }
6370
6371 static inline struct LDKPeerHandleError CResult_NonePeerHandleErrorZ_get_err(LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR owner){
6372         LDKPeerHandleError ret = *owner->contents.err;
6373         ret.is_owned = false;
6374         return ret;
6375 }
6376 uint64_t  __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_get_err"))) TS_CResult_NonePeerHandleErrorZ_get_err(uint64_t owner) {
6377         LDKCResult_NonePeerHandleErrorZ* owner_conv = (LDKCResult_NonePeerHandleErrorZ*)untag_ptr(owner);
6378         LDKPeerHandleError ret_var = CResult_NonePeerHandleErrorZ_get_err(owner_conv);
6379         uint64_t ret_ref = 0;
6380         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6381         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6382         return ret_ref;
6383 }
6384
6385 static inline bool CResult_boolPeerHandleErrorZ_get_ok(LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR owner){
6386 CHECK(owner->result_ok);
6387         return *owner->contents.result;
6388 }
6389 jboolean  __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_get_ok"))) TS_CResult_boolPeerHandleErrorZ_get_ok(uint64_t owner) {
6390         LDKCResult_boolPeerHandleErrorZ* owner_conv = (LDKCResult_boolPeerHandleErrorZ*)untag_ptr(owner);
6391         jboolean ret_conv = CResult_boolPeerHandleErrorZ_get_ok(owner_conv);
6392         return ret_conv;
6393 }
6394
6395 static inline struct LDKPeerHandleError CResult_boolPeerHandleErrorZ_get_err(LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR owner){
6396         LDKPeerHandleError ret = *owner->contents.err;
6397         ret.is_owned = false;
6398         return ret;
6399 }
6400 uint64_t  __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_get_err"))) TS_CResult_boolPeerHandleErrorZ_get_err(uint64_t owner) {
6401         LDKCResult_boolPeerHandleErrorZ* owner_conv = (LDKCResult_boolPeerHandleErrorZ*)untag_ptr(owner);
6402         LDKPeerHandleError ret_var = CResult_boolPeerHandleErrorZ_get_err(owner_conv);
6403         uint64_t ret_ref = 0;
6404         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6405         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6406         return ret_ref;
6407 }
6408
6409 static inline void CResult_NoneErrorZ_get_ok(LDKCResult_NoneErrorZ *NONNULL_PTR owner){
6410 CHECK(owner->result_ok);
6411         return *owner->contents.result;
6412 }
6413 void  __attribute__((export_name("TS_CResult_NoneErrorZ_get_ok"))) TS_CResult_NoneErrorZ_get_ok(uint64_t owner) {
6414         LDKCResult_NoneErrorZ* owner_conv = (LDKCResult_NoneErrorZ*)untag_ptr(owner);
6415         CResult_NoneErrorZ_get_ok(owner_conv);
6416 }
6417
6418 static inline enum LDKIOError CResult_NoneErrorZ_get_err(LDKCResult_NoneErrorZ *NONNULL_PTR owner){
6419 CHECK(!owner->result_ok);
6420         return *owner->contents.err;
6421 }
6422 uint32_t  __attribute__((export_name("TS_CResult_NoneErrorZ_get_err"))) TS_CResult_NoneErrorZ_get_err(uint64_t owner) {
6423         LDKCResult_NoneErrorZ* owner_conv = (LDKCResult_NoneErrorZ*)untag_ptr(owner);
6424         uint32_t ret_conv = LDKIOError_to_js(CResult_NoneErrorZ_get_err(owner_conv));
6425         return ret_conv;
6426 }
6427
6428 static inline struct LDKNetAddress CResult_NetAddressDecodeErrorZ_get_ok(LDKCResult_NetAddressDecodeErrorZ *NONNULL_PTR owner){
6429 CHECK(owner->result_ok);
6430         return NetAddress_clone(&*owner->contents.result);
6431 }
6432 uint64_t  __attribute__((export_name("TS_CResult_NetAddressDecodeErrorZ_get_ok"))) TS_CResult_NetAddressDecodeErrorZ_get_ok(uint64_t owner) {
6433         LDKCResult_NetAddressDecodeErrorZ* owner_conv = (LDKCResult_NetAddressDecodeErrorZ*)untag_ptr(owner);
6434         LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
6435         *ret_copy = CResult_NetAddressDecodeErrorZ_get_ok(owner_conv);
6436         uint64_t ret_ref = tag_ptr(ret_copy, true);
6437         return ret_ref;
6438 }
6439
6440 static inline struct LDKDecodeError CResult_NetAddressDecodeErrorZ_get_err(LDKCResult_NetAddressDecodeErrorZ *NONNULL_PTR owner){
6441         LDKDecodeError ret = *owner->contents.err;
6442         ret.is_owned = false;
6443         return ret;
6444 }
6445 uint64_t  __attribute__((export_name("TS_CResult_NetAddressDecodeErrorZ_get_err"))) TS_CResult_NetAddressDecodeErrorZ_get_err(uint64_t owner) {
6446         LDKCResult_NetAddressDecodeErrorZ* owner_conv = (LDKCResult_NetAddressDecodeErrorZ*)untag_ptr(owner);
6447         LDKDecodeError ret_var = CResult_NetAddressDecodeErrorZ_get_err(owner_conv);
6448         uint64_t ret_ref = 0;
6449         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6450         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6451         return ret_ref;
6452 }
6453
6454 static inline LDKCVec_UpdateAddHTLCZ CVec_UpdateAddHTLCZ_clone(const LDKCVec_UpdateAddHTLCZ *orig) {
6455         LDKCVec_UpdateAddHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateAddHTLC) * orig->datalen, "LDKCVec_UpdateAddHTLCZ clone bytes"), .datalen = orig->datalen };
6456         for (size_t i = 0; i < ret.datalen; i++) {
6457                 ret.data[i] = UpdateAddHTLC_clone(&orig->data[i]);
6458         }
6459         return ret;
6460 }
6461 static inline LDKCVec_UpdateFulfillHTLCZ CVec_UpdateFulfillHTLCZ_clone(const LDKCVec_UpdateFulfillHTLCZ *orig) {
6462         LDKCVec_UpdateFulfillHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFulfillHTLC) * orig->datalen, "LDKCVec_UpdateFulfillHTLCZ clone bytes"), .datalen = orig->datalen };
6463         for (size_t i = 0; i < ret.datalen; i++) {
6464                 ret.data[i] = UpdateFulfillHTLC_clone(&orig->data[i]);
6465         }
6466         return ret;
6467 }
6468 static inline LDKCVec_UpdateFailHTLCZ CVec_UpdateFailHTLCZ_clone(const LDKCVec_UpdateFailHTLCZ *orig) {
6469         LDKCVec_UpdateFailHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFailHTLC) * orig->datalen, "LDKCVec_UpdateFailHTLCZ clone bytes"), .datalen = orig->datalen };
6470         for (size_t i = 0; i < ret.datalen; i++) {
6471                 ret.data[i] = UpdateFailHTLC_clone(&orig->data[i]);
6472         }
6473         return ret;
6474 }
6475 static inline LDKCVec_UpdateFailMalformedHTLCZ CVec_UpdateFailMalformedHTLCZ_clone(const LDKCVec_UpdateFailMalformedHTLCZ *orig) {
6476         LDKCVec_UpdateFailMalformedHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFailMalformedHTLC) * orig->datalen, "LDKCVec_UpdateFailMalformedHTLCZ clone bytes"), .datalen = orig->datalen };
6477         for (size_t i = 0; i < ret.datalen; i++) {
6478                 ret.data[i] = UpdateFailMalformedHTLC_clone(&orig->data[i]);
6479         }
6480         return ret;
6481 }
6482 static inline struct LDKAcceptChannel CResult_AcceptChannelDecodeErrorZ_get_ok(LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR owner){
6483         LDKAcceptChannel ret = *owner->contents.result;
6484         ret.is_owned = false;
6485         return ret;
6486 }
6487 uint64_t  __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_get_ok"))) TS_CResult_AcceptChannelDecodeErrorZ_get_ok(uint64_t owner) {
6488         LDKCResult_AcceptChannelDecodeErrorZ* owner_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)untag_ptr(owner);
6489         LDKAcceptChannel ret_var = CResult_AcceptChannelDecodeErrorZ_get_ok(owner_conv);
6490         uint64_t ret_ref = 0;
6491         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6492         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6493         return ret_ref;
6494 }
6495
6496 static inline struct LDKDecodeError CResult_AcceptChannelDecodeErrorZ_get_err(LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR owner){
6497         LDKDecodeError ret = *owner->contents.err;
6498         ret.is_owned = false;
6499         return ret;
6500 }
6501 uint64_t  __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_get_err"))) TS_CResult_AcceptChannelDecodeErrorZ_get_err(uint64_t owner) {
6502         LDKCResult_AcceptChannelDecodeErrorZ* owner_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)untag_ptr(owner);
6503         LDKDecodeError ret_var = CResult_AcceptChannelDecodeErrorZ_get_err(owner_conv);
6504         uint64_t ret_ref = 0;
6505         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6506         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6507         return ret_ref;
6508 }
6509
6510 static inline struct LDKAnnouncementSignatures CResult_AnnouncementSignaturesDecodeErrorZ_get_ok(LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR owner){
6511         LDKAnnouncementSignatures ret = *owner->contents.result;
6512         ret.is_owned = false;
6513         return ret;
6514 }
6515 uint64_t  __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_get_ok"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_get_ok(uint64_t owner) {
6516         LDKCResult_AnnouncementSignaturesDecodeErrorZ* owner_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)untag_ptr(owner);
6517         LDKAnnouncementSignatures ret_var = CResult_AnnouncementSignaturesDecodeErrorZ_get_ok(owner_conv);
6518         uint64_t ret_ref = 0;
6519         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6520         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6521         return ret_ref;
6522 }
6523
6524 static inline struct LDKDecodeError CResult_AnnouncementSignaturesDecodeErrorZ_get_err(LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR owner){
6525         LDKDecodeError ret = *owner->contents.err;
6526         ret.is_owned = false;
6527         return ret;
6528 }
6529 uint64_t  __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_get_err"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_get_err(uint64_t owner) {
6530         LDKCResult_AnnouncementSignaturesDecodeErrorZ* owner_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)untag_ptr(owner);
6531         LDKDecodeError ret_var = CResult_AnnouncementSignaturesDecodeErrorZ_get_err(owner_conv);
6532         uint64_t ret_ref = 0;
6533         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6534         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6535         return ret_ref;
6536 }
6537
6538 static inline struct LDKChannelReestablish CResult_ChannelReestablishDecodeErrorZ_get_ok(LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR owner){
6539         LDKChannelReestablish ret = *owner->contents.result;
6540         ret.is_owned = false;
6541         return ret;
6542 }
6543 uint64_t  __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_get_ok"))) TS_CResult_ChannelReestablishDecodeErrorZ_get_ok(uint64_t owner) {
6544         LDKCResult_ChannelReestablishDecodeErrorZ* owner_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)untag_ptr(owner);
6545         LDKChannelReestablish ret_var = CResult_ChannelReestablishDecodeErrorZ_get_ok(owner_conv);
6546         uint64_t ret_ref = 0;
6547         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6548         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6549         return ret_ref;
6550 }
6551
6552 static inline struct LDKDecodeError CResult_ChannelReestablishDecodeErrorZ_get_err(LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR owner){
6553         LDKDecodeError ret = *owner->contents.err;
6554         ret.is_owned = false;
6555         return ret;
6556 }
6557 uint64_t  __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_get_err"))) TS_CResult_ChannelReestablishDecodeErrorZ_get_err(uint64_t owner) {
6558         LDKCResult_ChannelReestablishDecodeErrorZ* owner_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)untag_ptr(owner);
6559         LDKDecodeError ret_var = CResult_ChannelReestablishDecodeErrorZ_get_err(owner_conv);
6560         uint64_t ret_ref = 0;
6561         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6562         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6563         return ret_ref;
6564 }
6565
6566 static inline struct LDKClosingSigned CResult_ClosingSignedDecodeErrorZ_get_ok(LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR owner){
6567         LDKClosingSigned ret = *owner->contents.result;
6568         ret.is_owned = false;
6569         return ret;
6570 }
6571 uint64_t  __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_get_ok"))) TS_CResult_ClosingSignedDecodeErrorZ_get_ok(uint64_t owner) {
6572         LDKCResult_ClosingSignedDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)untag_ptr(owner);
6573         LDKClosingSigned ret_var = CResult_ClosingSignedDecodeErrorZ_get_ok(owner_conv);
6574         uint64_t ret_ref = 0;
6575         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6576         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6577         return ret_ref;
6578 }
6579
6580 static inline struct LDKDecodeError CResult_ClosingSignedDecodeErrorZ_get_err(LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR owner){
6581         LDKDecodeError ret = *owner->contents.err;
6582         ret.is_owned = false;
6583         return ret;
6584 }
6585 uint64_t  __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_get_err"))) TS_CResult_ClosingSignedDecodeErrorZ_get_err(uint64_t owner) {
6586         LDKCResult_ClosingSignedDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)untag_ptr(owner);
6587         LDKDecodeError ret_var = CResult_ClosingSignedDecodeErrorZ_get_err(owner_conv);
6588         uint64_t ret_ref = 0;
6589         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6590         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6591         return ret_ref;
6592 }
6593
6594 static inline struct LDKClosingSignedFeeRange CResult_ClosingSignedFeeRangeDecodeErrorZ_get_ok(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR owner){
6595         LDKClosingSignedFeeRange ret = *owner->contents.result;
6596         ret.is_owned = false;
6597         return ret;
6598 }
6599 uint64_t  __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_get_ok"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_get_ok(uint64_t owner) {
6600         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)untag_ptr(owner);
6601         LDKClosingSignedFeeRange ret_var = CResult_ClosingSignedFeeRangeDecodeErrorZ_get_ok(owner_conv);
6602         uint64_t ret_ref = 0;
6603         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6604         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6605         return ret_ref;
6606 }
6607
6608 static inline struct LDKDecodeError CResult_ClosingSignedFeeRangeDecodeErrorZ_get_err(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR owner){
6609         LDKDecodeError ret = *owner->contents.err;
6610         ret.is_owned = false;
6611         return ret;
6612 }
6613 uint64_t  __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_get_err"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_get_err(uint64_t owner) {
6614         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)untag_ptr(owner);
6615         LDKDecodeError ret_var = CResult_ClosingSignedFeeRangeDecodeErrorZ_get_err(owner_conv);
6616         uint64_t ret_ref = 0;
6617         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6618         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6619         return ret_ref;
6620 }
6621
6622 static inline struct LDKCommitmentSigned CResult_CommitmentSignedDecodeErrorZ_get_ok(LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR owner){
6623         LDKCommitmentSigned ret = *owner->contents.result;
6624         ret.is_owned = false;
6625         return ret;
6626 }
6627 uint64_t  __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_get_ok"))) TS_CResult_CommitmentSignedDecodeErrorZ_get_ok(uint64_t owner) {
6628         LDKCResult_CommitmentSignedDecodeErrorZ* owner_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)untag_ptr(owner);
6629         LDKCommitmentSigned ret_var = CResult_CommitmentSignedDecodeErrorZ_get_ok(owner_conv);
6630         uint64_t ret_ref = 0;
6631         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6632         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6633         return ret_ref;
6634 }
6635
6636 static inline struct LDKDecodeError CResult_CommitmentSignedDecodeErrorZ_get_err(LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR owner){
6637         LDKDecodeError ret = *owner->contents.err;
6638         ret.is_owned = false;
6639         return ret;
6640 }
6641 uint64_t  __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_get_err"))) TS_CResult_CommitmentSignedDecodeErrorZ_get_err(uint64_t owner) {
6642         LDKCResult_CommitmentSignedDecodeErrorZ* owner_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)untag_ptr(owner);
6643         LDKDecodeError ret_var = CResult_CommitmentSignedDecodeErrorZ_get_err(owner_conv);
6644         uint64_t ret_ref = 0;
6645         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6646         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6647         return ret_ref;
6648 }
6649
6650 static inline struct LDKFundingCreated CResult_FundingCreatedDecodeErrorZ_get_ok(LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR owner){
6651         LDKFundingCreated ret = *owner->contents.result;
6652         ret.is_owned = false;
6653         return ret;
6654 }
6655 uint64_t  __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_get_ok"))) TS_CResult_FundingCreatedDecodeErrorZ_get_ok(uint64_t owner) {
6656         LDKCResult_FundingCreatedDecodeErrorZ* owner_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)untag_ptr(owner);
6657         LDKFundingCreated ret_var = CResult_FundingCreatedDecodeErrorZ_get_ok(owner_conv);
6658         uint64_t ret_ref = 0;
6659         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6660         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6661         return ret_ref;
6662 }
6663
6664 static inline struct LDKDecodeError CResult_FundingCreatedDecodeErrorZ_get_err(LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR owner){
6665         LDKDecodeError ret = *owner->contents.err;
6666         ret.is_owned = false;
6667         return ret;
6668 }
6669 uint64_t  __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_get_err"))) TS_CResult_FundingCreatedDecodeErrorZ_get_err(uint64_t owner) {
6670         LDKCResult_FundingCreatedDecodeErrorZ* owner_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)untag_ptr(owner);
6671         LDKDecodeError ret_var = CResult_FundingCreatedDecodeErrorZ_get_err(owner_conv);
6672         uint64_t ret_ref = 0;
6673         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6674         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6675         return ret_ref;
6676 }
6677
6678 static inline struct LDKFundingSigned CResult_FundingSignedDecodeErrorZ_get_ok(LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR owner){
6679         LDKFundingSigned ret = *owner->contents.result;
6680         ret.is_owned = false;
6681         return ret;
6682 }
6683 uint64_t  __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_get_ok"))) TS_CResult_FundingSignedDecodeErrorZ_get_ok(uint64_t owner) {
6684         LDKCResult_FundingSignedDecodeErrorZ* owner_conv = (LDKCResult_FundingSignedDecodeErrorZ*)untag_ptr(owner);
6685         LDKFundingSigned ret_var = CResult_FundingSignedDecodeErrorZ_get_ok(owner_conv);
6686         uint64_t ret_ref = 0;
6687         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6688         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6689         return ret_ref;
6690 }
6691
6692 static inline struct LDKDecodeError CResult_FundingSignedDecodeErrorZ_get_err(LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR owner){
6693         LDKDecodeError ret = *owner->contents.err;
6694         ret.is_owned = false;
6695         return ret;
6696 }
6697 uint64_t  __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_get_err"))) TS_CResult_FundingSignedDecodeErrorZ_get_err(uint64_t owner) {
6698         LDKCResult_FundingSignedDecodeErrorZ* owner_conv = (LDKCResult_FundingSignedDecodeErrorZ*)untag_ptr(owner);
6699         LDKDecodeError ret_var = CResult_FundingSignedDecodeErrorZ_get_err(owner_conv);
6700         uint64_t ret_ref = 0;
6701         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6702         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6703         return ret_ref;
6704 }
6705
6706 static inline struct LDKChannelReady CResult_ChannelReadyDecodeErrorZ_get_ok(LDKCResult_ChannelReadyDecodeErrorZ *NONNULL_PTR owner){
6707         LDKChannelReady ret = *owner->contents.result;
6708         ret.is_owned = false;
6709         return ret;
6710 }
6711 uint64_t  __attribute__((export_name("TS_CResult_ChannelReadyDecodeErrorZ_get_ok"))) TS_CResult_ChannelReadyDecodeErrorZ_get_ok(uint64_t owner) {
6712         LDKCResult_ChannelReadyDecodeErrorZ* owner_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)untag_ptr(owner);
6713         LDKChannelReady ret_var = CResult_ChannelReadyDecodeErrorZ_get_ok(owner_conv);
6714         uint64_t ret_ref = 0;
6715         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6716         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6717         return ret_ref;
6718 }
6719
6720 static inline struct LDKDecodeError CResult_ChannelReadyDecodeErrorZ_get_err(LDKCResult_ChannelReadyDecodeErrorZ *NONNULL_PTR owner){
6721         LDKDecodeError ret = *owner->contents.err;
6722         ret.is_owned = false;
6723         return ret;
6724 }
6725 uint64_t  __attribute__((export_name("TS_CResult_ChannelReadyDecodeErrorZ_get_err"))) TS_CResult_ChannelReadyDecodeErrorZ_get_err(uint64_t owner) {
6726         LDKCResult_ChannelReadyDecodeErrorZ* owner_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)untag_ptr(owner);
6727         LDKDecodeError ret_var = CResult_ChannelReadyDecodeErrorZ_get_err(owner_conv);
6728         uint64_t ret_ref = 0;
6729         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6730         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6731         return ret_ref;
6732 }
6733
6734 static inline struct LDKInit CResult_InitDecodeErrorZ_get_ok(LDKCResult_InitDecodeErrorZ *NONNULL_PTR owner){
6735         LDKInit ret = *owner->contents.result;
6736         ret.is_owned = false;
6737         return ret;
6738 }
6739 uint64_t  __attribute__((export_name("TS_CResult_InitDecodeErrorZ_get_ok"))) TS_CResult_InitDecodeErrorZ_get_ok(uint64_t owner) {
6740         LDKCResult_InitDecodeErrorZ* owner_conv = (LDKCResult_InitDecodeErrorZ*)untag_ptr(owner);
6741         LDKInit ret_var = CResult_InitDecodeErrorZ_get_ok(owner_conv);
6742         uint64_t ret_ref = 0;
6743         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6744         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6745         return ret_ref;
6746 }
6747
6748 static inline struct LDKDecodeError CResult_InitDecodeErrorZ_get_err(LDKCResult_InitDecodeErrorZ *NONNULL_PTR owner){
6749         LDKDecodeError ret = *owner->contents.err;
6750         ret.is_owned = false;
6751         return ret;
6752 }
6753 uint64_t  __attribute__((export_name("TS_CResult_InitDecodeErrorZ_get_err"))) TS_CResult_InitDecodeErrorZ_get_err(uint64_t owner) {
6754         LDKCResult_InitDecodeErrorZ* owner_conv = (LDKCResult_InitDecodeErrorZ*)untag_ptr(owner);
6755         LDKDecodeError ret_var = CResult_InitDecodeErrorZ_get_err(owner_conv);
6756         uint64_t ret_ref = 0;
6757         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6758         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6759         return ret_ref;
6760 }
6761
6762 static inline struct LDKOpenChannel CResult_OpenChannelDecodeErrorZ_get_ok(LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR owner){
6763         LDKOpenChannel ret = *owner->contents.result;
6764         ret.is_owned = false;
6765         return ret;
6766 }
6767 uint64_t  __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_get_ok"))) TS_CResult_OpenChannelDecodeErrorZ_get_ok(uint64_t owner) {
6768         LDKCResult_OpenChannelDecodeErrorZ* owner_conv = (LDKCResult_OpenChannelDecodeErrorZ*)untag_ptr(owner);
6769         LDKOpenChannel ret_var = CResult_OpenChannelDecodeErrorZ_get_ok(owner_conv);
6770         uint64_t ret_ref = 0;
6771         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6772         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6773         return ret_ref;
6774 }
6775
6776 static inline struct LDKDecodeError CResult_OpenChannelDecodeErrorZ_get_err(LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR owner){
6777         LDKDecodeError ret = *owner->contents.err;
6778         ret.is_owned = false;
6779         return ret;
6780 }
6781 uint64_t  __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_get_err"))) TS_CResult_OpenChannelDecodeErrorZ_get_err(uint64_t owner) {
6782         LDKCResult_OpenChannelDecodeErrorZ* owner_conv = (LDKCResult_OpenChannelDecodeErrorZ*)untag_ptr(owner);
6783         LDKDecodeError ret_var = CResult_OpenChannelDecodeErrorZ_get_err(owner_conv);
6784         uint64_t ret_ref = 0;
6785         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6786         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6787         return ret_ref;
6788 }
6789
6790 static inline struct LDKRevokeAndACK CResult_RevokeAndACKDecodeErrorZ_get_ok(LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR owner){
6791         LDKRevokeAndACK ret = *owner->contents.result;
6792         ret.is_owned = false;
6793         return ret;
6794 }
6795 uint64_t  __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_get_ok"))) TS_CResult_RevokeAndACKDecodeErrorZ_get_ok(uint64_t owner) {
6796         LDKCResult_RevokeAndACKDecodeErrorZ* owner_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)untag_ptr(owner);
6797         LDKRevokeAndACK ret_var = CResult_RevokeAndACKDecodeErrorZ_get_ok(owner_conv);
6798         uint64_t ret_ref = 0;
6799         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6800         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6801         return ret_ref;
6802 }
6803
6804 static inline struct LDKDecodeError CResult_RevokeAndACKDecodeErrorZ_get_err(LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR owner){
6805         LDKDecodeError ret = *owner->contents.err;
6806         ret.is_owned = false;
6807         return ret;
6808 }
6809 uint64_t  __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_get_err"))) TS_CResult_RevokeAndACKDecodeErrorZ_get_err(uint64_t owner) {
6810         LDKCResult_RevokeAndACKDecodeErrorZ* owner_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)untag_ptr(owner);
6811         LDKDecodeError ret_var = CResult_RevokeAndACKDecodeErrorZ_get_err(owner_conv);
6812         uint64_t ret_ref = 0;
6813         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6814         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6815         return ret_ref;
6816 }
6817
6818 static inline struct LDKShutdown CResult_ShutdownDecodeErrorZ_get_ok(LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR owner){
6819         LDKShutdown ret = *owner->contents.result;
6820         ret.is_owned = false;
6821         return ret;
6822 }
6823 uint64_t  __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_get_ok"))) TS_CResult_ShutdownDecodeErrorZ_get_ok(uint64_t owner) {
6824         LDKCResult_ShutdownDecodeErrorZ* owner_conv = (LDKCResult_ShutdownDecodeErrorZ*)untag_ptr(owner);
6825         LDKShutdown ret_var = CResult_ShutdownDecodeErrorZ_get_ok(owner_conv);
6826         uint64_t ret_ref = 0;
6827         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6828         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6829         return ret_ref;
6830 }
6831
6832 static inline struct LDKDecodeError CResult_ShutdownDecodeErrorZ_get_err(LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR owner){
6833         LDKDecodeError ret = *owner->contents.err;
6834         ret.is_owned = false;
6835         return ret;
6836 }
6837 uint64_t  __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_get_err"))) TS_CResult_ShutdownDecodeErrorZ_get_err(uint64_t owner) {
6838         LDKCResult_ShutdownDecodeErrorZ* owner_conv = (LDKCResult_ShutdownDecodeErrorZ*)untag_ptr(owner);
6839         LDKDecodeError ret_var = CResult_ShutdownDecodeErrorZ_get_err(owner_conv);
6840         uint64_t ret_ref = 0;
6841         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6842         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6843         return ret_ref;
6844 }
6845
6846 static inline struct LDKUpdateFailHTLC CResult_UpdateFailHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR owner){
6847         LDKUpdateFailHTLC ret = *owner->contents.result;
6848         ret.is_owned = false;
6849         return ret;
6850 }
6851 uint64_t  __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_get_ok"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_get_ok(uint64_t owner) {
6852         LDKCResult_UpdateFailHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)untag_ptr(owner);
6853         LDKUpdateFailHTLC ret_var = CResult_UpdateFailHTLCDecodeErrorZ_get_ok(owner_conv);
6854         uint64_t ret_ref = 0;
6855         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6856         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6857         return ret_ref;
6858 }
6859
6860 static inline struct LDKDecodeError CResult_UpdateFailHTLCDecodeErrorZ_get_err(LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR owner){
6861         LDKDecodeError ret = *owner->contents.err;
6862         ret.is_owned = false;
6863         return ret;
6864 }
6865 uint64_t  __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_get_err"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_get_err(uint64_t owner) {
6866         LDKCResult_UpdateFailHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)untag_ptr(owner);
6867         LDKDecodeError ret_var = CResult_UpdateFailHTLCDecodeErrorZ_get_err(owner_conv);
6868         uint64_t ret_ref = 0;
6869         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6870         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6871         return ret_ref;
6872 }
6873
6874 static inline struct LDKUpdateFailMalformedHTLC CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR owner){
6875         LDKUpdateFailMalformedHTLC ret = *owner->contents.result;
6876         ret.is_owned = false;
6877         return ret;
6878 }
6879 uint64_t  __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_ok"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_ok(uint64_t owner) {
6880         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)untag_ptr(owner);
6881         LDKUpdateFailMalformedHTLC ret_var = CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_ok(owner_conv);
6882         uint64_t ret_ref = 0;
6883         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6884         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6885         return ret_ref;
6886 }
6887
6888 static inline struct LDKDecodeError CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_err(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR owner){
6889         LDKDecodeError ret = *owner->contents.err;
6890         ret.is_owned = false;
6891         return ret;
6892 }
6893 uint64_t  __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_err"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_err(uint64_t owner) {
6894         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)untag_ptr(owner);
6895         LDKDecodeError ret_var = CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_err(owner_conv);
6896         uint64_t ret_ref = 0;
6897         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6898         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6899         return ret_ref;
6900 }
6901
6902 static inline struct LDKUpdateFee CResult_UpdateFeeDecodeErrorZ_get_ok(LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR owner){
6903         LDKUpdateFee ret = *owner->contents.result;
6904         ret.is_owned = false;
6905         return ret;
6906 }
6907 uint64_t  __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_get_ok"))) TS_CResult_UpdateFeeDecodeErrorZ_get_ok(uint64_t owner) {
6908         LDKCResult_UpdateFeeDecodeErrorZ* owner_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)untag_ptr(owner);
6909         LDKUpdateFee ret_var = CResult_UpdateFeeDecodeErrorZ_get_ok(owner_conv);
6910         uint64_t ret_ref = 0;
6911         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6912         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6913         return ret_ref;
6914 }
6915
6916 static inline struct LDKDecodeError CResult_UpdateFeeDecodeErrorZ_get_err(LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR owner){
6917         LDKDecodeError ret = *owner->contents.err;
6918         ret.is_owned = false;
6919         return ret;
6920 }
6921 uint64_t  __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_get_err"))) TS_CResult_UpdateFeeDecodeErrorZ_get_err(uint64_t owner) {
6922         LDKCResult_UpdateFeeDecodeErrorZ* owner_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)untag_ptr(owner);
6923         LDKDecodeError ret_var = CResult_UpdateFeeDecodeErrorZ_get_err(owner_conv);
6924         uint64_t ret_ref = 0;
6925         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6926         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6927         return ret_ref;
6928 }
6929
6930 static inline struct LDKUpdateFulfillHTLC CResult_UpdateFulfillHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR owner){
6931         LDKUpdateFulfillHTLC ret = *owner->contents.result;
6932         ret.is_owned = false;
6933         return ret;
6934 }
6935 uint64_t  __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_get_ok"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_get_ok(uint64_t owner) {
6936         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)untag_ptr(owner);
6937         LDKUpdateFulfillHTLC ret_var = CResult_UpdateFulfillHTLCDecodeErrorZ_get_ok(owner_conv);
6938         uint64_t ret_ref = 0;
6939         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6940         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6941         return ret_ref;
6942 }
6943
6944 static inline struct LDKDecodeError CResult_UpdateFulfillHTLCDecodeErrorZ_get_err(LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR owner){
6945         LDKDecodeError ret = *owner->contents.err;
6946         ret.is_owned = false;
6947         return ret;
6948 }
6949 uint64_t  __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_get_err"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_get_err(uint64_t owner) {
6950         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)untag_ptr(owner);
6951         LDKDecodeError ret_var = CResult_UpdateFulfillHTLCDecodeErrorZ_get_err(owner_conv);
6952         uint64_t ret_ref = 0;
6953         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6954         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6955         return ret_ref;
6956 }
6957
6958 static inline struct LDKUpdateAddHTLC CResult_UpdateAddHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR owner){
6959         LDKUpdateAddHTLC ret = *owner->contents.result;
6960         ret.is_owned = false;
6961         return ret;
6962 }
6963 uint64_t  __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_get_ok"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_get_ok(uint64_t owner) {
6964         LDKCResult_UpdateAddHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)untag_ptr(owner);
6965         LDKUpdateAddHTLC ret_var = CResult_UpdateAddHTLCDecodeErrorZ_get_ok(owner_conv);
6966         uint64_t ret_ref = 0;
6967         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6968         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6969         return ret_ref;
6970 }
6971
6972 static inline struct LDKDecodeError CResult_UpdateAddHTLCDecodeErrorZ_get_err(LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR owner){
6973         LDKDecodeError ret = *owner->contents.err;
6974         ret.is_owned = false;
6975         return ret;
6976 }
6977 uint64_t  __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_get_err"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_get_err(uint64_t owner) {
6978         LDKCResult_UpdateAddHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)untag_ptr(owner);
6979         LDKDecodeError ret_var = CResult_UpdateAddHTLCDecodeErrorZ_get_err(owner_conv);
6980         uint64_t ret_ref = 0;
6981         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6982         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6983         return ret_ref;
6984 }
6985
6986 static inline struct LDKPing CResult_PingDecodeErrorZ_get_ok(LDKCResult_PingDecodeErrorZ *NONNULL_PTR owner){
6987         LDKPing ret = *owner->contents.result;
6988         ret.is_owned = false;
6989         return ret;
6990 }
6991 uint64_t  __attribute__((export_name("TS_CResult_PingDecodeErrorZ_get_ok"))) TS_CResult_PingDecodeErrorZ_get_ok(uint64_t owner) {
6992         LDKCResult_PingDecodeErrorZ* owner_conv = (LDKCResult_PingDecodeErrorZ*)untag_ptr(owner);
6993         LDKPing ret_var = CResult_PingDecodeErrorZ_get_ok(owner_conv);
6994         uint64_t ret_ref = 0;
6995         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6996         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6997         return ret_ref;
6998 }
6999
7000 static inline struct LDKDecodeError CResult_PingDecodeErrorZ_get_err(LDKCResult_PingDecodeErrorZ *NONNULL_PTR owner){
7001         LDKDecodeError ret = *owner->contents.err;
7002         ret.is_owned = false;
7003         return ret;
7004 }
7005 uint64_t  __attribute__((export_name("TS_CResult_PingDecodeErrorZ_get_err"))) TS_CResult_PingDecodeErrorZ_get_err(uint64_t owner) {
7006         LDKCResult_PingDecodeErrorZ* owner_conv = (LDKCResult_PingDecodeErrorZ*)untag_ptr(owner);
7007         LDKDecodeError ret_var = CResult_PingDecodeErrorZ_get_err(owner_conv);
7008         uint64_t ret_ref = 0;
7009         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7010         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7011         return ret_ref;
7012 }
7013
7014 static inline struct LDKPong CResult_PongDecodeErrorZ_get_ok(LDKCResult_PongDecodeErrorZ *NONNULL_PTR owner){
7015         LDKPong ret = *owner->contents.result;
7016         ret.is_owned = false;
7017         return ret;
7018 }
7019 uint64_t  __attribute__((export_name("TS_CResult_PongDecodeErrorZ_get_ok"))) TS_CResult_PongDecodeErrorZ_get_ok(uint64_t owner) {
7020         LDKCResult_PongDecodeErrorZ* owner_conv = (LDKCResult_PongDecodeErrorZ*)untag_ptr(owner);
7021         LDKPong ret_var = CResult_PongDecodeErrorZ_get_ok(owner_conv);
7022         uint64_t ret_ref = 0;
7023         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7024         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7025         return ret_ref;
7026 }
7027
7028 static inline struct LDKDecodeError CResult_PongDecodeErrorZ_get_err(LDKCResult_PongDecodeErrorZ *NONNULL_PTR owner){
7029         LDKDecodeError ret = *owner->contents.err;
7030         ret.is_owned = false;
7031         return ret;
7032 }
7033 uint64_t  __attribute__((export_name("TS_CResult_PongDecodeErrorZ_get_err"))) TS_CResult_PongDecodeErrorZ_get_err(uint64_t owner) {
7034         LDKCResult_PongDecodeErrorZ* owner_conv = (LDKCResult_PongDecodeErrorZ*)untag_ptr(owner);
7035         LDKDecodeError ret_var = CResult_PongDecodeErrorZ_get_err(owner_conv);
7036         uint64_t ret_ref = 0;
7037         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7038         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7039         return ret_ref;
7040 }
7041
7042 static inline struct LDKUnsignedChannelAnnouncement CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_ok(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
7043         LDKUnsignedChannelAnnouncement ret = *owner->contents.result;
7044         ret.is_owned = false;
7045         return ret;
7046 }
7047 uint64_t  __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_ok"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_ok(uint64_t owner) {
7048         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)untag_ptr(owner);
7049         LDKUnsignedChannelAnnouncement ret_var = CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_ok(owner_conv);
7050         uint64_t ret_ref = 0;
7051         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7052         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7053         return ret_ref;
7054 }
7055
7056 static inline struct LDKDecodeError CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_err(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
7057         LDKDecodeError ret = *owner->contents.err;
7058         ret.is_owned = false;
7059         return ret;
7060 }
7061 uint64_t  __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_err"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_err(uint64_t owner) {
7062         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)untag_ptr(owner);
7063         LDKDecodeError ret_var = CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_err(owner_conv);
7064         uint64_t ret_ref = 0;
7065         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7066         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7067         return ret_ref;
7068 }
7069
7070 static inline struct LDKChannelAnnouncement CResult_ChannelAnnouncementDecodeErrorZ_get_ok(LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
7071         LDKChannelAnnouncement ret = *owner->contents.result;
7072         ret.is_owned = false;
7073         return ret;
7074 }
7075 uint64_t  __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_get_ok"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_get_ok(uint64_t owner) {
7076         LDKCResult_ChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)untag_ptr(owner);
7077         LDKChannelAnnouncement ret_var = CResult_ChannelAnnouncementDecodeErrorZ_get_ok(owner_conv);
7078         uint64_t ret_ref = 0;
7079         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7080         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7081         return ret_ref;
7082 }
7083
7084 static inline struct LDKDecodeError CResult_ChannelAnnouncementDecodeErrorZ_get_err(LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
7085         LDKDecodeError ret = *owner->contents.err;
7086         ret.is_owned = false;
7087         return ret;
7088 }
7089 uint64_t  __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_get_err"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_get_err(uint64_t owner) {
7090         LDKCResult_ChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)untag_ptr(owner);
7091         LDKDecodeError ret_var = CResult_ChannelAnnouncementDecodeErrorZ_get_err(owner_conv);
7092         uint64_t ret_ref = 0;
7093         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7094         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7095         return ret_ref;
7096 }
7097
7098 static inline struct LDKUnsignedChannelUpdate CResult_UnsignedChannelUpdateDecodeErrorZ_get_ok(LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
7099         LDKUnsignedChannelUpdate ret = *owner->contents.result;
7100         ret.is_owned = false;
7101         return ret;
7102 }
7103 uint64_t  __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_get_ok"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_get_ok(uint64_t owner) {
7104         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)untag_ptr(owner);
7105         LDKUnsignedChannelUpdate ret_var = CResult_UnsignedChannelUpdateDecodeErrorZ_get_ok(owner_conv);
7106         uint64_t ret_ref = 0;
7107         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7108         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7109         return ret_ref;
7110 }
7111
7112 static inline struct LDKDecodeError CResult_UnsignedChannelUpdateDecodeErrorZ_get_err(LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
7113         LDKDecodeError ret = *owner->contents.err;
7114         ret.is_owned = false;
7115         return ret;
7116 }
7117 uint64_t  __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_get_err"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_get_err(uint64_t owner) {
7118         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)untag_ptr(owner);
7119         LDKDecodeError ret_var = CResult_UnsignedChannelUpdateDecodeErrorZ_get_err(owner_conv);
7120         uint64_t ret_ref = 0;
7121         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7122         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7123         return ret_ref;
7124 }
7125
7126 static inline struct LDKChannelUpdate CResult_ChannelUpdateDecodeErrorZ_get_ok(LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
7127         LDKChannelUpdate ret = *owner->contents.result;
7128         ret.is_owned = false;
7129         return ret;
7130 }
7131 uint64_t  __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_get_ok"))) TS_CResult_ChannelUpdateDecodeErrorZ_get_ok(uint64_t owner) {
7132         LDKCResult_ChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)untag_ptr(owner);
7133         LDKChannelUpdate ret_var = CResult_ChannelUpdateDecodeErrorZ_get_ok(owner_conv);
7134         uint64_t ret_ref = 0;
7135         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7136         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7137         return ret_ref;
7138 }
7139
7140 static inline struct LDKDecodeError CResult_ChannelUpdateDecodeErrorZ_get_err(LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
7141         LDKDecodeError ret = *owner->contents.err;
7142         ret.is_owned = false;
7143         return ret;
7144 }
7145 uint64_t  __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_get_err"))) TS_CResult_ChannelUpdateDecodeErrorZ_get_err(uint64_t owner) {
7146         LDKCResult_ChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)untag_ptr(owner);
7147         LDKDecodeError ret_var = CResult_ChannelUpdateDecodeErrorZ_get_err(owner_conv);
7148         uint64_t ret_ref = 0;
7149         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7150         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7151         return ret_ref;
7152 }
7153
7154 static inline struct LDKErrorMessage CResult_ErrorMessageDecodeErrorZ_get_ok(LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR owner){
7155         LDKErrorMessage ret = *owner->contents.result;
7156         ret.is_owned = false;
7157         return ret;
7158 }
7159 uint64_t  __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_get_ok"))) TS_CResult_ErrorMessageDecodeErrorZ_get_ok(uint64_t owner) {
7160         LDKCResult_ErrorMessageDecodeErrorZ* owner_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)untag_ptr(owner);
7161         LDKErrorMessage ret_var = CResult_ErrorMessageDecodeErrorZ_get_ok(owner_conv);
7162         uint64_t ret_ref = 0;
7163         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7164         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7165         return ret_ref;
7166 }
7167
7168 static inline struct LDKDecodeError CResult_ErrorMessageDecodeErrorZ_get_err(LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR owner){
7169         LDKDecodeError ret = *owner->contents.err;
7170         ret.is_owned = false;
7171         return ret;
7172 }
7173 uint64_t  __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_get_err"))) TS_CResult_ErrorMessageDecodeErrorZ_get_err(uint64_t owner) {
7174         LDKCResult_ErrorMessageDecodeErrorZ* owner_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)untag_ptr(owner);
7175         LDKDecodeError ret_var = CResult_ErrorMessageDecodeErrorZ_get_err(owner_conv);
7176         uint64_t ret_ref = 0;
7177         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7178         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7179         return ret_ref;
7180 }
7181
7182 static inline struct LDKWarningMessage CResult_WarningMessageDecodeErrorZ_get_ok(LDKCResult_WarningMessageDecodeErrorZ *NONNULL_PTR owner){
7183         LDKWarningMessage ret = *owner->contents.result;
7184         ret.is_owned = false;
7185         return ret;
7186 }
7187 uint64_t  __attribute__((export_name("TS_CResult_WarningMessageDecodeErrorZ_get_ok"))) TS_CResult_WarningMessageDecodeErrorZ_get_ok(uint64_t owner) {
7188         LDKCResult_WarningMessageDecodeErrorZ* owner_conv = (LDKCResult_WarningMessageDecodeErrorZ*)untag_ptr(owner);
7189         LDKWarningMessage ret_var = CResult_WarningMessageDecodeErrorZ_get_ok(owner_conv);
7190         uint64_t ret_ref = 0;
7191         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7192         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7193         return ret_ref;
7194 }
7195
7196 static inline struct LDKDecodeError CResult_WarningMessageDecodeErrorZ_get_err(LDKCResult_WarningMessageDecodeErrorZ *NONNULL_PTR owner){
7197         LDKDecodeError ret = *owner->contents.err;
7198         ret.is_owned = false;
7199         return ret;
7200 }
7201 uint64_t  __attribute__((export_name("TS_CResult_WarningMessageDecodeErrorZ_get_err"))) TS_CResult_WarningMessageDecodeErrorZ_get_err(uint64_t owner) {
7202         LDKCResult_WarningMessageDecodeErrorZ* owner_conv = (LDKCResult_WarningMessageDecodeErrorZ*)untag_ptr(owner);
7203         LDKDecodeError ret_var = CResult_WarningMessageDecodeErrorZ_get_err(owner_conv);
7204         uint64_t ret_ref = 0;
7205         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7206         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7207         return ret_ref;
7208 }
7209
7210 static inline struct LDKUnsignedNodeAnnouncement CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_ok(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
7211         LDKUnsignedNodeAnnouncement ret = *owner->contents.result;
7212         ret.is_owned = false;
7213         return ret;
7214 }
7215 uint64_t  __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_ok"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_ok(uint64_t owner) {
7216         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)untag_ptr(owner);
7217         LDKUnsignedNodeAnnouncement ret_var = CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_ok(owner_conv);
7218         uint64_t ret_ref = 0;
7219         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7220         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7221         return ret_ref;
7222 }
7223
7224 static inline struct LDKDecodeError CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_err(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
7225         LDKDecodeError ret = *owner->contents.err;
7226         ret.is_owned = false;
7227         return ret;
7228 }
7229 uint64_t  __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_err"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_err(uint64_t owner) {
7230         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)untag_ptr(owner);
7231         LDKDecodeError ret_var = CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_err(owner_conv);
7232         uint64_t ret_ref = 0;
7233         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7234         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7235         return ret_ref;
7236 }
7237
7238 static inline struct LDKNodeAnnouncement CResult_NodeAnnouncementDecodeErrorZ_get_ok(LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
7239         LDKNodeAnnouncement ret = *owner->contents.result;
7240         ret.is_owned = false;
7241         return ret;
7242 }
7243 uint64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_get_ok"))) TS_CResult_NodeAnnouncementDecodeErrorZ_get_ok(uint64_t owner) {
7244         LDKCResult_NodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)untag_ptr(owner);
7245         LDKNodeAnnouncement ret_var = CResult_NodeAnnouncementDecodeErrorZ_get_ok(owner_conv);
7246         uint64_t ret_ref = 0;
7247         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7248         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7249         return ret_ref;
7250 }
7251
7252 static inline struct LDKDecodeError CResult_NodeAnnouncementDecodeErrorZ_get_err(LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
7253         LDKDecodeError ret = *owner->contents.err;
7254         ret.is_owned = false;
7255         return ret;
7256 }
7257 uint64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_get_err"))) TS_CResult_NodeAnnouncementDecodeErrorZ_get_err(uint64_t owner) {
7258         LDKCResult_NodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)untag_ptr(owner);
7259         LDKDecodeError ret_var = CResult_NodeAnnouncementDecodeErrorZ_get_err(owner_conv);
7260         uint64_t ret_ref = 0;
7261         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7262         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7263         return ret_ref;
7264 }
7265
7266 static inline struct LDKQueryShortChannelIds CResult_QueryShortChannelIdsDecodeErrorZ_get_ok(LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR owner){
7267         LDKQueryShortChannelIds ret = *owner->contents.result;
7268         ret.is_owned = false;
7269         return ret;
7270 }
7271 uint64_t  __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_get_ok"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_get_ok(uint64_t owner) {
7272         LDKCResult_QueryShortChannelIdsDecodeErrorZ* owner_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)untag_ptr(owner);
7273         LDKQueryShortChannelIds ret_var = CResult_QueryShortChannelIdsDecodeErrorZ_get_ok(owner_conv);
7274         uint64_t ret_ref = 0;
7275         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7276         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7277         return ret_ref;
7278 }
7279
7280 static inline struct LDKDecodeError CResult_QueryShortChannelIdsDecodeErrorZ_get_err(LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR owner){
7281         LDKDecodeError ret = *owner->contents.err;
7282         ret.is_owned = false;
7283         return ret;
7284 }
7285 uint64_t  __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_get_err"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_get_err(uint64_t owner) {
7286         LDKCResult_QueryShortChannelIdsDecodeErrorZ* owner_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)untag_ptr(owner);
7287         LDKDecodeError ret_var = CResult_QueryShortChannelIdsDecodeErrorZ_get_err(owner_conv);
7288         uint64_t ret_ref = 0;
7289         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7290         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7291         return ret_ref;
7292 }
7293
7294 static inline struct LDKReplyShortChannelIdsEnd CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_ok(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR owner){
7295         LDKReplyShortChannelIdsEnd ret = *owner->contents.result;
7296         ret.is_owned = false;
7297         return ret;
7298 }
7299 uint64_t  __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_ok"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_ok(uint64_t owner) {
7300         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* owner_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)untag_ptr(owner);
7301         LDKReplyShortChannelIdsEnd ret_var = CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_ok(owner_conv);
7302         uint64_t ret_ref = 0;
7303         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7304         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7305         return ret_ref;
7306 }
7307
7308 static inline struct LDKDecodeError CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_err(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR owner){
7309         LDKDecodeError ret = *owner->contents.err;
7310         ret.is_owned = false;
7311         return ret;
7312 }
7313 uint64_t  __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_err"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_err(uint64_t owner) {
7314         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* owner_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)untag_ptr(owner);
7315         LDKDecodeError ret_var = CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_err(owner_conv);
7316         uint64_t ret_ref = 0;
7317         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7318         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7319         return ret_ref;
7320 }
7321
7322 static inline struct LDKQueryChannelRange CResult_QueryChannelRangeDecodeErrorZ_get_ok(LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR owner){
7323         LDKQueryChannelRange ret = *owner->contents.result;
7324         ret.is_owned = false;
7325         return ret;
7326 }
7327 uint64_t  __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_get_ok"))) TS_CResult_QueryChannelRangeDecodeErrorZ_get_ok(uint64_t owner) {
7328         LDKCResult_QueryChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)untag_ptr(owner);
7329         LDKQueryChannelRange ret_var = CResult_QueryChannelRangeDecodeErrorZ_get_ok(owner_conv);
7330         uint64_t ret_ref = 0;
7331         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7332         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7333         return ret_ref;
7334 }
7335
7336 static inline struct LDKDecodeError CResult_QueryChannelRangeDecodeErrorZ_get_err(LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR owner){
7337         LDKDecodeError ret = *owner->contents.err;
7338         ret.is_owned = false;
7339         return ret;
7340 }
7341 uint64_t  __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_get_err"))) TS_CResult_QueryChannelRangeDecodeErrorZ_get_err(uint64_t owner) {
7342         LDKCResult_QueryChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)untag_ptr(owner);
7343         LDKDecodeError ret_var = CResult_QueryChannelRangeDecodeErrorZ_get_err(owner_conv);
7344         uint64_t ret_ref = 0;
7345         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7346         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7347         return ret_ref;
7348 }
7349
7350 static inline struct LDKReplyChannelRange CResult_ReplyChannelRangeDecodeErrorZ_get_ok(LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR owner){
7351         LDKReplyChannelRange ret = *owner->contents.result;
7352         ret.is_owned = false;
7353         return ret;
7354 }
7355 uint64_t  __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_get_ok"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_get_ok(uint64_t owner) {
7356         LDKCResult_ReplyChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)untag_ptr(owner);
7357         LDKReplyChannelRange ret_var = CResult_ReplyChannelRangeDecodeErrorZ_get_ok(owner_conv);
7358         uint64_t ret_ref = 0;
7359         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7360         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7361         return ret_ref;
7362 }
7363
7364 static inline struct LDKDecodeError CResult_ReplyChannelRangeDecodeErrorZ_get_err(LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR owner){
7365         LDKDecodeError ret = *owner->contents.err;
7366         ret.is_owned = false;
7367         return ret;
7368 }
7369 uint64_t  __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_get_err"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_get_err(uint64_t owner) {
7370         LDKCResult_ReplyChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)untag_ptr(owner);
7371         LDKDecodeError ret_var = CResult_ReplyChannelRangeDecodeErrorZ_get_err(owner_conv);
7372         uint64_t ret_ref = 0;
7373         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7374         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7375         return ret_ref;
7376 }
7377
7378 static inline struct LDKGossipTimestampFilter CResult_GossipTimestampFilterDecodeErrorZ_get_ok(LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR owner){
7379         LDKGossipTimestampFilter ret = *owner->contents.result;
7380         ret.is_owned = false;
7381         return ret;
7382 }
7383 uint64_t  __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_get_ok"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_get_ok(uint64_t owner) {
7384         LDKCResult_GossipTimestampFilterDecodeErrorZ* owner_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)untag_ptr(owner);
7385         LDKGossipTimestampFilter ret_var = CResult_GossipTimestampFilterDecodeErrorZ_get_ok(owner_conv);
7386         uint64_t ret_ref = 0;
7387         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7388         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7389         return ret_ref;
7390 }
7391
7392 static inline struct LDKDecodeError CResult_GossipTimestampFilterDecodeErrorZ_get_err(LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR owner){
7393         LDKDecodeError ret = *owner->contents.err;
7394         ret.is_owned = false;
7395         return ret;
7396 }
7397 uint64_t  __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_get_err"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_get_err(uint64_t owner) {
7398         LDKCResult_GossipTimestampFilterDecodeErrorZ* owner_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)untag_ptr(owner);
7399         LDKDecodeError ret_var = CResult_GossipTimestampFilterDecodeErrorZ_get_err(owner_conv);
7400         uint64_t ret_ref = 0;
7401         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7402         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7403         return ret_ref;
7404 }
7405
7406 uint32_t __attribute__((export_name("TS_LDKSignOrCreationError_ty_from_ptr"))) TS_LDKSignOrCreationError_ty_from_ptr(uint64_t ptr) {
7407         LDKSignOrCreationError *obj = (LDKSignOrCreationError*)untag_ptr(ptr);
7408         switch(obj->tag) {
7409                 case LDKSignOrCreationError_SignError: return 0;
7410                 case LDKSignOrCreationError_CreationError: return 1;
7411                 default: abort();
7412         }
7413 }
7414 uint32_t __attribute__((export_name("TS_LDKSignOrCreationError_CreationError_get_creation_error"))) TS_LDKSignOrCreationError_CreationError_get_creation_error(uint64_t ptr) {
7415         LDKSignOrCreationError *obj = (LDKSignOrCreationError*)untag_ptr(ptr);
7416         assert(obj->tag == LDKSignOrCreationError_CreationError);
7417                         uint32_t creation_error_conv = LDKCreationError_to_js(obj->creation_error);
7418         return creation_error_conv;
7419 }
7420 static inline struct LDKInvoice CResult_InvoiceSignOrCreationErrorZ_get_ok(LDKCResult_InvoiceSignOrCreationErrorZ *NONNULL_PTR owner){
7421         LDKInvoice ret = *owner->contents.result;
7422         ret.is_owned = false;
7423         return ret;
7424 }
7425 uint64_t  __attribute__((export_name("TS_CResult_InvoiceSignOrCreationErrorZ_get_ok"))) TS_CResult_InvoiceSignOrCreationErrorZ_get_ok(uint64_t owner) {
7426         LDKCResult_InvoiceSignOrCreationErrorZ* owner_conv = (LDKCResult_InvoiceSignOrCreationErrorZ*)untag_ptr(owner);
7427         LDKInvoice ret_var = CResult_InvoiceSignOrCreationErrorZ_get_ok(owner_conv);
7428         uint64_t ret_ref = 0;
7429         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7430         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7431         return ret_ref;
7432 }
7433
7434 static inline struct LDKSignOrCreationError CResult_InvoiceSignOrCreationErrorZ_get_err(LDKCResult_InvoiceSignOrCreationErrorZ *NONNULL_PTR owner){
7435 CHECK(!owner->result_ok);
7436         return SignOrCreationError_clone(&*owner->contents.err);
7437 }
7438 uint64_t  __attribute__((export_name("TS_CResult_InvoiceSignOrCreationErrorZ_get_err"))) TS_CResult_InvoiceSignOrCreationErrorZ_get_err(uint64_t owner) {
7439         LDKCResult_InvoiceSignOrCreationErrorZ* owner_conv = (LDKCResult_InvoiceSignOrCreationErrorZ*)untag_ptr(owner);
7440         LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
7441         *ret_copy = CResult_InvoiceSignOrCreationErrorZ_get_err(owner_conv);
7442         uint64_t ret_ref = tag_ptr(ret_copy, true);
7443         return ret_ref;
7444 }
7445
7446 typedef struct LDKFilter_JCalls {
7447         atomic_size_t refcnt;
7448         uint32_t instance_ptr;
7449 } LDKFilter_JCalls;
7450 static void LDKFilter_JCalls_free(void* this_arg) {
7451         LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
7452         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
7453                 FREE(j_calls);
7454         }
7455 }
7456 void register_tx_LDKFilter_jcall(const void* this_arg, const uint8_t (* txid)[32], LDKu8slice script_pubkey) {
7457         LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
7458         int8_tArray txid_arr = init_int8_tArray(32, __LINE__);
7459         memcpy(txid_arr->elems, *txid, 32);
7460         LDKu8slice script_pubkey_var = script_pubkey;
7461         int8_tArray script_pubkey_arr = init_int8_tArray(script_pubkey_var.datalen, __LINE__);
7462         memcpy(script_pubkey_arr->elems, script_pubkey_var.data, script_pubkey_var.datalen);
7463         js_invoke_function_uuuuuu(j_calls->instance_ptr, 32, (uint32_t)txid_arr, (uint32_t)script_pubkey_arr, 0, 0, 0, 0);
7464 }
7465 LDKCOption_C2Tuple_usizeTransactionZZ register_output_LDKFilter_jcall(const void* this_arg, LDKWatchedOutput output) {
7466         LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
7467         LDKWatchedOutput output_var = output;
7468         uint64_t output_ref = 0;
7469         CHECK_INNER_FIELD_ACCESS_OR_NULL(output_var);
7470         output_ref = tag_ptr(output_var.inner, output_var.is_owned);
7471         uint32_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 33, output_ref, 0, 0, 0, 0, 0);
7472         void* ret_ptr = untag_ptr(ret);
7473         CHECK_ACCESS(ret_ptr);
7474         LDKCOption_C2Tuple_usizeTransactionZZ ret_conv = *(LDKCOption_C2Tuple_usizeTransactionZZ*)(ret_ptr);
7475         FREE(untag_ptr(ret));
7476         return ret_conv;
7477 }
7478 static void LDKFilter_JCalls_cloned(LDKFilter* new_obj) {
7479         LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) new_obj->this_arg;
7480         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
7481 }
7482 static inline LDKFilter LDKFilter_init (JSValue o) {
7483         LDKFilter_JCalls *calls = MALLOC(sizeof(LDKFilter_JCalls), "LDKFilter_JCalls");
7484         atomic_init(&calls->refcnt, 1);
7485         calls->instance_ptr = o;
7486
7487         LDKFilter ret = {
7488                 .this_arg = (void*) calls,
7489                 .register_tx = register_tx_LDKFilter_jcall,
7490                 .register_output = register_output_LDKFilter_jcall,
7491                 .free = LDKFilter_JCalls_free,
7492         };
7493         return ret;
7494 }
7495 uint64_t  __attribute__((export_name("TS_LDKFilter_new"))) TS_LDKFilter_new(JSValue o) {
7496         LDKFilter *res_ptr = MALLOC(sizeof(LDKFilter), "LDKFilter");
7497         *res_ptr = LDKFilter_init(o);
7498         return tag_ptr(res_ptr, true);
7499 }
7500 void  __attribute__((export_name("TS_Filter_register_tx"))) TS_Filter_register_tx(uint64_t this_arg, int8_tArray txid, int8_tArray script_pubkey) {
7501         void* this_arg_ptr = untag_ptr(this_arg);
7502         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
7503         LDKFilter* this_arg_conv = (LDKFilter*)this_arg_ptr;
7504         unsigned char txid_arr[32];
7505         CHECK(txid->arr_len == 32);
7506         memcpy(txid_arr, txid->elems, 32); FREE(txid);
7507         unsigned char (*txid_ref)[32] = &txid_arr;
7508         LDKu8slice script_pubkey_ref;
7509         script_pubkey_ref.datalen = script_pubkey->arr_len;
7510         script_pubkey_ref.data = script_pubkey->elems;
7511         (this_arg_conv->register_tx)(this_arg_conv->this_arg, txid_ref, script_pubkey_ref);
7512         FREE(script_pubkey);
7513 }
7514
7515 uint64_t  __attribute__((export_name("TS_Filter_register_output"))) TS_Filter_register_output(uint64_t this_arg, uint64_t output) {
7516         void* this_arg_ptr = untag_ptr(this_arg);
7517         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
7518         LDKFilter* this_arg_conv = (LDKFilter*)this_arg_ptr;
7519         LDKWatchedOutput output_conv;
7520         output_conv.inner = untag_ptr(output);
7521         output_conv.is_owned = ptr_is_owned(output);
7522         CHECK_INNER_FIELD_ACCESS_OR_NULL(output_conv);
7523         output_conv = WatchedOutput_clone(&output_conv);
7524         LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
7525         *ret_copy = (this_arg_conv->register_output)(this_arg_conv->this_arg, output_conv);
7526         uint64_t ret_ref = tag_ptr(ret_copy, true);
7527         return ret_ref;
7528 }
7529
7530 uint32_t __attribute__((export_name("TS_LDKCOption_FilterZ_ty_from_ptr"))) TS_LDKCOption_FilterZ_ty_from_ptr(uint64_t ptr) {
7531         LDKCOption_FilterZ *obj = (LDKCOption_FilterZ*)untag_ptr(ptr);
7532         switch(obj->tag) {
7533                 case LDKCOption_FilterZ_Some: return 0;
7534                 case LDKCOption_FilterZ_None: return 1;
7535                 default: abort();
7536         }
7537 }
7538 uint64_t __attribute__((export_name("TS_LDKCOption_FilterZ_Some_get_some"))) TS_LDKCOption_FilterZ_Some_get_some(uint64_t ptr) {
7539         LDKCOption_FilterZ *obj = (LDKCOption_FilterZ*)untag_ptr(ptr);
7540         assert(obj->tag == LDKCOption_FilterZ_Some);
7541                         LDKFilter* some_ret = MALLOC(sizeof(LDKFilter), "LDKFilter");
7542                         *some_ret = obj->some;
7543                         // WARNING: We likely need to clone here, but no clone is available, so we just do it for Java instances
7544                         if ((*some_ret).free == LDKFilter_JCalls_free) {
7545                                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
7546                                 LDKFilter_JCalls_cloned(&(*some_ret));
7547                         }
7548         return tag_ptr(some_ret, true);
7549 }
7550 static inline struct LDKLockedChannelMonitor CResult_LockedChannelMonitorNoneZ_get_ok(LDKCResult_LockedChannelMonitorNoneZ *NONNULL_PTR owner){
7551         LDKLockedChannelMonitor ret = *owner->contents.result;
7552         ret.is_owned = false;
7553         return ret;
7554 }
7555 uint64_t  __attribute__((export_name("TS_CResult_LockedChannelMonitorNoneZ_get_ok"))) TS_CResult_LockedChannelMonitorNoneZ_get_ok(uint64_t owner) {
7556         LDKCResult_LockedChannelMonitorNoneZ* owner_conv = (LDKCResult_LockedChannelMonitorNoneZ*)untag_ptr(owner);
7557         LDKLockedChannelMonitor ret_var = CResult_LockedChannelMonitorNoneZ_get_ok(owner_conv);
7558         uint64_t ret_ref = 0;
7559         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7560         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7561         return ret_ref;
7562 }
7563
7564 static inline void CResult_LockedChannelMonitorNoneZ_get_err(LDKCResult_LockedChannelMonitorNoneZ *NONNULL_PTR owner){
7565 CHECK(!owner->result_ok);
7566         return *owner->contents.err;
7567 }
7568 void  __attribute__((export_name("TS_CResult_LockedChannelMonitorNoneZ_get_err"))) TS_CResult_LockedChannelMonitorNoneZ_get_err(uint64_t owner) {
7569         LDKCResult_LockedChannelMonitorNoneZ* owner_conv = (LDKCResult_LockedChannelMonitorNoneZ*)untag_ptr(owner);
7570         CResult_LockedChannelMonitorNoneZ_get_err(owner_conv);
7571 }
7572
7573 static inline LDKCVec_OutPointZ CVec_OutPointZ_clone(const LDKCVec_OutPointZ *orig) {
7574         LDKCVec_OutPointZ ret = { .data = MALLOC(sizeof(LDKOutPoint) * orig->datalen, "LDKCVec_OutPointZ clone bytes"), .datalen = orig->datalen };
7575         for (size_t i = 0; i < ret.datalen; i++) {
7576                 ret.data[i] = OutPoint_clone(&orig->data[i]);
7577         }
7578         return ret;
7579 }
7580 typedef struct LDKMessageSendEventsProvider_JCalls {
7581         atomic_size_t refcnt;
7582         uint32_t instance_ptr;
7583 } LDKMessageSendEventsProvider_JCalls;
7584 static void LDKMessageSendEventsProvider_JCalls_free(void* this_arg) {
7585         LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
7586         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
7587                 FREE(j_calls);
7588         }
7589 }
7590 LDKCVec_MessageSendEventZ get_and_clear_pending_msg_events_LDKMessageSendEventsProvider_jcall(const void* this_arg) {
7591         LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
7592         uint64_tArray ret = (uint64_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 34, 0, 0, 0, 0, 0, 0);
7593         LDKCVec_MessageSendEventZ ret_constr;
7594         ret_constr.datalen = ret->arr_len;
7595         if (ret_constr.datalen > 0)
7596                 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
7597         else
7598                 ret_constr.data = NULL;
7599         uint64_t* ret_vals = ret->elems;
7600         for (size_t s = 0; s < ret_constr.datalen; s++) {
7601                 uint64_t ret_conv_18 = ret_vals[s];
7602                 void* ret_conv_18_ptr = untag_ptr(ret_conv_18);
7603                 CHECK_ACCESS(ret_conv_18_ptr);
7604                 LDKMessageSendEvent ret_conv_18_conv = *(LDKMessageSendEvent*)(ret_conv_18_ptr);
7605                 FREE(untag_ptr(ret_conv_18));
7606                 ret_constr.data[s] = ret_conv_18_conv;
7607         }
7608         FREE(ret);
7609         return ret_constr;
7610 }
7611 static void LDKMessageSendEventsProvider_JCalls_cloned(LDKMessageSendEventsProvider* new_obj) {
7612         LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) new_obj->this_arg;
7613         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
7614 }
7615 static inline LDKMessageSendEventsProvider LDKMessageSendEventsProvider_init (JSValue o) {
7616         LDKMessageSendEventsProvider_JCalls *calls = MALLOC(sizeof(LDKMessageSendEventsProvider_JCalls), "LDKMessageSendEventsProvider_JCalls");
7617         atomic_init(&calls->refcnt, 1);
7618         calls->instance_ptr = o;
7619
7620         LDKMessageSendEventsProvider ret = {
7621                 .this_arg = (void*) calls,
7622                 .get_and_clear_pending_msg_events = get_and_clear_pending_msg_events_LDKMessageSendEventsProvider_jcall,
7623                 .free = LDKMessageSendEventsProvider_JCalls_free,
7624         };
7625         return ret;
7626 }
7627 uint64_t  __attribute__((export_name("TS_LDKMessageSendEventsProvider_new"))) TS_LDKMessageSendEventsProvider_new(JSValue o) {
7628         LDKMessageSendEventsProvider *res_ptr = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
7629         *res_ptr = LDKMessageSendEventsProvider_init(o);
7630         return tag_ptr(res_ptr, true);
7631 }
7632 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) {
7633         void* this_arg_ptr = untag_ptr(this_arg);
7634         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
7635         LDKMessageSendEventsProvider* this_arg_conv = (LDKMessageSendEventsProvider*)this_arg_ptr;
7636         LDKCVec_MessageSendEventZ ret_var = (this_arg_conv->get_and_clear_pending_msg_events)(this_arg_conv->this_arg);
7637         uint64_tArray ret_arr = NULL;
7638         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
7639         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
7640         for (size_t s = 0; s < ret_var.datalen; s++) {
7641                 LDKMessageSendEvent *ret_conv_18_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
7642                 *ret_conv_18_copy = ret_var.data[s];
7643                 uint64_t ret_conv_18_ref = tag_ptr(ret_conv_18_copy, true);
7644                 ret_arr_ptr[s] = ret_conv_18_ref;
7645         }
7646         
7647         FREE(ret_var.data);
7648         return ret_arr;
7649 }
7650
7651 typedef struct LDKEventHandler_JCalls {
7652         atomic_size_t refcnt;
7653         uint32_t instance_ptr;
7654 } LDKEventHandler_JCalls;
7655 static void LDKEventHandler_JCalls_free(void* this_arg) {
7656         LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) this_arg;
7657         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
7658                 FREE(j_calls);
7659         }
7660 }
7661 void handle_event_LDKEventHandler_jcall(const void* this_arg, const LDKEvent * event) {
7662         LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) this_arg;
7663         LDKEvent *ret_event = MALLOC(sizeof(LDKEvent), "LDKEvent ret conversion");
7664         *ret_event = Event_clone(event);
7665         uint64_t ref_event = tag_ptr(ret_event, true);
7666         js_invoke_function_buuuuu(j_calls->instance_ptr, 35, ref_event, 0, 0, 0, 0, 0);
7667 }
7668 static void LDKEventHandler_JCalls_cloned(LDKEventHandler* new_obj) {
7669         LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) new_obj->this_arg;
7670         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
7671 }
7672 static inline LDKEventHandler LDKEventHandler_init (JSValue o) {
7673         LDKEventHandler_JCalls *calls = MALLOC(sizeof(LDKEventHandler_JCalls), "LDKEventHandler_JCalls");
7674         atomic_init(&calls->refcnt, 1);
7675         calls->instance_ptr = o;
7676
7677         LDKEventHandler ret = {
7678                 .this_arg = (void*) calls,
7679                 .handle_event = handle_event_LDKEventHandler_jcall,
7680                 .free = LDKEventHandler_JCalls_free,
7681         };
7682         return ret;
7683 }
7684 uint64_t  __attribute__((export_name("TS_LDKEventHandler_new"))) TS_LDKEventHandler_new(JSValue o) {
7685         LDKEventHandler *res_ptr = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
7686         *res_ptr = LDKEventHandler_init(o);
7687         return tag_ptr(res_ptr, true);
7688 }
7689 void  __attribute__((export_name("TS_EventHandler_handle_event"))) TS_EventHandler_handle_event(uint64_t this_arg, uint64_t event) {
7690         void* this_arg_ptr = untag_ptr(this_arg);
7691         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
7692         LDKEventHandler* this_arg_conv = (LDKEventHandler*)this_arg_ptr;
7693         LDKEvent* event_conv = (LDKEvent*)untag_ptr(event);
7694         (this_arg_conv->handle_event)(this_arg_conv->this_arg, event_conv);
7695 }
7696
7697 typedef struct LDKEventsProvider_JCalls {
7698         atomic_size_t refcnt;
7699         uint32_t instance_ptr;
7700 } LDKEventsProvider_JCalls;
7701 static void LDKEventsProvider_JCalls_free(void* this_arg) {
7702         LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
7703         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
7704                 FREE(j_calls);
7705         }
7706 }
7707 void process_pending_events_LDKEventsProvider_jcall(const void* this_arg, LDKEventHandler handler) {
7708         LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
7709         LDKEventHandler* handler_ret = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
7710         *handler_ret = handler;
7711         js_invoke_function_buuuuu(j_calls->instance_ptr, 36, tag_ptr(handler_ret, true), 0, 0, 0, 0, 0);
7712 }
7713 static void LDKEventsProvider_JCalls_cloned(LDKEventsProvider* new_obj) {
7714         LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) new_obj->this_arg;
7715         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
7716 }
7717 static inline LDKEventsProvider LDKEventsProvider_init (JSValue o) {
7718         LDKEventsProvider_JCalls *calls = MALLOC(sizeof(LDKEventsProvider_JCalls), "LDKEventsProvider_JCalls");
7719         atomic_init(&calls->refcnt, 1);
7720         calls->instance_ptr = o;
7721
7722         LDKEventsProvider ret = {
7723                 .this_arg = (void*) calls,
7724                 .process_pending_events = process_pending_events_LDKEventsProvider_jcall,
7725                 .free = LDKEventsProvider_JCalls_free,
7726         };
7727         return ret;
7728 }
7729 uint64_t  __attribute__((export_name("TS_LDKEventsProvider_new"))) TS_LDKEventsProvider_new(JSValue o) {
7730         LDKEventsProvider *res_ptr = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
7731         *res_ptr = LDKEventsProvider_init(o);
7732         return tag_ptr(res_ptr, true);
7733 }
7734 void  __attribute__((export_name("TS_EventsProvider_process_pending_events"))) TS_EventsProvider_process_pending_events(uint64_t this_arg, uint64_t handler) {
7735         void* this_arg_ptr = untag_ptr(this_arg);
7736         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
7737         LDKEventsProvider* this_arg_conv = (LDKEventsProvider*)this_arg_ptr;
7738         void* handler_ptr = untag_ptr(handler);
7739         CHECK_ACCESS(handler_ptr);
7740         LDKEventHandler handler_conv = *(LDKEventHandler*)(handler_ptr);
7741         if (handler_conv.free == LDKEventHandler_JCalls_free) {
7742                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
7743                 LDKEventHandler_JCalls_cloned(&handler_conv);
7744         }
7745         (this_arg_conv->process_pending_events)(this_arg_conv->this_arg, handler_conv);
7746 }
7747
7748 typedef struct LDKScore_JCalls {
7749         atomic_size_t refcnt;
7750         uint32_t instance_ptr;
7751 } LDKScore_JCalls;
7752 static void LDKScore_JCalls_free(void* this_arg) {
7753         LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
7754         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
7755                 FREE(j_calls);
7756         }
7757 }
7758 uint64_t channel_penalty_msat_LDKScore_jcall(const void* this_arg, uint64_t short_channel_id, const LDKNodeId * source, const LDKNodeId * target, LDKChannelUsage usage) {
7759         LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
7760         int64_t short_channel_id_conv = short_channel_id;
7761         LDKNodeId source_var = *source;
7762         uint64_t source_ref = 0;
7763         source_var = NodeId_clone(&source_var);
7764         CHECK_INNER_FIELD_ACCESS_OR_NULL(source_var);
7765         source_ref = tag_ptr(source_var.inner, source_var.is_owned);
7766         LDKNodeId target_var = *target;
7767         uint64_t target_ref = 0;
7768         target_var = NodeId_clone(&target_var);
7769         CHECK_INNER_FIELD_ACCESS_OR_NULL(target_var);
7770         target_ref = tag_ptr(target_var.inner, target_var.is_owned);
7771         LDKChannelUsage usage_var = usage;
7772         uint64_t usage_ref = 0;
7773         CHECK_INNER_FIELD_ACCESS_OR_NULL(usage_var);
7774         usage_ref = tag_ptr(usage_var.inner, usage_var.is_owned);
7775         return js_invoke_function_bbbbuu(j_calls->instance_ptr, 37, short_channel_id_conv, source_ref, target_ref, usage_ref, 0, 0);
7776 }
7777 void payment_path_failed_LDKScore_jcall(void* this_arg, LDKCVec_RouteHopZ path, uint64_t short_channel_id) {
7778         LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
7779         LDKCVec_RouteHopZ path_var = path;
7780         uint64_tArray path_arr = NULL;
7781         path_arr = init_uint64_tArray(path_var.datalen, __LINE__);
7782         uint64_t *path_arr_ptr = (uint64_t*)(((uint8_t*)path_arr) + 8);
7783         for (size_t k = 0; k < path_var.datalen; k++) {
7784                 LDKRouteHop path_conv_10_var = path_var.data[k];
7785                 uint64_t path_conv_10_ref = 0;
7786                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var);
7787                 path_conv_10_ref = tag_ptr(path_conv_10_var.inner, path_conv_10_var.is_owned);
7788                 path_arr_ptr[k] = path_conv_10_ref;
7789         }
7790         
7791         FREE(path_var.data);
7792         int64_t short_channel_id_conv = short_channel_id;
7793         js_invoke_function_ubuuuu(j_calls->instance_ptr, 38, (uint32_t)path_arr, short_channel_id_conv, 0, 0, 0, 0);
7794 }
7795 void payment_path_successful_LDKScore_jcall(void* this_arg, LDKCVec_RouteHopZ path) {
7796         LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
7797         LDKCVec_RouteHopZ path_var = path;
7798         uint64_tArray path_arr = NULL;
7799         path_arr = init_uint64_tArray(path_var.datalen, __LINE__);
7800         uint64_t *path_arr_ptr = (uint64_t*)(((uint8_t*)path_arr) + 8);
7801         for (size_t k = 0; k < path_var.datalen; k++) {
7802                 LDKRouteHop path_conv_10_var = path_var.data[k];
7803                 uint64_t path_conv_10_ref = 0;
7804                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var);
7805                 path_conv_10_ref = tag_ptr(path_conv_10_var.inner, path_conv_10_var.is_owned);
7806                 path_arr_ptr[k] = path_conv_10_ref;
7807         }
7808         
7809         FREE(path_var.data);
7810         js_invoke_function_uuuuuu(j_calls->instance_ptr, 39, (uint32_t)path_arr, 0, 0, 0, 0, 0);
7811 }
7812 void probe_failed_LDKScore_jcall(void* this_arg, LDKCVec_RouteHopZ path, uint64_t short_channel_id) {
7813         LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
7814         LDKCVec_RouteHopZ path_var = path;
7815         uint64_tArray path_arr = NULL;
7816         path_arr = init_uint64_tArray(path_var.datalen, __LINE__);
7817         uint64_t *path_arr_ptr = (uint64_t*)(((uint8_t*)path_arr) + 8);
7818         for (size_t k = 0; k < path_var.datalen; k++) {
7819                 LDKRouteHop path_conv_10_var = path_var.data[k];
7820                 uint64_t path_conv_10_ref = 0;
7821                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var);
7822                 path_conv_10_ref = tag_ptr(path_conv_10_var.inner, path_conv_10_var.is_owned);
7823                 path_arr_ptr[k] = path_conv_10_ref;
7824         }
7825         
7826         FREE(path_var.data);
7827         int64_t short_channel_id_conv = short_channel_id;
7828         js_invoke_function_ubuuuu(j_calls->instance_ptr, 40, (uint32_t)path_arr, short_channel_id_conv, 0, 0, 0, 0);
7829 }
7830 void probe_successful_LDKScore_jcall(void* this_arg, LDKCVec_RouteHopZ path) {
7831         LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
7832         LDKCVec_RouteHopZ path_var = path;
7833         uint64_tArray path_arr = NULL;
7834         path_arr = init_uint64_tArray(path_var.datalen, __LINE__);
7835         uint64_t *path_arr_ptr = (uint64_t*)(((uint8_t*)path_arr) + 8);
7836         for (size_t k = 0; k < path_var.datalen; k++) {
7837                 LDKRouteHop path_conv_10_var = path_var.data[k];
7838                 uint64_t path_conv_10_ref = 0;
7839                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var);
7840                 path_conv_10_ref = tag_ptr(path_conv_10_var.inner, path_conv_10_var.is_owned);
7841                 path_arr_ptr[k] = path_conv_10_ref;
7842         }
7843         
7844         FREE(path_var.data);
7845         js_invoke_function_uuuuuu(j_calls->instance_ptr, 41, (uint32_t)path_arr, 0, 0, 0, 0, 0);
7846 }
7847 LDKCVec_u8Z write_LDKScore_jcall(const void* this_arg) {
7848         LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
7849         int8_tArray ret = (int8_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 42, 0, 0, 0, 0, 0, 0);
7850         LDKCVec_u8Z ret_ref;
7851         ret_ref.datalen = ret->arr_len;
7852         ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
7853         memcpy(ret_ref.data, ret->elems, ret_ref.datalen); FREE(ret);
7854         return ret_ref;
7855 }
7856 static void LDKScore_JCalls_cloned(LDKScore* new_obj) {
7857         LDKScore_JCalls *j_calls = (LDKScore_JCalls*) new_obj->this_arg;
7858         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
7859 }
7860 static inline LDKScore LDKScore_init (JSValue o) {
7861         LDKScore_JCalls *calls = MALLOC(sizeof(LDKScore_JCalls), "LDKScore_JCalls");
7862         atomic_init(&calls->refcnt, 1);
7863         calls->instance_ptr = o;
7864
7865         LDKScore ret = {
7866                 .this_arg = (void*) calls,
7867                 .channel_penalty_msat = channel_penalty_msat_LDKScore_jcall,
7868                 .payment_path_failed = payment_path_failed_LDKScore_jcall,
7869                 .payment_path_successful = payment_path_successful_LDKScore_jcall,
7870                 .probe_failed = probe_failed_LDKScore_jcall,
7871                 .probe_successful = probe_successful_LDKScore_jcall,
7872                 .write = write_LDKScore_jcall,
7873                 .free = LDKScore_JCalls_free,
7874         };
7875         return ret;
7876 }
7877 uint64_t  __attribute__((export_name("TS_LDKScore_new"))) TS_LDKScore_new(JSValue o) {
7878         LDKScore *res_ptr = MALLOC(sizeof(LDKScore), "LDKScore");
7879         *res_ptr = LDKScore_init(o);
7880         return tag_ptr(res_ptr, true);
7881 }
7882 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) {
7883         void* this_arg_ptr = untag_ptr(this_arg);
7884         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
7885         LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
7886         LDKNodeId source_conv;
7887         source_conv.inner = untag_ptr(source);
7888         source_conv.is_owned = ptr_is_owned(source);
7889         CHECK_INNER_FIELD_ACCESS_OR_NULL(source_conv);
7890         source_conv.is_owned = false;
7891         LDKNodeId target_conv;
7892         target_conv.inner = untag_ptr(target);
7893         target_conv.is_owned = ptr_is_owned(target);
7894         CHECK_INNER_FIELD_ACCESS_OR_NULL(target_conv);
7895         target_conv.is_owned = false;
7896         LDKChannelUsage usage_conv;
7897         usage_conv.inner = untag_ptr(usage);
7898         usage_conv.is_owned = ptr_is_owned(usage);
7899         CHECK_INNER_FIELD_ACCESS_OR_NULL(usage_conv);
7900         usage_conv = ChannelUsage_clone(&usage_conv);
7901         int64_t ret_conv = (this_arg_conv->channel_penalty_msat)(this_arg_conv->this_arg, short_channel_id, &source_conv, &target_conv, usage_conv);
7902         return ret_conv;
7903 }
7904
7905 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) {
7906         void* this_arg_ptr = untag_ptr(this_arg);
7907         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
7908         LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
7909         LDKCVec_RouteHopZ path_constr;
7910         path_constr.datalen = path->arr_len;
7911         if (path_constr.datalen > 0)
7912                 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
7913         else
7914                 path_constr.data = NULL;
7915         uint64_t* path_vals = path->elems;
7916         for (size_t k = 0; k < path_constr.datalen; k++) {
7917                 uint64_t path_conv_10 = path_vals[k];
7918                 LDKRouteHop path_conv_10_conv;
7919                 path_conv_10_conv.inner = untag_ptr(path_conv_10);
7920                 path_conv_10_conv.is_owned = ptr_is_owned(path_conv_10);
7921                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
7922                 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
7923                 path_constr.data[k] = path_conv_10_conv;
7924         }
7925         FREE(path);
7926         (this_arg_conv->payment_path_failed)(this_arg_conv->this_arg, path_constr, short_channel_id);
7927 }
7928
7929 void  __attribute__((export_name("TS_Score_payment_path_successful"))) TS_Score_payment_path_successful(uint64_t this_arg, uint64_tArray path) {
7930         void* this_arg_ptr = untag_ptr(this_arg);
7931         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
7932         LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
7933         LDKCVec_RouteHopZ path_constr;
7934         path_constr.datalen = path->arr_len;
7935         if (path_constr.datalen > 0)
7936                 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
7937         else
7938                 path_constr.data = NULL;
7939         uint64_t* path_vals = path->elems;
7940         for (size_t k = 0; k < path_constr.datalen; k++) {
7941                 uint64_t path_conv_10 = path_vals[k];
7942                 LDKRouteHop path_conv_10_conv;
7943                 path_conv_10_conv.inner = untag_ptr(path_conv_10);
7944                 path_conv_10_conv.is_owned = ptr_is_owned(path_conv_10);
7945                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
7946                 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
7947                 path_constr.data[k] = path_conv_10_conv;
7948         }
7949         FREE(path);
7950         (this_arg_conv->payment_path_successful)(this_arg_conv->this_arg, path_constr);
7951 }
7952
7953 void  __attribute__((export_name("TS_Score_probe_failed"))) TS_Score_probe_failed(uint64_t this_arg, uint64_tArray path, int64_t short_channel_id) {
7954         void* this_arg_ptr = untag_ptr(this_arg);
7955         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
7956         LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
7957         LDKCVec_RouteHopZ path_constr;
7958         path_constr.datalen = path->arr_len;
7959         if (path_constr.datalen > 0)
7960                 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
7961         else
7962                 path_constr.data = NULL;
7963         uint64_t* path_vals = path->elems;
7964         for (size_t k = 0; k < path_constr.datalen; k++) {
7965                 uint64_t path_conv_10 = path_vals[k];
7966                 LDKRouteHop path_conv_10_conv;
7967                 path_conv_10_conv.inner = untag_ptr(path_conv_10);
7968                 path_conv_10_conv.is_owned = ptr_is_owned(path_conv_10);
7969                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
7970                 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
7971                 path_constr.data[k] = path_conv_10_conv;
7972         }
7973         FREE(path);
7974         (this_arg_conv->probe_failed)(this_arg_conv->this_arg, path_constr, short_channel_id);
7975 }
7976
7977 void  __attribute__((export_name("TS_Score_probe_successful"))) TS_Score_probe_successful(uint64_t this_arg, uint64_tArray path) {
7978         void* this_arg_ptr = untag_ptr(this_arg);
7979         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
7980         LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
7981         LDKCVec_RouteHopZ path_constr;
7982         path_constr.datalen = path->arr_len;
7983         if (path_constr.datalen > 0)
7984                 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
7985         else
7986                 path_constr.data = NULL;
7987         uint64_t* path_vals = path->elems;
7988         for (size_t k = 0; k < path_constr.datalen; k++) {
7989                 uint64_t path_conv_10 = path_vals[k];
7990                 LDKRouteHop path_conv_10_conv;
7991                 path_conv_10_conv.inner = untag_ptr(path_conv_10);
7992                 path_conv_10_conv.is_owned = ptr_is_owned(path_conv_10);
7993                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
7994                 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
7995                 path_constr.data[k] = path_conv_10_conv;
7996         }
7997         FREE(path);
7998         (this_arg_conv->probe_successful)(this_arg_conv->this_arg, path_constr);
7999 }
8000
8001 int8_tArray  __attribute__((export_name("TS_Score_write"))) TS_Score_write(uint64_t this_arg) {
8002         void* this_arg_ptr = untag_ptr(this_arg);
8003         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8004         LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
8005         LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
8006         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
8007         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
8008         CVec_u8Z_free(ret_var);
8009         return ret_arr;
8010 }
8011
8012 typedef struct LDKPersister_JCalls {
8013         atomic_size_t refcnt;
8014         uint32_t instance_ptr;
8015 } LDKPersister_JCalls;
8016 static void LDKPersister_JCalls_free(void* this_arg) {
8017         LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) this_arg;
8018         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
8019                 FREE(j_calls);
8020         }
8021 }
8022 LDKCResult_NoneErrorZ persist_manager_LDKPersister_jcall(const void* this_arg, const LDKChannelManager * channel_manager) {
8023         LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) this_arg;
8024         LDKChannelManager channel_manager_var = *channel_manager;
8025         uint64_t channel_manager_ref = 0;
8026         // WARNING: we may need a move here but no clone is available for LDKChannelManager
8027         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_manager_var);
8028         channel_manager_ref = tag_ptr(channel_manager_var.inner, channel_manager_var.is_owned);
8029         uint32_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 43, channel_manager_ref, 0, 0, 0, 0, 0);
8030         void* ret_ptr = untag_ptr(ret);
8031         CHECK_ACCESS(ret_ptr);
8032         LDKCResult_NoneErrorZ ret_conv = *(LDKCResult_NoneErrorZ*)(ret_ptr);
8033         FREE(untag_ptr(ret));
8034         return ret_conv;
8035 }
8036 LDKCResult_NoneErrorZ persist_graph_LDKPersister_jcall(const void* this_arg, const LDKNetworkGraph * network_graph) {
8037         LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) this_arg;
8038         LDKNetworkGraph network_graph_var = *network_graph;
8039         uint64_t network_graph_ref = 0;
8040         // WARNING: we may need a move here but no clone is available for LDKNetworkGraph
8041         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_var);
8042         network_graph_ref = tag_ptr(network_graph_var.inner, network_graph_var.is_owned);
8043         uint32_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 44, network_graph_ref, 0, 0, 0, 0, 0);
8044         void* ret_ptr = untag_ptr(ret);
8045         CHECK_ACCESS(ret_ptr);
8046         LDKCResult_NoneErrorZ ret_conv = *(LDKCResult_NoneErrorZ*)(ret_ptr);
8047         FREE(untag_ptr(ret));
8048         return ret_conv;
8049 }
8050 LDKCResult_NoneErrorZ persist_scorer_LDKPersister_jcall(const void* this_arg, const LDKMultiThreadedLockableScore * scorer) {
8051         LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) this_arg;
8052         LDKMultiThreadedLockableScore scorer_var = *scorer;
8053         uint64_t scorer_ref = 0;
8054         // WARNING: we may need a move here but no clone is available for LDKMultiThreadedLockableScore
8055         CHECK_INNER_FIELD_ACCESS_OR_NULL(scorer_var);
8056         scorer_ref = tag_ptr(scorer_var.inner, scorer_var.is_owned);
8057         uint32_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 45, scorer_ref, 0, 0, 0, 0, 0);
8058         void* ret_ptr = untag_ptr(ret);
8059         CHECK_ACCESS(ret_ptr);
8060         LDKCResult_NoneErrorZ ret_conv = *(LDKCResult_NoneErrorZ*)(ret_ptr);
8061         FREE(untag_ptr(ret));
8062         return ret_conv;
8063 }
8064 static void LDKPersister_JCalls_cloned(LDKPersister* new_obj) {
8065         LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) new_obj->this_arg;
8066         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
8067 }
8068 static inline LDKPersister LDKPersister_init (JSValue o) {
8069         LDKPersister_JCalls *calls = MALLOC(sizeof(LDKPersister_JCalls), "LDKPersister_JCalls");
8070         atomic_init(&calls->refcnt, 1);
8071         calls->instance_ptr = o;
8072
8073         LDKPersister ret = {
8074                 .this_arg = (void*) calls,
8075                 .persist_manager = persist_manager_LDKPersister_jcall,
8076                 .persist_graph = persist_graph_LDKPersister_jcall,
8077                 .persist_scorer = persist_scorer_LDKPersister_jcall,
8078                 .free = LDKPersister_JCalls_free,
8079         };
8080         return ret;
8081 }
8082 uint64_t  __attribute__((export_name("TS_LDKPersister_new"))) TS_LDKPersister_new(JSValue o) {
8083         LDKPersister *res_ptr = MALLOC(sizeof(LDKPersister), "LDKPersister");
8084         *res_ptr = LDKPersister_init(o);
8085         return tag_ptr(res_ptr, true);
8086 }
8087 uint64_t  __attribute__((export_name("TS_Persister_persist_manager"))) TS_Persister_persist_manager(uint64_t this_arg, uint64_t channel_manager) {
8088         void* this_arg_ptr = untag_ptr(this_arg);
8089         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8090         LDKPersister* this_arg_conv = (LDKPersister*)this_arg_ptr;
8091         LDKChannelManager channel_manager_conv;
8092         channel_manager_conv.inner = untag_ptr(channel_manager);
8093         channel_manager_conv.is_owned = ptr_is_owned(channel_manager);
8094         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_manager_conv);
8095         channel_manager_conv.is_owned = false;
8096         LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
8097         *ret_conv = (this_arg_conv->persist_manager)(this_arg_conv->this_arg, &channel_manager_conv);
8098         return tag_ptr(ret_conv, true);
8099 }
8100
8101 uint64_t  __attribute__((export_name("TS_Persister_persist_graph"))) TS_Persister_persist_graph(uint64_t this_arg, uint64_t network_graph) {
8102         void* this_arg_ptr = untag_ptr(this_arg);
8103         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8104         LDKPersister* this_arg_conv = (LDKPersister*)this_arg_ptr;
8105         LDKNetworkGraph network_graph_conv;
8106         network_graph_conv.inner = untag_ptr(network_graph);
8107         network_graph_conv.is_owned = ptr_is_owned(network_graph);
8108         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
8109         network_graph_conv.is_owned = false;
8110         LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
8111         *ret_conv = (this_arg_conv->persist_graph)(this_arg_conv->this_arg, &network_graph_conv);
8112         return tag_ptr(ret_conv, true);
8113 }
8114
8115 uint64_t  __attribute__((export_name("TS_Persister_persist_scorer"))) TS_Persister_persist_scorer(uint64_t this_arg, uint64_t scorer) {
8116         void* this_arg_ptr = untag_ptr(this_arg);
8117         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8118         LDKPersister* this_arg_conv = (LDKPersister*)this_arg_ptr;
8119         LDKMultiThreadedLockableScore scorer_conv;
8120         scorer_conv.inner = untag_ptr(scorer);
8121         scorer_conv.is_owned = ptr_is_owned(scorer);
8122         CHECK_INNER_FIELD_ACCESS_OR_NULL(scorer_conv);
8123         scorer_conv.is_owned = false;
8124         LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
8125         *ret_conv = (this_arg_conv->persist_scorer)(this_arg_conv->this_arg, &scorer_conv);
8126         return tag_ptr(ret_conv, true);
8127 }
8128
8129 typedef struct LDKListen_JCalls {
8130         atomic_size_t refcnt;
8131         uint32_t instance_ptr;
8132 } LDKListen_JCalls;
8133 static void LDKListen_JCalls_free(void* this_arg) {
8134         LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
8135         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
8136                 FREE(j_calls);
8137         }
8138 }
8139 void filtered_block_connected_LDKListen_jcall(const void* this_arg, const uint8_t (* header)[80], LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height) {
8140         LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
8141         int8_tArray header_arr = init_int8_tArray(80, __LINE__);
8142         memcpy(header_arr->elems, *header, 80);
8143         LDKCVec_C2Tuple_usizeTransactionZZ txdata_var = txdata;
8144         uint64_tArray txdata_arr = NULL;
8145         txdata_arr = init_uint64_tArray(txdata_var.datalen, __LINE__);
8146         uint64_t *txdata_arr_ptr = (uint64_t*)(((uint8_t*)txdata_arr) + 8);
8147         for (size_t c = 0; c < txdata_var.datalen; c++) {
8148                 LDKC2Tuple_usizeTransactionZ* txdata_conv_28_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
8149                 *txdata_conv_28_conv = txdata_var.data[c];
8150                 txdata_arr_ptr[c] = tag_ptr(txdata_conv_28_conv, true);
8151         }
8152         
8153         FREE(txdata_var.data);
8154         int32_t height_conv = height;
8155         js_invoke_function_uuuuuu(j_calls->instance_ptr, 46, (uint32_t)header_arr, (uint32_t)txdata_arr, height_conv, 0, 0, 0);
8156 }
8157 void block_connected_LDKListen_jcall(const void* this_arg, LDKu8slice block, uint32_t height) {
8158         LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
8159         LDKu8slice block_var = block;
8160         int8_tArray block_arr = init_int8_tArray(block_var.datalen, __LINE__);
8161         memcpy(block_arr->elems, block_var.data, block_var.datalen);
8162         int32_t height_conv = height;
8163         js_invoke_function_uuuuuu(j_calls->instance_ptr, 47, (uint32_t)block_arr, height_conv, 0, 0, 0, 0);
8164 }
8165 void block_disconnected_LDKListen_jcall(const void* this_arg, const uint8_t (* header)[80], uint32_t height) {
8166         LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
8167         int8_tArray header_arr = init_int8_tArray(80, __LINE__);
8168         memcpy(header_arr->elems, *header, 80);
8169         int32_t height_conv = height;
8170         js_invoke_function_uuuuuu(j_calls->instance_ptr, 48, (uint32_t)header_arr, height_conv, 0, 0, 0, 0);
8171 }
8172 static void LDKListen_JCalls_cloned(LDKListen* new_obj) {
8173         LDKListen_JCalls *j_calls = (LDKListen_JCalls*) new_obj->this_arg;
8174         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
8175 }
8176 static inline LDKListen LDKListen_init (JSValue o) {
8177         LDKListen_JCalls *calls = MALLOC(sizeof(LDKListen_JCalls), "LDKListen_JCalls");
8178         atomic_init(&calls->refcnt, 1);
8179         calls->instance_ptr = o;
8180
8181         LDKListen ret = {
8182                 .this_arg = (void*) calls,
8183                 .filtered_block_connected = filtered_block_connected_LDKListen_jcall,
8184                 .block_connected = block_connected_LDKListen_jcall,
8185                 .block_disconnected = block_disconnected_LDKListen_jcall,
8186                 .free = LDKListen_JCalls_free,
8187         };
8188         return ret;
8189 }
8190 uint64_t  __attribute__((export_name("TS_LDKListen_new"))) TS_LDKListen_new(JSValue o) {
8191         LDKListen *res_ptr = MALLOC(sizeof(LDKListen), "LDKListen");
8192         *res_ptr = LDKListen_init(o);
8193         return tag_ptr(res_ptr, true);
8194 }
8195 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) {
8196         void* this_arg_ptr = untag_ptr(this_arg);
8197         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8198         LDKListen* this_arg_conv = (LDKListen*)this_arg_ptr;
8199         unsigned char header_arr[80];
8200         CHECK(header->arr_len == 80);
8201         memcpy(header_arr, header->elems, 80); FREE(header);
8202         unsigned char (*header_ref)[80] = &header_arr;
8203         LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
8204         txdata_constr.datalen = txdata->arr_len;
8205         if (txdata_constr.datalen > 0)
8206                 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
8207         else
8208                 txdata_constr.data = NULL;
8209         uint64_t* txdata_vals = txdata->elems;
8210         for (size_t c = 0; c < txdata_constr.datalen; c++) {
8211                 uint64_t txdata_conv_28 = txdata_vals[c];
8212                 void* txdata_conv_28_ptr = untag_ptr(txdata_conv_28);
8213                 CHECK_ACCESS(txdata_conv_28_ptr);
8214                 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
8215                 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)untag_ptr(txdata_conv_28));
8216                 txdata_constr.data[c] = txdata_conv_28_conv;
8217         }
8218         FREE(txdata);
8219         (this_arg_conv->filtered_block_connected)(this_arg_conv->this_arg, header_ref, txdata_constr, height);
8220 }
8221
8222 void  __attribute__((export_name("TS_Listen_block_connected"))) TS_Listen_block_connected(uint64_t this_arg, int8_tArray block, int32_t height) {
8223         void* this_arg_ptr = untag_ptr(this_arg);
8224         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8225         LDKListen* this_arg_conv = (LDKListen*)this_arg_ptr;
8226         LDKu8slice block_ref;
8227         block_ref.datalen = block->arr_len;
8228         block_ref.data = block->elems;
8229         (this_arg_conv->block_connected)(this_arg_conv->this_arg, block_ref, height);
8230         FREE(block);
8231 }
8232
8233 void  __attribute__((export_name("TS_Listen_block_disconnected"))) TS_Listen_block_disconnected(uint64_t this_arg, int8_tArray header, int32_t height) {
8234         void* this_arg_ptr = untag_ptr(this_arg);
8235         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8236         LDKListen* this_arg_conv = (LDKListen*)this_arg_ptr;
8237         unsigned char header_arr[80];
8238         CHECK(header->arr_len == 80);
8239         memcpy(header_arr, header->elems, 80); FREE(header);
8240         unsigned char (*header_ref)[80] = &header_arr;
8241         (this_arg_conv->block_disconnected)(this_arg_conv->this_arg, header_ref, height);
8242 }
8243
8244 typedef struct LDKConfirm_JCalls {
8245         atomic_size_t refcnt;
8246         uint32_t instance_ptr;
8247 } LDKConfirm_JCalls;
8248 static void LDKConfirm_JCalls_free(void* this_arg) {
8249         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
8250         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
8251                 FREE(j_calls);
8252         }
8253 }
8254 void transactions_confirmed_LDKConfirm_jcall(const void* this_arg, const uint8_t (* header)[80], LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height) {
8255         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
8256         int8_tArray header_arr = init_int8_tArray(80, __LINE__);
8257         memcpy(header_arr->elems, *header, 80);
8258         LDKCVec_C2Tuple_usizeTransactionZZ txdata_var = txdata;
8259         uint64_tArray txdata_arr = NULL;
8260         txdata_arr = init_uint64_tArray(txdata_var.datalen, __LINE__);
8261         uint64_t *txdata_arr_ptr = (uint64_t*)(((uint8_t*)txdata_arr) + 8);
8262         for (size_t c = 0; c < txdata_var.datalen; c++) {
8263                 LDKC2Tuple_usizeTransactionZ* txdata_conv_28_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
8264                 *txdata_conv_28_conv = txdata_var.data[c];
8265                 txdata_arr_ptr[c] = tag_ptr(txdata_conv_28_conv, true);
8266         }
8267         
8268         FREE(txdata_var.data);
8269         int32_t height_conv = height;
8270         js_invoke_function_uuuuuu(j_calls->instance_ptr, 49, (uint32_t)header_arr, (uint32_t)txdata_arr, height_conv, 0, 0, 0);
8271 }
8272 void transaction_unconfirmed_LDKConfirm_jcall(const void* this_arg, const uint8_t (* txid)[32]) {
8273         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
8274         int8_tArray txid_arr = init_int8_tArray(32, __LINE__);
8275         memcpy(txid_arr->elems, *txid, 32);
8276         js_invoke_function_uuuuuu(j_calls->instance_ptr, 50, (uint32_t)txid_arr, 0, 0, 0, 0, 0);
8277 }
8278 void best_block_updated_LDKConfirm_jcall(const void* this_arg, const uint8_t (* header)[80], uint32_t height) {
8279         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
8280         int8_tArray header_arr = init_int8_tArray(80, __LINE__);
8281         memcpy(header_arr->elems, *header, 80);
8282         int32_t height_conv = height;
8283         js_invoke_function_uuuuuu(j_calls->instance_ptr, 51, (uint32_t)header_arr, height_conv, 0, 0, 0, 0);
8284 }
8285 LDKCVec_TxidZ get_relevant_txids_LDKConfirm_jcall(const void* this_arg) {
8286         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
8287         ptrArray ret = (ptrArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 52, 0, 0, 0, 0, 0, 0);
8288         LDKCVec_TxidZ ret_constr;
8289         ret_constr.datalen = ret->arr_len;
8290         if (ret_constr.datalen > 0)
8291                 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_TxidZ Elements");
8292         else
8293                 ret_constr.data = NULL;
8294         int8_tArray* ret_vals = (void*) ret->elems;
8295         for (size_t m = 0; m < ret_constr.datalen; m++) {
8296                 int8_tArray ret_conv_12 = ret_vals[m];
8297                 LDKThirtyTwoBytes ret_conv_12_ref;
8298                 CHECK(ret_conv_12->arr_len == 32);
8299                 memcpy(ret_conv_12_ref.data, ret_conv_12->elems, 32); FREE(ret_conv_12);
8300                 ret_constr.data[m] = ret_conv_12_ref;
8301         }
8302         FREE(ret);
8303         return ret_constr;
8304 }
8305 static void LDKConfirm_JCalls_cloned(LDKConfirm* new_obj) {
8306         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) new_obj->this_arg;
8307         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
8308 }
8309 static inline LDKConfirm LDKConfirm_init (JSValue o) {
8310         LDKConfirm_JCalls *calls = MALLOC(sizeof(LDKConfirm_JCalls), "LDKConfirm_JCalls");
8311         atomic_init(&calls->refcnt, 1);
8312         calls->instance_ptr = o;
8313
8314         LDKConfirm ret = {
8315                 .this_arg = (void*) calls,
8316                 .transactions_confirmed = transactions_confirmed_LDKConfirm_jcall,
8317                 .transaction_unconfirmed = transaction_unconfirmed_LDKConfirm_jcall,
8318                 .best_block_updated = best_block_updated_LDKConfirm_jcall,
8319                 .get_relevant_txids = get_relevant_txids_LDKConfirm_jcall,
8320                 .free = LDKConfirm_JCalls_free,
8321         };
8322         return ret;
8323 }
8324 uint64_t  __attribute__((export_name("TS_LDKConfirm_new"))) TS_LDKConfirm_new(JSValue o) {
8325         LDKConfirm *res_ptr = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
8326         *res_ptr = LDKConfirm_init(o);
8327         return tag_ptr(res_ptr, true);
8328 }
8329 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) {
8330         void* this_arg_ptr = untag_ptr(this_arg);
8331         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8332         LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
8333         unsigned char header_arr[80];
8334         CHECK(header->arr_len == 80);
8335         memcpy(header_arr, header->elems, 80); FREE(header);
8336         unsigned char (*header_ref)[80] = &header_arr;
8337         LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
8338         txdata_constr.datalen = txdata->arr_len;
8339         if (txdata_constr.datalen > 0)
8340                 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
8341         else
8342                 txdata_constr.data = NULL;
8343         uint64_t* txdata_vals = txdata->elems;
8344         for (size_t c = 0; c < txdata_constr.datalen; c++) {
8345                 uint64_t txdata_conv_28 = txdata_vals[c];
8346                 void* txdata_conv_28_ptr = untag_ptr(txdata_conv_28);
8347                 CHECK_ACCESS(txdata_conv_28_ptr);
8348                 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
8349                 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)untag_ptr(txdata_conv_28));
8350                 txdata_constr.data[c] = txdata_conv_28_conv;
8351         }
8352         FREE(txdata);
8353         (this_arg_conv->transactions_confirmed)(this_arg_conv->this_arg, header_ref, txdata_constr, height);
8354 }
8355
8356 void  __attribute__((export_name("TS_Confirm_transaction_unconfirmed"))) TS_Confirm_transaction_unconfirmed(uint64_t this_arg, int8_tArray txid) {
8357         void* this_arg_ptr = untag_ptr(this_arg);
8358         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8359         LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
8360         unsigned char txid_arr[32];
8361         CHECK(txid->arr_len == 32);
8362         memcpy(txid_arr, txid->elems, 32); FREE(txid);
8363         unsigned char (*txid_ref)[32] = &txid_arr;
8364         (this_arg_conv->transaction_unconfirmed)(this_arg_conv->this_arg, txid_ref);
8365 }
8366
8367 void  __attribute__((export_name("TS_Confirm_best_block_updated"))) TS_Confirm_best_block_updated(uint64_t this_arg, int8_tArray header, int32_t height) {
8368         void* this_arg_ptr = untag_ptr(this_arg);
8369         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8370         LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
8371         unsigned char header_arr[80];
8372         CHECK(header->arr_len == 80);
8373         memcpy(header_arr, header->elems, 80); FREE(header);
8374         unsigned char (*header_ref)[80] = &header_arr;
8375         (this_arg_conv->best_block_updated)(this_arg_conv->this_arg, header_ref, height);
8376 }
8377
8378 ptrArray  __attribute__((export_name("TS_Confirm_get_relevant_txids"))) TS_Confirm_get_relevant_txids(uint64_t this_arg) {
8379         void* this_arg_ptr = untag_ptr(this_arg);
8380         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8381         LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
8382         LDKCVec_TxidZ ret_var = (this_arg_conv->get_relevant_txids)(this_arg_conv->this_arg);
8383         ptrArray ret_arr = NULL;
8384         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
8385         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
8386         for (size_t m = 0; m < ret_var.datalen; m++) {
8387                 int8_tArray ret_conv_12_arr = init_int8_tArray(32, __LINE__);
8388                 memcpy(ret_conv_12_arr->elems, ret_var.data[m].data, 32);
8389                 ret_arr_ptr[m] = ret_conv_12_arr;
8390         }
8391         
8392         FREE(ret_var.data);
8393         return ret_arr;
8394 }
8395
8396 typedef struct LDKPersist_JCalls {
8397         atomic_size_t refcnt;
8398         uint32_t instance_ptr;
8399 } LDKPersist_JCalls;
8400 static void LDKPersist_JCalls_free(void* this_arg) {
8401         LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
8402         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
8403                 FREE(j_calls);
8404         }
8405 }
8406 LDKCResult_NoneChannelMonitorUpdateErrZ persist_new_channel_LDKPersist_jcall(const void* this_arg, LDKOutPoint channel_id, const LDKChannelMonitor * data, LDKMonitorUpdateId update_id) {
8407         LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
8408         LDKOutPoint channel_id_var = channel_id;
8409         uint64_t channel_id_ref = 0;
8410         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_var);
8411         channel_id_ref = tag_ptr(channel_id_var.inner, channel_id_var.is_owned);
8412         LDKChannelMonitor data_var = *data;
8413         uint64_t data_ref = 0;
8414         data_var = ChannelMonitor_clone(&data_var);
8415         CHECK_INNER_FIELD_ACCESS_OR_NULL(data_var);
8416         data_ref = tag_ptr(data_var.inner, data_var.is_owned);
8417         LDKMonitorUpdateId update_id_var = update_id;
8418         uint64_t update_id_ref = 0;
8419         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_var);
8420         update_id_ref = tag_ptr(update_id_var.inner, update_id_var.is_owned);
8421         uint32_t ret = js_invoke_function_bbbuuu(j_calls->instance_ptr, 53, channel_id_ref, data_ref, update_id_ref, 0, 0, 0);
8422         void* ret_ptr = untag_ptr(ret);
8423         CHECK_ACCESS(ret_ptr);
8424         LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(ret_ptr);
8425         FREE(untag_ptr(ret));
8426         return ret_conv;
8427 }
8428 LDKCResult_NoneChannelMonitorUpdateErrZ update_persisted_channel_LDKPersist_jcall(const void* this_arg, LDKOutPoint channel_id, const LDKChannelMonitorUpdate * update, const LDKChannelMonitor * data, LDKMonitorUpdateId update_id) {
8429         LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
8430         LDKOutPoint channel_id_var = channel_id;
8431         uint64_t channel_id_ref = 0;
8432         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_var);
8433         channel_id_ref = tag_ptr(channel_id_var.inner, channel_id_var.is_owned);
8434         LDKChannelMonitorUpdate update_var = *update;
8435         uint64_t update_ref = 0;
8436         update_var = ChannelMonitorUpdate_clone(&update_var);
8437         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_var);
8438         update_ref = tag_ptr(update_var.inner, update_var.is_owned);
8439         LDKChannelMonitor data_var = *data;
8440         uint64_t data_ref = 0;
8441         data_var = ChannelMonitor_clone(&data_var);
8442         CHECK_INNER_FIELD_ACCESS_OR_NULL(data_var);
8443         data_ref = tag_ptr(data_var.inner, data_var.is_owned);
8444         LDKMonitorUpdateId update_id_var = update_id;
8445         uint64_t update_id_ref = 0;
8446         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_var);
8447         update_id_ref = tag_ptr(update_id_var.inner, update_id_var.is_owned);
8448         uint32_t ret = js_invoke_function_bbbbuu(j_calls->instance_ptr, 54, channel_id_ref, update_ref, data_ref, update_id_ref, 0, 0);
8449         void* ret_ptr = untag_ptr(ret);
8450         CHECK_ACCESS(ret_ptr);
8451         LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(ret_ptr);
8452         FREE(untag_ptr(ret));
8453         return ret_conv;
8454 }
8455 static void LDKPersist_JCalls_cloned(LDKPersist* new_obj) {
8456         LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) new_obj->this_arg;
8457         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
8458 }
8459 static inline LDKPersist LDKPersist_init (JSValue o) {
8460         LDKPersist_JCalls *calls = MALLOC(sizeof(LDKPersist_JCalls), "LDKPersist_JCalls");
8461         atomic_init(&calls->refcnt, 1);
8462         calls->instance_ptr = o;
8463
8464         LDKPersist ret = {
8465                 .this_arg = (void*) calls,
8466                 .persist_new_channel = persist_new_channel_LDKPersist_jcall,
8467                 .update_persisted_channel = update_persisted_channel_LDKPersist_jcall,
8468                 .free = LDKPersist_JCalls_free,
8469         };
8470         return ret;
8471 }
8472 uint64_t  __attribute__((export_name("TS_LDKPersist_new"))) TS_LDKPersist_new(JSValue o) {
8473         LDKPersist *res_ptr = MALLOC(sizeof(LDKPersist), "LDKPersist");
8474         *res_ptr = LDKPersist_init(o);
8475         return tag_ptr(res_ptr, true);
8476 }
8477 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) {
8478         void* this_arg_ptr = untag_ptr(this_arg);
8479         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8480         LDKPersist* this_arg_conv = (LDKPersist*)this_arg_ptr;
8481         LDKOutPoint channel_id_conv;
8482         channel_id_conv.inner = untag_ptr(channel_id);
8483         channel_id_conv.is_owned = ptr_is_owned(channel_id);
8484         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_conv);
8485         channel_id_conv = OutPoint_clone(&channel_id_conv);
8486         LDKChannelMonitor data_conv;
8487         data_conv.inner = untag_ptr(data);
8488         data_conv.is_owned = ptr_is_owned(data);
8489         CHECK_INNER_FIELD_ACCESS_OR_NULL(data_conv);
8490         data_conv.is_owned = false;
8491         LDKMonitorUpdateId update_id_conv;
8492         update_id_conv.inner = untag_ptr(update_id);
8493         update_id_conv.is_owned = ptr_is_owned(update_id);
8494         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_conv);
8495         update_id_conv = MonitorUpdateId_clone(&update_id_conv);
8496         LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
8497         *ret_conv = (this_arg_conv->persist_new_channel)(this_arg_conv->this_arg, channel_id_conv, &data_conv, update_id_conv);
8498         return tag_ptr(ret_conv, true);
8499 }
8500
8501 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) {
8502         void* this_arg_ptr = untag_ptr(this_arg);
8503         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8504         LDKPersist* this_arg_conv = (LDKPersist*)this_arg_ptr;
8505         LDKOutPoint channel_id_conv;
8506         channel_id_conv.inner = untag_ptr(channel_id);
8507         channel_id_conv.is_owned = ptr_is_owned(channel_id);
8508         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_conv);
8509         channel_id_conv = OutPoint_clone(&channel_id_conv);
8510         LDKChannelMonitorUpdate update_conv;
8511         update_conv.inner = untag_ptr(update);
8512         update_conv.is_owned = ptr_is_owned(update);
8513         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_conv);
8514         update_conv.is_owned = false;
8515         LDKChannelMonitor data_conv;
8516         data_conv.inner = untag_ptr(data);
8517         data_conv.is_owned = ptr_is_owned(data);
8518         CHECK_INNER_FIELD_ACCESS_OR_NULL(data_conv);
8519         data_conv.is_owned = false;
8520         LDKMonitorUpdateId update_id_conv;
8521         update_id_conv.inner = untag_ptr(update_id);
8522         update_id_conv.is_owned = ptr_is_owned(update_id);
8523         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_conv);
8524         update_id_conv = MonitorUpdateId_clone(&update_id_conv);
8525         LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
8526         *ret_conv = (this_arg_conv->update_persisted_channel)(this_arg_conv->this_arg, channel_id_conv, &update_conv, &data_conv, update_id_conv);
8527         return tag_ptr(ret_conv, true);
8528 }
8529
8530 typedef struct LDKChannelMessageHandler_JCalls {
8531         atomic_size_t refcnt;
8532         uint32_t instance_ptr;
8533         LDKMessageSendEventsProvider_JCalls* MessageSendEventsProvider;
8534 } LDKChannelMessageHandler_JCalls;
8535 static void LDKChannelMessageHandler_JCalls_free(void* this_arg) {
8536         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
8537         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
8538                 FREE(j_calls);
8539         }
8540 }
8541 void handle_open_channel_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKInitFeatures their_features, const LDKOpenChannel * msg) {
8542         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
8543         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
8544         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
8545         LDKInitFeatures their_features_var = their_features;
8546         uint64_t their_features_ref = 0;
8547         CHECK_INNER_FIELD_ACCESS_OR_NULL(their_features_var);
8548         their_features_ref = tag_ptr(their_features_var.inner, their_features_var.is_owned);
8549         LDKOpenChannel msg_var = *msg;
8550         uint64_t msg_ref = 0;
8551         msg_var = OpenChannel_clone(&msg_var);
8552         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
8553         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
8554         js_invoke_function_ubbuuu(j_calls->instance_ptr, 55, (uint32_t)their_node_id_arr, their_features_ref, msg_ref, 0, 0, 0);
8555 }
8556 void handle_accept_channel_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKInitFeatures their_features, const LDKAcceptChannel * msg) {
8557         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
8558         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
8559         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
8560         LDKInitFeatures their_features_var = their_features;
8561         uint64_t their_features_ref = 0;
8562         CHECK_INNER_FIELD_ACCESS_OR_NULL(their_features_var);
8563         their_features_ref = tag_ptr(their_features_var.inner, their_features_var.is_owned);
8564         LDKAcceptChannel msg_var = *msg;
8565         uint64_t msg_ref = 0;
8566         msg_var = AcceptChannel_clone(&msg_var);
8567         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
8568         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
8569         js_invoke_function_ubbuuu(j_calls->instance_ptr, 56, (uint32_t)their_node_id_arr, their_features_ref, msg_ref, 0, 0, 0);
8570 }
8571 void handle_funding_created_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingCreated * msg) {
8572         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
8573         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
8574         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
8575         LDKFundingCreated msg_var = *msg;
8576         uint64_t msg_ref = 0;
8577         msg_var = FundingCreated_clone(&msg_var);
8578         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
8579         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
8580         js_invoke_function_ubuuuu(j_calls->instance_ptr, 57, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
8581 }
8582 void handle_funding_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingSigned * msg) {
8583         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
8584         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
8585         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
8586         LDKFundingSigned msg_var = *msg;
8587         uint64_t msg_ref = 0;
8588         msg_var = FundingSigned_clone(&msg_var);
8589         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
8590         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
8591         js_invoke_function_ubuuuu(j_calls->instance_ptr, 58, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
8592 }
8593 void handle_channel_ready_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelReady * msg) {
8594         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
8595         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
8596         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
8597         LDKChannelReady msg_var = *msg;
8598         uint64_t msg_ref = 0;
8599         msg_var = ChannelReady_clone(&msg_var);
8600         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
8601         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
8602         js_invoke_function_ubuuuu(j_calls->instance_ptr, 59, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
8603 }
8604 void handle_shutdown_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInitFeatures * their_features, const LDKShutdown * msg) {
8605         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
8606         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
8607         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
8608         LDKInitFeatures their_features_var = *their_features;
8609         uint64_t their_features_ref = 0;
8610         their_features_var = InitFeatures_clone(&their_features_var);
8611         CHECK_INNER_FIELD_ACCESS_OR_NULL(their_features_var);
8612         their_features_ref = tag_ptr(their_features_var.inner, their_features_var.is_owned);
8613         LDKShutdown msg_var = *msg;
8614         uint64_t msg_ref = 0;
8615         msg_var = Shutdown_clone(&msg_var);
8616         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
8617         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
8618         js_invoke_function_ubbuuu(j_calls->instance_ptr, 60, (uint32_t)their_node_id_arr, their_features_ref, msg_ref, 0, 0, 0);
8619 }
8620 void handle_closing_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKClosingSigned * msg) {
8621         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
8622         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
8623         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
8624         LDKClosingSigned msg_var = *msg;
8625         uint64_t msg_ref = 0;
8626         msg_var = ClosingSigned_clone(&msg_var);
8627         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
8628         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
8629         js_invoke_function_ubuuuu(j_calls->instance_ptr, 61, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
8630 }
8631 void handle_update_add_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateAddHTLC * msg) {
8632         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
8633         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
8634         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
8635         LDKUpdateAddHTLC msg_var = *msg;
8636         uint64_t msg_ref = 0;
8637         msg_var = UpdateAddHTLC_clone(&msg_var);
8638         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
8639         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
8640         js_invoke_function_ubuuuu(j_calls->instance_ptr, 62, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
8641 }
8642 void handle_update_fulfill_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFulfillHTLC * msg) {
8643         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
8644         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
8645         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
8646         LDKUpdateFulfillHTLC msg_var = *msg;
8647         uint64_t msg_ref = 0;
8648         msg_var = UpdateFulfillHTLC_clone(&msg_var);
8649         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
8650         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
8651         js_invoke_function_ubuuuu(j_calls->instance_ptr, 63, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
8652 }
8653 void handle_update_fail_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailHTLC * msg) {
8654         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
8655         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
8656         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
8657         LDKUpdateFailHTLC msg_var = *msg;
8658         uint64_t msg_ref = 0;
8659         msg_var = UpdateFailHTLC_clone(&msg_var);
8660         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
8661         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
8662         js_invoke_function_ubuuuu(j_calls->instance_ptr, 64, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
8663 }
8664 void handle_update_fail_malformed_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailMalformedHTLC * msg) {
8665         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
8666         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
8667         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
8668         LDKUpdateFailMalformedHTLC msg_var = *msg;
8669         uint64_t msg_ref = 0;
8670         msg_var = UpdateFailMalformedHTLC_clone(&msg_var);
8671         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
8672         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
8673         js_invoke_function_ubuuuu(j_calls->instance_ptr, 65, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
8674 }
8675 void handle_commitment_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKCommitmentSigned * msg) {
8676         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
8677         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
8678         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
8679         LDKCommitmentSigned msg_var = *msg;
8680         uint64_t msg_ref = 0;
8681         msg_var = CommitmentSigned_clone(&msg_var);
8682         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
8683         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
8684         js_invoke_function_ubuuuu(j_calls->instance_ptr, 66, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
8685 }
8686 void handle_revoke_and_ack_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKRevokeAndACK * msg) {
8687         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
8688         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
8689         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
8690         LDKRevokeAndACK msg_var = *msg;
8691         uint64_t msg_ref = 0;
8692         msg_var = RevokeAndACK_clone(&msg_var);
8693         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
8694         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
8695         js_invoke_function_ubuuuu(j_calls->instance_ptr, 67, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
8696 }
8697 void handle_update_fee_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFee * msg) {
8698         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
8699         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
8700         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
8701         LDKUpdateFee msg_var = *msg;
8702         uint64_t msg_ref = 0;
8703         msg_var = UpdateFee_clone(&msg_var);
8704         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
8705         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
8706         js_invoke_function_ubuuuu(j_calls->instance_ptr, 68, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
8707 }
8708 void handle_announcement_signatures_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKAnnouncementSignatures * msg) {
8709         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
8710         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
8711         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
8712         LDKAnnouncementSignatures msg_var = *msg;
8713         uint64_t msg_ref = 0;
8714         msg_var = AnnouncementSignatures_clone(&msg_var);
8715         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
8716         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
8717         js_invoke_function_ubuuuu(j_calls->instance_ptr, 69, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
8718 }
8719 void peer_disconnected_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, bool no_connection_possible) {
8720         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
8721         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
8722         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
8723         jboolean no_connection_possible_conv = no_connection_possible;
8724         js_invoke_function_uuuuuu(j_calls->instance_ptr, 70, (uint32_t)their_node_id_arr, no_connection_possible_conv, 0, 0, 0, 0);
8725 }
8726 void peer_connected_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * msg) {
8727         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
8728         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
8729         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
8730         LDKInit msg_var = *msg;
8731         uint64_t msg_ref = 0;
8732         msg_var = Init_clone(&msg_var);
8733         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
8734         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
8735         js_invoke_function_ubuuuu(j_calls->instance_ptr, 71, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
8736 }
8737 void handle_channel_reestablish_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelReestablish * msg) {
8738         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
8739         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
8740         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
8741         LDKChannelReestablish msg_var = *msg;
8742         uint64_t msg_ref = 0;
8743         msg_var = ChannelReestablish_clone(&msg_var);
8744         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
8745         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
8746         js_invoke_function_ubuuuu(j_calls->instance_ptr, 72, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
8747 }
8748 void handle_channel_update_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelUpdate * msg) {
8749         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
8750         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
8751         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
8752         LDKChannelUpdate msg_var = *msg;
8753         uint64_t msg_ref = 0;
8754         msg_var = ChannelUpdate_clone(&msg_var);
8755         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
8756         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
8757         js_invoke_function_ubuuuu(j_calls->instance_ptr, 73, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
8758 }
8759 void handle_error_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKErrorMessage * msg) {
8760         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
8761         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
8762         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
8763         LDKErrorMessage msg_var = *msg;
8764         uint64_t msg_ref = 0;
8765         msg_var = ErrorMessage_clone(&msg_var);
8766         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
8767         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
8768         js_invoke_function_ubuuuu(j_calls->instance_ptr, 74, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
8769 }
8770 static void LDKChannelMessageHandler_JCalls_cloned(LDKChannelMessageHandler* new_obj) {
8771         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) new_obj->this_arg;
8772         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
8773         atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
8774 }
8775 static inline LDKChannelMessageHandler LDKChannelMessageHandler_init (JSValue o, JSValue MessageSendEventsProvider) {
8776         LDKChannelMessageHandler_JCalls *calls = MALLOC(sizeof(LDKChannelMessageHandler_JCalls), "LDKChannelMessageHandler_JCalls");
8777         atomic_init(&calls->refcnt, 1);
8778         calls->instance_ptr = o;
8779
8780         LDKChannelMessageHandler ret = {
8781                 .this_arg = (void*) calls,
8782                 .handle_open_channel = handle_open_channel_LDKChannelMessageHandler_jcall,
8783                 .handle_accept_channel = handle_accept_channel_LDKChannelMessageHandler_jcall,
8784                 .handle_funding_created = handle_funding_created_LDKChannelMessageHandler_jcall,
8785                 .handle_funding_signed = handle_funding_signed_LDKChannelMessageHandler_jcall,
8786                 .handle_channel_ready = handle_channel_ready_LDKChannelMessageHandler_jcall,
8787                 .handle_shutdown = handle_shutdown_LDKChannelMessageHandler_jcall,
8788                 .handle_closing_signed = handle_closing_signed_LDKChannelMessageHandler_jcall,
8789                 .handle_update_add_htlc = handle_update_add_htlc_LDKChannelMessageHandler_jcall,
8790                 .handle_update_fulfill_htlc = handle_update_fulfill_htlc_LDKChannelMessageHandler_jcall,
8791                 .handle_update_fail_htlc = handle_update_fail_htlc_LDKChannelMessageHandler_jcall,
8792                 .handle_update_fail_malformed_htlc = handle_update_fail_malformed_htlc_LDKChannelMessageHandler_jcall,
8793                 .handle_commitment_signed = handle_commitment_signed_LDKChannelMessageHandler_jcall,
8794                 .handle_revoke_and_ack = handle_revoke_and_ack_LDKChannelMessageHandler_jcall,
8795                 .handle_update_fee = handle_update_fee_LDKChannelMessageHandler_jcall,
8796                 .handle_announcement_signatures = handle_announcement_signatures_LDKChannelMessageHandler_jcall,
8797                 .peer_disconnected = peer_disconnected_LDKChannelMessageHandler_jcall,
8798                 .peer_connected = peer_connected_LDKChannelMessageHandler_jcall,
8799                 .handle_channel_reestablish = handle_channel_reestablish_LDKChannelMessageHandler_jcall,
8800                 .handle_channel_update = handle_channel_update_LDKChannelMessageHandler_jcall,
8801                 .handle_error = handle_error_LDKChannelMessageHandler_jcall,
8802                 .free = LDKChannelMessageHandler_JCalls_free,
8803                 .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(MessageSendEventsProvider),
8804         };
8805         calls->MessageSendEventsProvider = ret.MessageSendEventsProvider.this_arg;
8806         return ret;
8807 }
8808 uint64_t  __attribute__((export_name("TS_LDKChannelMessageHandler_new"))) TS_LDKChannelMessageHandler_new(JSValue o, JSValue MessageSendEventsProvider) {
8809         LDKChannelMessageHandler *res_ptr = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
8810         *res_ptr = LDKChannelMessageHandler_init(o, MessageSendEventsProvider);
8811         return tag_ptr(res_ptr, true);
8812 }
8813 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) {
8814         void* this_arg_ptr = untag_ptr(this_arg);
8815         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8816         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
8817         LDKPublicKey their_node_id_ref;
8818         CHECK(their_node_id->arr_len == 33);
8819         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
8820         LDKInitFeatures their_features_conv;
8821         their_features_conv.inner = untag_ptr(their_features);
8822         their_features_conv.is_owned = ptr_is_owned(their_features);
8823         CHECK_INNER_FIELD_ACCESS_OR_NULL(their_features_conv);
8824         their_features_conv = InitFeatures_clone(&their_features_conv);
8825         LDKOpenChannel msg_conv;
8826         msg_conv.inner = untag_ptr(msg);
8827         msg_conv.is_owned = ptr_is_owned(msg);
8828         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
8829         msg_conv.is_owned = false;
8830         (this_arg_conv->handle_open_channel)(this_arg_conv->this_arg, their_node_id_ref, their_features_conv, &msg_conv);
8831 }
8832
8833 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) {
8834         void* this_arg_ptr = untag_ptr(this_arg);
8835         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8836         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
8837         LDKPublicKey their_node_id_ref;
8838         CHECK(their_node_id->arr_len == 33);
8839         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
8840         LDKInitFeatures their_features_conv;
8841         their_features_conv.inner = untag_ptr(their_features);
8842         their_features_conv.is_owned = ptr_is_owned(their_features);
8843         CHECK_INNER_FIELD_ACCESS_OR_NULL(their_features_conv);
8844         their_features_conv = InitFeatures_clone(&their_features_conv);
8845         LDKAcceptChannel msg_conv;
8846         msg_conv.inner = untag_ptr(msg);
8847         msg_conv.is_owned = ptr_is_owned(msg);
8848         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
8849         msg_conv.is_owned = false;
8850         (this_arg_conv->handle_accept_channel)(this_arg_conv->this_arg, their_node_id_ref, their_features_conv, &msg_conv);
8851 }
8852
8853 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) {
8854         void* this_arg_ptr = untag_ptr(this_arg);
8855         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8856         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
8857         LDKPublicKey their_node_id_ref;
8858         CHECK(their_node_id->arr_len == 33);
8859         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
8860         LDKFundingCreated msg_conv;
8861         msg_conv.inner = untag_ptr(msg);
8862         msg_conv.is_owned = ptr_is_owned(msg);
8863         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
8864         msg_conv.is_owned = false;
8865         (this_arg_conv->handle_funding_created)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
8866 }
8867
8868 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) {
8869         void* this_arg_ptr = untag_ptr(this_arg);
8870         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8871         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
8872         LDKPublicKey their_node_id_ref;
8873         CHECK(their_node_id->arr_len == 33);
8874         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
8875         LDKFundingSigned msg_conv;
8876         msg_conv.inner = untag_ptr(msg);
8877         msg_conv.is_owned = ptr_is_owned(msg);
8878         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
8879         msg_conv.is_owned = false;
8880         (this_arg_conv->handle_funding_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
8881 }
8882
8883 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) {
8884         void* this_arg_ptr = untag_ptr(this_arg);
8885         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8886         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
8887         LDKPublicKey their_node_id_ref;
8888         CHECK(their_node_id->arr_len == 33);
8889         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
8890         LDKChannelReady msg_conv;
8891         msg_conv.inner = untag_ptr(msg);
8892         msg_conv.is_owned = ptr_is_owned(msg);
8893         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
8894         msg_conv.is_owned = false;
8895         (this_arg_conv->handle_channel_ready)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
8896 }
8897
8898 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) {
8899         void* this_arg_ptr = untag_ptr(this_arg);
8900         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8901         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
8902         LDKPublicKey their_node_id_ref;
8903         CHECK(their_node_id->arr_len == 33);
8904         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
8905         LDKInitFeatures their_features_conv;
8906         their_features_conv.inner = untag_ptr(their_features);
8907         their_features_conv.is_owned = ptr_is_owned(their_features);
8908         CHECK_INNER_FIELD_ACCESS_OR_NULL(their_features_conv);
8909         their_features_conv.is_owned = false;
8910         LDKShutdown msg_conv;
8911         msg_conv.inner = untag_ptr(msg);
8912         msg_conv.is_owned = ptr_is_owned(msg);
8913         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
8914         msg_conv.is_owned = false;
8915         (this_arg_conv->handle_shutdown)(this_arg_conv->this_arg, their_node_id_ref, &their_features_conv, &msg_conv);
8916 }
8917
8918 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) {
8919         void* this_arg_ptr = untag_ptr(this_arg);
8920         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8921         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
8922         LDKPublicKey their_node_id_ref;
8923         CHECK(their_node_id->arr_len == 33);
8924         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
8925         LDKClosingSigned msg_conv;
8926         msg_conv.inner = untag_ptr(msg);
8927         msg_conv.is_owned = ptr_is_owned(msg);
8928         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
8929         msg_conv.is_owned = false;
8930         (this_arg_conv->handle_closing_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
8931 }
8932
8933 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) {
8934         void* this_arg_ptr = untag_ptr(this_arg);
8935         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8936         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
8937         LDKPublicKey their_node_id_ref;
8938         CHECK(their_node_id->arr_len == 33);
8939         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
8940         LDKUpdateAddHTLC msg_conv;
8941         msg_conv.inner = untag_ptr(msg);
8942         msg_conv.is_owned = ptr_is_owned(msg);
8943         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
8944         msg_conv.is_owned = false;
8945         (this_arg_conv->handle_update_add_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
8946 }
8947
8948 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) {
8949         void* this_arg_ptr = untag_ptr(this_arg);
8950         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8951         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
8952         LDKPublicKey their_node_id_ref;
8953         CHECK(their_node_id->arr_len == 33);
8954         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
8955         LDKUpdateFulfillHTLC msg_conv;
8956         msg_conv.inner = untag_ptr(msg);
8957         msg_conv.is_owned = ptr_is_owned(msg);
8958         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
8959         msg_conv.is_owned = false;
8960         (this_arg_conv->handle_update_fulfill_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
8961 }
8962
8963 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) {
8964         void* this_arg_ptr = untag_ptr(this_arg);
8965         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8966         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
8967         LDKPublicKey their_node_id_ref;
8968         CHECK(their_node_id->arr_len == 33);
8969         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
8970         LDKUpdateFailHTLC msg_conv;
8971         msg_conv.inner = untag_ptr(msg);
8972         msg_conv.is_owned = ptr_is_owned(msg);
8973         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
8974         msg_conv.is_owned = false;
8975         (this_arg_conv->handle_update_fail_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
8976 }
8977
8978 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) {
8979         void* this_arg_ptr = untag_ptr(this_arg);
8980         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8981         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
8982         LDKPublicKey their_node_id_ref;
8983         CHECK(their_node_id->arr_len == 33);
8984         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
8985         LDKUpdateFailMalformedHTLC msg_conv;
8986         msg_conv.inner = untag_ptr(msg);
8987         msg_conv.is_owned = ptr_is_owned(msg);
8988         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
8989         msg_conv.is_owned = false;
8990         (this_arg_conv->handle_update_fail_malformed_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
8991 }
8992
8993 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) {
8994         void* this_arg_ptr = untag_ptr(this_arg);
8995         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8996         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
8997         LDKPublicKey their_node_id_ref;
8998         CHECK(their_node_id->arr_len == 33);
8999         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9000         LDKCommitmentSigned msg_conv;
9001         msg_conv.inner = untag_ptr(msg);
9002         msg_conv.is_owned = ptr_is_owned(msg);
9003         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9004         msg_conv.is_owned = false;
9005         (this_arg_conv->handle_commitment_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
9006 }
9007
9008 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) {
9009         void* this_arg_ptr = untag_ptr(this_arg);
9010         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9011         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9012         LDKPublicKey their_node_id_ref;
9013         CHECK(their_node_id->arr_len == 33);
9014         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9015         LDKRevokeAndACK msg_conv;
9016         msg_conv.inner = untag_ptr(msg);
9017         msg_conv.is_owned = ptr_is_owned(msg);
9018         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9019         msg_conv.is_owned = false;
9020         (this_arg_conv->handle_revoke_and_ack)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
9021 }
9022
9023 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) {
9024         void* this_arg_ptr = untag_ptr(this_arg);
9025         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9026         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9027         LDKPublicKey their_node_id_ref;
9028         CHECK(their_node_id->arr_len == 33);
9029         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9030         LDKUpdateFee msg_conv;
9031         msg_conv.inner = untag_ptr(msg);
9032         msg_conv.is_owned = ptr_is_owned(msg);
9033         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9034         msg_conv.is_owned = false;
9035         (this_arg_conv->handle_update_fee)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
9036 }
9037
9038 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) {
9039         void* this_arg_ptr = untag_ptr(this_arg);
9040         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9041         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9042         LDKPublicKey their_node_id_ref;
9043         CHECK(their_node_id->arr_len == 33);
9044         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9045         LDKAnnouncementSignatures msg_conv;
9046         msg_conv.inner = untag_ptr(msg);
9047         msg_conv.is_owned = ptr_is_owned(msg);
9048         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9049         msg_conv.is_owned = false;
9050         (this_arg_conv->handle_announcement_signatures)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
9051 }
9052
9053 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) {
9054         void* this_arg_ptr = untag_ptr(this_arg);
9055         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9056         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9057         LDKPublicKey their_node_id_ref;
9058         CHECK(their_node_id->arr_len == 33);
9059         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9060         (this_arg_conv->peer_disconnected)(this_arg_conv->this_arg, their_node_id_ref, no_connection_possible);
9061 }
9062
9063 void  __attribute__((export_name("TS_ChannelMessageHandler_peer_connected"))) TS_ChannelMessageHandler_peer_connected(uint64_t this_arg, int8_tArray their_node_id, uint64_t msg) {
9064         void* this_arg_ptr = untag_ptr(this_arg);
9065         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9066         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9067         LDKPublicKey their_node_id_ref;
9068         CHECK(their_node_id->arr_len == 33);
9069         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9070         LDKInit msg_conv;
9071         msg_conv.inner = untag_ptr(msg);
9072         msg_conv.is_owned = ptr_is_owned(msg);
9073         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9074         msg_conv.is_owned = false;
9075         (this_arg_conv->peer_connected)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
9076 }
9077
9078 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) {
9079         void* this_arg_ptr = untag_ptr(this_arg);
9080         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9081         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9082         LDKPublicKey their_node_id_ref;
9083         CHECK(their_node_id->arr_len == 33);
9084         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9085         LDKChannelReestablish msg_conv;
9086         msg_conv.inner = untag_ptr(msg);
9087         msg_conv.is_owned = ptr_is_owned(msg);
9088         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9089         msg_conv.is_owned = false;
9090         (this_arg_conv->handle_channel_reestablish)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
9091 }
9092
9093 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) {
9094         void* this_arg_ptr = untag_ptr(this_arg);
9095         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9096         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9097         LDKPublicKey their_node_id_ref;
9098         CHECK(their_node_id->arr_len == 33);
9099         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9100         LDKChannelUpdate msg_conv;
9101         msg_conv.inner = untag_ptr(msg);
9102         msg_conv.is_owned = ptr_is_owned(msg);
9103         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9104         msg_conv.is_owned = false;
9105         (this_arg_conv->handle_channel_update)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
9106 }
9107
9108 void  __attribute__((export_name("TS_ChannelMessageHandler_handle_error"))) TS_ChannelMessageHandler_handle_error(uint64_t this_arg, int8_tArray their_node_id, uint64_t msg) {
9109         void* this_arg_ptr = untag_ptr(this_arg);
9110         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9111         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9112         LDKPublicKey their_node_id_ref;
9113         CHECK(their_node_id->arr_len == 33);
9114         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9115         LDKErrorMessage msg_conv;
9116         msg_conv.inner = untag_ptr(msg);
9117         msg_conv.is_owned = ptr_is_owned(msg);
9118         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9119         msg_conv.is_owned = false;
9120         (this_arg_conv->handle_error)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
9121 }
9122
9123 typedef struct LDKRoutingMessageHandler_JCalls {
9124         atomic_size_t refcnt;
9125         uint32_t instance_ptr;
9126         LDKMessageSendEventsProvider_JCalls* MessageSendEventsProvider;
9127 } LDKRoutingMessageHandler_JCalls;
9128 static void LDKRoutingMessageHandler_JCalls_free(void* this_arg) {
9129         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
9130         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
9131                 FREE(j_calls);
9132         }
9133 }
9134 LDKCResult_boolLightningErrorZ handle_node_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKNodeAnnouncement * msg) {
9135         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
9136         LDKNodeAnnouncement msg_var = *msg;
9137         uint64_t msg_ref = 0;
9138         msg_var = NodeAnnouncement_clone(&msg_var);
9139         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9140         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
9141         uint32_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 75, msg_ref, 0, 0, 0, 0, 0);
9142         void* ret_ptr = untag_ptr(ret);
9143         CHECK_ACCESS(ret_ptr);
9144         LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(ret_ptr);
9145         FREE(untag_ptr(ret));
9146         return ret_conv;
9147 }
9148 LDKCResult_boolLightningErrorZ handle_channel_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKChannelAnnouncement * msg) {
9149         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
9150         LDKChannelAnnouncement msg_var = *msg;
9151         uint64_t msg_ref = 0;
9152         msg_var = ChannelAnnouncement_clone(&msg_var);
9153         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9154         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
9155         uint32_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 76, msg_ref, 0, 0, 0, 0, 0);
9156         void* ret_ptr = untag_ptr(ret);
9157         CHECK_ACCESS(ret_ptr);
9158         LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(ret_ptr);
9159         FREE(untag_ptr(ret));
9160         return ret_conv;
9161 }
9162 LDKCResult_boolLightningErrorZ handle_channel_update_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKChannelUpdate * msg) {
9163         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
9164         LDKChannelUpdate msg_var = *msg;
9165         uint64_t msg_ref = 0;
9166         msg_var = ChannelUpdate_clone(&msg_var);
9167         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9168         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
9169         uint32_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 77, msg_ref, 0, 0, 0, 0, 0);
9170         void* ret_ptr = untag_ptr(ret);
9171         CHECK_ACCESS(ret_ptr);
9172         LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(ret_ptr);
9173         FREE(untag_ptr(ret));
9174         return ret_conv;
9175 }
9176 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ get_next_channel_announcements_LDKRoutingMessageHandler_jcall(const void* this_arg, uint64_t starting_point, uint8_t batch_amount) {
9177         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
9178         int64_t starting_point_conv = starting_point;
9179         int8_t batch_amount_conv = batch_amount;
9180         uint64_tArray ret = (uint64_tArray)js_invoke_function_buuuuu(j_calls->instance_ptr, 78, starting_point_conv, batch_amount_conv, 0, 0, 0, 0);
9181         LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret_constr;
9182         ret_constr.datalen = ret->arr_len;
9183         if (ret_constr.datalen > 0)
9184                 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ Elements");
9185         else
9186                 ret_constr.data = NULL;
9187         uint64_t* ret_vals = ret->elems;
9188         for (size_t h = 0; h < ret_constr.datalen; h++) {
9189                 uint64_t ret_conv_59 = ret_vals[h];
9190                 void* ret_conv_59_ptr = untag_ptr(ret_conv_59);
9191                 CHECK_ACCESS(ret_conv_59_ptr);
9192                 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ ret_conv_59_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(ret_conv_59_ptr);
9193                 FREE(untag_ptr(ret_conv_59));
9194                 ret_constr.data[h] = ret_conv_59_conv;
9195         }
9196         FREE(ret);
9197         return ret_constr;
9198 }
9199 LDKCVec_NodeAnnouncementZ get_next_node_announcements_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey starting_point, uint8_t batch_amount) {
9200         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
9201         int8_tArray starting_point_arr = init_int8_tArray(33, __LINE__);
9202         memcpy(starting_point_arr->elems, starting_point.compressed_form, 33);
9203         int8_t batch_amount_conv = batch_amount;
9204         uint64_tArray ret = (uint64_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 79, (uint32_t)starting_point_arr, batch_amount_conv, 0, 0, 0, 0);
9205         LDKCVec_NodeAnnouncementZ ret_constr;
9206         ret_constr.datalen = ret->arr_len;
9207         if (ret_constr.datalen > 0)
9208                 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKNodeAnnouncement), "LDKCVec_NodeAnnouncementZ Elements");
9209         else
9210                 ret_constr.data = NULL;
9211         uint64_t* ret_vals = ret->elems;
9212         for (size_t s = 0; s < ret_constr.datalen; s++) {
9213                 uint64_t ret_conv_18 = ret_vals[s];
9214                 LDKNodeAnnouncement ret_conv_18_conv;
9215                 ret_conv_18_conv.inner = untag_ptr(ret_conv_18);
9216                 ret_conv_18_conv.is_owned = ptr_is_owned(ret_conv_18);
9217                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_18_conv);
9218                 ret_constr.data[s] = ret_conv_18_conv;
9219         }
9220         FREE(ret);
9221         return ret_constr;
9222 }
9223 void peer_connected_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * init) {
9224         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
9225         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9226         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9227         LDKInit init_var = *init;
9228         uint64_t init_ref = 0;
9229         init_var = Init_clone(&init_var);
9230         CHECK_INNER_FIELD_ACCESS_OR_NULL(init_var);
9231         init_ref = tag_ptr(init_var.inner, init_var.is_owned);
9232         js_invoke_function_ubuuuu(j_calls->instance_ptr, 80, (uint32_t)their_node_id_arr, init_ref, 0, 0, 0, 0);
9233 }
9234 LDKCResult_NoneLightningErrorZ handle_reply_channel_range_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKReplyChannelRange msg) {
9235         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
9236         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9237         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9238         LDKReplyChannelRange msg_var = msg;
9239         uint64_t msg_ref = 0;
9240         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9241         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
9242         uint32_t ret = js_invoke_function_ubuuuu(j_calls->instance_ptr, 81, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
9243         void* ret_ptr = untag_ptr(ret);
9244         CHECK_ACCESS(ret_ptr);
9245         LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
9246         FREE(untag_ptr(ret));
9247         return ret_conv;
9248 }
9249 LDKCResult_NoneLightningErrorZ handle_reply_short_channel_ids_end_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKReplyShortChannelIdsEnd msg) {
9250         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
9251         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9252         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9253         LDKReplyShortChannelIdsEnd msg_var = msg;
9254         uint64_t msg_ref = 0;
9255         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9256         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
9257         uint32_t ret = js_invoke_function_ubuuuu(j_calls->instance_ptr, 82, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
9258         void* ret_ptr = untag_ptr(ret);
9259         CHECK_ACCESS(ret_ptr);
9260         LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
9261         FREE(untag_ptr(ret));
9262         return ret_conv;
9263 }
9264 LDKCResult_NoneLightningErrorZ handle_query_channel_range_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKQueryChannelRange msg) {
9265         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
9266         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9267         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9268         LDKQueryChannelRange msg_var = msg;
9269         uint64_t msg_ref = 0;
9270         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9271         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
9272         uint32_t ret = js_invoke_function_ubuuuu(j_calls->instance_ptr, 83, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
9273         void* ret_ptr = untag_ptr(ret);
9274         CHECK_ACCESS(ret_ptr);
9275         LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
9276         FREE(untag_ptr(ret));
9277         return ret_conv;
9278 }
9279 LDKCResult_NoneLightningErrorZ handle_query_short_channel_ids_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKQueryShortChannelIds msg) {
9280         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
9281         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9282         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9283         LDKQueryShortChannelIds msg_var = msg;
9284         uint64_t msg_ref = 0;
9285         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9286         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
9287         uint32_t ret = js_invoke_function_ubuuuu(j_calls->instance_ptr, 84, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
9288         void* ret_ptr = untag_ptr(ret);
9289         CHECK_ACCESS(ret_ptr);
9290         LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
9291         FREE(untag_ptr(ret));
9292         return ret_conv;
9293 }
9294 static void LDKRoutingMessageHandler_JCalls_cloned(LDKRoutingMessageHandler* new_obj) {
9295         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) new_obj->this_arg;
9296         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
9297         atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
9298 }
9299 static inline LDKRoutingMessageHandler LDKRoutingMessageHandler_init (JSValue o, JSValue MessageSendEventsProvider) {
9300         LDKRoutingMessageHandler_JCalls *calls = MALLOC(sizeof(LDKRoutingMessageHandler_JCalls), "LDKRoutingMessageHandler_JCalls");
9301         atomic_init(&calls->refcnt, 1);
9302         calls->instance_ptr = o;
9303
9304         LDKRoutingMessageHandler ret = {
9305                 .this_arg = (void*) calls,
9306                 .handle_node_announcement = handle_node_announcement_LDKRoutingMessageHandler_jcall,
9307                 .handle_channel_announcement = handle_channel_announcement_LDKRoutingMessageHandler_jcall,
9308                 .handle_channel_update = handle_channel_update_LDKRoutingMessageHandler_jcall,
9309                 .get_next_channel_announcements = get_next_channel_announcements_LDKRoutingMessageHandler_jcall,
9310                 .get_next_node_announcements = get_next_node_announcements_LDKRoutingMessageHandler_jcall,
9311                 .peer_connected = peer_connected_LDKRoutingMessageHandler_jcall,
9312                 .handle_reply_channel_range = handle_reply_channel_range_LDKRoutingMessageHandler_jcall,
9313                 .handle_reply_short_channel_ids_end = handle_reply_short_channel_ids_end_LDKRoutingMessageHandler_jcall,
9314                 .handle_query_channel_range = handle_query_channel_range_LDKRoutingMessageHandler_jcall,
9315                 .handle_query_short_channel_ids = handle_query_short_channel_ids_LDKRoutingMessageHandler_jcall,
9316                 .free = LDKRoutingMessageHandler_JCalls_free,
9317                 .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(MessageSendEventsProvider),
9318         };
9319         calls->MessageSendEventsProvider = ret.MessageSendEventsProvider.this_arg;
9320         return ret;
9321 }
9322 uint64_t  __attribute__((export_name("TS_LDKRoutingMessageHandler_new"))) TS_LDKRoutingMessageHandler_new(JSValue o, JSValue MessageSendEventsProvider) {
9323         LDKRoutingMessageHandler *res_ptr = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
9324         *res_ptr = LDKRoutingMessageHandler_init(o, MessageSendEventsProvider);
9325         return tag_ptr(res_ptr, true);
9326 }
9327 uint64_t  __attribute__((export_name("TS_RoutingMessageHandler_handle_node_announcement"))) TS_RoutingMessageHandler_handle_node_announcement(uint64_t this_arg, uint64_t msg) {
9328         void* this_arg_ptr = untag_ptr(this_arg);
9329         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9330         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
9331         LDKNodeAnnouncement msg_conv;
9332         msg_conv.inner = untag_ptr(msg);
9333         msg_conv.is_owned = ptr_is_owned(msg);
9334         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9335         msg_conv.is_owned = false;
9336         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
9337         *ret_conv = (this_arg_conv->handle_node_announcement)(this_arg_conv->this_arg, &msg_conv);
9338         return tag_ptr(ret_conv, true);
9339 }
9340
9341 uint64_t  __attribute__((export_name("TS_RoutingMessageHandler_handle_channel_announcement"))) TS_RoutingMessageHandler_handle_channel_announcement(uint64_t this_arg, uint64_t msg) {
9342         void* this_arg_ptr = untag_ptr(this_arg);
9343         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9344         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
9345         LDKChannelAnnouncement msg_conv;
9346         msg_conv.inner = untag_ptr(msg);
9347         msg_conv.is_owned = ptr_is_owned(msg);
9348         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9349         msg_conv.is_owned = false;
9350         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
9351         *ret_conv = (this_arg_conv->handle_channel_announcement)(this_arg_conv->this_arg, &msg_conv);
9352         return tag_ptr(ret_conv, true);
9353 }
9354
9355 uint64_t  __attribute__((export_name("TS_RoutingMessageHandler_handle_channel_update"))) TS_RoutingMessageHandler_handle_channel_update(uint64_t this_arg, uint64_t msg) {
9356         void* this_arg_ptr = untag_ptr(this_arg);
9357         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9358         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
9359         LDKChannelUpdate msg_conv;
9360         msg_conv.inner = untag_ptr(msg);
9361         msg_conv.is_owned = ptr_is_owned(msg);
9362         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9363         msg_conv.is_owned = false;
9364         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
9365         *ret_conv = (this_arg_conv->handle_channel_update)(this_arg_conv->this_arg, &msg_conv);
9366         return tag_ptr(ret_conv, true);
9367 }
9368
9369 uint64_tArray  __attribute__((export_name("TS_RoutingMessageHandler_get_next_channel_announcements"))) TS_RoutingMessageHandler_get_next_channel_announcements(uint64_t this_arg, int64_t starting_point, int8_t batch_amount) {
9370         void* this_arg_ptr = untag_ptr(this_arg);
9371         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9372         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
9373         LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret_var = (this_arg_conv->get_next_channel_announcements)(this_arg_conv->this_arg, starting_point, batch_amount);
9374         uint64_tArray ret_arr = NULL;
9375         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
9376         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
9377         for (size_t h = 0; h < ret_var.datalen; h++) {
9378                 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv_59_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
9379                 *ret_conv_59_conv = ret_var.data[h];
9380                 ret_arr_ptr[h] = tag_ptr(ret_conv_59_conv, true);
9381         }
9382         
9383         FREE(ret_var.data);
9384         return ret_arr;
9385 }
9386
9387 uint64_tArray  __attribute__((export_name("TS_RoutingMessageHandler_get_next_node_announcements"))) TS_RoutingMessageHandler_get_next_node_announcements(uint64_t this_arg, int8_tArray starting_point, int8_t batch_amount) {
9388         void* this_arg_ptr = untag_ptr(this_arg);
9389         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9390         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
9391         LDKPublicKey starting_point_ref;
9392         CHECK(starting_point->arr_len == 33);
9393         memcpy(starting_point_ref.compressed_form, starting_point->elems, 33); FREE(starting_point);
9394         LDKCVec_NodeAnnouncementZ ret_var = (this_arg_conv->get_next_node_announcements)(this_arg_conv->this_arg, starting_point_ref, batch_amount);
9395         uint64_tArray ret_arr = NULL;
9396         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
9397         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
9398         for (size_t s = 0; s < ret_var.datalen; s++) {
9399                 LDKNodeAnnouncement ret_conv_18_var = ret_var.data[s];
9400                 uint64_t ret_conv_18_ref = 0;
9401                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_18_var);
9402                 ret_conv_18_ref = tag_ptr(ret_conv_18_var.inner, ret_conv_18_var.is_owned);
9403                 ret_arr_ptr[s] = ret_conv_18_ref;
9404         }
9405         
9406         FREE(ret_var.data);
9407         return ret_arr;
9408 }
9409
9410 void  __attribute__((export_name("TS_RoutingMessageHandler_peer_connected"))) TS_RoutingMessageHandler_peer_connected(uint64_t this_arg, int8_tArray their_node_id, uint64_t init) {
9411         void* this_arg_ptr = untag_ptr(this_arg);
9412         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9413         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
9414         LDKPublicKey their_node_id_ref;
9415         CHECK(their_node_id->arr_len == 33);
9416         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9417         LDKInit init_conv;
9418         init_conv.inner = untag_ptr(init);
9419         init_conv.is_owned = ptr_is_owned(init);
9420         CHECK_INNER_FIELD_ACCESS_OR_NULL(init_conv);
9421         init_conv.is_owned = false;
9422         (this_arg_conv->peer_connected)(this_arg_conv->this_arg, their_node_id_ref, &init_conv);
9423 }
9424
9425 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) {
9426         void* this_arg_ptr = untag_ptr(this_arg);
9427         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9428         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
9429         LDKPublicKey their_node_id_ref;
9430         CHECK(their_node_id->arr_len == 33);
9431         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9432         LDKReplyChannelRange msg_conv;
9433         msg_conv.inner = untag_ptr(msg);
9434         msg_conv.is_owned = ptr_is_owned(msg);
9435         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9436         msg_conv = ReplyChannelRange_clone(&msg_conv);
9437         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
9438         *ret_conv = (this_arg_conv->handle_reply_channel_range)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
9439         return tag_ptr(ret_conv, true);
9440 }
9441
9442 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) {
9443         void* this_arg_ptr = untag_ptr(this_arg);
9444         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9445         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
9446         LDKPublicKey their_node_id_ref;
9447         CHECK(their_node_id->arr_len == 33);
9448         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9449         LDKReplyShortChannelIdsEnd msg_conv;
9450         msg_conv.inner = untag_ptr(msg);
9451         msg_conv.is_owned = ptr_is_owned(msg);
9452         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9453         msg_conv = ReplyShortChannelIdsEnd_clone(&msg_conv);
9454         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
9455         *ret_conv = (this_arg_conv->handle_reply_short_channel_ids_end)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
9456         return tag_ptr(ret_conv, true);
9457 }
9458
9459 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) {
9460         void* this_arg_ptr = untag_ptr(this_arg);
9461         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9462         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
9463         LDKPublicKey their_node_id_ref;
9464         CHECK(their_node_id->arr_len == 33);
9465         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9466         LDKQueryChannelRange msg_conv;
9467         msg_conv.inner = untag_ptr(msg);
9468         msg_conv.is_owned = ptr_is_owned(msg);
9469         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9470         msg_conv = QueryChannelRange_clone(&msg_conv);
9471         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
9472         *ret_conv = (this_arg_conv->handle_query_channel_range)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
9473         return tag_ptr(ret_conv, true);
9474 }
9475
9476 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) {
9477         void* this_arg_ptr = untag_ptr(this_arg);
9478         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9479         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
9480         LDKPublicKey their_node_id_ref;
9481         CHECK(their_node_id->arr_len == 33);
9482         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9483         LDKQueryShortChannelIds msg_conv;
9484         msg_conv.inner = untag_ptr(msg);
9485         msg_conv.is_owned = ptr_is_owned(msg);
9486         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9487         msg_conv = QueryShortChannelIds_clone(&msg_conv);
9488         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
9489         *ret_conv = (this_arg_conv->handle_query_short_channel_ids)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
9490         return tag_ptr(ret_conv, true);
9491 }
9492
9493 typedef struct LDKCustomMessageReader_JCalls {
9494         atomic_size_t refcnt;
9495         uint32_t instance_ptr;
9496 } LDKCustomMessageReader_JCalls;
9497 static void LDKCustomMessageReader_JCalls_free(void* this_arg) {
9498         LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) this_arg;
9499         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
9500                 FREE(j_calls);
9501         }
9502 }
9503 LDKCResult_COption_TypeZDecodeErrorZ read_LDKCustomMessageReader_jcall(const void* this_arg, uint16_t message_type, LDKu8slice buffer) {
9504         LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) this_arg;
9505         int16_t message_type_conv = message_type;
9506         LDKu8slice buffer_var = buffer;
9507         int8_tArray buffer_arr = init_int8_tArray(buffer_var.datalen, __LINE__);
9508         memcpy(buffer_arr->elems, buffer_var.data, buffer_var.datalen);
9509         uint32_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 85, message_type_conv, (uint32_t)buffer_arr, 0, 0, 0, 0);
9510         void* ret_ptr = untag_ptr(ret);
9511         CHECK_ACCESS(ret_ptr);
9512         LDKCResult_COption_TypeZDecodeErrorZ ret_conv = *(LDKCResult_COption_TypeZDecodeErrorZ*)(ret_ptr);
9513         FREE(untag_ptr(ret));
9514         return ret_conv;
9515 }
9516 static void LDKCustomMessageReader_JCalls_cloned(LDKCustomMessageReader* new_obj) {
9517         LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) new_obj->this_arg;
9518         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
9519 }
9520 static inline LDKCustomMessageReader LDKCustomMessageReader_init (JSValue o) {
9521         LDKCustomMessageReader_JCalls *calls = MALLOC(sizeof(LDKCustomMessageReader_JCalls), "LDKCustomMessageReader_JCalls");
9522         atomic_init(&calls->refcnt, 1);
9523         calls->instance_ptr = o;
9524
9525         LDKCustomMessageReader ret = {
9526                 .this_arg = (void*) calls,
9527                 .read = read_LDKCustomMessageReader_jcall,
9528                 .free = LDKCustomMessageReader_JCalls_free,
9529         };
9530         return ret;
9531 }
9532 uint64_t  __attribute__((export_name("TS_LDKCustomMessageReader_new"))) TS_LDKCustomMessageReader_new(JSValue o) {
9533         LDKCustomMessageReader *res_ptr = MALLOC(sizeof(LDKCustomMessageReader), "LDKCustomMessageReader");
9534         *res_ptr = LDKCustomMessageReader_init(o);
9535         return tag_ptr(res_ptr, true);
9536 }
9537 uint64_t  __attribute__((export_name("TS_CustomMessageReader_read"))) TS_CustomMessageReader_read(uint64_t this_arg, int16_t message_type, int8_tArray buffer) {
9538         void* this_arg_ptr = untag_ptr(this_arg);
9539         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9540         LDKCustomMessageReader* this_arg_conv = (LDKCustomMessageReader*)this_arg_ptr;
9541         LDKu8slice buffer_ref;
9542         buffer_ref.datalen = buffer->arr_len;
9543         buffer_ref.data = buffer->elems;
9544         LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
9545         *ret_conv = (this_arg_conv->read)(this_arg_conv->this_arg, message_type, buffer_ref);
9546         FREE(buffer);
9547         return tag_ptr(ret_conv, true);
9548 }
9549
9550 typedef struct LDKCustomMessageHandler_JCalls {
9551         atomic_size_t refcnt;
9552         uint32_t instance_ptr;
9553         LDKCustomMessageReader_JCalls* CustomMessageReader;
9554 } LDKCustomMessageHandler_JCalls;
9555 static void LDKCustomMessageHandler_JCalls_free(void* this_arg) {
9556         LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
9557         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
9558                 FREE(j_calls);
9559         }
9560 }
9561 LDKCResult_NoneLightningErrorZ handle_custom_message_LDKCustomMessageHandler_jcall(const void* this_arg, LDKType msg, LDKPublicKey sender_node_id) {
9562         LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
9563         LDKType* msg_ret = MALLOC(sizeof(LDKType), "LDKType");
9564         *msg_ret = msg;
9565         int8_tArray sender_node_id_arr = init_int8_tArray(33, __LINE__);
9566         memcpy(sender_node_id_arr->elems, sender_node_id.compressed_form, 33);
9567         uint32_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 86, tag_ptr(msg_ret, true), (uint32_t)sender_node_id_arr, 0, 0, 0, 0);
9568         void* ret_ptr = untag_ptr(ret);
9569         CHECK_ACCESS(ret_ptr);
9570         LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
9571         FREE(untag_ptr(ret));
9572         return ret_conv;
9573 }
9574 LDKCVec_C2Tuple_PublicKeyTypeZZ get_and_clear_pending_msg_LDKCustomMessageHandler_jcall(const void* this_arg) {
9575         LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
9576         uint64_tArray ret = (uint64_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 87, 0, 0, 0, 0, 0, 0);
9577         LDKCVec_C2Tuple_PublicKeyTypeZZ ret_constr;
9578         ret_constr.datalen = ret->arr_len;
9579         if (ret_constr.datalen > 0)
9580                 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKCVec_C2Tuple_PublicKeyTypeZZ Elements");
9581         else
9582                 ret_constr.data = NULL;
9583         uint64_t* ret_vals = ret->elems;
9584         for (size_t z = 0; z < ret_constr.datalen; z++) {
9585                 uint64_t ret_conv_25 = ret_vals[z];
9586                 void* ret_conv_25_ptr = untag_ptr(ret_conv_25);
9587                 CHECK_ACCESS(ret_conv_25_ptr);
9588                 LDKC2Tuple_PublicKeyTypeZ ret_conv_25_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(ret_conv_25_ptr);
9589                 FREE(untag_ptr(ret_conv_25));
9590                 ret_constr.data[z] = ret_conv_25_conv;
9591         }
9592         FREE(ret);
9593         return ret_constr;
9594 }
9595 static void LDKCustomMessageHandler_JCalls_cloned(LDKCustomMessageHandler* new_obj) {
9596         LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) new_obj->this_arg;
9597         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
9598         atomic_fetch_add_explicit(&j_calls->CustomMessageReader->refcnt, 1, memory_order_release);
9599 }
9600 static inline LDKCustomMessageHandler LDKCustomMessageHandler_init (JSValue o, JSValue CustomMessageReader) {
9601         LDKCustomMessageHandler_JCalls *calls = MALLOC(sizeof(LDKCustomMessageHandler_JCalls), "LDKCustomMessageHandler_JCalls");
9602         atomic_init(&calls->refcnt, 1);
9603         calls->instance_ptr = o;
9604
9605         LDKCustomMessageHandler ret = {
9606                 .this_arg = (void*) calls,
9607                 .handle_custom_message = handle_custom_message_LDKCustomMessageHandler_jcall,
9608                 .get_and_clear_pending_msg = get_and_clear_pending_msg_LDKCustomMessageHandler_jcall,
9609                 .free = LDKCustomMessageHandler_JCalls_free,
9610                 .CustomMessageReader = LDKCustomMessageReader_init(CustomMessageReader),
9611         };
9612         calls->CustomMessageReader = ret.CustomMessageReader.this_arg;
9613         return ret;
9614 }
9615 uint64_t  __attribute__((export_name("TS_LDKCustomMessageHandler_new"))) TS_LDKCustomMessageHandler_new(JSValue o, JSValue CustomMessageReader) {
9616         LDKCustomMessageHandler *res_ptr = MALLOC(sizeof(LDKCustomMessageHandler), "LDKCustomMessageHandler");
9617         *res_ptr = LDKCustomMessageHandler_init(o, CustomMessageReader);
9618         return tag_ptr(res_ptr, true);
9619 }
9620 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) {
9621         void* this_arg_ptr = untag_ptr(this_arg);
9622         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9623         LDKCustomMessageHandler* this_arg_conv = (LDKCustomMessageHandler*)this_arg_ptr;
9624         void* msg_ptr = untag_ptr(msg);
9625         CHECK_ACCESS(msg_ptr);
9626         LDKType msg_conv = *(LDKType*)(msg_ptr);
9627         if (msg_conv.free == LDKType_JCalls_free) {
9628                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
9629                 LDKType_JCalls_cloned(&msg_conv);
9630         }
9631         LDKPublicKey sender_node_id_ref;
9632         CHECK(sender_node_id->arr_len == 33);
9633         memcpy(sender_node_id_ref.compressed_form, sender_node_id->elems, 33); FREE(sender_node_id);
9634         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
9635         *ret_conv = (this_arg_conv->handle_custom_message)(this_arg_conv->this_arg, msg_conv, sender_node_id_ref);
9636         return tag_ptr(ret_conv, true);
9637 }
9638
9639 uint64_tArray  __attribute__((export_name("TS_CustomMessageHandler_get_and_clear_pending_msg"))) TS_CustomMessageHandler_get_and_clear_pending_msg(uint64_t this_arg) {
9640         void* this_arg_ptr = untag_ptr(this_arg);
9641         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9642         LDKCustomMessageHandler* this_arg_conv = (LDKCustomMessageHandler*)this_arg_ptr;
9643         LDKCVec_C2Tuple_PublicKeyTypeZZ ret_var = (this_arg_conv->get_and_clear_pending_msg)(this_arg_conv->this_arg);
9644         uint64_tArray ret_arr = NULL;
9645         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
9646         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
9647         for (size_t z = 0; z < ret_var.datalen; z++) {
9648                 LDKC2Tuple_PublicKeyTypeZ* ret_conv_25_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
9649                 *ret_conv_25_conv = ret_var.data[z];
9650                 ret_arr_ptr[z] = tag_ptr(ret_conv_25_conv, true);
9651         }
9652         
9653         FREE(ret_var.data);
9654         return ret_arr;
9655 }
9656
9657 typedef struct LDKSocketDescriptor_JCalls {
9658         atomic_size_t refcnt;
9659         uint32_t instance_ptr;
9660 } LDKSocketDescriptor_JCalls;
9661 static void LDKSocketDescriptor_JCalls_free(void* this_arg) {
9662         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
9663         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
9664                 FREE(j_calls);
9665         }
9666 }
9667 uintptr_t send_data_LDKSocketDescriptor_jcall(void* this_arg, LDKu8slice data, bool resume_read) {
9668         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
9669         LDKu8slice data_var = data;
9670         int8_tArray data_arr = init_int8_tArray(data_var.datalen, __LINE__);
9671         memcpy(data_arr->elems, data_var.data, data_var.datalen);
9672         jboolean resume_read_conv = resume_read;
9673         return js_invoke_function_uuuuuu(j_calls->instance_ptr, 88, (uint32_t)data_arr, resume_read_conv, 0, 0, 0, 0);
9674 }
9675 void disconnect_socket_LDKSocketDescriptor_jcall(void* this_arg) {
9676         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
9677         js_invoke_function_uuuuuu(j_calls->instance_ptr, 89, 0, 0, 0, 0, 0, 0);
9678 }
9679 bool eq_LDKSocketDescriptor_jcall(const void* this_arg, const LDKSocketDescriptor * other_arg) {
9680         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
9681         LDKSocketDescriptor *other_arg_clone = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
9682         *other_arg_clone = SocketDescriptor_clone(other_arg);
9683         return js_invoke_function_buuuuu(j_calls->instance_ptr, 90, tag_ptr(other_arg_clone, true), 0, 0, 0, 0, 0);
9684 }
9685 uint64_t hash_LDKSocketDescriptor_jcall(const void* this_arg) {
9686         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
9687         return js_invoke_function_uuuuuu(j_calls->instance_ptr, 91, 0, 0, 0, 0, 0, 0);
9688 }
9689 static void LDKSocketDescriptor_JCalls_cloned(LDKSocketDescriptor* new_obj) {
9690         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) new_obj->this_arg;
9691         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
9692 }
9693 static inline LDKSocketDescriptor LDKSocketDescriptor_init (JSValue o) {
9694         LDKSocketDescriptor_JCalls *calls = MALLOC(sizeof(LDKSocketDescriptor_JCalls), "LDKSocketDescriptor_JCalls");
9695         atomic_init(&calls->refcnt, 1);
9696         calls->instance_ptr = o;
9697
9698         LDKSocketDescriptor ret = {
9699                 .this_arg = (void*) calls,
9700                 .send_data = send_data_LDKSocketDescriptor_jcall,
9701                 .disconnect_socket = disconnect_socket_LDKSocketDescriptor_jcall,
9702                 .eq = eq_LDKSocketDescriptor_jcall,
9703                 .hash = hash_LDKSocketDescriptor_jcall,
9704                 .cloned = LDKSocketDescriptor_JCalls_cloned,
9705                 .free = LDKSocketDescriptor_JCalls_free,
9706         };
9707         return ret;
9708 }
9709 uint64_t  __attribute__((export_name("TS_LDKSocketDescriptor_new"))) TS_LDKSocketDescriptor_new(JSValue o) {
9710         LDKSocketDescriptor *res_ptr = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
9711         *res_ptr = LDKSocketDescriptor_init(o);
9712         return tag_ptr(res_ptr, true);
9713 }
9714 uint32_t  __attribute__((export_name("TS_SocketDescriptor_send_data"))) TS_SocketDescriptor_send_data(uint64_t this_arg, int8_tArray data, jboolean resume_read) {
9715         void* this_arg_ptr = untag_ptr(this_arg);
9716         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9717         LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg_ptr;
9718         LDKu8slice data_ref;
9719         data_ref.datalen = data->arr_len;
9720         data_ref.data = data->elems;
9721         uint32_t ret_conv = (this_arg_conv->send_data)(this_arg_conv->this_arg, data_ref, resume_read);
9722         FREE(data);
9723         return ret_conv;
9724 }
9725
9726 void  __attribute__((export_name("TS_SocketDescriptor_disconnect_socket"))) TS_SocketDescriptor_disconnect_socket(uint64_t this_arg) {
9727         void* this_arg_ptr = untag_ptr(this_arg);
9728         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9729         LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg_ptr;
9730         (this_arg_conv->disconnect_socket)(this_arg_conv->this_arg);
9731 }
9732
9733 int64_t  __attribute__((export_name("TS_SocketDescriptor_hash"))) TS_SocketDescriptor_hash(uint64_t this_arg) {
9734         void* this_arg_ptr = untag_ptr(this_arg);
9735         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9736         LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg_ptr;
9737         int64_t ret_conv = (this_arg_conv->hash)(this_arg_conv->this_arg);
9738         return ret_conv;
9739 }
9740
9741 uint32_t __attribute__((export_name("TS_LDKEffectiveCapacity_ty_from_ptr"))) TS_LDKEffectiveCapacity_ty_from_ptr(uint64_t ptr) {
9742         LDKEffectiveCapacity *obj = (LDKEffectiveCapacity*)untag_ptr(ptr);
9743         switch(obj->tag) {
9744                 case LDKEffectiveCapacity_ExactLiquidity: return 0;
9745                 case LDKEffectiveCapacity_MaximumHTLC: return 1;
9746                 case LDKEffectiveCapacity_Total: return 2;
9747                 case LDKEffectiveCapacity_Infinite: return 3;
9748                 case LDKEffectiveCapacity_Unknown: return 4;
9749                 default: abort();
9750         }
9751 }
9752 int64_t __attribute__((export_name("TS_LDKEffectiveCapacity_ExactLiquidity_get_liquidity_msat"))) TS_LDKEffectiveCapacity_ExactLiquidity_get_liquidity_msat(uint64_t ptr) {
9753         LDKEffectiveCapacity *obj = (LDKEffectiveCapacity*)untag_ptr(ptr);
9754         assert(obj->tag == LDKEffectiveCapacity_ExactLiquidity);
9755                         int64_t liquidity_msat_conv = obj->exact_liquidity.liquidity_msat;
9756         return liquidity_msat_conv;
9757 }
9758 int64_t __attribute__((export_name("TS_LDKEffectiveCapacity_MaximumHTLC_get_amount_msat"))) TS_LDKEffectiveCapacity_MaximumHTLC_get_amount_msat(uint64_t ptr) {
9759         LDKEffectiveCapacity *obj = (LDKEffectiveCapacity*)untag_ptr(ptr);
9760         assert(obj->tag == LDKEffectiveCapacity_MaximumHTLC);
9761                         int64_t amount_msat_conv = obj->maximum_htlc.amount_msat;
9762         return amount_msat_conv;
9763 }
9764 int64_t __attribute__((export_name("TS_LDKEffectiveCapacity_Total_get_capacity_msat"))) TS_LDKEffectiveCapacity_Total_get_capacity_msat(uint64_t ptr) {
9765         LDKEffectiveCapacity *obj = (LDKEffectiveCapacity*)untag_ptr(ptr);
9766         assert(obj->tag == LDKEffectiveCapacity_Total);
9767                         int64_t capacity_msat_conv = obj->total.capacity_msat;
9768         return capacity_msat_conv;
9769 }
9770 uint64_t __attribute__((export_name("TS_LDKEffectiveCapacity_Total_get_htlc_maximum_msat"))) TS_LDKEffectiveCapacity_Total_get_htlc_maximum_msat(uint64_t ptr) {
9771         LDKEffectiveCapacity *obj = (LDKEffectiveCapacity*)untag_ptr(ptr);
9772         assert(obj->tag == LDKEffectiveCapacity_Total);
9773                         uint64_t htlc_maximum_msat_ref = tag_ptr(&obj->total.htlc_maximum_msat, false);
9774         return htlc_maximum_msat_ref;
9775 }
9776 typedef struct LDKLockableScore_JCalls {
9777         atomic_size_t refcnt;
9778         uint32_t instance_ptr;
9779 } LDKLockableScore_JCalls;
9780 static void LDKLockableScore_JCalls_free(void* this_arg) {
9781         LDKLockableScore_JCalls *j_calls = (LDKLockableScore_JCalls*) this_arg;
9782         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
9783                 FREE(j_calls);
9784         }
9785 }
9786 LDKScore lock_LDKLockableScore_jcall(const void* this_arg) {
9787         LDKLockableScore_JCalls *j_calls = (LDKLockableScore_JCalls*) this_arg;
9788         uint32_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 92, 0, 0, 0, 0, 0, 0);
9789         void* ret_ptr = untag_ptr(ret);
9790         CHECK_ACCESS(ret_ptr);
9791         LDKScore ret_conv = *(LDKScore*)(ret_ptr);
9792         if (ret_conv.free == LDKScore_JCalls_free) {
9793                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
9794                 LDKScore_JCalls_cloned(&ret_conv);
9795         }// WARNING: we may need a move here but no clone is available for LDKScore
9796         
9797         return ret_conv;
9798 }
9799 static void LDKLockableScore_JCalls_cloned(LDKLockableScore* new_obj) {
9800         LDKLockableScore_JCalls *j_calls = (LDKLockableScore_JCalls*) new_obj->this_arg;
9801         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
9802 }
9803 static inline LDKLockableScore LDKLockableScore_init (JSValue o) {
9804         LDKLockableScore_JCalls *calls = MALLOC(sizeof(LDKLockableScore_JCalls), "LDKLockableScore_JCalls");
9805         atomic_init(&calls->refcnt, 1);
9806         calls->instance_ptr = o;
9807
9808         LDKLockableScore ret = {
9809                 .this_arg = (void*) calls,
9810                 .lock = lock_LDKLockableScore_jcall,
9811                 .free = LDKLockableScore_JCalls_free,
9812         };
9813         return ret;
9814 }
9815 uint64_t  __attribute__((export_name("TS_LDKLockableScore_new"))) TS_LDKLockableScore_new(JSValue o) {
9816         LDKLockableScore *res_ptr = MALLOC(sizeof(LDKLockableScore), "LDKLockableScore");
9817         *res_ptr = LDKLockableScore_init(o);
9818         return tag_ptr(res_ptr, true);
9819 }
9820 uint64_t  __attribute__((export_name("TS_LockableScore_lock"))) TS_LockableScore_lock(uint64_t this_arg) {
9821         void* this_arg_ptr = untag_ptr(this_arg);
9822         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9823         LDKLockableScore* this_arg_conv = (LDKLockableScore*)this_arg_ptr;
9824         LDKScore* ret_ret = MALLOC(sizeof(LDKScore), "LDKScore");
9825         *ret_ret = (this_arg_conv->lock)(this_arg_conv->this_arg);
9826         return tag_ptr(ret_ret, true);
9827 }
9828
9829 uint32_t __attribute__((export_name("TS_LDKFallback_ty_from_ptr"))) TS_LDKFallback_ty_from_ptr(uint64_t ptr) {
9830         LDKFallback *obj = (LDKFallback*)untag_ptr(ptr);
9831         switch(obj->tag) {
9832                 case LDKFallback_SegWitProgram: return 0;
9833                 case LDKFallback_PubKeyHash: return 1;
9834                 case LDKFallback_ScriptHash: return 2;
9835                 default: abort();
9836         }
9837 }
9838 int8_t __attribute__((export_name("TS_LDKFallback_SegWitProgram_get_version"))) TS_LDKFallback_SegWitProgram_get_version(uint64_t ptr) {
9839         LDKFallback *obj = (LDKFallback*)untag_ptr(ptr);
9840         assert(obj->tag == LDKFallback_SegWitProgram);
9841                         uint8_t version_val = obj->seg_wit_program.version._0;
9842         return version_val;
9843 }
9844 int8_tArray __attribute__((export_name("TS_LDKFallback_SegWitProgram_get_program"))) TS_LDKFallback_SegWitProgram_get_program(uint64_t ptr) {
9845         LDKFallback *obj = (LDKFallback*)untag_ptr(ptr);
9846         assert(obj->tag == LDKFallback_SegWitProgram);
9847                         LDKCVec_u8Z program_var = obj->seg_wit_program.program;
9848                         int8_tArray program_arr = init_int8_tArray(program_var.datalen, __LINE__);
9849                         memcpy(program_arr->elems, program_var.data, program_var.datalen);
9850         return program_arr;
9851 }
9852 int8_tArray __attribute__((export_name("TS_LDKFallback_PubKeyHash_get_pub_key_hash"))) TS_LDKFallback_PubKeyHash_get_pub_key_hash(uint64_t ptr) {
9853         LDKFallback *obj = (LDKFallback*)untag_ptr(ptr);
9854         assert(obj->tag == LDKFallback_PubKeyHash);
9855                         int8_tArray pub_key_hash_arr = init_int8_tArray(20, __LINE__);
9856                         memcpy(pub_key_hash_arr->elems, obj->pub_key_hash.data, 20);
9857         return pub_key_hash_arr;
9858 }
9859 int8_tArray __attribute__((export_name("TS_LDKFallback_ScriptHash_get_script_hash"))) TS_LDKFallback_ScriptHash_get_script_hash(uint64_t ptr) {
9860         LDKFallback *obj = (LDKFallback*)untag_ptr(ptr);
9861         assert(obj->tag == LDKFallback_ScriptHash);
9862                         int8_tArray script_hash_arr = init_int8_tArray(20, __LINE__);
9863                         memcpy(script_hash_arr->elems, obj->script_hash.data, 20);
9864         return script_hash_arr;
9865 }
9866 typedef struct LDKPayer_JCalls {
9867         atomic_size_t refcnt;
9868         uint32_t instance_ptr;
9869 } LDKPayer_JCalls;
9870 static void LDKPayer_JCalls_free(void* this_arg) {
9871         LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg;
9872         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
9873                 FREE(j_calls);
9874         }
9875 }
9876 LDKPublicKey node_id_LDKPayer_jcall(const void* this_arg) {
9877         LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg;
9878         int8_tArray ret = (int8_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 93, 0, 0, 0, 0, 0, 0);
9879         LDKPublicKey ret_ref;
9880         CHECK(ret->arr_len == 33);
9881         memcpy(ret_ref.compressed_form, ret->elems, 33); FREE(ret);
9882         return ret_ref;
9883 }
9884 LDKCVec_ChannelDetailsZ first_hops_LDKPayer_jcall(const void* this_arg) {
9885         LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg;
9886         uint64_tArray ret = (uint64_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 94, 0, 0, 0, 0, 0, 0);
9887         LDKCVec_ChannelDetailsZ ret_constr;
9888         ret_constr.datalen = ret->arr_len;
9889         if (ret_constr.datalen > 0)
9890                 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
9891         else
9892                 ret_constr.data = NULL;
9893         uint64_t* ret_vals = ret->elems;
9894         for (size_t q = 0; q < ret_constr.datalen; q++) {
9895                 uint64_t ret_conv_16 = ret_vals[q];
9896                 LDKChannelDetails ret_conv_16_conv;
9897                 ret_conv_16_conv.inner = untag_ptr(ret_conv_16);
9898                 ret_conv_16_conv.is_owned = ptr_is_owned(ret_conv_16);
9899                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_conv);
9900                 ret_constr.data[q] = ret_conv_16_conv;
9901         }
9902         FREE(ret);
9903         return ret_constr;
9904 }
9905 LDKCResult_PaymentIdPaymentSendFailureZ send_payment_LDKPayer_jcall(const void* this_arg, const LDKRoute * route, LDKThirtyTwoBytes payment_hash, LDKThirtyTwoBytes payment_secret) {
9906         LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg;
9907         LDKRoute route_var = *route;
9908         uint64_t route_ref = 0;
9909         route_var = Route_clone(&route_var);
9910         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_var);
9911         route_ref = tag_ptr(route_var.inner, route_var.is_owned);
9912         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
9913         memcpy(payment_hash_arr->elems, payment_hash.data, 32);
9914         int8_tArray payment_secret_arr = init_int8_tArray(32, __LINE__);
9915         memcpy(payment_secret_arr->elems, payment_secret.data, 32);
9916         uint32_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 95, route_ref, (uint32_t)payment_hash_arr, (uint32_t)payment_secret_arr, 0, 0, 0);
9917         void* ret_ptr = untag_ptr(ret);
9918         CHECK_ACCESS(ret_ptr);
9919         LDKCResult_PaymentIdPaymentSendFailureZ ret_conv = *(LDKCResult_PaymentIdPaymentSendFailureZ*)(ret_ptr);
9920         FREE(untag_ptr(ret));
9921         return ret_conv;
9922 }
9923 LDKCResult_PaymentIdPaymentSendFailureZ send_spontaneous_payment_LDKPayer_jcall(const void* this_arg, const LDKRoute * route, LDKThirtyTwoBytes payment_preimage) {
9924         LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg;
9925         LDKRoute route_var = *route;
9926         uint64_t route_ref = 0;
9927         route_var = Route_clone(&route_var);
9928         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_var);
9929         route_ref = tag_ptr(route_var.inner, route_var.is_owned);
9930         int8_tArray payment_preimage_arr = init_int8_tArray(32, __LINE__);
9931         memcpy(payment_preimage_arr->elems, payment_preimage.data, 32);
9932         uint32_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 96, route_ref, (uint32_t)payment_preimage_arr, 0, 0, 0, 0);
9933         void* ret_ptr = untag_ptr(ret);
9934         CHECK_ACCESS(ret_ptr);
9935         LDKCResult_PaymentIdPaymentSendFailureZ ret_conv = *(LDKCResult_PaymentIdPaymentSendFailureZ*)(ret_ptr);
9936         FREE(untag_ptr(ret));
9937         return ret_conv;
9938 }
9939 LDKCResult_NonePaymentSendFailureZ retry_payment_LDKPayer_jcall(const void* this_arg, const LDKRoute * route, LDKThirtyTwoBytes payment_id) {
9940         LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg;
9941         LDKRoute route_var = *route;
9942         uint64_t route_ref = 0;
9943         route_var = Route_clone(&route_var);
9944         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_var);
9945         route_ref = tag_ptr(route_var.inner, route_var.is_owned);
9946         int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
9947         memcpy(payment_id_arr->elems, payment_id.data, 32);
9948         uint32_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 97, route_ref, (uint32_t)payment_id_arr, 0, 0, 0, 0);
9949         void* ret_ptr = untag_ptr(ret);
9950         CHECK_ACCESS(ret_ptr);
9951         LDKCResult_NonePaymentSendFailureZ ret_conv = *(LDKCResult_NonePaymentSendFailureZ*)(ret_ptr);
9952         FREE(untag_ptr(ret));
9953         return ret_conv;
9954 }
9955 void abandon_payment_LDKPayer_jcall(const void* this_arg, LDKThirtyTwoBytes payment_id) {
9956         LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg;
9957         int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
9958         memcpy(payment_id_arr->elems, payment_id.data, 32);
9959         js_invoke_function_uuuuuu(j_calls->instance_ptr, 98, (uint32_t)payment_id_arr, 0, 0, 0, 0, 0);
9960 }
9961 static void LDKPayer_JCalls_cloned(LDKPayer* new_obj) {
9962         LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) new_obj->this_arg;
9963         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
9964 }
9965 static inline LDKPayer LDKPayer_init (JSValue o) {
9966         LDKPayer_JCalls *calls = MALLOC(sizeof(LDKPayer_JCalls), "LDKPayer_JCalls");
9967         atomic_init(&calls->refcnt, 1);
9968         calls->instance_ptr = o;
9969
9970         LDKPayer ret = {
9971                 .this_arg = (void*) calls,
9972                 .node_id = node_id_LDKPayer_jcall,
9973                 .first_hops = first_hops_LDKPayer_jcall,
9974                 .send_payment = send_payment_LDKPayer_jcall,
9975                 .send_spontaneous_payment = send_spontaneous_payment_LDKPayer_jcall,
9976                 .retry_payment = retry_payment_LDKPayer_jcall,
9977                 .abandon_payment = abandon_payment_LDKPayer_jcall,
9978                 .free = LDKPayer_JCalls_free,
9979         };
9980         return ret;
9981 }
9982 uint64_t  __attribute__((export_name("TS_LDKPayer_new"))) TS_LDKPayer_new(JSValue o) {
9983         LDKPayer *res_ptr = MALLOC(sizeof(LDKPayer), "LDKPayer");
9984         *res_ptr = LDKPayer_init(o);
9985         return tag_ptr(res_ptr, true);
9986 }
9987 int8_tArray  __attribute__((export_name("TS_Payer_node_id"))) TS_Payer_node_id(uint64_t this_arg) {
9988         void* this_arg_ptr = untag_ptr(this_arg);
9989         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9990         LDKPayer* this_arg_conv = (LDKPayer*)this_arg_ptr;
9991         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
9992         memcpy(ret_arr->elems, (this_arg_conv->node_id)(this_arg_conv->this_arg).compressed_form, 33);
9993         return ret_arr;
9994 }
9995
9996 uint64_tArray  __attribute__((export_name("TS_Payer_first_hops"))) TS_Payer_first_hops(uint64_t this_arg) {
9997         void* this_arg_ptr = untag_ptr(this_arg);
9998         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9999         LDKPayer* this_arg_conv = (LDKPayer*)this_arg_ptr;
10000         LDKCVec_ChannelDetailsZ ret_var = (this_arg_conv->first_hops)(this_arg_conv->this_arg);
10001         uint64_tArray ret_arr = NULL;
10002         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
10003         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
10004         for (size_t q = 0; q < ret_var.datalen; q++) {
10005                 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
10006                 uint64_t ret_conv_16_ref = 0;
10007                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
10008                 ret_conv_16_ref = tag_ptr(ret_conv_16_var.inner, ret_conv_16_var.is_owned);
10009                 ret_arr_ptr[q] = ret_conv_16_ref;
10010         }
10011         
10012         FREE(ret_var.data);
10013         return ret_arr;
10014 }
10015
10016 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) {
10017         void* this_arg_ptr = untag_ptr(this_arg);
10018         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10019         LDKPayer* this_arg_conv = (LDKPayer*)this_arg_ptr;
10020         LDKRoute route_conv;
10021         route_conv.inner = untag_ptr(route);
10022         route_conv.is_owned = ptr_is_owned(route);
10023         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
10024         route_conv.is_owned = false;
10025         LDKThirtyTwoBytes payment_hash_ref;
10026         CHECK(payment_hash->arr_len == 32);
10027         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
10028         LDKThirtyTwoBytes payment_secret_ref;
10029         CHECK(payment_secret->arr_len == 32);
10030         memcpy(payment_secret_ref.data, payment_secret->elems, 32); FREE(payment_secret);
10031         LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
10032         *ret_conv = (this_arg_conv->send_payment)(this_arg_conv->this_arg, &route_conv, payment_hash_ref, payment_secret_ref);
10033         return tag_ptr(ret_conv, true);
10034 }
10035
10036 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) {
10037         void* this_arg_ptr = untag_ptr(this_arg);
10038         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10039         LDKPayer* this_arg_conv = (LDKPayer*)this_arg_ptr;
10040         LDKRoute route_conv;
10041         route_conv.inner = untag_ptr(route);
10042         route_conv.is_owned = ptr_is_owned(route);
10043         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
10044         route_conv.is_owned = false;
10045         LDKThirtyTwoBytes payment_preimage_ref;
10046         CHECK(payment_preimage->arr_len == 32);
10047         memcpy(payment_preimage_ref.data, payment_preimage->elems, 32); FREE(payment_preimage);
10048         LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
10049         *ret_conv = (this_arg_conv->send_spontaneous_payment)(this_arg_conv->this_arg, &route_conv, payment_preimage_ref);
10050         return tag_ptr(ret_conv, true);
10051 }
10052
10053 uint64_t  __attribute__((export_name("TS_Payer_retry_payment"))) TS_Payer_retry_payment(uint64_t this_arg, uint64_t route, int8_tArray payment_id) {
10054         void* this_arg_ptr = untag_ptr(this_arg);
10055         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10056         LDKPayer* this_arg_conv = (LDKPayer*)this_arg_ptr;
10057         LDKRoute route_conv;
10058         route_conv.inner = untag_ptr(route);
10059         route_conv.is_owned = ptr_is_owned(route);
10060         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
10061         route_conv.is_owned = false;
10062         LDKThirtyTwoBytes payment_id_ref;
10063         CHECK(payment_id->arr_len == 32);
10064         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
10065         LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
10066         *ret_conv = (this_arg_conv->retry_payment)(this_arg_conv->this_arg, &route_conv, payment_id_ref);
10067         return tag_ptr(ret_conv, true);
10068 }
10069
10070 void  __attribute__((export_name("TS_Payer_abandon_payment"))) TS_Payer_abandon_payment(uint64_t this_arg, int8_tArray payment_id) {
10071         void* this_arg_ptr = untag_ptr(this_arg);
10072         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10073         LDKPayer* this_arg_conv = (LDKPayer*)this_arg_ptr;
10074         LDKThirtyTwoBytes payment_id_ref;
10075         CHECK(payment_id->arr_len == 32);
10076         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
10077         (this_arg_conv->abandon_payment)(this_arg_conv->this_arg, payment_id_ref);
10078 }
10079
10080 typedef struct LDKRouter_JCalls {
10081         atomic_size_t refcnt;
10082         uint32_t instance_ptr;
10083 } LDKRouter_JCalls;
10084 static void LDKRouter_JCalls_free(void* this_arg) {
10085         LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) this_arg;
10086         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
10087                 FREE(j_calls);
10088         }
10089 }
10090 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, const LDKScore * scorer) {
10091         LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) this_arg;
10092         int8_tArray payer_arr = init_int8_tArray(33, __LINE__);
10093         memcpy(payer_arr->elems, payer.compressed_form, 33);
10094         LDKRouteParameters route_params_var = *route_params;
10095         uint64_t route_params_ref = 0;
10096         route_params_var = RouteParameters_clone(&route_params_var);
10097         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_var);
10098         route_params_ref = tag_ptr(route_params_var.inner, route_params_var.is_owned);
10099         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
10100         memcpy(payment_hash_arr->elems, *payment_hash, 32);
10101         LDKCVec_ChannelDetailsZ *first_hops_var_ptr = first_hops;
10102         uint64_tArray first_hops_arr = NULL;
10103         if (first_hops != NULL) {
10104                 LDKCVec_ChannelDetailsZ first_hops_var = *first_hops_var_ptr;
10105                 first_hops_arr = init_uint64_tArray(first_hops_var.datalen, __LINE__);
10106                 uint64_t *first_hops_arr_ptr = (uint64_t*)(((uint8_t*)first_hops_arr) + 8);
10107                 for (size_t q = 0; q < first_hops_var.datalen; q++) {
10108                         LDKChannelDetails first_hops_conv_16_var =      first_hops_var.data[q];
10109                         uint64_t first_hops_conv_16_ref = 0;
10110                         CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_var);
10111                         first_hops_conv_16_ref = tag_ptr(first_hops_conv_16_var.inner, first_hops_conv_16_var.is_owned);
10112                         first_hops_arr_ptr[q] = first_hops_conv_16_ref;
10113                 }
10114         
10115         }
10116         // WARNING: This object doesn't live past this scope, needs clone!
10117         uint64_t ret_scorer = tag_ptr(scorer, false);
10118         uint32_t ret = js_invoke_function_ubuubu(j_calls->instance_ptr, 99, (uint32_t)payer_arr, route_params_ref, (uint32_t)payment_hash_arr, (uint32_t)first_hops_arr, ret_scorer, 0);
10119         void* ret_ptr = untag_ptr(ret);
10120         CHECK_ACCESS(ret_ptr);
10121         LDKCResult_RouteLightningErrorZ ret_conv = *(LDKCResult_RouteLightningErrorZ*)(ret_ptr);
10122         FREE(untag_ptr(ret));
10123         return ret_conv;
10124 }
10125 static void LDKRouter_JCalls_cloned(LDKRouter* new_obj) {
10126         LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) new_obj->this_arg;
10127         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
10128 }
10129 static inline LDKRouter LDKRouter_init (JSValue o) {
10130         LDKRouter_JCalls *calls = MALLOC(sizeof(LDKRouter_JCalls), "LDKRouter_JCalls");
10131         atomic_init(&calls->refcnt, 1);
10132         calls->instance_ptr = o;
10133
10134         LDKRouter ret = {
10135                 .this_arg = (void*) calls,
10136                 .find_route = find_route_LDKRouter_jcall,
10137                 .free = LDKRouter_JCalls_free,
10138         };
10139         return ret;
10140 }
10141 uint64_t  __attribute__((export_name("TS_LDKRouter_new"))) TS_LDKRouter_new(JSValue o) {
10142         LDKRouter *res_ptr = MALLOC(sizeof(LDKRouter), "LDKRouter");
10143         *res_ptr = LDKRouter_init(o);
10144         return tag_ptr(res_ptr, true);
10145 }
10146 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 scorer) {
10147         void* this_arg_ptr = untag_ptr(this_arg);
10148         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10149         LDKRouter* this_arg_conv = (LDKRouter*)this_arg_ptr;
10150         LDKPublicKey payer_ref;
10151         CHECK(payer->arr_len == 33);
10152         memcpy(payer_ref.compressed_form, payer->elems, 33); FREE(payer);
10153         LDKRouteParameters route_params_conv;
10154         route_params_conv.inner = untag_ptr(route_params);
10155         route_params_conv.is_owned = ptr_is_owned(route_params);
10156         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
10157         route_params_conv.is_owned = false;
10158         unsigned char payment_hash_arr[32];
10159         CHECK(payment_hash->arr_len == 32);
10160         memcpy(payment_hash_arr, payment_hash->elems, 32); FREE(payment_hash);
10161         unsigned char (*payment_hash_ref)[32] = &payment_hash_arr;
10162         LDKCVec_ChannelDetailsZ first_hops_constr;
10163         LDKCVec_ChannelDetailsZ *first_hops_ptr = NULL;
10164         if (first_hops != 0) {
10165                 first_hops_constr.datalen = first_hops->arr_len;
10166                 if (first_hops_constr.datalen > 0)
10167                         first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
10168                 else
10169                         first_hops_constr.data = NULL;
10170                 uint64_t* first_hops_vals = first_hops->elems;
10171                 for (size_t q = 0; q < first_hops_constr.datalen; q++) {
10172                         uint64_t first_hops_conv_16 = first_hops_vals[q];
10173                         LDKChannelDetails first_hops_conv_16_conv;
10174                         first_hops_conv_16_conv.inner = untag_ptr(first_hops_conv_16);
10175                         first_hops_conv_16_conv.is_owned = ptr_is_owned(first_hops_conv_16);
10176                         CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_conv);
10177                         first_hops_conv_16_conv.is_owned = false;
10178                         first_hops_constr.data[q] = first_hops_conv_16_conv;
10179                 }
10180                 FREE(first_hops);
10181                 first_hops_ptr = &first_hops_constr;
10182         }
10183         void* scorer_ptr = untag_ptr(scorer);
10184         if (ptr_is_owned(scorer)) { CHECK_ACCESS(scorer_ptr); }
10185         LDKScore* scorer_conv = (LDKScore*)scorer_ptr;
10186         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
10187         *ret_conv = (this_arg_conv->find_route)(this_arg_conv->this_arg, payer_ref, &route_params_conv, payment_hash_ref, first_hops_ptr, scorer_conv);
10188         if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); }
10189         return tag_ptr(ret_conv, true);
10190 }
10191
10192 uint32_t __attribute__((export_name("TS_LDKRetry_ty_from_ptr"))) TS_LDKRetry_ty_from_ptr(uint64_t ptr) {
10193         LDKRetry *obj = (LDKRetry*)untag_ptr(ptr);
10194         switch(obj->tag) {
10195                 case LDKRetry_Attempts: return 0;
10196                 default: abort();
10197         }
10198 }
10199 uint32_t __attribute__((export_name("TS_LDKRetry_Attempts_get_attempts"))) TS_LDKRetry_Attempts_get_attempts(uint64_t ptr) {
10200         LDKRetry *obj = (LDKRetry*)untag_ptr(ptr);
10201         assert(obj->tag == LDKRetry_Attempts);
10202                         uint32_t attempts_conv = obj->attempts;
10203         return attempts_conv;
10204 }
10205 jstring  __attribute__((export_name("TS__ldk_get_compiled_version"))) TS__ldk_get_compiled_version() {
10206         LDKStr ret_str = _ldk_get_compiled_version();
10207         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
10208         Str_free(ret_str);
10209         return ret_conv;
10210 }
10211
10212 jstring  __attribute__((export_name("TS__ldk_c_bindings_get_compiled_version"))) TS__ldk_c_bindings_get_compiled_version() {
10213         LDKStr ret_str = _ldk_c_bindings_get_compiled_version();
10214         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
10215         Str_free(ret_str);
10216         return ret_conv;
10217 }
10218
10219 static inline uint64_t Bech32Error_clone_ptr(LDKBech32Error *NONNULL_PTR arg) {
10220         LDKBech32Error *ret_copy = MALLOC(sizeof(LDKBech32Error), "LDKBech32Error");
10221         *ret_copy = Bech32Error_clone(arg);
10222         uint64_t ret_ref = tag_ptr(ret_copy, true);
10223         return ret_ref;
10224 }
10225 int64_t  __attribute__((export_name("TS_Bech32Error_clone_ptr"))) TS_Bech32Error_clone_ptr(uint64_t arg) {
10226         LDKBech32Error* arg_conv = (LDKBech32Error*)untag_ptr(arg);
10227         int64_t ret_conv = Bech32Error_clone_ptr(arg_conv);
10228         return ret_conv;
10229 }
10230
10231 uint64_t  __attribute__((export_name("TS_Bech32Error_clone"))) TS_Bech32Error_clone(uint64_t orig) {
10232         LDKBech32Error* orig_conv = (LDKBech32Error*)untag_ptr(orig);
10233         LDKBech32Error *ret_copy = MALLOC(sizeof(LDKBech32Error), "LDKBech32Error");
10234         *ret_copy = Bech32Error_clone(orig_conv);
10235         uint64_t ret_ref = tag_ptr(ret_copy, true);
10236         return ret_ref;
10237 }
10238
10239 void  __attribute__((export_name("TS_Bech32Error_free"))) TS_Bech32Error_free(uint64_t o) {
10240         if (!ptr_is_owned(o)) return;
10241         void* o_ptr = untag_ptr(o);
10242         CHECK_ACCESS(o_ptr);
10243         LDKBech32Error o_conv = *(LDKBech32Error*)(o_ptr);
10244         FREE(untag_ptr(o));
10245         Bech32Error_free(o_conv);
10246 }
10247
10248 void  __attribute__((export_name("TS_Transaction_free"))) TS_Transaction_free(int8_tArray _res) {
10249         LDKTransaction _res_ref;
10250         _res_ref.datalen = _res->arr_len;
10251         _res_ref.data = MALLOC(_res_ref.datalen, "LDKTransaction Bytes");
10252         memcpy(_res_ref.data, _res->elems, _res_ref.datalen); FREE(_res);
10253         _res_ref.data_is_owned = true;
10254         Transaction_free(_res_ref);
10255 }
10256
10257 uint64_t  __attribute__((export_name("TS_TxOut_new"))) TS_TxOut_new(int8_tArray script_pubkey, int64_t value) {
10258         LDKCVec_u8Z script_pubkey_ref;
10259         script_pubkey_ref.datalen = script_pubkey->arr_len;
10260         script_pubkey_ref.data = MALLOC(script_pubkey_ref.datalen, "LDKCVec_u8Z Bytes");
10261         memcpy(script_pubkey_ref.data, script_pubkey->elems, script_pubkey_ref.datalen); FREE(script_pubkey);
10262         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
10263         *ret_ref = TxOut_new(script_pubkey_ref, value);
10264         return tag_ptr(ret_ref, true);
10265 }
10266
10267 void  __attribute__((export_name("TS_TxOut_free"))) TS_TxOut_free(uint64_t _res) {
10268         if (!ptr_is_owned(_res)) return;
10269         void* _res_ptr = untag_ptr(_res);
10270         CHECK_ACCESS(_res_ptr);
10271         LDKTxOut _res_conv = *(LDKTxOut*)(_res_ptr);
10272         FREE(untag_ptr(_res));
10273         TxOut_free(_res_conv);
10274 }
10275
10276 static inline uint64_t TxOut_clone_ptr(LDKTxOut *NONNULL_PTR arg) {
10277         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
10278         *ret_ref = TxOut_clone(arg);
10279         return tag_ptr(ret_ref, true);
10280 }
10281 int64_t  __attribute__((export_name("TS_TxOut_clone_ptr"))) TS_TxOut_clone_ptr(uint64_t arg) {
10282         LDKTxOut* arg_conv = (LDKTxOut*)untag_ptr(arg);
10283         int64_t ret_conv = TxOut_clone_ptr(arg_conv);
10284         return ret_conv;
10285 }
10286
10287 uint64_t  __attribute__((export_name("TS_TxOut_clone"))) TS_TxOut_clone(uint64_t orig) {
10288         LDKTxOut* orig_conv = (LDKTxOut*)untag_ptr(orig);
10289         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
10290         *ret_ref = TxOut_clone(orig_conv);
10291         return tag_ptr(ret_ref, true);
10292 }
10293
10294 void  __attribute__((export_name("TS_Str_free"))) TS_Str_free(jstring _res) {
10295         LDKStr dummy = { .chars = NULL, .len = 0, .chars_is_owned = false };
10296         Str_free(dummy);
10297 }
10298
10299 uint64_t  __attribute__((export_name("TS_CResult_NoneNoneZ_ok"))) TS_CResult_NoneNoneZ_ok() {
10300         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
10301         *ret_conv = CResult_NoneNoneZ_ok();
10302         return tag_ptr(ret_conv, true);
10303 }
10304
10305 uint64_t  __attribute__((export_name("TS_CResult_NoneNoneZ_err"))) TS_CResult_NoneNoneZ_err() {
10306         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
10307         *ret_conv = CResult_NoneNoneZ_err();
10308         return tag_ptr(ret_conv, true);
10309 }
10310
10311 jboolean  __attribute__((export_name("TS_CResult_NoneNoneZ_is_ok"))) TS_CResult_NoneNoneZ_is_ok(uint64_t o) {
10312         LDKCResult_NoneNoneZ* o_conv = (LDKCResult_NoneNoneZ*)untag_ptr(o);
10313         jboolean ret_conv = CResult_NoneNoneZ_is_ok(o_conv);
10314         return ret_conv;
10315 }
10316
10317 void  __attribute__((export_name("TS_CResult_NoneNoneZ_free"))) TS_CResult_NoneNoneZ_free(uint64_t _res) {
10318         if (!ptr_is_owned(_res)) return;
10319         void* _res_ptr = untag_ptr(_res);
10320         CHECK_ACCESS(_res_ptr);
10321         LDKCResult_NoneNoneZ _res_conv = *(LDKCResult_NoneNoneZ*)(_res_ptr);
10322         FREE(untag_ptr(_res));
10323         CResult_NoneNoneZ_free(_res_conv);
10324 }
10325
10326 static inline uint64_t CResult_NoneNoneZ_clone_ptr(LDKCResult_NoneNoneZ *NONNULL_PTR arg) {
10327         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
10328         *ret_conv = CResult_NoneNoneZ_clone(arg);
10329         return tag_ptr(ret_conv, true);
10330 }
10331 int64_t  __attribute__((export_name("TS_CResult_NoneNoneZ_clone_ptr"))) TS_CResult_NoneNoneZ_clone_ptr(uint64_t arg) {
10332         LDKCResult_NoneNoneZ* arg_conv = (LDKCResult_NoneNoneZ*)untag_ptr(arg);
10333         int64_t ret_conv = CResult_NoneNoneZ_clone_ptr(arg_conv);
10334         return ret_conv;
10335 }
10336
10337 uint64_t  __attribute__((export_name("TS_CResult_NoneNoneZ_clone"))) TS_CResult_NoneNoneZ_clone(uint64_t orig) {
10338         LDKCResult_NoneNoneZ* orig_conv = (LDKCResult_NoneNoneZ*)untag_ptr(orig);
10339         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
10340         *ret_conv = CResult_NoneNoneZ_clone(orig_conv);
10341         return tag_ptr(ret_conv, true);
10342 }
10343
10344 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_ok"))) TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_ok(uint64_t o) {
10345         LDKCounterpartyCommitmentSecrets o_conv;
10346         o_conv.inner = untag_ptr(o);
10347         o_conv.is_owned = ptr_is_owned(o);
10348         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
10349         o_conv = CounterpartyCommitmentSecrets_clone(&o_conv);
10350         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
10351         *ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_ok(o_conv);
10352         return tag_ptr(ret_conv, true);
10353 }
10354
10355 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_err"))) TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_err(uint64_t e) {
10356         LDKDecodeError e_conv;
10357         e_conv.inner = untag_ptr(e);
10358         e_conv.is_owned = ptr_is_owned(e);
10359         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
10360         e_conv = DecodeError_clone(&e_conv);
10361         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
10362         *ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_err(e_conv);
10363         return tag_ptr(ret_conv, true);
10364 }
10365
10366 jboolean  __attribute__((export_name("TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_is_ok"))) TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_is_ok(uint64_t o) {
10367         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* o_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)untag_ptr(o);
10368         jboolean ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_is_ok(o_conv);
10369         return ret_conv;
10370 }
10371
10372 void  __attribute__((export_name("TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_free"))) TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_free(uint64_t _res) {
10373         if (!ptr_is_owned(_res)) return;
10374         void* _res_ptr = untag_ptr(_res);
10375         CHECK_ACCESS(_res_ptr);
10376         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ _res_conv = *(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)(_res_ptr);
10377         FREE(untag_ptr(_res));
10378         CResult_CounterpartyCommitmentSecretsDecodeErrorZ_free(_res_conv);
10379 }
10380
10381 static inline uint64_t CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone_ptr(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ *NONNULL_PTR arg) {
10382         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
10383         *ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone(arg);
10384         return tag_ptr(ret_conv, true);
10385 }
10386 int64_t  __attribute__((export_name("TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone_ptr"))) TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone_ptr(uint64_t arg) {
10387         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* arg_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)untag_ptr(arg);
10388         int64_t ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone_ptr(arg_conv);
10389         return ret_conv;
10390 }
10391
10392 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone"))) TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone(uint64_t orig) {
10393         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* orig_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)untag_ptr(orig);
10394         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
10395         *ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone(orig_conv);
10396         return tag_ptr(ret_conv, true);
10397 }
10398
10399 uint64_t  __attribute__((export_name("TS_CResult_SecretKeyErrorZ_ok"))) TS_CResult_SecretKeyErrorZ_ok(int8_tArray o) {
10400         LDKSecretKey o_ref;
10401         CHECK(o->arr_len == 32);
10402         memcpy(o_ref.bytes, o->elems, 32); FREE(o);
10403         LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
10404         *ret_conv = CResult_SecretKeyErrorZ_ok(o_ref);
10405         return tag_ptr(ret_conv, true);
10406 }
10407
10408 uint64_t  __attribute__((export_name("TS_CResult_SecretKeyErrorZ_err"))) TS_CResult_SecretKeyErrorZ_err(uint32_t e) {
10409         LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_js(e);
10410         LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
10411         *ret_conv = CResult_SecretKeyErrorZ_err(e_conv);
10412         return tag_ptr(ret_conv, true);
10413 }
10414
10415 jboolean  __attribute__((export_name("TS_CResult_SecretKeyErrorZ_is_ok"))) TS_CResult_SecretKeyErrorZ_is_ok(uint64_t o) {
10416         LDKCResult_SecretKeyErrorZ* o_conv = (LDKCResult_SecretKeyErrorZ*)untag_ptr(o);
10417         jboolean ret_conv = CResult_SecretKeyErrorZ_is_ok(o_conv);
10418         return ret_conv;
10419 }
10420
10421 void  __attribute__((export_name("TS_CResult_SecretKeyErrorZ_free"))) TS_CResult_SecretKeyErrorZ_free(uint64_t _res) {
10422         if (!ptr_is_owned(_res)) return;
10423         void* _res_ptr = untag_ptr(_res);
10424         CHECK_ACCESS(_res_ptr);
10425         LDKCResult_SecretKeyErrorZ _res_conv = *(LDKCResult_SecretKeyErrorZ*)(_res_ptr);
10426         FREE(untag_ptr(_res));
10427         CResult_SecretKeyErrorZ_free(_res_conv);
10428 }
10429
10430 static inline uint64_t CResult_SecretKeyErrorZ_clone_ptr(LDKCResult_SecretKeyErrorZ *NONNULL_PTR arg) {
10431         LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
10432         *ret_conv = CResult_SecretKeyErrorZ_clone(arg);
10433         return tag_ptr(ret_conv, true);
10434 }
10435 int64_t  __attribute__((export_name("TS_CResult_SecretKeyErrorZ_clone_ptr"))) TS_CResult_SecretKeyErrorZ_clone_ptr(uint64_t arg) {
10436         LDKCResult_SecretKeyErrorZ* arg_conv = (LDKCResult_SecretKeyErrorZ*)untag_ptr(arg);
10437         int64_t ret_conv = CResult_SecretKeyErrorZ_clone_ptr(arg_conv);
10438         return ret_conv;
10439 }
10440
10441 uint64_t  __attribute__((export_name("TS_CResult_SecretKeyErrorZ_clone"))) TS_CResult_SecretKeyErrorZ_clone(uint64_t orig) {
10442         LDKCResult_SecretKeyErrorZ* orig_conv = (LDKCResult_SecretKeyErrorZ*)untag_ptr(orig);
10443         LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
10444         *ret_conv = CResult_SecretKeyErrorZ_clone(orig_conv);
10445         return tag_ptr(ret_conv, true);
10446 }
10447
10448 uint64_t  __attribute__((export_name("TS_CResult_PublicKeyErrorZ_ok"))) TS_CResult_PublicKeyErrorZ_ok(int8_tArray o) {
10449         LDKPublicKey o_ref;
10450         CHECK(o->arr_len == 33);
10451         memcpy(o_ref.compressed_form, o->elems, 33); FREE(o);
10452         LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
10453         *ret_conv = CResult_PublicKeyErrorZ_ok(o_ref);
10454         return tag_ptr(ret_conv, true);
10455 }
10456
10457 uint64_t  __attribute__((export_name("TS_CResult_PublicKeyErrorZ_err"))) TS_CResult_PublicKeyErrorZ_err(uint32_t e) {
10458         LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_js(e);
10459         LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
10460         *ret_conv = CResult_PublicKeyErrorZ_err(e_conv);
10461         return tag_ptr(ret_conv, true);
10462 }
10463
10464 jboolean  __attribute__((export_name("TS_CResult_PublicKeyErrorZ_is_ok"))) TS_CResult_PublicKeyErrorZ_is_ok(uint64_t o) {
10465         LDKCResult_PublicKeyErrorZ* o_conv = (LDKCResult_PublicKeyErrorZ*)untag_ptr(o);
10466         jboolean ret_conv = CResult_PublicKeyErrorZ_is_ok(o_conv);
10467         return ret_conv;
10468 }
10469
10470 void  __attribute__((export_name("TS_CResult_PublicKeyErrorZ_free"))) TS_CResult_PublicKeyErrorZ_free(uint64_t _res) {
10471         if (!ptr_is_owned(_res)) return;
10472         void* _res_ptr = untag_ptr(_res);
10473         CHECK_ACCESS(_res_ptr);
10474         LDKCResult_PublicKeyErrorZ _res_conv = *(LDKCResult_PublicKeyErrorZ*)(_res_ptr);
10475         FREE(untag_ptr(_res));
10476         CResult_PublicKeyErrorZ_free(_res_conv);
10477 }
10478
10479 static inline uint64_t CResult_PublicKeyErrorZ_clone_ptr(LDKCResult_PublicKeyErrorZ *NONNULL_PTR arg) {
10480         LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
10481         *ret_conv = CResult_PublicKeyErrorZ_clone(arg);
10482         return tag_ptr(ret_conv, true);
10483 }
10484 int64_t  __attribute__((export_name("TS_CResult_PublicKeyErrorZ_clone_ptr"))) TS_CResult_PublicKeyErrorZ_clone_ptr(uint64_t arg) {
10485         LDKCResult_PublicKeyErrorZ* arg_conv = (LDKCResult_PublicKeyErrorZ*)untag_ptr(arg);
10486         int64_t ret_conv = CResult_PublicKeyErrorZ_clone_ptr(arg_conv);
10487         return ret_conv;
10488 }
10489
10490 uint64_t  __attribute__((export_name("TS_CResult_PublicKeyErrorZ_clone"))) TS_CResult_PublicKeyErrorZ_clone(uint64_t orig) {
10491         LDKCResult_PublicKeyErrorZ* orig_conv = (LDKCResult_PublicKeyErrorZ*)untag_ptr(orig);
10492         LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
10493         *ret_conv = CResult_PublicKeyErrorZ_clone(orig_conv);
10494         return tag_ptr(ret_conv, true);
10495 }
10496
10497 uint64_t  __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_ok"))) TS_CResult_TxCreationKeysDecodeErrorZ_ok(uint64_t o) {
10498         LDKTxCreationKeys o_conv;
10499         o_conv.inner = untag_ptr(o);
10500         o_conv.is_owned = ptr_is_owned(o);
10501         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
10502         o_conv = TxCreationKeys_clone(&o_conv);
10503         LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
10504         *ret_conv = CResult_TxCreationKeysDecodeErrorZ_ok(o_conv);
10505         return tag_ptr(ret_conv, true);
10506 }
10507
10508 uint64_t  __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_err"))) TS_CResult_TxCreationKeysDecodeErrorZ_err(uint64_t e) {
10509         LDKDecodeError e_conv;
10510         e_conv.inner = untag_ptr(e);
10511         e_conv.is_owned = ptr_is_owned(e);
10512         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
10513         e_conv = DecodeError_clone(&e_conv);
10514         LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
10515         *ret_conv = CResult_TxCreationKeysDecodeErrorZ_err(e_conv);
10516         return tag_ptr(ret_conv, true);
10517 }
10518
10519 jboolean  __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_is_ok"))) TS_CResult_TxCreationKeysDecodeErrorZ_is_ok(uint64_t o) {
10520         LDKCResult_TxCreationKeysDecodeErrorZ* o_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)untag_ptr(o);
10521         jboolean ret_conv = CResult_TxCreationKeysDecodeErrorZ_is_ok(o_conv);
10522         return ret_conv;
10523 }
10524
10525 void  __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_free"))) TS_CResult_TxCreationKeysDecodeErrorZ_free(uint64_t _res) {
10526         if (!ptr_is_owned(_res)) return;
10527         void* _res_ptr = untag_ptr(_res);
10528         CHECK_ACCESS(_res_ptr);
10529         LDKCResult_TxCreationKeysDecodeErrorZ _res_conv = *(LDKCResult_TxCreationKeysDecodeErrorZ*)(_res_ptr);
10530         FREE(untag_ptr(_res));
10531         CResult_TxCreationKeysDecodeErrorZ_free(_res_conv);
10532 }
10533
10534 static inline uint64_t CResult_TxCreationKeysDecodeErrorZ_clone_ptr(LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR arg) {
10535         LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
10536         *ret_conv = CResult_TxCreationKeysDecodeErrorZ_clone(arg);
10537         return tag_ptr(ret_conv, true);
10538 }
10539 int64_t  __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_clone_ptr"))) TS_CResult_TxCreationKeysDecodeErrorZ_clone_ptr(uint64_t arg) {
10540         LDKCResult_TxCreationKeysDecodeErrorZ* arg_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)untag_ptr(arg);
10541         int64_t ret_conv = CResult_TxCreationKeysDecodeErrorZ_clone_ptr(arg_conv);
10542         return ret_conv;
10543 }
10544
10545 uint64_t  __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_clone"))) TS_CResult_TxCreationKeysDecodeErrorZ_clone(uint64_t orig) {
10546         LDKCResult_TxCreationKeysDecodeErrorZ* orig_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)untag_ptr(orig);
10547         LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
10548         *ret_conv = CResult_TxCreationKeysDecodeErrorZ_clone(orig_conv);
10549         return tag_ptr(ret_conv, true);
10550 }
10551
10552 uint64_t  __attribute__((export_name("TS_CResult_ChannelPublicKeysDecodeErrorZ_ok"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_ok(uint64_t o) {
10553         LDKChannelPublicKeys o_conv;
10554         o_conv.inner = untag_ptr(o);
10555         o_conv.is_owned = ptr_is_owned(o);
10556         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
10557         o_conv = ChannelPublicKeys_clone(&o_conv);
10558         LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
10559         *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_ok(o_conv);
10560         return tag_ptr(ret_conv, true);
10561 }
10562
10563 uint64_t  __attribute__((export_name("TS_CResult_ChannelPublicKeysDecodeErrorZ_err"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_err(uint64_t e) {
10564         LDKDecodeError e_conv;
10565         e_conv.inner = untag_ptr(e);
10566         e_conv.is_owned = ptr_is_owned(e);
10567         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
10568         e_conv = DecodeError_clone(&e_conv);
10569         LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
10570         *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_err(e_conv);
10571         return tag_ptr(ret_conv, true);
10572 }
10573
10574 jboolean  __attribute__((export_name("TS_CResult_ChannelPublicKeysDecodeErrorZ_is_ok"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_is_ok(uint64_t o) {
10575         LDKCResult_ChannelPublicKeysDecodeErrorZ* o_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)untag_ptr(o);
10576         jboolean ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_is_ok(o_conv);
10577         return ret_conv;
10578 }
10579
10580 void  __attribute__((export_name("TS_CResult_ChannelPublicKeysDecodeErrorZ_free"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_free(uint64_t _res) {
10581         if (!ptr_is_owned(_res)) return;
10582         void* _res_ptr = untag_ptr(_res);
10583         CHECK_ACCESS(_res_ptr);
10584         LDKCResult_ChannelPublicKeysDecodeErrorZ _res_conv = *(LDKCResult_ChannelPublicKeysDecodeErrorZ*)(_res_ptr);
10585         FREE(untag_ptr(_res));
10586         CResult_ChannelPublicKeysDecodeErrorZ_free(_res_conv);
10587 }
10588
10589 static inline uint64_t CResult_ChannelPublicKeysDecodeErrorZ_clone_ptr(LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR arg) {
10590         LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
10591         *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_clone(arg);
10592         return tag_ptr(ret_conv, true);
10593 }
10594 int64_t  __attribute__((export_name("TS_CResult_ChannelPublicKeysDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_clone_ptr(uint64_t arg) {
10595         LDKCResult_ChannelPublicKeysDecodeErrorZ* arg_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)untag_ptr(arg);
10596         int64_t ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_clone_ptr(arg_conv);
10597         return ret_conv;
10598 }
10599
10600 uint64_t  __attribute__((export_name("TS_CResult_ChannelPublicKeysDecodeErrorZ_clone"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_clone(uint64_t orig) {
10601         LDKCResult_ChannelPublicKeysDecodeErrorZ* orig_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)untag_ptr(orig);
10602         LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
10603         *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_clone(orig_conv);
10604         return tag_ptr(ret_conv, true);
10605 }
10606
10607 uint64_t  __attribute__((export_name("TS_CResult_TxCreationKeysErrorZ_ok"))) TS_CResult_TxCreationKeysErrorZ_ok(uint64_t o) {
10608         LDKTxCreationKeys o_conv;
10609         o_conv.inner = untag_ptr(o);
10610         o_conv.is_owned = ptr_is_owned(o);
10611         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
10612         o_conv = TxCreationKeys_clone(&o_conv);
10613         LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
10614         *ret_conv = CResult_TxCreationKeysErrorZ_ok(o_conv);
10615         return tag_ptr(ret_conv, true);
10616 }
10617
10618 uint64_t  __attribute__((export_name("TS_CResult_TxCreationKeysErrorZ_err"))) TS_CResult_TxCreationKeysErrorZ_err(uint32_t e) {
10619         LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_js(e);
10620         LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
10621         *ret_conv = CResult_TxCreationKeysErrorZ_err(e_conv);
10622         return tag_ptr(ret_conv, true);
10623 }
10624
10625 jboolean  __attribute__((export_name("TS_CResult_TxCreationKeysErrorZ_is_ok"))) TS_CResult_TxCreationKeysErrorZ_is_ok(uint64_t o) {
10626         LDKCResult_TxCreationKeysErrorZ* o_conv = (LDKCResult_TxCreationKeysErrorZ*)untag_ptr(o);
10627         jboolean ret_conv = CResult_TxCreationKeysErrorZ_is_ok(o_conv);
10628         return ret_conv;
10629 }
10630
10631 void  __attribute__((export_name("TS_CResult_TxCreationKeysErrorZ_free"))) TS_CResult_TxCreationKeysErrorZ_free(uint64_t _res) {
10632         if (!ptr_is_owned(_res)) return;
10633         void* _res_ptr = untag_ptr(_res);
10634         CHECK_ACCESS(_res_ptr);
10635         LDKCResult_TxCreationKeysErrorZ _res_conv = *(LDKCResult_TxCreationKeysErrorZ*)(_res_ptr);
10636         FREE(untag_ptr(_res));
10637         CResult_TxCreationKeysErrorZ_free(_res_conv);
10638 }
10639
10640 static inline uint64_t CResult_TxCreationKeysErrorZ_clone_ptr(LDKCResult_TxCreationKeysErrorZ *NONNULL_PTR arg) {
10641         LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
10642         *ret_conv = CResult_TxCreationKeysErrorZ_clone(arg);
10643         return tag_ptr(ret_conv, true);
10644 }
10645 int64_t  __attribute__((export_name("TS_CResult_TxCreationKeysErrorZ_clone_ptr"))) TS_CResult_TxCreationKeysErrorZ_clone_ptr(uint64_t arg) {
10646         LDKCResult_TxCreationKeysErrorZ* arg_conv = (LDKCResult_TxCreationKeysErrorZ*)untag_ptr(arg);
10647         int64_t ret_conv = CResult_TxCreationKeysErrorZ_clone_ptr(arg_conv);
10648         return ret_conv;
10649 }
10650
10651 uint64_t  __attribute__((export_name("TS_CResult_TxCreationKeysErrorZ_clone"))) TS_CResult_TxCreationKeysErrorZ_clone(uint64_t orig) {
10652         LDKCResult_TxCreationKeysErrorZ* orig_conv = (LDKCResult_TxCreationKeysErrorZ*)untag_ptr(orig);
10653         LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
10654         *ret_conv = CResult_TxCreationKeysErrorZ_clone(orig_conv);
10655         return tag_ptr(ret_conv, true);
10656 }
10657
10658 uint64_t  __attribute__((export_name("TS_COption_u32Z_some"))) TS_COption_u32Z_some(int32_t o) {
10659         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
10660         *ret_copy = COption_u32Z_some(o);
10661         uint64_t ret_ref = tag_ptr(ret_copy, true);
10662         return ret_ref;
10663 }
10664
10665 uint64_t  __attribute__((export_name("TS_COption_u32Z_none"))) TS_COption_u32Z_none() {
10666         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
10667         *ret_copy = COption_u32Z_none();
10668         uint64_t ret_ref = tag_ptr(ret_copy, true);
10669         return ret_ref;
10670 }
10671
10672 void  __attribute__((export_name("TS_COption_u32Z_free"))) TS_COption_u32Z_free(uint64_t _res) {
10673         if (!ptr_is_owned(_res)) return;
10674         void* _res_ptr = untag_ptr(_res);
10675         CHECK_ACCESS(_res_ptr);
10676         LDKCOption_u32Z _res_conv = *(LDKCOption_u32Z*)(_res_ptr);
10677         FREE(untag_ptr(_res));
10678         COption_u32Z_free(_res_conv);
10679 }
10680
10681 static inline uint64_t COption_u32Z_clone_ptr(LDKCOption_u32Z *NONNULL_PTR arg) {
10682         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
10683         *ret_copy = COption_u32Z_clone(arg);
10684         uint64_t ret_ref = tag_ptr(ret_copy, true);
10685         return ret_ref;
10686 }
10687 int64_t  __attribute__((export_name("TS_COption_u32Z_clone_ptr"))) TS_COption_u32Z_clone_ptr(uint64_t arg) {
10688         LDKCOption_u32Z* arg_conv = (LDKCOption_u32Z*)untag_ptr(arg);
10689         int64_t ret_conv = COption_u32Z_clone_ptr(arg_conv);
10690         return ret_conv;
10691 }
10692
10693 uint64_t  __attribute__((export_name("TS_COption_u32Z_clone"))) TS_COption_u32Z_clone(uint64_t orig) {
10694         LDKCOption_u32Z* orig_conv = (LDKCOption_u32Z*)untag_ptr(orig);
10695         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
10696         *ret_copy = COption_u32Z_clone(orig_conv);
10697         uint64_t ret_ref = tag_ptr(ret_copy, true);
10698         return ret_ref;
10699 }
10700
10701 uint64_t  __attribute__((export_name("TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_ok"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(uint64_t o) {
10702         LDKHTLCOutputInCommitment o_conv;
10703         o_conv.inner = untag_ptr(o);
10704         o_conv.is_owned = ptr_is_owned(o);
10705         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
10706         o_conv = HTLCOutputInCommitment_clone(&o_conv);
10707         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
10708         *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(o_conv);
10709         return tag_ptr(ret_conv, true);
10710 }
10711
10712 uint64_t  __attribute__((export_name("TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_err"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_err(uint64_t e) {
10713         LDKDecodeError e_conv;
10714         e_conv.inner = untag_ptr(e);
10715         e_conv.is_owned = ptr_is_owned(e);
10716         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
10717         e_conv = DecodeError_clone(&e_conv);
10718         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
10719         *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_err(e_conv);
10720         return tag_ptr(ret_conv, true);
10721 }
10722
10723 jboolean  __attribute__((export_name("TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_is_ok"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_is_ok(uint64_t o) {
10724         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* o_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)untag_ptr(o);
10725         jboolean ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_is_ok(o_conv);
10726         return ret_conv;
10727 }
10728
10729 void  __attribute__((export_name("TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_free"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_free(uint64_t _res) {
10730         if (!ptr_is_owned(_res)) return;
10731         void* _res_ptr = untag_ptr(_res);
10732         CHECK_ACCESS(_res_ptr);
10733         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ _res_conv = *(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(_res_ptr);
10734         FREE(untag_ptr(_res));
10735         CResult_HTLCOutputInCommitmentDecodeErrorZ_free(_res_conv);
10736 }
10737
10738 static inline uint64_t CResult_HTLCOutputInCommitmentDecodeErrorZ_clone_ptr(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR arg) {
10739         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
10740         *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(arg);
10741         return tag_ptr(ret_conv, true);
10742 }
10743 int64_t  __attribute__((export_name("TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_clone_ptr"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_clone_ptr(uint64_t arg) {
10744         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* arg_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)untag_ptr(arg);
10745         int64_t ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_clone_ptr(arg_conv);
10746         return ret_conv;
10747 }
10748
10749 uint64_t  __attribute__((export_name("TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_clone"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(uint64_t orig) {
10750         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* orig_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)untag_ptr(orig);
10751         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
10752         *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(orig_conv);
10753         return tag_ptr(ret_conv, true);
10754 }
10755
10756 uint32_t  __attribute__((export_name("TS_COption_NoneZ_some"))) TS_COption_NoneZ_some() {
10757         uint32_t ret_conv = LDKCOption_NoneZ_to_js(COption_NoneZ_some());
10758         return ret_conv;
10759 }
10760
10761 uint32_t  __attribute__((export_name("TS_COption_NoneZ_none"))) TS_COption_NoneZ_none() {
10762         uint32_t ret_conv = LDKCOption_NoneZ_to_js(COption_NoneZ_none());
10763         return ret_conv;
10764 }
10765
10766 void  __attribute__((export_name("TS_COption_NoneZ_free"))) TS_COption_NoneZ_free(uint32_t _res) {
10767         LDKCOption_NoneZ _res_conv = LDKCOption_NoneZ_from_js(_res);
10768         COption_NoneZ_free(_res_conv);
10769 }
10770
10771 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(uint64_t o) {
10772         LDKCounterpartyChannelTransactionParameters o_conv;
10773         o_conv.inner = untag_ptr(o);
10774         o_conv.is_owned = ptr_is_owned(o);
10775         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
10776         o_conv = CounterpartyChannelTransactionParameters_clone(&o_conv);
10777         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
10778         *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(o_conv);
10779         return tag_ptr(ret_conv, true);
10780 }
10781
10782 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(uint64_t e) {
10783         LDKDecodeError e_conv;
10784         e_conv.inner = untag_ptr(e);
10785         e_conv.is_owned = ptr_is_owned(e);
10786         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
10787         e_conv = DecodeError_clone(&e_conv);
10788         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
10789         *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(e_conv);
10790         return tag_ptr(ret_conv, true);
10791 }
10792
10793 jboolean  __attribute__((export_name("TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_is_ok"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_is_ok(uint64_t o) {
10794         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* o_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)untag_ptr(o);
10795         jboolean ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_is_ok(o_conv);
10796         return ret_conv;
10797 }
10798
10799 void  __attribute__((export_name("TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(uint64_t _res) {
10800         if (!ptr_is_owned(_res)) return;
10801         void* _res_ptr = untag_ptr(_res);
10802         CHECK_ACCESS(_res_ptr);
10803         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ _res_conv = *(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(_res_ptr);
10804         FREE(untag_ptr(_res));
10805         CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(_res_conv);
10806 }
10807
10808 static inline uint64_t CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone_ptr(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR arg) {
10809         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
10810         *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(arg);
10811         return tag_ptr(ret_conv, true);
10812 }
10813 int64_t  __attribute__((export_name("TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone_ptr"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone_ptr(uint64_t arg) {
10814         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* arg_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)untag_ptr(arg);
10815         int64_t ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone_ptr(arg_conv);
10816         return ret_conv;
10817 }
10818
10819 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(uint64_t orig) {
10820         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* orig_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)untag_ptr(orig);
10821         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
10822         *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(orig_conv);
10823         return tag_ptr(ret_conv, true);
10824 }
10825
10826 uint64_t  __attribute__((export_name("TS_CResult_ChannelTransactionParametersDecodeErrorZ_ok"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_ok(uint64_t o) {
10827         LDKChannelTransactionParameters o_conv;
10828         o_conv.inner = untag_ptr(o);
10829         o_conv.is_owned = ptr_is_owned(o);
10830         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
10831         o_conv = ChannelTransactionParameters_clone(&o_conv);
10832         LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
10833         *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_ok(o_conv);
10834         return tag_ptr(ret_conv, true);
10835 }
10836
10837 uint64_t  __attribute__((export_name("TS_CResult_ChannelTransactionParametersDecodeErrorZ_err"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_err(uint64_t e) {
10838         LDKDecodeError e_conv;
10839         e_conv.inner = untag_ptr(e);
10840         e_conv.is_owned = ptr_is_owned(e);
10841         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
10842         e_conv = DecodeError_clone(&e_conv);
10843         LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
10844         *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_err(e_conv);
10845         return tag_ptr(ret_conv, true);
10846 }
10847
10848 jboolean  __attribute__((export_name("TS_CResult_ChannelTransactionParametersDecodeErrorZ_is_ok"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_is_ok(uint64_t o) {
10849         LDKCResult_ChannelTransactionParametersDecodeErrorZ* o_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)untag_ptr(o);
10850         jboolean ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_is_ok(o_conv);
10851         return ret_conv;
10852 }
10853
10854 void  __attribute__((export_name("TS_CResult_ChannelTransactionParametersDecodeErrorZ_free"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_free(uint64_t _res) {
10855         if (!ptr_is_owned(_res)) return;
10856         void* _res_ptr = untag_ptr(_res);
10857         CHECK_ACCESS(_res_ptr);
10858         LDKCResult_ChannelTransactionParametersDecodeErrorZ _res_conv = *(LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(_res_ptr);
10859         FREE(untag_ptr(_res));
10860         CResult_ChannelTransactionParametersDecodeErrorZ_free(_res_conv);
10861 }
10862
10863 static inline uint64_t CResult_ChannelTransactionParametersDecodeErrorZ_clone_ptr(LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR arg) {
10864         LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
10865         *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_clone(arg);
10866         return tag_ptr(ret_conv, true);
10867 }
10868 int64_t  __attribute__((export_name("TS_CResult_ChannelTransactionParametersDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_clone_ptr(uint64_t arg) {
10869         LDKCResult_ChannelTransactionParametersDecodeErrorZ* arg_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)untag_ptr(arg);
10870         int64_t ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_clone_ptr(arg_conv);
10871         return ret_conv;
10872 }
10873
10874 uint64_t  __attribute__((export_name("TS_CResult_ChannelTransactionParametersDecodeErrorZ_clone"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_clone(uint64_t orig) {
10875         LDKCResult_ChannelTransactionParametersDecodeErrorZ* orig_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)untag_ptr(orig);
10876         LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
10877         *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_clone(orig_conv);
10878         return tag_ptr(ret_conv, true);
10879 }
10880
10881 void  __attribute__((export_name("TS_CVec_SignatureZ_free"))) TS_CVec_SignatureZ_free(ptrArray _res) {
10882         LDKCVec_SignatureZ _res_constr;
10883         _res_constr.datalen = _res->arr_len;
10884         if (_res_constr.datalen > 0)
10885                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
10886         else
10887                 _res_constr.data = NULL;
10888         int8_tArray* _res_vals = (void*) _res->elems;
10889         for (size_t m = 0; m < _res_constr.datalen; m++) {
10890                 int8_tArray _res_conv_12 = _res_vals[m];
10891                 LDKSignature _res_conv_12_ref;
10892                 CHECK(_res_conv_12->arr_len == 64);
10893                 memcpy(_res_conv_12_ref.compact_form, _res_conv_12->elems, 64); FREE(_res_conv_12);
10894                 _res_constr.data[m] = _res_conv_12_ref;
10895         }
10896         FREE(_res);
10897         CVec_SignatureZ_free(_res_constr);
10898 }
10899
10900 uint64_t  __attribute__((export_name("TS_CResult_HolderCommitmentTransactionDecodeErrorZ_ok"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_ok(uint64_t o) {
10901         LDKHolderCommitmentTransaction o_conv;
10902         o_conv.inner = untag_ptr(o);
10903         o_conv.is_owned = ptr_is_owned(o);
10904         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
10905         o_conv = HolderCommitmentTransaction_clone(&o_conv);
10906         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
10907         *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_ok(o_conv);
10908         return tag_ptr(ret_conv, true);
10909 }
10910
10911 uint64_t  __attribute__((export_name("TS_CResult_HolderCommitmentTransactionDecodeErrorZ_err"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_err(uint64_t e) {
10912         LDKDecodeError e_conv;
10913         e_conv.inner = untag_ptr(e);
10914         e_conv.is_owned = ptr_is_owned(e);
10915         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
10916         e_conv = DecodeError_clone(&e_conv);
10917         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
10918         *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_err(e_conv);
10919         return tag_ptr(ret_conv, true);
10920 }
10921
10922 jboolean  __attribute__((export_name("TS_CResult_HolderCommitmentTransactionDecodeErrorZ_is_ok"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_is_ok(uint64_t o) {
10923         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* o_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)untag_ptr(o);
10924         jboolean ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_is_ok(o_conv);
10925         return ret_conv;
10926 }
10927
10928 void  __attribute__((export_name("TS_CResult_HolderCommitmentTransactionDecodeErrorZ_free"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_free(uint64_t _res) {
10929         if (!ptr_is_owned(_res)) return;
10930         void* _res_ptr = untag_ptr(_res);
10931         CHECK_ACCESS(_res_ptr);
10932         LDKCResult_HolderCommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(_res_ptr);
10933         FREE(untag_ptr(_res));
10934         CResult_HolderCommitmentTransactionDecodeErrorZ_free(_res_conv);
10935 }
10936
10937 static inline uint64_t CResult_HolderCommitmentTransactionDecodeErrorZ_clone_ptr(LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR arg) {
10938         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
10939         *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_clone(arg);
10940         return tag_ptr(ret_conv, true);
10941 }
10942 int64_t  __attribute__((export_name("TS_CResult_HolderCommitmentTransactionDecodeErrorZ_clone_ptr"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_clone_ptr(uint64_t arg) {
10943         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* arg_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)untag_ptr(arg);
10944         int64_t ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_clone_ptr(arg_conv);
10945         return ret_conv;
10946 }
10947
10948 uint64_t  __attribute__((export_name("TS_CResult_HolderCommitmentTransactionDecodeErrorZ_clone"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_clone(uint64_t orig) {
10949         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)untag_ptr(orig);
10950         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
10951         *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_clone(orig_conv);
10952         return tag_ptr(ret_conv, true);
10953 }
10954
10955 uint64_t  __attribute__((export_name("TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_ok"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(uint64_t o) {
10956         LDKBuiltCommitmentTransaction o_conv;
10957         o_conv.inner = untag_ptr(o);
10958         o_conv.is_owned = ptr_is_owned(o);
10959         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
10960         o_conv = BuiltCommitmentTransaction_clone(&o_conv);
10961         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
10962         *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(o_conv);
10963         return tag_ptr(ret_conv, true);
10964 }
10965
10966 uint64_t  __attribute__((export_name("TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_err"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_err(uint64_t e) {
10967         LDKDecodeError e_conv;
10968         e_conv.inner = untag_ptr(e);
10969         e_conv.is_owned = ptr_is_owned(e);
10970         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
10971         e_conv = DecodeError_clone(&e_conv);
10972         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
10973         *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_err(e_conv);
10974         return tag_ptr(ret_conv, true);
10975 }
10976
10977 jboolean  __attribute__((export_name("TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_is_ok"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_is_ok(uint64_t o) {
10978         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* o_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)untag_ptr(o);
10979         jboolean ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_is_ok(o_conv);
10980         return ret_conv;
10981 }
10982
10983 void  __attribute__((export_name("TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_free"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_free(uint64_t _res) {
10984         if (!ptr_is_owned(_res)) return;
10985         void* _res_ptr = untag_ptr(_res);
10986         CHECK_ACCESS(_res_ptr);
10987         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(_res_ptr);
10988         FREE(untag_ptr(_res));
10989         CResult_BuiltCommitmentTransactionDecodeErrorZ_free(_res_conv);
10990 }
10991
10992 static inline uint64_t CResult_BuiltCommitmentTransactionDecodeErrorZ_clone_ptr(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR arg) {
10993         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
10994         *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(arg);
10995         return tag_ptr(ret_conv, true);
10996 }
10997 int64_t  __attribute__((export_name("TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_clone_ptr"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_clone_ptr(uint64_t arg) {
10998         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* arg_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)untag_ptr(arg);
10999         int64_t ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_clone_ptr(arg_conv);
11000         return ret_conv;
11001 }
11002
11003 uint64_t  __attribute__((export_name("TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_clone"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(uint64_t orig) {
11004         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)untag_ptr(orig);
11005         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
11006         *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(orig_conv);
11007         return tag_ptr(ret_conv, true);
11008 }
11009
11010 uint64_t  __attribute__((export_name("TS_CResult_TrustedClosingTransactionNoneZ_ok"))) TS_CResult_TrustedClosingTransactionNoneZ_ok(uint64_t o) {
11011         LDKTrustedClosingTransaction o_conv;
11012         o_conv.inner = untag_ptr(o);
11013         o_conv.is_owned = ptr_is_owned(o);
11014         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
11015         // WARNING: we need a move here but no clone is available for LDKTrustedClosingTransaction
11016         
11017         LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
11018         *ret_conv = CResult_TrustedClosingTransactionNoneZ_ok(o_conv);
11019         return tag_ptr(ret_conv, true);
11020 }
11021
11022 uint64_t  __attribute__((export_name("TS_CResult_TrustedClosingTransactionNoneZ_err"))) TS_CResult_TrustedClosingTransactionNoneZ_err() {
11023         LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
11024         *ret_conv = CResult_TrustedClosingTransactionNoneZ_err();
11025         return tag_ptr(ret_conv, true);
11026 }
11027
11028 jboolean  __attribute__((export_name("TS_CResult_TrustedClosingTransactionNoneZ_is_ok"))) TS_CResult_TrustedClosingTransactionNoneZ_is_ok(uint64_t o) {
11029         LDKCResult_TrustedClosingTransactionNoneZ* o_conv = (LDKCResult_TrustedClosingTransactionNoneZ*)untag_ptr(o);
11030         jboolean ret_conv = CResult_TrustedClosingTransactionNoneZ_is_ok(o_conv);
11031         return ret_conv;
11032 }
11033
11034 void  __attribute__((export_name("TS_CResult_TrustedClosingTransactionNoneZ_free"))) TS_CResult_TrustedClosingTransactionNoneZ_free(uint64_t _res) {
11035         if (!ptr_is_owned(_res)) return;
11036         void* _res_ptr = untag_ptr(_res);
11037         CHECK_ACCESS(_res_ptr);
11038         LDKCResult_TrustedClosingTransactionNoneZ _res_conv = *(LDKCResult_TrustedClosingTransactionNoneZ*)(_res_ptr);
11039         FREE(untag_ptr(_res));
11040         CResult_TrustedClosingTransactionNoneZ_free(_res_conv);
11041 }
11042
11043 uint64_t  __attribute__((export_name("TS_CResult_CommitmentTransactionDecodeErrorZ_ok"))) TS_CResult_CommitmentTransactionDecodeErrorZ_ok(uint64_t o) {
11044         LDKCommitmentTransaction o_conv;
11045         o_conv.inner = untag_ptr(o);
11046         o_conv.is_owned = ptr_is_owned(o);
11047         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
11048         o_conv = CommitmentTransaction_clone(&o_conv);
11049         LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
11050         *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_ok(o_conv);
11051         return tag_ptr(ret_conv, true);
11052 }
11053
11054 uint64_t  __attribute__((export_name("TS_CResult_CommitmentTransactionDecodeErrorZ_err"))) TS_CResult_CommitmentTransactionDecodeErrorZ_err(uint64_t e) {
11055         LDKDecodeError e_conv;
11056         e_conv.inner = untag_ptr(e);
11057         e_conv.is_owned = ptr_is_owned(e);
11058         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
11059         e_conv = DecodeError_clone(&e_conv);
11060         LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
11061         *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_err(e_conv);
11062         return tag_ptr(ret_conv, true);
11063 }
11064
11065 jboolean  __attribute__((export_name("TS_CResult_CommitmentTransactionDecodeErrorZ_is_ok"))) TS_CResult_CommitmentTransactionDecodeErrorZ_is_ok(uint64_t o) {
11066         LDKCResult_CommitmentTransactionDecodeErrorZ* o_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)untag_ptr(o);
11067         jboolean ret_conv = CResult_CommitmentTransactionDecodeErrorZ_is_ok(o_conv);
11068         return ret_conv;
11069 }
11070
11071 void  __attribute__((export_name("TS_CResult_CommitmentTransactionDecodeErrorZ_free"))) TS_CResult_CommitmentTransactionDecodeErrorZ_free(uint64_t _res) {
11072         if (!ptr_is_owned(_res)) return;
11073         void* _res_ptr = untag_ptr(_res);
11074         CHECK_ACCESS(_res_ptr);
11075         LDKCResult_CommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_CommitmentTransactionDecodeErrorZ*)(_res_ptr);
11076         FREE(untag_ptr(_res));
11077         CResult_CommitmentTransactionDecodeErrorZ_free(_res_conv);
11078 }
11079
11080 static inline uint64_t CResult_CommitmentTransactionDecodeErrorZ_clone_ptr(LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR arg) {
11081         LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
11082         *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_clone(arg);
11083         return tag_ptr(ret_conv, true);
11084 }
11085 int64_t  __attribute__((export_name("TS_CResult_CommitmentTransactionDecodeErrorZ_clone_ptr"))) TS_CResult_CommitmentTransactionDecodeErrorZ_clone_ptr(uint64_t arg) {
11086         LDKCResult_CommitmentTransactionDecodeErrorZ* arg_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)untag_ptr(arg);
11087         int64_t ret_conv = CResult_CommitmentTransactionDecodeErrorZ_clone_ptr(arg_conv);
11088         return ret_conv;
11089 }
11090
11091 uint64_t  __attribute__((export_name("TS_CResult_CommitmentTransactionDecodeErrorZ_clone"))) TS_CResult_CommitmentTransactionDecodeErrorZ_clone(uint64_t orig) {
11092         LDKCResult_CommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)untag_ptr(orig);
11093         LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
11094         *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_clone(orig_conv);
11095         return tag_ptr(ret_conv, true);
11096 }
11097
11098 uint64_t  __attribute__((export_name("TS_CResult_TrustedCommitmentTransactionNoneZ_ok"))) TS_CResult_TrustedCommitmentTransactionNoneZ_ok(uint64_t o) {
11099         LDKTrustedCommitmentTransaction o_conv;
11100         o_conv.inner = untag_ptr(o);
11101         o_conv.is_owned = ptr_is_owned(o);
11102         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
11103         // WARNING: we need a move here but no clone is available for LDKTrustedCommitmentTransaction
11104         
11105         LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
11106         *ret_conv = CResult_TrustedCommitmentTransactionNoneZ_ok(o_conv);
11107         return tag_ptr(ret_conv, true);
11108 }
11109
11110 uint64_t  __attribute__((export_name("TS_CResult_TrustedCommitmentTransactionNoneZ_err"))) TS_CResult_TrustedCommitmentTransactionNoneZ_err() {
11111         LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
11112         *ret_conv = CResult_TrustedCommitmentTransactionNoneZ_err();
11113         return tag_ptr(ret_conv, true);
11114 }
11115
11116 jboolean  __attribute__((export_name("TS_CResult_TrustedCommitmentTransactionNoneZ_is_ok"))) TS_CResult_TrustedCommitmentTransactionNoneZ_is_ok(uint64_t o) {
11117         LDKCResult_TrustedCommitmentTransactionNoneZ* o_conv = (LDKCResult_TrustedCommitmentTransactionNoneZ*)untag_ptr(o);
11118         jboolean ret_conv = CResult_TrustedCommitmentTransactionNoneZ_is_ok(o_conv);
11119         return ret_conv;
11120 }
11121
11122 void  __attribute__((export_name("TS_CResult_TrustedCommitmentTransactionNoneZ_free"))) TS_CResult_TrustedCommitmentTransactionNoneZ_free(uint64_t _res) {
11123         if (!ptr_is_owned(_res)) return;
11124         void* _res_ptr = untag_ptr(_res);
11125         CHECK_ACCESS(_res_ptr);
11126         LDKCResult_TrustedCommitmentTransactionNoneZ _res_conv = *(LDKCResult_TrustedCommitmentTransactionNoneZ*)(_res_ptr);
11127         FREE(untag_ptr(_res));
11128         CResult_TrustedCommitmentTransactionNoneZ_free(_res_conv);
11129 }
11130
11131 uint64_t  __attribute__((export_name("TS_CResult_CVec_SignatureZNoneZ_ok"))) TS_CResult_CVec_SignatureZNoneZ_ok(ptrArray o) {
11132         LDKCVec_SignatureZ o_constr;
11133         o_constr.datalen = o->arr_len;
11134         if (o_constr.datalen > 0)
11135                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
11136         else
11137                 o_constr.data = NULL;
11138         int8_tArray* o_vals = (void*) o->elems;
11139         for (size_t m = 0; m < o_constr.datalen; m++) {
11140                 int8_tArray o_conv_12 = o_vals[m];
11141                 LDKSignature o_conv_12_ref;
11142                 CHECK(o_conv_12->arr_len == 64);
11143                 memcpy(o_conv_12_ref.compact_form, o_conv_12->elems, 64); FREE(o_conv_12);
11144                 o_constr.data[m] = o_conv_12_ref;
11145         }
11146         FREE(o);
11147         LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
11148         *ret_conv = CResult_CVec_SignatureZNoneZ_ok(o_constr);
11149         return tag_ptr(ret_conv, true);
11150 }
11151
11152 uint64_t  __attribute__((export_name("TS_CResult_CVec_SignatureZNoneZ_err"))) TS_CResult_CVec_SignatureZNoneZ_err() {
11153         LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
11154         *ret_conv = CResult_CVec_SignatureZNoneZ_err();
11155         return tag_ptr(ret_conv, true);
11156 }
11157
11158 jboolean  __attribute__((export_name("TS_CResult_CVec_SignatureZNoneZ_is_ok"))) TS_CResult_CVec_SignatureZNoneZ_is_ok(uint64_t o) {
11159         LDKCResult_CVec_SignatureZNoneZ* o_conv = (LDKCResult_CVec_SignatureZNoneZ*)untag_ptr(o);
11160         jboolean ret_conv = CResult_CVec_SignatureZNoneZ_is_ok(o_conv);
11161         return ret_conv;
11162 }
11163
11164 void  __attribute__((export_name("TS_CResult_CVec_SignatureZNoneZ_free"))) TS_CResult_CVec_SignatureZNoneZ_free(uint64_t _res) {
11165         if (!ptr_is_owned(_res)) return;
11166         void* _res_ptr = untag_ptr(_res);
11167         CHECK_ACCESS(_res_ptr);
11168         LDKCResult_CVec_SignatureZNoneZ _res_conv = *(LDKCResult_CVec_SignatureZNoneZ*)(_res_ptr);
11169         FREE(untag_ptr(_res));
11170         CResult_CVec_SignatureZNoneZ_free(_res_conv);
11171 }
11172
11173 static inline uint64_t CResult_CVec_SignatureZNoneZ_clone_ptr(LDKCResult_CVec_SignatureZNoneZ *NONNULL_PTR arg) {
11174         LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
11175         *ret_conv = CResult_CVec_SignatureZNoneZ_clone(arg);
11176         return tag_ptr(ret_conv, true);
11177 }
11178 int64_t  __attribute__((export_name("TS_CResult_CVec_SignatureZNoneZ_clone_ptr"))) TS_CResult_CVec_SignatureZNoneZ_clone_ptr(uint64_t arg) {
11179         LDKCResult_CVec_SignatureZNoneZ* arg_conv = (LDKCResult_CVec_SignatureZNoneZ*)untag_ptr(arg);
11180         int64_t ret_conv = CResult_CVec_SignatureZNoneZ_clone_ptr(arg_conv);
11181         return ret_conv;
11182 }
11183
11184 uint64_t  __attribute__((export_name("TS_CResult_CVec_SignatureZNoneZ_clone"))) TS_CResult_CVec_SignatureZNoneZ_clone(uint64_t orig) {
11185         LDKCResult_CVec_SignatureZNoneZ* orig_conv = (LDKCResult_CVec_SignatureZNoneZ*)untag_ptr(orig);
11186         LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
11187         *ret_conv = CResult_CVec_SignatureZNoneZ_clone(orig_conv);
11188         return tag_ptr(ret_conv, true);
11189 }
11190
11191 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptDecodeErrorZ_ok"))) TS_CResult_ShutdownScriptDecodeErrorZ_ok(uint64_t o) {
11192         LDKShutdownScript o_conv;
11193         o_conv.inner = untag_ptr(o);
11194         o_conv.is_owned = ptr_is_owned(o);
11195         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
11196         o_conv = ShutdownScript_clone(&o_conv);
11197         LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
11198         *ret_conv = CResult_ShutdownScriptDecodeErrorZ_ok(o_conv);
11199         return tag_ptr(ret_conv, true);
11200 }
11201
11202 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptDecodeErrorZ_err"))) TS_CResult_ShutdownScriptDecodeErrorZ_err(uint64_t e) {
11203         LDKDecodeError e_conv;
11204         e_conv.inner = untag_ptr(e);
11205         e_conv.is_owned = ptr_is_owned(e);
11206         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
11207         e_conv = DecodeError_clone(&e_conv);
11208         LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
11209         *ret_conv = CResult_ShutdownScriptDecodeErrorZ_err(e_conv);
11210         return tag_ptr(ret_conv, true);
11211 }
11212
11213 jboolean  __attribute__((export_name("TS_CResult_ShutdownScriptDecodeErrorZ_is_ok"))) TS_CResult_ShutdownScriptDecodeErrorZ_is_ok(uint64_t o) {
11214         LDKCResult_ShutdownScriptDecodeErrorZ* o_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)untag_ptr(o);
11215         jboolean ret_conv = CResult_ShutdownScriptDecodeErrorZ_is_ok(o_conv);
11216         return ret_conv;
11217 }
11218
11219 void  __attribute__((export_name("TS_CResult_ShutdownScriptDecodeErrorZ_free"))) TS_CResult_ShutdownScriptDecodeErrorZ_free(uint64_t _res) {
11220         if (!ptr_is_owned(_res)) return;
11221         void* _res_ptr = untag_ptr(_res);
11222         CHECK_ACCESS(_res_ptr);
11223         LDKCResult_ShutdownScriptDecodeErrorZ _res_conv = *(LDKCResult_ShutdownScriptDecodeErrorZ*)(_res_ptr);
11224         FREE(untag_ptr(_res));
11225         CResult_ShutdownScriptDecodeErrorZ_free(_res_conv);
11226 }
11227
11228 static inline uint64_t CResult_ShutdownScriptDecodeErrorZ_clone_ptr(LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR arg) {
11229         LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
11230         *ret_conv = CResult_ShutdownScriptDecodeErrorZ_clone(arg);
11231         return tag_ptr(ret_conv, true);
11232 }
11233 int64_t  __attribute__((export_name("TS_CResult_ShutdownScriptDecodeErrorZ_clone_ptr"))) TS_CResult_ShutdownScriptDecodeErrorZ_clone_ptr(uint64_t arg) {
11234         LDKCResult_ShutdownScriptDecodeErrorZ* arg_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)untag_ptr(arg);
11235         int64_t ret_conv = CResult_ShutdownScriptDecodeErrorZ_clone_ptr(arg_conv);
11236         return ret_conv;
11237 }
11238
11239 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptDecodeErrorZ_clone"))) TS_CResult_ShutdownScriptDecodeErrorZ_clone(uint64_t orig) {
11240         LDKCResult_ShutdownScriptDecodeErrorZ* orig_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)untag_ptr(orig);
11241         LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
11242         *ret_conv = CResult_ShutdownScriptDecodeErrorZ_clone(orig_conv);
11243         return tag_ptr(ret_conv, true);
11244 }
11245
11246 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptInvalidShutdownScriptZ_ok"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_ok(uint64_t o) {
11247         LDKShutdownScript o_conv;
11248         o_conv.inner = untag_ptr(o);
11249         o_conv.is_owned = ptr_is_owned(o);
11250         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
11251         o_conv = ShutdownScript_clone(&o_conv);
11252         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
11253         *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_ok(o_conv);
11254         return tag_ptr(ret_conv, true);
11255 }
11256
11257 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptInvalidShutdownScriptZ_err"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_err(uint64_t e) {
11258         LDKInvalidShutdownScript e_conv;
11259         e_conv.inner = untag_ptr(e);
11260         e_conv.is_owned = ptr_is_owned(e);
11261         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
11262         e_conv = InvalidShutdownScript_clone(&e_conv);
11263         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
11264         *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_err(e_conv);
11265         return tag_ptr(ret_conv, true);
11266 }
11267
11268 jboolean  __attribute__((export_name("TS_CResult_ShutdownScriptInvalidShutdownScriptZ_is_ok"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_is_ok(uint64_t o) {
11269         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* o_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)untag_ptr(o);
11270         jboolean ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_is_ok(o_conv);
11271         return ret_conv;
11272 }
11273
11274 void  __attribute__((export_name("TS_CResult_ShutdownScriptInvalidShutdownScriptZ_free"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_free(uint64_t _res) {
11275         if (!ptr_is_owned(_res)) return;
11276         void* _res_ptr = untag_ptr(_res);
11277         CHECK_ACCESS(_res_ptr);
11278         LDKCResult_ShutdownScriptInvalidShutdownScriptZ _res_conv = *(LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)(_res_ptr);
11279         FREE(untag_ptr(_res));
11280         CResult_ShutdownScriptInvalidShutdownScriptZ_free(_res_conv);
11281 }
11282
11283 static inline uint64_t CResult_ShutdownScriptInvalidShutdownScriptZ_clone_ptr(LDKCResult_ShutdownScriptInvalidShutdownScriptZ *NONNULL_PTR arg) {
11284         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
11285         *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_clone(arg);
11286         return tag_ptr(ret_conv, true);
11287 }
11288 int64_t  __attribute__((export_name("TS_CResult_ShutdownScriptInvalidShutdownScriptZ_clone_ptr"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_clone_ptr(uint64_t arg) {
11289         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* arg_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)untag_ptr(arg);
11290         int64_t ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_clone_ptr(arg_conv);
11291         return ret_conv;
11292 }
11293
11294 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptInvalidShutdownScriptZ_clone"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_clone(uint64_t orig) {
11295         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* orig_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)untag_ptr(orig);
11296         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
11297         *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_clone(orig_conv);
11298         return tag_ptr(ret_conv, true);
11299 }
11300
11301 uint64_t  __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_ok"))) TS_CResult_RouteHopDecodeErrorZ_ok(uint64_t o) {
11302         LDKRouteHop o_conv;
11303         o_conv.inner = untag_ptr(o);
11304         o_conv.is_owned = ptr_is_owned(o);
11305         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
11306         o_conv = RouteHop_clone(&o_conv);
11307         LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
11308         *ret_conv = CResult_RouteHopDecodeErrorZ_ok(o_conv);
11309         return tag_ptr(ret_conv, true);
11310 }
11311
11312 uint64_t  __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_err"))) TS_CResult_RouteHopDecodeErrorZ_err(uint64_t e) {
11313         LDKDecodeError e_conv;
11314         e_conv.inner = untag_ptr(e);
11315         e_conv.is_owned = ptr_is_owned(e);
11316         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
11317         e_conv = DecodeError_clone(&e_conv);
11318         LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
11319         *ret_conv = CResult_RouteHopDecodeErrorZ_err(e_conv);
11320         return tag_ptr(ret_conv, true);
11321 }
11322
11323 jboolean  __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_is_ok"))) TS_CResult_RouteHopDecodeErrorZ_is_ok(uint64_t o) {
11324         LDKCResult_RouteHopDecodeErrorZ* o_conv = (LDKCResult_RouteHopDecodeErrorZ*)untag_ptr(o);
11325         jboolean ret_conv = CResult_RouteHopDecodeErrorZ_is_ok(o_conv);
11326         return ret_conv;
11327 }
11328
11329 void  __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_free"))) TS_CResult_RouteHopDecodeErrorZ_free(uint64_t _res) {
11330         if (!ptr_is_owned(_res)) return;
11331         void* _res_ptr = untag_ptr(_res);
11332         CHECK_ACCESS(_res_ptr);
11333         LDKCResult_RouteHopDecodeErrorZ _res_conv = *(LDKCResult_RouteHopDecodeErrorZ*)(_res_ptr);
11334         FREE(untag_ptr(_res));
11335         CResult_RouteHopDecodeErrorZ_free(_res_conv);
11336 }
11337
11338 static inline uint64_t CResult_RouteHopDecodeErrorZ_clone_ptr(LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR arg) {
11339         LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
11340         *ret_conv = CResult_RouteHopDecodeErrorZ_clone(arg);
11341         return tag_ptr(ret_conv, true);
11342 }
11343 int64_t  __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_clone_ptr"))) TS_CResult_RouteHopDecodeErrorZ_clone_ptr(uint64_t arg) {
11344         LDKCResult_RouteHopDecodeErrorZ* arg_conv = (LDKCResult_RouteHopDecodeErrorZ*)untag_ptr(arg);
11345         int64_t ret_conv = CResult_RouteHopDecodeErrorZ_clone_ptr(arg_conv);
11346         return ret_conv;
11347 }
11348
11349 uint64_t  __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_clone"))) TS_CResult_RouteHopDecodeErrorZ_clone(uint64_t orig) {
11350         LDKCResult_RouteHopDecodeErrorZ* orig_conv = (LDKCResult_RouteHopDecodeErrorZ*)untag_ptr(orig);
11351         LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
11352         *ret_conv = CResult_RouteHopDecodeErrorZ_clone(orig_conv);
11353         return tag_ptr(ret_conv, true);
11354 }
11355
11356 void  __attribute__((export_name("TS_CVec_RouteHopZ_free"))) TS_CVec_RouteHopZ_free(uint64_tArray _res) {
11357         LDKCVec_RouteHopZ _res_constr;
11358         _res_constr.datalen = _res->arr_len;
11359         if (_res_constr.datalen > 0)
11360                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
11361         else
11362                 _res_constr.data = NULL;
11363         uint64_t* _res_vals = _res->elems;
11364         for (size_t k = 0; k < _res_constr.datalen; k++) {
11365                 uint64_t _res_conv_10 = _res_vals[k];
11366                 LDKRouteHop _res_conv_10_conv;
11367                 _res_conv_10_conv.inner = untag_ptr(_res_conv_10);
11368                 _res_conv_10_conv.is_owned = ptr_is_owned(_res_conv_10);
11369                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_10_conv);
11370                 _res_constr.data[k] = _res_conv_10_conv;
11371         }
11372         FREE(_res);
11373         CVec_RouteHopZ_free(_res_constr);
11374 }
11375
11376 void  __attribute__((export_name("TS_CVec_CVec_RouteHopZZ_free"))) TS_CVec_CVec_RouteHopZZ_free(ptrArray _res) {
11377         LDKCVec_CVec_RouteHopZZ _res_constr;
11378         _res_constr.datalen = _res->arr_len;
11379         if (_res_constr.datalen > 0)
11380                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
11381         else
11382                 _res_constr.data = NULL;
11383         uint64_tArray* _res_vals = (void*) _res->elems;
11384         for (size_t m = 0; m < _res_constr.datalen; m++) {
11385                 uint64_tArray _res_conv_12 = _res_vals[m];
11386                 LDKCVec_RouteHopZ _res_conv_12_constr;
11387                 _res_conv_12_constr.datalen = _res_conv_12->arr_len;
11388                 if (_res_conv_12_constr.datalen > 0)
11389                         _res_conv_12_constr.data = MALLOC(_res_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
11390                 else
11391                         _res_conv_12_constr.data = NULL;
11392                 uint64_t* _res_conv_12_vals = _res_conv_12->elems;
11393                 for (size_t k = 0; k < _res_conv_12_constr.datalen; k++) {
11394                         uint64_t _res_conv_12_conv_10 = _res_conv_12_vals[k];
11395                         LDKRouteHop _res_conv_12_conv_10_conv;
11396                         _res_conv_12_conv_10_conv.inner = untag_ptr(_res_conv_12_conv_10);
11397                         _res_conv_12_conv_10_conv.is_owned = ptr_is_owned(_res_conv_12_conv_10);
11398                         CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_12_conv_10_conv);
11399                         _res_conv_12_constr.data[k] = _res_conv_12_conv_10_conv;
11400                 }
11401                 FREE(_res_conv_12);
11402                 _res_constr.data[m] = _res_conv_12_constr;
11403         }
11404         FREE(_res);
11405         CVec_CVec_RouteHopZZ_free(_res_constr);
11406 }
11407
11408 uint64_t  __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_ok"))) TS_CResult_RouteDecodeErrorZ_ok(uint64_t o) {
11409         LDKRoute o_conv;
11410         o_conv.inner = untag_ptr(o);
11411         o_conv.is_owned = ptr_is_owned(o);
11412         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
11413         o_conv = Route_clone(&o_conv);
11414         LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
11415         *ret_conv = CResult_RouteDecodeErrorZ_ok(o_conv);
11416         return tag_ptr(ret_conv, true);
11417 }
11418
11419 uint64_t  __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_err"))) TS_CResult_RouteDecodeErrorZ_err(uint64_t e) {
11420         LDKDecodeError e_conv;
11421         e_conv.inner = untag_ptr(e);
11422         e_conv.is_owned = ptr_is_owned(e);
11423         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
11424         e_conv = DecodeError_clone(&e_conv);
11425         LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
11426         *ret_conv = CResult_RouteDecodeErrorZ_err(e_conv);
11427         return tag_ptr(ret_conv, true);
11428 }
11429
11430 jboolean  __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_is_ok"))) TS_CResult_RouteDecodeErrorZ_is_ok(uint64_t o) {
11431         LDKCResult_RouteDecodeErrorZ* o_conv = (LDKCResult_RouteDecodeErrorZ*)untag_ptr(o);
11432         jboolean ret_conv = CResult_RouteDecodeErrorZ_is_ok(o_conv);
11433         return ret_conv;
11434 }
11435
11436 void  __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_free"))) TS_CResult_RouteDecodeErrorZ_free(uint64_t _res) {
11437         if (!ptr_is_owned(_res)) return;
11438         void* _res_ptr = untag_ptr(_res);
11439         CHECK_ACCESS(_res_ptr);
11440         LDKCResult_RouteDecodeErrorZ _res_conv = *(LDKCResult_RouteDecodeErrorZ*)(_res_ptr);
11441         FREE(untag_ptr(_res));
11442         CResult_RouteDecodeErrorZ_free(_res_conv);
11443 }
11444
11445 static inline uint64_t CResult_RouteDecodeErrorZ_clone_ptr(LDKCResult_RouteDecodeErrorZ *NONNULL_PTR arg) {
11446         LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
11447         *ret_conv = CResult_RouteDecodeErrorZ_clone(arg);
11448         return tag_ptr(ret_conv, true);
11449 }
11450 int64_t  __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_clone_ptr"))) TS_CResult_RouteDecodeErrorZ_clone_ptr(uint64_t arg) {
11451         LDKCResult_RouteDecodeErrorZ* arg_conv = (LDKCResult_RouteDecodeErrorZ*)untag_ptr(arg);
11452         int64_t ret_conv = CResult_RouteDecodeErrorZ_clone_ptr(arg_conv);
11453         return ret_conv;
11454 }
11455
11456 uint64_t  __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_clone"))) TS_CResult_RouteDecodeErrorZ_clone(uint64_t orig) {
11457         LDKCResult_RouteDecodeErrorZ* orig_conv = (LDKCResult_RouteDecodeErrorZ*)untag_ptr(orig);
11458         LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
11459         *ret_conv = CResult_RouteDecodeErrorZ_clone(orig_conv);
11460         return tag_ptr(ret_conv, true);
11461 }
11462
11463 uint64_t  __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_ok"))) TS_CResult_RouteParametersDecodeErrorZ_ok(uint64_t o) {
11464         LDKRouteParameters o_conv;
11465         o_conv.inner = untag_ptr(o);
11466         o_conv.is_owned = ptr_is_owned(o);
11467         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
11468         o_conv = RouteParameters_clone(&o_conv);
11469         LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
11470         *ret_conv = CResult_RouteParametersDecodeErrorZ_ok(o_conv);
11471         return tag_ptr(ret_conv, true);
11472 }
11473
11474 uint64_t  __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_err"))) TS_CResult_RouteParametersDecodeErrorZ_err(uint64_t e) {
11475         LDKDecodeError e_conv;
11476         e_conv.inner = untag_ptr(e);
11477         e_conv.is_owned = ptr_is_owned(e);
11478         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
11479         e_conv = DecodeError_clone(&e_conv);
11480         LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
11481         *ret_conv = CResult_RouteParametersDecodeErrorZ_err(e_conv);
11482         return tag_ptr(ret_conv, true);
11483 }
11484
11485 jboolean  __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_is_ok"))) TS_CResult_RouteParametersDecodeErrorZ_is_ok(uint64_t o) {
11486         LDKCResult_RouteParametersDecodeErrorZ* o_conv = (LDKCResult_RouteParametersDecodeErrorZ*)untag_ptr(o);
11487         jboolean ret_conv = CResult_RouteParametersDecodeErrorZ_is_ok(o_conv);
11488         return ret_conv;
11489 }
11490
11491 void  __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_free"))) TS_CResult_RouteParametersDecodeErrorZ_free(uint64_t _res) {
11492         if (!ptr_is_owned(_res)) return;
11493         void* _res_ptr = untag_ptr(_res);
11494         CHECK_ACCESS(_res_ptr);
11495         LDKCResult_RouteParametersDecodeErrorZ _res_conv = *(LDKCResult_RouteParametersDecodeErrorZ*)(_res_ptr);
11496         FREE(untag_ptr(_res));
11497         CResult_RouteParametersDecodeErrorZ_free(_res_conv);
11498 }
11499
11500 static inline uint64_t CResult_RouteParametersDecodeErrorZ_clone_ptr(LDKCResult_RouteParametersDecodeErrorZ *NONNULL_PTR arg) {
11501         LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
11502         *ret_conv = CResult_RouteParametersDecodeErrorZ_clone(arg);
11503         return tag_ptr(ret_conv, true);
11504 }
11505 int64_t  __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_clone_ptr"))) TS_CResult_RouteParametersDecodeErrorZ_clone_ptr(uint64_t arg) {
11506         LDKCResult_RouteParametersDecodeErrorZ* arg_conv = (LDKCResult_RouteParametersDecodeErrorZ*)untag_ptr(arg);
11507         int64_t ret_conv = CResult_RouteParametersDecodeErrorZ_clone_ptr(arg_conv);
11508         return ret_conv;
11509 }
11510
11511 uint64_t  __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_clone"))) TS_CResult_RouteParametersDecodeErrorZ_clone(uint64_t orig) {
11512         LDKCResult_RouteParametersDecodeErrorZ* orig_conv = (LDKCResult_RouteParametersDecodeErrorZ*)untag_ptr(orig);
11513         LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
11514         *ret_conv = CResult_RouteParametersDecodeErrorZ_clone(orig_conv);
11515         return tag_ptr(ret_conv, true);
11516 }
11517
11518 void  __attribute__((export_name("TS_CVec_RouteHintZ_free"))) TS_CVec_RouteHintZ_free(uint64_tArray _res) {
11519         LDKCVec_RouteHintZ _res_constr;
11520         _res_constr.datalen = _res->arr_len;
11521         if (_res_constr.datalen > 0)
11522                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
11523         else
11524                 _res_constr.data = NULL;
11525         uint64_t* _res_vals = _res->elems;
11526         for (size_t l = 0; l < _res_constr.datalen; l++) {
11527                 uint64_t _res_conv_11 = _res_vals[l];
11528                 LDKRouteHint _res_conv_11_conv;
11529                 _res_conv_11_conv.inner = untag_ptr(_res_conv_11);
11530                 _res_conv_11_conv.is_owned = ptr_is_owned(_res_conv_11);
11531                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_11_conv);
11532                 _res_constr.data[l] = _res_conv_11_conv;
11533         }
11534         FREE(_res);
11535         CVec_RouteHintZ_free(_res_constr);
11536 }
11537
11538 uint64_t  __attribute__((export_name("TS_COption_u64Z_some"))) TS_COption_u64Z_some(int64_t o) {
11539         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
11540         *ret_copy = COption_u64Z_some(o);
11541         uint64_t ret_ref = tag_ptr(ret_copy, true);
11542         return ret_ref;
11543 }
11544
11545 uint64_t  __attribute__((export_name("TS_COption_u64Z_none"))) TS_COption_u64Z_none() {
11546         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
11547         *ret_copy = COption_u64Z_none();
11548         uint64_t ret_ref = tag_ptr(ret_copy, true);
11549         return ret_ref;
11550 }
11551
11552 void  __attribute__((export_name("TS_COption_u64Z_free"))) TS_COption_u64Z_free(uint64_t _res) {
11553         if (!ptr_is_owned(_res)) return;
11554         void* _res_ptr = untag_ptr(_res);
11555         CHECK_ACCESS(_res_ptr);
11556         LDKCOption_u64Z _res_conv = *(LDKCOption_u64Z*)(_res_ptr);
11557         FREE(untag_ptr(_res));
11558         COption_u64Z_free(_res_conv);
11559 }
11560
11561 static inline uint64_t COption_u64Z_clone_ptr(LDKCOption_u64Z *NONNULL_PTR arg) {
11562         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
11563         *ret_copy = COption_u64Z_clone(arg);
11564         uint64_t ret_ref = tag_ptr(ret_copy, true);
11565         return ret_ref;
11566 }
11567 int64_t  __attribute__((export_name("TS_COption_u64Z_clone_ptr"))) TS_COption_u64Z_clone_ptr(uint64_t arg) {
11568         LDKCOption_u64Z* arg_conv = (LDKCOption_u64Z*)untag_ptr(arg);
11569         int64_t ret_conv = COption_u64Z_clone_ptr(arg_conv);
11570         return ret_conv;
11571 }
11572
11573 uint64_t  __attribute__((export_name("TS_COption_u64Z_clone"))) TS_COption_u64Z_clone(uint64_t orig) {
11574         LDKCOption_u64Z* orig_conv = (LDKCOption_u64Z*)untag_ptr(orig);
11575         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
11576         *ret_copy = COption_u64Z_clone(orig_conv);
11577         uint64_t ret_ref = tag_ptr(ret_copy, true);
11578         return ret_ref;
11579 }
11580
11581 void  __attribute__((export_name("TS_CVec_u64Z_free"))) TS_CVec_u64Z_free(int64_tArray _res) {
11582         LDKCVec_u64Z _res_constr;
11583         _res_constr.datalen = _res->arr_len;
11584         if (_res_constr.datalen > 0)
11585                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
11586         else
11587                 _res_constr.data = NULL;
11588         int64_t* _res_vals = _res->elems;
11589         for (size_t i = 0; i < _res_constr.datalen; i++) {
11590                 int64_t _res_conv_8 = _res_vals[i];
11591                 _res_constr.data[i] = _res_conv_8;
11592         }
11593         FREE(_res);
11594         CVec_u64Z_free(_res_constr);
11595 }
11596
11597 uint64_t  __attribute__((export_name("TS_CResult_PaymentParametersDecodeErrorZ_ok"))) TS_CResult_PaymentParametersDecodeErrorZ_ok(uint64_t o) {
11598         LDKPaymentParameters o_conv;
11599         o_conv.inner = untag_ptr(o);
11600         o_conv.is_owned = ptr_is_owned(o);
11601         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
11602         o_conv = PaymentParameters_clone(&o_conv);
11603         LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
11604         *ret_conv = CResult_PaymentParametersDecodeErrorZ_ok(o_conv);
11605         return tag_ptr(ret_conv, true);
11606 }
11607
11608 uint64_t  __attribute__((export_name("TS_CResult_PaymentParametersDecodeErrorZ_err"))) TS_CResult_PaymentParametersDecodeErrorZ_err(uint64_t e) {
11609         LDKDecodeError e_conv;
11610         e_conv.inner = untag_ptr(e);
11611         e_conv.is_owned = ptr_is_owned(e);
11612         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
11613         e_conv = DecodeError_clone(&e_conv);
11614         LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
11615         *ret_conv = CResult_PaymentParametersDecodeErrorZ_err(e_conv);
11616         return tag_ptr(ret_conv, true);
11617 }
11618
11619 jboolean  __attribute__((export_name("TS_CResult_PaymentParametersDecodeErrorZ_is_ok"))) TS_CResult_PaymentParametersDecodeErrorZ_is_ok(uint64_t o) {
11620         LDKCResult_PaymentParametersDecodeErrorZ* o_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)untag_ptr(o);
11621         jboolean ret_conv = CResult_PaymentParametersDecodeErrorZ_is_ok(o_conv);
11622         return ret_conv;
11623 }
11624
11625 void  __attribute__((export_name("TS_CResult_PaymentParametersDecodeErrorZ_free"))) TS_CResult_PaymentParametersDecodeErrorZ_free(uint64_t _res) {
11626         if (!ptr_is_owned(_res)) return;
11627         void* _res_ptr = untag_ptr(_res);
11628         CHECK_ACCESS(_res_ptr);
11629         LDKCResult_PaymentParametersDecodeErrorZ _res_conv = *(LDKCResult_PaymentParametersDecodeErrorZ*)(_res_ptr);
11630         FREE(untag_ptr(_res));
11631         CResult_PaymentParametersDecodeErrorZ_free(_res_conv);
11632 }
11633
11634 static inline uint64_t CResult_PaymentParametersDecodeErrorZ_clone_ptr(LDKCResult_PaymentParametersDecodeErrorZ *NONNULL_PTR arg) {
11635         LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
11636         *ret_conv = CResult_PaymentParametersDecodeErrorZ_clone(arg);
11637         return tag_ptr(ret_conv, true);
11638 }
11639 int64_t  __attribute__((export_name("TS_CResult_PaymentParametersDecodeErrorZ_clone_ptr"))) TS_CResult_PaymentParametersDecodeErrorZ_clone_ptr(uint64_t arg) {
11640         LDKCResult_PaymentParametersDecodeErrorZ* arg_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)untag_ptr(arg);
11641         int64_t ret_conv = CResult_PaymentParametersDecodeErrorZ_clone_ptr(arg_conv);
11642         return ret_conv;
11643 }
11644
11645 uint64_t  __attribute__((export_name("TS_CResult_PaymentParametersDecodeErrorZ_clone"))) TS_CResult_PaymentParametersDecodeErrorZ_clone(uint64_t orig) {
11646         LDKCResult_PaymentParametersDecodeErrorZ* orig_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)untag_ptr(orig);
11647         LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
11648         *ret_conv = CResult_PaymentParametersDecodeErrorZ_clone(orig_conv);
11649         return tag_ptr(ret_conv, true);
11650 }
11651
11652 void  __attribute__((export_name("TS_CVec_RouteHintHopZ_free"))) TS_CVec_RouteHintHopZ_free(uint64_tArray _res) {
11653         LDKCVec_RouteHintHopZ _res_constr;
11654         _res_constr.datalen = _res->arr_len;
11655         if (_res_constr.datalen > 0)
11656                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHintHop), "LDKCVec_RouteHintHopZ Elements");
11657         else
11658                 _res_constr.data = NULL;
11659         uint64_t* _res_vals = _res->elems;
11660         for (size_t o = 0; o < _res_constr.datalen; o++) {
11661                 uint64_t _res_conv_14 = _res_vals[o];
11662                 LDKRouteHintHop _res_conv_14_conv;
11663                 _res_conv_14_conv.inner = untag_ptr(_res_conv_14);
11664                 _res_conv_14_conv.is_owned = ptr_is_owned(_res_conv_14);
11665                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_14_conv);
11666                 _res_constr.data[o] = _res_conv_14_conv;
11667         }
11668         FREE(_res);
11669         CVec_RouteHintHopZ_free(_res_constr);
11670 }
11671
11672 uint64_t  __attribute__((export_name("TS_CResult_RouteHintDecodeErrorZ_ok"))) TS_CResult_RouteHintDecodeErrorZ_ok(uint64_t o) {
11673         LDKRouteHint o_conv;
11674         o_conv.inner = untag_ptr(o);
11675         o_conv.is_owned = ptr_is_owned(o);
11676         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
11677         o_conv = RouteHint_clone(&o_conv);
11678         LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
11679         *ret_conv = CResult_RouteHintDecodeErrorZ_ok(o_conv);
11680         return tag_ptr(ret_conv, true);
11681 }
11682
11683 uint64_t  __attribute__((export_name("TS_CResult_RouteHintDecodeErrorZ_err"))) TS_CResult_RouteHintDecodeErrorZ_err(uint64_t e) {
11684         LDKDecodeError e_conv;
11685         e_conv.inner = untag_ptr(e);
11686         e_conv.is_owned = ptr_is_owned(e);
11687         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
11688         e_conv = DecodeError_clone(&e_conv);
11689         LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
11690         *ret_conv = CResult_RouteHintDecodeErrorZ_err(e_conv);
11691         return tag_ptr(ret_conv, true);
11692 }
11693
11694 jboolean  __attribute__((export_name("TS_CResult_RouteHintDecodeErrorZ_is_ok"))) TS_CResult_RouteHintDecodeErrorZ_is_ok(uint64_t o) {
11695         LDKCResult_RouteHintDecodeErrorZ* o_conv = (LDKCResult_RouteHintDecodeErrorZ*)untag_ptr(o);
11696         jboolean ret_conv = CResult_RouteHintDecodeErrorZ_is_ok(o_conv);
11697         return ret_conv;
11698 }
11699
11700 void  __attribute__((export_name("TS_CResult_RouteHintDecodeErrorZ_free"))) TS_CResult_RouteHintDecodeErrorZ_free(uint64_t _res) {
11701         if (!ptr_is_owned(_res)) return;
11702         void* _res_ptr = untag_ptr(_res);
11703         CHECK_ACCESS(_res_ptr);
11704         LDKCResult_RouteHintDecodeErrorZ _res_conv = *(LDKCResult_RouteHintDecodeErrorZ*)(_res_ptr);
11705         FREE(untag_ptr(_res));
11706         CResult_RouteHintDecodeErrorZ_free(_res_conv);
11707 }
11708
11709 static inline uint64_t CResult_RouteHintDecodeErrorZ_clone_ptr(LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR arg) {
11710         LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
11711         *ret_conv = CResult_RouteHintDecodeErrorZ_clone(arg);
11712         return tag_ptr(ret_conv, true);
11713 }
11714 int64_t  __attribute__((export_name("TS_CResult_RouteHintDecodeErrorZ_clone_ptr"))) TS_CResult_RouteHintDecodeErrorZ_clone_ptr(uint64_t arg) {
11715         LDKCResult_RouteHintDecodeErrorZ* arg_conv = (LDKCResult_RouteHintDecodeErrorZ*)untag_ptr(arg);
11716         int64_t ret_conv = CResult_RouteHintDecodeErrorZ_clone_ptr(arg_conv);
11717         return ret_conv;
11718 }
11719
11720 uint64_t  __attribute__((export_name("TS_CResult_RouteHintDecodeErrorZ_clone"))) TS_CResult_RouteHintDecodeErrorZ_clone(uint64_t orig) {
11721         LDKCResult_RouteHintDecodeErrorZ* orig_conv = (LDKCResult_RouteHintDecodeErrorZ*)untag_ptr(orig);
11722         LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
11723         *ret_conv = CResult_RouteHintDecodeErrorZ_clone(orig_conv);
11724         return tag_ptr(ret_conv, true);
11725 }
11726
11727 uint64_t  __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_ok"))) TS_CResult_RouteHintHopDecodeErrorZ_ok(uint64_t o) {
11728         LDKRouteHintHop o_conv;
11729         o_conv.inner = untag_ptr(o);
11730         o_conv.is_owned = ptr_is_owned(o);
11731         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
11732         o_conv = RouteHintHop_clone(&o_conv);
11733         LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
11734         *ret_conv = CResult_RouteHintHopDecodeErrorZ_ok(o_conv);
11735         return tag_ptr(ret_conv, true);
11736 }
11737
11738 uint64_t  __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_err"))) TS_CResult_RouteHintHopDecodeErrorZ_err(uint64_t e) {
11739         LDKDecodeError e_conv;
11740         e_conv.inner = untag_ptr(e);
11741         e_conv.is_owned = ptr_is_owned(e);
11742         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
11743         e_conv = DecodeError_clone(&e_conv);
11744         LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
11745         *ret_conv = CResult_RouteHintHopDecodeErrorZ_err(e_conv);
11746         return tag_ptr(ret_conv, true);
11747 }
11748
11749 jboolean  __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_is_ok"))) TS_CResult_RouteHintHopDecodeErrorZ_is_ok(uint64_t o) {
11750         LDKCResult_RouteHintHopDecodeErrorZ* o_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)untag_ptr(o);
11751         jboolean ret_conv = CResult_RouteHintHopDecodeErrorZ_is_ok(o_conv);
11752         return ret_conv;
11753 }
11754
11755 void  __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_free"))) TS_CResult_RouteHintHopDecodeErrorZ_free(uint64_t _res) {
11756         if (!ptr_is_owned(_res)) return;
11757         void* _res_ptr = untag_ptr(_res);
11758         CHECK_ACCESS(_res_ptr);
11759         LDKCResult_RouteHintHopDecodeErrorZ _res_conv = *(LDKCResult_RouteHintHopDecodeErrorZ*)(_res_ptr);
11760         FREE(untag_ptr(_res));
11761         CResult_RouteHintHopDecodeErrorZ_free(_res_conv);
11762 }
11763
11764 static inline uint64_t CResult_RouteHintHopDecodeErrorZ_clone_ptr(LDKCResult_RouteHintHopDecodeErrorZ *NONNULL_PTR arg) {
11765         LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
11766         *ret_conv = CResult_RouteHintHopDecodeErrorZ_clone(arg);
11767         return tag_ptr(ret_conv, true);
11768 }
11769 int64_t  __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_clone_ptr"))) TS_CResult_RouteHintHopDecodeErrorZ_clone_ptr(uint64_t arg) {
11770         LDKCResult_RouteHintHopDecodeErrorZ* arg_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)untag_ptr(arg);
11771         int64_t ret_conv = CResult_RouteHintHopDecodeErrorZ_clone_ptr(arg_conv);
11772         return ret_conv;
11773 }
11774
11775 uint64_t  __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_clone"))) TS_CResult_RouteHintHopDecodeErrorZ_clone(uint64_t orig) {
11776         LDKCResult_RouteHintHopDecodeErrorZ* orig_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)untag_ptr(orig);
11777         LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
11778         *ret_conv = CResult_RouteHintHopDecodeErrorZ_clone(orig_conv);
11779         return tag_ptr(ret_conv, true);
11780 }
11781
11782 void  __attribute__((export_name("TS_CVec_ChannelDetailsZ_free"))) TS_CVec_ChannelDetailsZ_free(uint64_tArray _res) {
11783         LDKCVec_ChannelDetailsZ _res_constr;
11784         _res_constr.datalen = _res->arr_len;
11785         if (_res_constr.datalen > 0)
11786                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
11787         else
11788                 _res_constr.data = NULL;
11789         uint64_t* _res_vals = _res->elems;
11790         for (size_t q = 0; q < _res_constr.datalen; q++) {
11791                 uint64_t _res_conv_16 = _res_vals[q];
11792                 LDKChannelDetails _res_conv_16_conv;
11793                 _res_conv_16_conv.inner = untag_ptr(_res_conv_16);
11794                 _res_conv_16_conv.is_owned = ptr_is_owned(_res_conv_16);
11795                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_16_conv);
11796                 _res_constr.data[q] = _res_conv_16_conv;
11797         }
11798         FREE(_res);
11799         CVec_ChannelDetailsZ_free(_res_constr);
11800 }
11801
11802 uint64_t  __attribute__((export_name("TS_CResult_RouteLightningErrorZ_ok"))) TS_CResult_RouteLightningErrorZ_ok(uint64_t o) {
11803         LDKRoute o_conv;
11804         o_conv.inner = untag_ptr(o);
11805         o_conv.is_owned = ptr_is_owned(o);
11806         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
11807         o_conv = Route_clone(&o_conv);
11808         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
11809         *ret_conv = CResult_RouteLightningErrorZ_ok(o_conv);
11810         return tag_ptr(ret_conv, true);
11811 }
11812
11813 uint64_t  __attribute__((export_name("TS_CResult_RouteLightningErrorZ_err"))) TS_CResult_RouteLightningErrorZ_err(uint64_t e) {
11814         LDKLightningError e_conv;
11815         e_conv.inner = untag_ptr(e);
11816         e_conv.is_owned = ptr_is_owned(e);
11817         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
11818         e_conv = LightningError_clone(&e_conv);
11819         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
11820         *ret_conv = CResult_RouteLightningErrorZ_err(e_conv);
11821         return tag_ptr(ret_conv, true);
11822 }
11823
11824 jboolean  __attribute__((export_name("TS_CResult_RouteLightningErrorZ_is_ok"))) TS_CResult_RouteLightningErrorZ_is_ok(uint64_t o) {
11825         LDKCResult_RouteLightningErrorZ* o_conv = (LDKCResult_RouteLightningErrorZ*)untag_ptr(o);
11826         jboolean ret_conv = CResult_RouteLightningErrorZ_is_ok(o_conv);
11827         return ret_conv;
11828 }
11829
11830 void  __attribute__((export_name("TS_CResult_RouteLightningErrorZ_free"))) TS_CResult_RouteLightningErrorZ_free(uint64_t _res) {
11831         if (!ptr_is_owned(_res)) return;
11832         void* _res_ptr = untag_ptr(_res);
11833         CHECK_ACCESS(_res_ptr);
11834         LDKCResult_RouteLightningErrorZ _res_conv = *(LDKCResult_RouteLightningErrorZ*)(_res_ptr);
11835         FREE(untag_ptr(_res));
11836         CResult_RouteLightningErrorZ_free(_res_conv);
11837 }
11838
11839 static inline uint64_t CResult_RouteLightningErrorZ_clone_ptr(LDKCResult_RouteLightningErrorZ *NONNULL_PTR arg) {
11840         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
11841         *ret_conv = CResult_RouteLightningErrorZ_clone(arg);
11842         return tag_ptr(ret_conv, true);
11843 }
11844 int64_t  __attribute__((export_name("TS_CResult_RouteLightningErrorZ_clone_ptr"))) TS_CResult_RouteLightningErrorZ_clone_ptr(uint64_t arg) {
11845         LDKCResult_RouteLightningErrorZ* arg_conv = (LDKCResult_RouteLightningErrorZ*)untag_ptr(arg);
11846         int64_t ret_conv = CResult_RouteLightningErrorZ_clone_ptr(arg_conv);
11847         return ret_conv;
11848 }
11849
11850 uint64_t  __attribute__((export_name("TS_CResult_RouteLightningErrorZ_clone"))) TS_CResult_RouteLightningErrorZ_clone(uint64_t orig) {
11851         LDKCResult_RouteLightningErrorZ* orig_conv = (LDKCResult_RouteLightningErrorZ*)untag_ptr(orig);
11852         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
11853         *ret_conv = CResult_RouteLightningErrorZ_clone(orig_conv);
11854         return tag_ptr(ret_conv, true);
11855 }
11856
11857 void  __attribute__((export_name("TS_CVec_PublicKeyZ_free"))) TS_CVec_PublicKeyZ_free(ptrArray _res) {
11858         LDKCVec_PublicKeyZ _res_constr;
11859         _res_constr.datalen = _res->arr_len;
11860         if (_res_constr.datalen > 0)
11861                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
11862         else
11863                 _res_constr.data = NULL;
11864         int8_tArray* _res_vals = (void*) _res->elems;
11865         for (size_t m = 0; m < _res_constr.datalen; m++) {
11866                 int8_tArray _res_conv_12 = _res_vals[m];
11867                 LDKPublicKey _res_conv_12_ref;
11868                 CHECK(_res_conv_12->arr_len == 33);
11869                 memcpy(_res_conv_12_ref.compressed_form, _res_conv_12->elems, 33); FREE(_res_conv_12);
11870                 _res_constr.data[m] = _res_conv_12_ref;
11871         }
11872         FREE(_res);
11873         CVec_PublicKeyZ_free(_res_constr);
11874 }
11875
11876 uint64_t  __attribute__((export_name("TS_CResult_PaymentPurposeDecodeErrorZ_ok"))) TS_CResult_PaymentPurposeDecodeErrorZ_ok(uint64_t o) {
11877         void* o_ptr = untag_ptr(o);
11878         CHECK_ACCESS(o_ptr);
11879         LDKPaymentPurpose o_conv = *(LDKPaymentPurpose*)(o_ptr);
11880         o_conv = PaymentPurpose_clone((LDKPaymentPurpose*)untag_ptr(o));
11881         LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
11882         *ret_conv = CResult_PaymentPurposeDecodeErrorZ_ok(o_conv);
11883         return tag_ptr(ret_conv, true);
11884 }
11885
11886 uint64_t  __attribute__((export_name("TS_CResult_PaymentPurposeDecodeErrorZ_err"))) TS_CResult_PaymentPurposeDecodeErrorZ_err(uint64_t e) {
11887         LDKDecodeError e_conv;
11888         e_conv.inner = untag_ptr(e);
11889         e_conv.is_owned = ptr_is_owned(e);
11890         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
11891         e_conv = DecodeError_clone(&e_conv);
11892         LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
11893         *ret_conv = CResult_PaymentPurposeDecodeErrorZ_err(e_conv);
11894         return tag_ptr(ret_conv, true);
11895 }
11896
11897 jboolean  __attribute__((export_name("TS_CResult_PaymentPurposeDecodeErrorZ_is_ok"))) TS_CResult_PaymentPurposeDecodeErrorZ_is_ok(uint64_t o) {
11898         LDKCResult_PaymentPurposeDecodeErrorZ* o_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)untag_ptr(o);
11899         jboolean ret_conv = CResult_PaymentPurposeDecodeErrorZ_is_ok(o_conv);
11900         return ret_conv;
11901 }
11902
11903 void  __attribute__((export_name("TS_CResult_PaymentPurposeDecodeErrorZ_free"))) TS_CResult_PaymentPurposeDecodeErrorZ_free(uint64_t _res) {
11904         if (!ptr_is_owned(_res)) return;
11905         void* _res_ptr = untag_ptr(_res);
11906         CHECK_ACCESS(_res_ptr);
11907         LDKCResult_PaymentPurposeDecodeErrorZ _res_conv = *(LDKCResult_PaymentPurposeDecodeErrorZ*)(_res_ptr);
11908         FREE(untag_ptr(_res));
11909         CResult_PaymentPurposeDecodeErrorZ_free(_res_conv);
11910 }
11911
11912 static inline uint64_t CResult_PaymentPurposeDecodeErrorZ_clone_ptr(LDKCResult_PaymentPurposeDecodeErrorZ *NONNULL_PTR arg) {
11913         LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
11914         *ret_conv = CResult_PaymentPurposeDecodeErrorZ_clone(arg);
11915         return tag_ptr(ret_conv, true);
11916 }
11917 int64_t  __attribute__((export_name("TS_CResult_PaymentPurposeDecodeErrorZ_clone_ptr"))) TS_CResult_PaymentPurposeDecodeErrorZ_clone_ptr(uint64_t arg) {
11918         LDKCResult_PaymentPurposeDecodeErrorZ* arg_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)untag_ptr(arg);
11919         int64_t ret_conv = CResult_PaymentPurposeDecodeErrorZ_clone_ptr(arg_conv);
11920         return ret_conv;
11921 }
11922
11923 uint64_t  __attribute__((export_name("TS_CResult_PaymentPurposeDecodeErrorZ_clone"))) TS_CResult_PaymentPurposeDecodeErrorZ_clone(uint64_t orig) {
11924         LDKCResult_PaymentPurposeDecodeErrorZ* orig_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)untag_ptr(orig);
11925         LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
11926         *ret_conv = CResult_PaymentPurposeDecodeErrorZ_clone(orig_conv);
11927         return tag_ptr(ret_conv, true);
11928 }
11929
11930 uint64_t  __attribute__((export_name("TS_COption_ClosureReasonZ_some"))) TS_COption_ClosureReasonZ_some(uint64_t o) {
11931         void* o_ptr = untag_ptr(o);
11932         CHECK_ACCESS(o_ptr);
11933         LDKClosureReason o_conv = *(LDKClosureReason*)(o_ptr);
11934         o_conv = ClosureReason_clone((LDKClosureReason*)untag_ptr(o));
11935         LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
11936         *ret_copy = COption_ClosureReasonZ_some(o_conv);
11937         uint64_t ret_ref = tag_ptr(ret_copy, true);
11938         return ret_ref;
11939 }
11940
11941 uint64_t  __attribute__((export_name("TS_COption_ClosureReasonZ_none"))) TS_COption_ClosureReasonZ_none() {
11942         LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
11943         *ret_copy = COption_ClosureReasonZ_none();
11944         uint64_t ret_ref = tag_ptr(ret_copy, true);
11945         return ret_ref;
11946 }
11947
11948 void  __attribute__((export_name("TS_COption_ClosureReasonZ_free"))) TS_COption_ClosureReasonZ_free(uint64_t _res) {
11949         if (!ptr_is_owned(_res)) return;
11950         void* _res_ptr = untag_ptr(_res);
11951         CHECK_ACCESS(_res_ptr);
11952         LDKCOption_ClosureReasonZ _res_conv = *(LDKCOption_ClosureReasonZ*)(_res_ptr);
11953         FREE(untag_ptr(_res));
11954         COption_ClosureReasonZ_free(_res_conv);
11955 }
11956
11957 static inline uint64_t COption_ClosureReasonZ_clone_ptr(LDKCOption_ClosureReasonZ *NONNULL_PTR arg) {
11958         LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
11959         *ret_copy = COption_ClosureReasonZ_clone(arg);
11960         uint64_t ret_ref = tag_ptr(ret_copy, true);
11961         return ret_ref;
11962 }
11963 int64_t  __attribute__((export_name("TS_COption_ClosureReasonZ_clone_ptr"))) TS_COption_ClosureReasonZ_clone_ptr(uint64_t arg) {
11964         LDKCOption_ClosureReasonZ* arg_conv = (LDKCOption_ClosureReasonZ*)untag_ptr(arg);
11965         int64_t ret_conv = COption_ClosureReasonZ_clone_ptr(arg_conv);
11966         return ret_conv;
11967 }
11968
11969 uint64_t  __attribute__((export_name("TS_COption_ClosureReasonZ_clone"))) TS_COption_ClosureReasonZ_clone(uint64_t orig) {
11970         LDKCOption_ClosureReasonZ* orig_conv = (LDKCOption_ClosureReasonZ*)untag_ptr(orig);
11971         LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
11972         *ret_copy = COption_ClosureReasonZ_clone(orig_conv);
11973         uint64_t ret_ref = tag_ptr(ret_copy, true);
11974         return ret_ref;
11975 }
11976
11977 uint64_t  __attribute__((export_name("TS_CResult_COption_ClosureReasonZDecodeErrorZ_ok"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_ok(uint64_t o) {
11978         void* o_ptr = untag_ptr(o);
11979         CHECK_ACCESS(o_ptr);
11980         LDKCOption_ClosureReasonZ o_conv = *(LDKCOption_ClosureReasonZ*)(o_ptr);
11981         o_conv = COption_ClosureReasonZ_clone((LDKCOption_ClosureReasonZ*)untag_ptr(o));
11982         LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
11983         *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_ok(o_conv);
11984         return tag_ptr(ret_conv, true);
11985 }
11986
11987 uint64_t  __attribute__((export_name("TS_CResult_COption_ClosureReasonZDecodeErrorZ_err"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_err(uint64_t e) {
11988         LDKDecodeError e_conv;
11989         e_conv.inner = untag_ptr(e);
11990         e_conv.is_owned = ptr_is_owned(e);
11991         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
11992         e_conv = DecodeError_clone(&e_conv);
11993         LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
11994         *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_err(e_conv);
11995         return tag_ptr(ret_conv, true);
11996 }
11997
11998 jboolean  __attribute__((export_name("TS_CResult_COption_ClosureReasonZDecodeErrorZ_is_ok"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_is_ok(uint64_t o) {
11999         LDKCResult_COption_ClosureReasonZDecodeErrorZ* o_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)untag_ptr(o);
12000         jboolean ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_is_ok(o_conv);
12001         return ret_conv;
12002 }
12003
12004 void  __attribute__((export_name("TS_CResult_COption_ClosureReasonZDecodeErrorZ_free"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_free(uint64_t _res) {
12005         if (!ptr_is_owned(_res)) return;
12006         void* _res_ptr = untag_ptr(_res);
12007         CHECK_ACCESS(_res_ptr);
12008         LDKCResult_COption_ClosureReasonZDecodeErrorZ _res_conv = *(LDKCResult_COption_ClosureReasonZDecodeErrorZ*)(_res_ptr);
12009         FREE(untag_ptr(_res));
12010         CResult_COption_ClosureReasonZDecodeErrorZ_free(_res_conv);
12011 }
12012
12013 static inline uint64_t CResult_COption_ClosureReasonZDecodeErrorZ_clone_ptr(LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR arg) {
12014         LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
12015         *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_clone(arg);
12016         return tag_ptr(ret_conv, true);
12017 }
12018 int64_t  __attribute__((export_name("TS_CResult_COption_ClosureReasonZDecodeErrorZ_clone_ptr"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_clone_ptr(uint64_t arg) {
12019         LDKCResult_COption_ClosureReasonZDecodeErrorZ* arg_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)untag_ptr(arg);
12020         int64_t ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_clone_ptr(arg_conv);
12021         return ret_conv;
12022 }
12023
12024 uint64_t  __attribute__((export_name("TS_CResult_COption_ClosureReasonZDecodeErrorZ_clone"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_clone(uint64_t orig) {
12025         LDKCResult_COption_ClosureReasonZDecodeErrorZ* orig_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)untag_ptr(orig);
12026         LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
12027         *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_clone(orig_conv);
12028         return tag_ptr(ret_conv, true);
12029 }
12030
12031 uint64_t  __attribute__((export_name("TS_COption_HTLCDestinationZ_some"))) TS_COption_HTLCDestinationZ_some(uint64_t o) {
12032         void* o_ptr = untag_ptr(o);
12033         CHECK_ACCESS(o_ptr);
12034         LDKHTLCDestination o_conv = *(LDKHTLCDestination*)(o_ptr);
12035         o_conv = HTLCDestination_clone((LDKHTLCDestination*)untag_ptr(o));
12036         LDKCOption_HTLCDestinationZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCDestinationZ), "LDKCOption_HTLCDestinationZ");
12037         *ret_copy = COption_HTLCDestinationZ_some(o_conv);
12038         uint64_t ret_ref = tag_ptr(ret_copy, true);
12039         return ret_ref;
12040 }
12041
12042 uint64_t  __attribute__((export_name("TS_COption_HTLCDestinationZ_none"))) TS_COption_HTLCDestinationZ_none() {
12043         LDKCOption_HTLCDestinationZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCDestinationZ), "LDKCOption_HTLCDestinationZ");
12044         *ret_copy = COption_HTLCDestinationZ_none();
12045         uint64_t ret_ref = tag_ptr(ret_copy, true);
12046         return ret_ref;
12047 }
12048
12049 void  __attribute__((export_name("TS_COption_HTLCDestinationZ_free"))) TS_COption_HTLCDestinationZ_free(uint64_t _res) {
12050         if (!ptr_is_owned(_res)) return;
12051         void* _res_ptr = untag_ptr(_res);
12052         CHECK_ACCESS(_res_ptr);
12053         LDKCOption_HTLCDestinationZ _res_conv = *(LDKCOption_HTLCDestinationZ*)(_res_ptr);
12054         FREE(untag_ptr(_res));
12055         COption_HTLCDestinationZ_free(_res_conv);
12056 }
12057
12058 static inline uint64_t COption_HTLCDestinationZ_clone_ptr(LDKCOption_HTLCDestinationZ *NONNULL_PTR arg) {
12059         LDKCOption_HTLCDestinationZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCDestinationZ), "LDKCOption_HTLCDestinationZ");
12060         *ret_copy = COption_HTLCDestinationZ_clone(arg);
12061         uint64_t ret_ref = tag_ptr(ret_copy, true);
12062         return ret_ref;
12063 }
12064 int64_t  __attribute__((export_name("TS_COption_HTLCDestinationZ_clone_ptr"))) TS_COption_HTLCDestinationZ_clone_ptr(uint64_t arg) {
12065         LDKCOption_HTLCDestinationZ* arg_conv = (LDKCOption_HTLCDestinationZ*)untag_ptr(arg);
12066         int64_t ret_conv = COption_HTLCDestinationZ_clone_ptr(arg_conv);
12067         return ret_conv;
12068 }
12069
12070 uint64_t  __attribute__((export_name("TS_COption_HTLCDestinationZ_clone"))) TS_COption_HTLCDestinationZ_clone(uint64_t orig) {
12071         LDKCOption_HTLCDestinationZ* orig_conv = (LDKCOption_HTLCDestinationZ*)untag_ptr(orig);
12072         LDKCOption_HTLCDestinationZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCDestinationZ), "LDKCOption_HTLCDestinationZ");
12073         *ret_copy = COption_HTLCDestinationZ_clone(orig_conv);
12074         uint64_t ret_ref = tag_ptr(ret_copy, true);
12075         return ret_ref;
12076 }
12077
12078 uint64_t  __attribute__((export_name("TS_CResult_COption_HTLCDestinationZDecodeErrorZ_ok"))) TS_CResult_COption_HTLCDestinationZDecodeErrorZ_ok(uint64_t o) {
12079         void* o_ptr = untag_ptr(o);
12080         CHECK_ACCESS(o_ptr);
12081         LDKCOption_HTLCDestinationZ o_conv = *(LDKCOption_HTLCDestinationZ*)(o_ptr);
12082         o_conv = COption_HTLCDestinationZ_clone((LDKCOption_HTLCDestinationZ*)untag_ptr(o));
12083         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ), "LDKCResult_COption_HTLCDestinationZDecodeErrorZ");
12084         *ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_ok(o_conv);
12085         return tag_ptr(ret_conv, true);
12086 }
12087
12088 uint64_t  __attribute__((export_name("TS_CResult_COption_HTLCDestinationZDecodeErrorZ_err"))) TS_CResult_COption_HTLCDestinationZDecodeErrorZ_err(uint64_t e) {
12089         LDKDecodeError e_conv;
12090         e_conv.inner = untag_ptr(e);
12091         e_conv.is_owned = ptr_is_owned(e);
12092         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
12093         e_conv = DecodeError_clone(&e_conv);
12094         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ), "LDKCResult_COption_HTLCDestinationZDecodeErrorZ");
12095         *ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_err(e_conv);
12096         return tag_ptr(ret_conv, true);
12097 }
12098
12099 jboolean  __attribute__((export_name("TS_CResult_COption_HTLCDestinationZDecodeErrorZ_is_ok"))) TS_CResult_COption_HTLCDestinationZDecodeErrorZ_is_ok(uint64_t o) {
12100         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* o_conv = (LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)untag_ptr(o);
12101         jboolean ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_is_ok(o_conv);
12102         return ret_conv;
12103 }
12104
12105 void  __attribute__((export_name("TS_CResult_COption_HTLCDestinationZDecodeErrorZ_free"))) TS_CResult_COption_HTLCDestinationZDecodeErrorZ_free(uint64_t _res) {
12106         if (!ptr_is_owned(_res)) return;
12107         void* _res_ptr = untag_ptr(_res);
12108         CHECK_ACCESS(_res_ptr);
12109         LDKCResult_COption_HTLCDestinationZDecodeErrorZ _res_conv = *(LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)(_res_ptr);
12110         FREE(untag_ptr(_res));
12111         CResult_COption_HTLCDestinationZDecodeErrorZ_free(_res_conv);
12112 }
12113
12114 static inline uint64_t CResult_COption_HTLCDestinationZDecodeErrorZ_clone_ptr(LDKCResult_COption_HTLCDestinationZDecodeErrorZ *NONNULL_PTR arg) {
12115         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ), "LDKCResult_COption_HTLCDestinationZDecodeErrorZ");
12116         *ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_clone(arg);
12117         return tag_ptr(ret_conv, true);
12118 }
12119 int64_t  __attribute__((export_name("TS_CResult_COption_HTLCDestinationZDecodeErrorZ_clone_ptr"))) TS_CResult_COption_HTLCDestinationZDecodeErrorZ_clone_ptr(uint64_t arg) {
12120         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* arg_conv = (LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)untag_ptr(arg);
12121         int64_t ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_clone_ptr(arg_conv);
12122         return ret_conv;
12123 }
12124
12125 uint64_t  __attribute__((export_name("TS_CResult_COption_HTLCDestinationZDecodeErrorZ_clone"))) TS_CResult_COption_HTLCDestinationZDecodeErrorZ_clone(uint64_t orig) {
12126         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* orig_conv = (LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)untag_ptr(orig);
12127         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ), "LDKCResult_COption_HTLCDestinationZDecodeErrorZ");
12128         *ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_clone(orig_conv);
12129         return tag_ptr(ret_conv, true);
12130 }
12131
12132 uint64_t  __attribute__((export_name("TS_COption_NetworkUpdateZ_some"))) TS_COption_NetworkUpdateZ_some(uint64_t o) {
12133         void* o_ptr = untag_ptr(o);
12134         CHECK_ACCESS(o_ptr);
12135         LDKNetworkUpdate o_conv = *(LDKNetworkUpdate*)(o_ptr);
12136         o_conv = NetworkUpdate_clone((LDKNetworkUpdate*)untag_ptr(o));
12137         LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
12138         *ret_copy = COption_NetworkUpdateZ_some(o_conv);
12139         uint64_t ret_ref = tag_ptr(ret_copy, true);
12140         return ret_ref;
12141 }
12142
12143 uint64_t  __attribute__((export_name("TS_COption_NetworkUpdateZ_none"))) TS_COption_NetworkUpdateZ_none() {
12144         LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
12145         *ret_copy = COption_NetworkUpdateZ_none();
12146         uint64_t ret_ref = tag_ptr(ret_copy, true);
12147         return ret_ref;
12148 }
12149
12150 void  __attribute__((export_name("TS_COption_NetworkUpdateZ_free"))) TS_COption_NetworkUpdateZ_free(uint64_t _res) {
12151         if (!ptr_is_owned(_res)) return;
12152         void* _res_ptr = untag_ptr(_res);
12153         CHECK_ACCESS(_res_ptr);
12154         LDKCOption_NetworkUpdateZ _res_conv = *(LDKCOption_NetworkUpdateZ*)(_res_ptr);
12155         FREE(untag_ptr(_res));
12156         COption_NetworkUpdateZ_free(_res_conv);
12157 }
12158
12159 static inline uint64_t COption_NetworkUpdateZ_clone_ptr(LDKCOption_NetworkUpdateZ *NONNULL_PTR arg) {
12160         LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
12161         *ret_copy = COption_NetworkUpdateZ_clone(arg);
12162         uint64_t ret_ref = tag_ptr(ret_copy, true);
12163         return ret_ref;
12164 }
12165 int64_t  __attribute__((export_name("TS_COption_NetworkUpdateZ_clone_ptr"))) TS_COption_NetworkUpdateZ_clone_ptr(uint64_t arg) {
12166         LDKCOption_NetworkUpdateZ* arg_conv = (LDKCOption_NetworkUpdateZ*)untag_ptr(arg);
12167         int64_t ret_conv = COption_NetworkUpdateZ_clone_ptr(arg_conv);
12168         return ret_conv;
12169 }
12170
12171 uint64_t  __attribute__((export_name("TS_COption_NetworkUpdateZ_clone"))) TS_COption_NetworkUpdateZ_clone(uint64_t orig) {
12172         LDKCOption_NetworkUpdateZ* orig_conv = (LDKCOption_NetworkUpdateZ*)untag_ptr(orig);
12173         LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
12174         *ret_copy = COption_NetworkUpdateZ_clone(orig_conv);
12175         uint64_t ret_ref = tag_ptr(ret_copy, true);
12176         return ret_ref;
12177 }
12178
12179 void  __attribute__((export_name("TS_CVec_SpendableOutputDescriptorZ_free"))) TS_CVec_SpendableOutputDescriptorZ_free(uint64_tArray _res) {
12180         LDKCVec_SpendableOutputDescriptorZ _res_constr;
12181         _res_constr.datalen = _res->arr_len;
12182         if (_res_constr.datalen > 0)
12183                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
12184         else
12185                 _res_constr.data = NULL;
12186         uint64_t* _res_vals = _res->elems;
12187         for (size_t b = 0; b < _res_constr.datalen; b++) {
12188                 uint64_t _res_conv_27 = _res_vals[b];
12189                 void* _res_conv_27_ptr = untag_ptr(_res_conv_27);
12190                 CHECK_ACCESS(_res_conv_27_ptr);
12191                 LDKSpendableOutputDescriptor _res_conv_27_conv = *(LDKSpendableOutputDescriptor*)(_res_conv_27_ptr);
12192                 FREE(untag_ptr(_res_conv_27));
12193                 _res_constr.data[b] = _res_conv_27_conv;
12194         }
12195         FREE(_res);
12196         CVec_SpendableOutputDescriptorZ_free(_res_constr);
12197 }
12198
12199 uint64_t  __attribute__((export_name("TS_COption_EventZ_some"))) TS_COption_EventZ_some(uint64_t o) {
12200         void* o_ptr = untag_ptr(o);
12201         CHECK_ACCESS(o_ptr);
12202         LDKEvent o_conv = *(LDKEvent*)(o_ptr);
12203         o_conv = Event_clone((LDKEvent*)untag_ptr(o));
12204         LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
12205         *ret_copy = COption_EventZ_some(o_conv);
12206         uint64_t ret_ref = tag_ptr(ret_copy, true);
12207         return ret_ref;
12208 }
12209
12210 uint64_t  __attribute__((export_name("TS_COption_EventZ_none"))) TS_COption_EventZ_none() {
12211         LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
12212         *ret_copy = COption_EventZ_none();
12213         uint64_t ret_ref = tag_ptr(ret_copy, true);
12214         return ret_ref;
12215 }
12216
12217 void  __attribute__((export_name("TS_COption_EventZ_free"))) TS_COption_EventZ_free(uint64_t _res) {
12218         if (!ptr_is_owned(_res)) return;
12219         void* _res_ptr = untag_ptr(_res);
12220         CHECK_ACCESS(_res_ptr);
12221         LDKCOption_EventZ _res_conv = *(LDKCOption_EventZ*)(_res_ptr);
12222         FREE(untag_ptr(_res));
12223         COption_EventZ_free(_res_conv);
12224 }
12225
12226 static inline uint64_t COption_EventZ_clone_ptr(LDKCOption_EventZ *NONNULL_PTR arg) {
12227         LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
12228         *ret_copy = COption_EventZ_clone(arg);
12229         uint64_t ret_ref = tag_ptr(ret_copy, true);
12230         return ret_ref;
12231 }
12232 int64_t  __attribute__((export_name("TS_COption_EventZ_clone_ptr"))) TS_COption_EventZ_clone_ptr(uint64_t arg) {
12233         LDKCOption_EventZ* arg_conv = (LDKCOption_EventZ*)untag_ptr(arg);
12234         int64_t ret_conv = COption_EventZ_clone_ptr(arg_conv);
12235         return ret_conv;
12236 }
12237
12238 uint64_t  __attribute__((export_name("TS_COption_EventZ_clone"))) TS_COption_EventZ_clone(uint64_t orig) {
12239         LDKCOption_EventZ* orig_conv = (LDKCOption_EventZ*)untag_ptr(orig);
12240         LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
12241         *ret_copy = COption_EventZ_clone(orig_conv);
12242         uint64_t ret_ref = tag_ptr(ret_copy, true);
12243         return ret_ref;
12244 }
12245
12246 uint64_t  __attribute__((export_name("TS_CResult_COption_EventZDecodeErrorZ_ok"))) TS_CResult_COption_EventZDecodeErrorZ_ok(uint64_t o) {
12247         void* o_ptr = untag_ptr(o);
12248         CHECK_ACCESS(o_ptr);
12249         LDKCOption_EventZ o_conv = *(LDKCOption_EventZ*)(o_ptr);
12250         o_conv = COption_EventZ_clone((LDKCOption_EventZ*)untag_ptr(o));
12251         LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
12252         *ret_conv = CResult_COption_EventZDecodeErrorZ_ok(o_conv);
12253         return tag_ptr(ret_conv, true);
12254 }
12255
12256 uint64_t  __attribute__((export_name("TS_CResult_COption_EventZDecodeErrorZ_err"))) TS_CResult_COption_EventZDecodeErrorZ_err(uint64_t e) {
12257         LDKDecodeError e_conv;
12258         e_conv.inner = untag_ptr(e);
12259         e_conv.is_owned = ptr_is_owned(e);
12260         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
12261         e_conv = DecodeError_clone(&e_conv);
12262         LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
12263         *ret_conv = CResult_COption_EventZDecodeErrorZ_err(e_conv);
12264         return tag_ptr(ret_conv, true);
12265 }
12266
12267 jboolean  __attribute__((export_name("TS_CResult_COption_EventZDecodeErrorZ_is_ok"))) TS_CResult_COption_EventZDecodeErrorZ_is_ok(uint64_t o) {
12268         LDKCResult_COption_EventZDecodeErrorZ* o_conv = (LDKCResult_COption_EventZDecodeErrorZ*)untag_ptr(o);
12269         jboolean ret_conv = CResult_COption_EventZDecodeErrorZ_is_ok(o_conv);
12270         return ret_conv;
12271 }
12272
12273 void  __attribute__((export_name("TS_CResult_COption_EventZDecodeErrorZ_free"))) TS_CResult_COption_EventZDecodeErrorZ_free(uint64_t _res) {
12274         if (!ptr_is_owned(_res)) return;
12275         void* _res_ptr = untag_ptr(_res);
12276         CHECK_ACCESS(_res_ptr);
12277         LDKCResult_COption_EventZDecodeErrorZ _res_conv = *(LDKCResult_COption_EventZDecodeErrorZ*)(_res_ptr);
12278         FREE(untag_ptr(_res));
12279         CResult_COption_EventZDecodeErrorZ_free(_res_conv);
12280 }
12281
12282 static inline uint64_t CResult_COption_EventZDecodeErrorZ_clone_ptr(LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR arg) {
12283         LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
12284         *ret_conv = CResult_COption_EventZDecodeErrorZ_clone(arg);
12285         return tag_ptr(ret_conv, true);
12286 }
12287 int64_t  __attribute__((export_name("TS_CResult_COption_EventZDecodeErrorZ_clone_ptr"))) TS_CResult_COption_EventZDecodeErrorZ_clone_ptr(uint64_t arg) {
12288         LDKCResult_COption_EventZDecodeErrorZ* arg_conv = (LDKCResult_COption_EventZDecodeErrorZ*)untag_ptr(arg);
12289         int64_t ret_conv = CResult_COption_EventZDecodeErrorZ_clone_ptr(arg_conv);
12290         return ret_conv;
12291 }
12292
12293 uint64_t  __attribute__((export_name("TS_CResult_COption_EventZDecodeErrorZ_clone"))) TS_CResult_COption_EventZDecodeErrorZ_clone(uint64_t orig) {
12294         LDKCResult_COption_EventZDecodeErrorZ* orig_conv = (LDKCResult_COption_EventZDecodeErrorZ*)untag_ptr(orig);
12295         LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
12296         *ret_conv = CResult_COption_EventZDecodeErrorZ_clone(orig_conv);
12297         return tag_ptr(ret_conv, true);
12298 }
12299
12300 void  __attribute__((export_name("TS_CVec_MessageSendEventZ_free"))) TS_CVec_MessageSendEventZ_free(uint64_tArray _res) {
12301         LDKCVec_MessageSendEventZ _res_constr;
12302         _res_constr.datalen = _res->arr_len;
12303         if (_res_constr.datalen > 0)
12304                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
12305         else
12306                 _res_constr.data = NULL;
12307         uint64_t* _res_vals = _res->elems;
12308         for (size_t s = 0; s < _res_constr.datalen; s++) {
12309                 uint64_t _res_conv_18 = _res_vals[s];
12310                 void* _res_conv_18_ptr = untag_ptr(_res_conv_18);
12311                 CHECK_ACCESS(_res_conv_18_ptr);
12312                 LDKMessageSendEvent _res_conv_18_conv = *(LDKMessageSendEvent*)(_res_conv_18_ptr);
12313                 FREE(untag_ptr(_res_conv_18));
12314                 _res_constr.data[s] = _res_conv_18_conv;
12315         }
12316         FREE(_res);
12317         CVec_MessageSendEventZ_free(_res_constr);
12318 }
12319
12320 uint64_t  __attribute__((export_name("TS_CResult_TxOutAccessErrorZ_ok"))) TS_CResult_TxOutAccessErrorZ_ok(uint64_t o) {
12321         void* o_ptr = untag_ptr(o);
12322         CHECK_ACCESS(o_ptr);
12323         LDKTxOut o_conv = *(LDKTxOut*)(o_ptr);
12324         o_conv = TxOut_clone((LDKTxOut*)untag_ptr(o));
12325         LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
12326         *ret_conv = CResult_TxOutAccessErrorZ_ok(o_conv);
12327         return tag_ptr(ret_conv, true);
12328 }
12329
12330 uint64_t  __attribute__((export_name("TS_CResult_TxOutAccessErrorZ_err"))) TS_CResult_TxOutAccessErrorZ_err(uint32_t e) {
12331         LDKAccessError e_conv = LDKAccessError_from_js(e);
12332         LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
12333         *ret_conv = CResult_TxOutAccessErrorZ_err(e_conv);
12334         return tag_ptr(ret_conv, true);
12335 }
12336
12337 jboolean  __attribute__((export_name("TS_CResult_TxOutAccessErrorZ_is_ok"))) TS_CResult_TxOutAccessErrorZ_is_ok(uint64_t o) {
12338         LDKCResult_TxOutAccessErrorZ* o_conv = (LDKCResult_TxOutAccessErrorZ*)untag_ptr(o);
12339         jboolean ret_conv = CResult_TxOutAccessErrorZ_is_ok(o_conv);
12340         return ret_conv;
12341 }
12342
12343 void  __attribute__((export_name("TS_CResult_TxOutAccessErrorZ_free"))) TS_CResult_TxOutAccessErrorZ_free(uint64_t _res) {
12344         if (!ptr_is_owned(_res)) return;
12345         void* _res_ptr = untag_ptr(_res);
12346         CHECK_ACCESS(_res_ptr);
12347         LDKCResult_TxOutAccessErrorZ _res_conv = *(LDKCResult_TxOutAccessErrorZ*)(_res_ptr);
12348         FREE(untag_ptr(_res));
12349         CResult_TxOutAccessErrorZ_free(_res_conv);
12350 }
12351
12352 static inline uint64_t CResult_TxOutAccessErrorZ_clone_ptr(LDKCResult_TxOutAccessErrorZ *NONNULL_PTR arg) {
12353         LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
12354         *ret_conv = CResult_TxOutAccessErrorZ_clone(arg);
12355         return tag_ptr(ret_conv, true);
12356 }
12357 int64_t  __attribute__((export_name("TS_CResult_TxOutAccessErrorZ_clone_ptr"))) TS_CResult_TxOutAccessErrorZ_clone_ptr(uint64_t arg) {
12358         LDKCResult_TxOutAccessErrorZ* arg_conv = (LDKCResult_TxOutAccessErrorZ*)untag_ptr(arg);
12359         int64_t ret_conv = CResult_TxOutAccessErrorZ_clone_ptr(arg_conv);
12360         return ret_conv;
12361 }
12362
12363 uint64_t  __attribute__((export_name("TS_CResult_TxOutAccessErrorZ_clone"))) TS_CResult_TxOutAccessErrorZ_clone(uint64_t orig) {
12364         LDKCResult_TxOutAccessErrorZ* orig_conv = (LDKCResult_TxOutAccessErrorZ*)untag_ptr(orig);
12365         LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
12366         *ret_conv = CResult_TxOutAccessErrorZ_clone(orig_conv);
12367         return tag_ptr(ret_conv, true);
12368 }
12369
12370 static inline uint64_t C2Tuple_usizeTransactionZ_clone_ptr(LDKC2Tuple_usizeTransactionZ *NONNULL_PTR arg) {
12371         LDKC2Tuple_usizeTransactionZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
12372         *ret_conv = C2Tuple_usizeTransactionZ_clone(arg);
12373         return tag_ptr(ret_conv, true);
12374 }
12375 int64_t  __attribute__((export_name("TS_C2Tuple_usizeTransactionZ_clone_ptr"))) TS_C2Tuple_usizeTransactionZ_clone_ptr(uint64_t arg) {
12376         LDKC2Tuple_usizeTransactionZ* arg_conv = (LDKC2Tuple_usizeTransactionZ*)untag_ptr(arg);
12377         int64_t ret_conv = C2Tuple_usizeTransactionZ_clone_ptr(arg_conv);
12378         return ret_conv;
12379 }
12380
12381 uint64_t  __attribute__((export_name("TS_C2Tuple_usizeTransactionZ_clone"))) TS_C2Tuple_usizeTransactionZ_clone(uint64_t orig) {
12382         LDKC2Tuple_usizeTransactionZ* orig_conv = (LDKC2Tuple_usizeTransactionZ*)untag_ptr(orig);
12383         LDKC2Tuple_usizeTransactionZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
12384         *ret_conv = C2Tuple_usizeTransactionZ_clone(orig_conv);
12385         return tag_ptr(ret_conv, true);
12386 }
12387
12388 uint64_t  __attribute__((export_name("TS_C2Tuple_usizeTransactionZ_new"))) TS_C2Tuple_usizeTransactionZ_new(uint32_t a, int8_tArray b) {
12389         LDKTransaction b_ref;
12390         b_ref.datalen = b->arr_len;
12391         b_ref.data = MALLOC(b_ref.datalen, "LDKTransaction Bytes");
12392         memcpy(b_ref.data, b->elems, b_ref.datalen); FREE(b);
12393         b_ref.data_is_owned = true;
12394         LDKC2Tuple_usizeTransactionZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
12395         *ret_conv = C2Tuple_usizeTransactionZ_new(a, b_ref);
12396         return tag_ptr(ret_conv, true);
12397 }
12398
12399 void  __attribute__((export_name("TS_C2Tuple_usizeTransactionZ_free"))) TS_C2Tuple_usizeTransactionZ_free(uint64_t _res) {
12400         if (!ptr_is_owned(_res)) return;
12401         void* _res_ptr = untag_ptr(_res);
12402         CHECK_ACCESS(_res_ptr);
12403         LDKC2Tuple_usizeTransactionZ _res_conv = *(LDKC2Tuple_usizeTransactionZ*)(_res_ptr);
12404         FREE(untag_ptr(_res));
12405         C2Tuple_usizeTransactionZ_free(_res_conv);
12406 }
12407
12408 void  __attribute__((export_name("TS_CVec_C2Tuple_usizeTransactionZZ_free"))) TS_CVec_C2Tuple_usizeTransactionZZ_free(uint64_tArray _res) {
12409         LDKCVec_C2Tuple_usizeTransactionZZ _res_constr;
12410         _res_constr.datalen = _res->arr_len;
12411         if (_res_constr.datalen > 0)
12412                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
12413         else
12414                 _res_constr.data = NULL;
12415         uint64_t* _res_vals = _res->elems;
12416         for (size_t c = 0; c < _res_constr.datalen; c++) {
12417                 uint64_t _res_conv_28 = _res_vals[c];
12418                 void* _res_conv_28_ptr = untag_ptr(_res_conv_28);
12419                 CHECK_ACCESS(_res_conv_28_ptr);
12420                 LDKC2Tuple_usizeTransactionZ _res_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(_res_conv_28_ptr);
12421                 FREE(untag_ptr(_res_conv_28));
12422                 _res_constr.data[c] = _res_conv_28_conv;
12423         }
12424         FREE(_res);
12425         CVec_C2Tuple_usizeTransactionZZ_free(_res_constr);
12426 }
12427
12428 void  __attribute__((export_name("TS_CVec_TxidZ_free"))) TS_CVec_TxidZ_free(ptrArray _res) {
12429         LDKCVec_TxidZ _res_constr;
12430         _res_constr.datalen = _res->arr_len;
12431         if (_res_constr.datalen > 0)
12432                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_TxidZ Elements");
12433         else
12434                 _res_constr.data = NULL;
12435         int8_tArray* _res_vals = (void*) _res->elems;
12436         for (size_t m = 0; m < _res_constr.datalen; m++) {
12437                 int8_tArray _res_conv_12 = _res_vals[m];
12438                 LDKThirtyTwoBytes _res_conv_12_ref;
12439                 CHECK(_res_conv_12->arr_len == 32);
12440                 memcpy(_res_conv_12_ref.data, _res_conv_12->elems, 32); FREE(_res_conv_12);
12441                 _res_constr.data[m] = _res_conv_12_ref;
12442         }
12443         FREE(_res);
12444         CVec_TxidZ_free(_res_constr);
12445 }
12446
12447 uint64_t  __attribute__((export_name("TS_CResult_NoneChannelMonitorUpdateErrZ_ok"))) TS_CResult_NoneChannelMonitorUpdateErrZ_ok() {
12448         LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
12449         *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_ok();
12450         return tag_ptr(ret_conv, true);
12451 }
12452
12453 uint64_t  __attribute__((export_name("TS_CResult_NoneChannelMonitorUpdateErrZ_err"))) TS_CResult_NoneChannelMonitorUpdateErrZ_err(uint32_t e) {
12454         LDKChannelMonitorUpdateErr e_conv = LDKChannelMonitorUpdateErr_from_js(e);
12455         LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
12456         *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_err(e_conv);
12457         return tag_ptr(ret_conv, true);
12458 }
12459
12460 jboolean  __attribute__((export_name("TS_CResult_NoneChannelMonitorUpdateErrZ_is_ok"))) TS_CResult_NoneChannelMonitorUpdateErrZ_is_ok(uint64_t o) {
12461         LDKCResult_NoneChannelMonitorUpdateErrZ* o_conv = (LDKCResult_NoneChannelMonitorUpdateErrZ*)untag_ptr(o);
12462         jboolean ret_conv = CResult_NoneChannelMonitorUpdateErrZ_is_ok(o_conv);
12463         return ret_conv;
12464 }
12465
12466 void  __attribute__((export_name("TS_CResult_NoneChannelMonitorUpdateErrZ_free"))) TS_CResult_NoneChannelMonitorUpdateErrZ_free(uint64_t _res) {
12467         if (!ptr_is_owned(_res)) return;
12468         void* _res_ptr = untag_ptr(_res);
12469         CHECK_ACCESS(_res_ptr);
12470         LDKCResult_NoneChannelMonitorUpdateErrZ _res_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(_res_ptr);
12471         FREE(untag_ptr(_res));
12472         CResult_NoneChannelMonitorUpdateErrZ_free(_res_conv);
12473 }
12474
12475 static inline uint64_t CResult_NoneChannelMonitorUpdateErrZ_clone_ptr(LDKCResult_NoneChannelMonitorUpdateErrZ *NONNULL_PTR arg) {
12476         LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
12477         *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone(arg);
12478         return tag_ptr(ret_conv, true);
12479 }
12480 int64_t  __attribute__((export_name("TS_CResult_NoneChannelMonitorUpdateErrZ_clone_ptr"))) TS_CResult_NoneChannelMonitorUpdateErrZ_clone_ptr(uint64_t arg) {
12481         LDKCResult_NoneChannelMonitorUpdateErrZ* arg_conv = (LDKCResult_NoneChannelMonitorUpdateErrZ*)untag_ptr(arg);
12482         int64_t ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone_ptr(arg_conv);
12483         return ret_conv;
12484 }
12485
12486 uint64_t  __attribute__((export_name("TS_CResult_NoneChannelMonitorUpdateErrZ_clone"))) TS_CResult_NoneChannelMonitorUpdateErrZ_clone(uint64_t orig) {
12487         LDKCResult_NoneChannelMonitorUpdateErrZ* orig_conv = (LDKCResult_NoneChannelMonitorUpdateErrZ*)untag_ptr(orig);
12488         LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
12489         *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone(orig_conv);
12490         return tag_ptr(ret_conv, true);
12491 }
12492
12493 void  __attribute__((export_name("TS_CVec_MonitorEventZ_free"))) TS_CVec_MonitorEventZ_free(uint64_tArray _res) {
12494         LDKCVec_MonitorEventZ _res_constr;
12495         _res_constr.datalen = _res->arr_len;
12496         if (_res_constr.datalen > 0)
12497                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
12498         else
12499                 _res_constr.data = NULL;
12500         uint64_t* _res_vals = _res->elems;
12501         for (size_t o = 0; o < _res_constr.datalen; o++) {
12502                 uint64_t _res_conv_14 = _res_vals[o];
12503                 void* _res_conv_14_ptr = untag_ptr(_res_conv_14);
12504                 CHECK_ACCESS(_res_conv_14_ptr);
12505                 LDKMonitorEvent _res_conv_14_conv = *(LDKMonitorEvent*)(_res_conv_14_ptr);
12506                 FREE(untag_ptr(_res_conv_14));
12507                 _res_constr.data[o] = _res_conv_14_conv;
12508         }
12509         FREE(_res);
12510         CVec_MonitorEventZ_free(_res_constr);
12511 }
12512
12513 static inline uint64_t C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone_ptr(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ *NONNULL_PTR arg) {
12514         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ), "LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ");
12515         *ret_conv = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone(arg);
12516         return tag_ptr(ret_conv, true);
12517 }
12518 int64_t  __attribute__((export_name("TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone_ptr"))) TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone_ptr(uint64_t arg) {
12519         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* arg_conv = (LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)untag_ptr(arg);
12520         int64_t ret_conv = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone_ptr(arg_conv);
12521         return ret_conv;
12522 }
12523
12524 uint64_t  __attribute__((export_name("TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone"))) TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone(uint64_t orig) {
12525         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* orig_conv = (LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)untag_ptr(orig);
12526         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ), "LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ");
12527         *ret_conv = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone(orig_conv);
12528         return tag_ptr(ret_conv, true);
12529 }
12530
12531 uint64_t  __attribute__((export_name("TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_new"))) TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_new(uint64_t a, uint64_tArray b, int8_tArray c) {
12532         LDKOutPoint a_conv;
12533         a_conv.inner = untag_ptr(a);
12534         a_conv.is_owned = ptr_is_owned(a);
12535         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
12536         a_conv = OutPoint_clone(&a_conv);
12537         LDKCVec_MonitorEventZ b_constr;
12538         b_constr.datalen = b->arr_len;
12539         if (b_constr.datalen > 0)
12540                 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
12541         else
12542                 b_constr.data = NULL;
12543         uint64_t* b_vals = b->elems;
12544         for (size_t o = 0; o < b_constr.datalen; o++) {
12545                 uint64_t b_conv_14 = b_vals[o];
12546                 void* b_conv_14_ptr = untag_ptr(b_conv_14);
12547                 CHECK_ACCESS(b_conv_14_ptr);
12548                 LDKMonitorEvent b_conv_14_conv = *(LDKMonitorEvent*)(b_conv_14_ptr);
12549                 b_conv_14_conv = MonitorEvent_clone((LDKMonitorEvent*)untag_ptr(b_conv_14));
12550                 b_constr.data[o] = b_conv_14_conv;
12551         }
12552         FREE(b);
12553         LDKPublicKey c_ref;
12554         CHECK(c->arr_len == 33);
12555         memcpy(c_ref.compressed_form, c->elems, 33); FREE(c);
12556         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ), "LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ");
12557         *ret_conv = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_new(a_conv, b_constr, c_ref);
12558         return tag_ptr(ret_conv, true);
12559 }
12560
12561 void  __attribute__((export_name("TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_free"))) TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_free(uint64_t _res) {
12562         if (!ptr_is_owned(_res)) return;
12563         void* _res_ptr = untag_ptr(_res);
12564         CHECK_ACCESS(_res_ptr);
12565         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ _res_conv = *(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)(_res_ptr);
12566         FREE(untag_ptr(_res));
12567         C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_free(_res_conv);
12568 }
12569
12570 void  __attribute__((export_name("TS_CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ_free"))) TS_CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ_free(uint64_tArray _res) {
12571         LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ _res_constr;
12572         _res_constr.datalen = _res->arr_len;
12573         if (_res_constr.datalen > 0)
12574                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ), "LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ Elements");
12575         else
12576                 _res_constr.data = NULL;
12577         uint64_t* _res_vals = _res->elems;
12578         for (size_t x = 0; x < _res_constr.datalen; x++) {
12579                 uint64_t _res_conv_49 = _res_vals[x];
12580                 void* _res_conv_49_ptr = untag_ptr(_res_conv_49);
12581                 CHECK_ACCESS(_res_conv_49_ptr);
12582                 LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ _res_conv_49_conv = *(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)(_res_conv_49_ptr);
12583                 FREE(untag_ptr(_res_conv_49));
12584                 _res_constr.data[x] = _res_conv_49_conv;
12585         }
12586         FREE(_res);
12587         CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ_free(_res_constr);
12588 }
12589
12590 uint64_t  __attribute__((export_name("TS_COption_C2Tuple_usizeTransactionZZ_some"))) TS_COption_C2Tuple_usizeTransactionZZ_some(uint64_t o) {
12591         void* o_ptr = untag_ptr(o);
12592         CHECK_ACCESS(o_ptr);
12593         LDKC2Tuple_usizeTransactionZ o_conv = *(LDKC2Tuple_usizeTransactionZ*)(o_ptr);
12594         o_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)untag_ptr(o));
12595         LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
12596         *ret_copy = COption_C2Tuple_usizeTransactionZZ_some(o_conv);
12597         uint64_t ret_ref = tag_ptr(ret_copy, true);
12598         return ret_ref;
12599 }
12600
12601 uint64_t  __attribute__((export_name("TS_COption_C2Tuple_usizeTransactionZZ_none"))) TS_COption_C2Tuple_usizeTransactionZZ_none() {
12602         LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
12603         *ret_copy = COption_C2Tuple_usizeTransactionZZ_none();
12604         uint64_t ret_ref = tag_ptr(ret_copy, true);
12605         return ret_ref;
12606 }
12607
12608 void  __attribute__((export_name("TS_COption_C2Tuple_usizeTransactionZZ_free"))) TS_COption_C2Tuple_usizeTransactionZZ_free(uint64_t _res) {
12609         if (!ptr_is_owned(_res)) return;
12610         void* _res_ptr = untag_ptr(_res);
12611         CHECK_ACCESS(_res_ptr);
12612         LDKCOption_C2Tuple_usizeTransactionZZ _res_conv = *(LDKCOption_C2Tuple_usizeTransactionZZ*)(_res_ptr);
12613         FREE(untag_ptr(_res));
12614         COption_C2Tuple_usizeTransactionZZ_free(_res_conv);
12615 }
12616
12617 static inline uint64_t COption_C2Tuple_usizeTransactionZZ_clone_ptr(LDKCOption_C2Tuple_usizeTransactionZZ *NONNULL_PTR arg) {
12618         LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
12619         *ret_copy = COption_C2Tuple_usizeTransactionZZ_clone(arg);
12620         uint64_t ret_ref = tag_ptr(ret_copy, true);
12621         return ret_ref;
12622 }
12623 int64_t  __attribute__((export_name("TS_COption_C2Tuple_usizeTransactionZZ_clone_ptr"))) TS_COption_C2Tuple_usizeTransactionZZ_clone_ptr(uint64_t arg) {
12624         LDKCOption_C2Tuple_usizeTransactionZZ* arg_conv = (LDKCOption_C2Tuple_usizeTransactionZZ*)untag_ptr(arg);
12625         int64_t ret_conv = COption_C2Tuple_usizeTransactionZZ_clone_ptr(arg_conv);
12626         return ret_conv;
12627 }
12628
12629 uint64_t  __attribute__((export_name("TS_COption_C2Tuple_usizeTransactionZZ_clone"))) TS_COption_C2Tuple_usizeTransactionZZ_clone(uint64_t orig) {
12630         LDKCOption_C2Tuple_usizeTransactionZZ* orig_conv = (LDKCOption_C2Tuple_usizeTransactionZZ*)untag_ptr(orig);
12631         LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
12632         *ret_copy = COption_C2Tuple_usizeTransactionZZ_clone(orig_conv);
12633         uint64_t ret_ref = tag_ptr(ret_copy, true);
12634         return ret_ref;
12635 }
12636
12637 uint64_t  __attribute__((export_name("TS_CResult_FixedPenaltyScorerDecodeErrorZ_ok"))) TS_CResult_FixedPenaltyScorerDecodeErrorZ_ok(uint64_t o) {
12638         LDKFixedPenaltyScorer o_conv;
12639         o_conv.inner = untag_ptr(o);
12640         o_conv.is_owned = ptr_is_owned(o);
12641         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12642         o_conv = FixedPenaltyScorer_clone(&o_conv);
12643         LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
12644         *ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_ok(o_conv);
12645         return tag_ptr(ret_conv, true);
12646 }
12647
12648 uint64_t  __attribute__((export_name("TS_CResult_FixedPenaltyScorerDecodeErrorZ_err"))) TS_CResult_FixedPenaltyScorerDecodeErrorZ_err(uint64_t e) {
12649         LDKDecodeError e_conv;
12650         e_conv.inner = untag_ptr(e);
12651         e_conv.is_owned = ptr_is_owned(e);
12652         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
12653         e_conv = DecodeError_clone(&e_conv);
12654         LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
12655         *ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_err(e_conv);
12656         return tag_ptr(ret_conv, true);
12657 }
12658
12659 jboolean  __attribute__((export_name("TS_CResult_FixedPenaltyScorerDecodeErrorZ_is_ok"))) TS_CResult_FixedPenaltyScorerDecodeErrorZ_is_ok(uint64_t o) {
12660         LDKCResult_FixedPenaltyScorerDecodeErrorZ* o_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)untag_ptr(o);
12661         jboolean ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_is_ok(o_conv);
12662         return ret_conv;
12663 }
12664
12665 void  __attribute__((export_name("TS_CResult_FixedPenaltyScorerDecodeErrorZ_free"))) TS_CResult_FixedPenaltyScorerDecodeErrorZ_free(uint64_t _res) {
12666         if (!ptr_is_owned(_res)) return;
12667         void* _res_ptr = untag_ptr(_res);
12668         CHECK_ACCESS(_res_ptr);
12669         LDKCResult_FixedPenaltyScorerDecodeErrorZ _res_conv = *(LDKCResult_FixedPenaltyScorerDecodeErrorZ*)(_res_ptr);
12670         FREE(untag_ptr(_res));
12671         CResult_FixedPenaltyScorerDecodeErrorZ_free(_res_conv);
12672 }
12673
12674 static inline uint64_t CResult_FixedPenaltyScorerDecodeErrorZ_clone_ptr(LDKCResult_FixedPenaltyScorerDecodeErrorZ *NONNULL_PTR arg) {
12675         LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
12676         *ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_clone(arg);
12677         return tag_ptr(ret_conv, true);
12678 }
12679 int64_t  __attribute__((export_name("TS_CResult_FixedPenaltyScorerDecodeErrorZ_clone_ptr"))) TS_CResult_FixedPenaltyScorerDecodeErrorZ_clone_ptr(uint64_t arg) {
12680         LDKCResult_FixedPenaltyScorerDecodeErrorZ* arg_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)untag_ptr(arg);
12681         int64_t ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_clone_ptr(arg_conv);
12682         return ret_conv;
12683 }
12684
12685 uint64_t  __attribute__((export_name("TS_CResult_FixedPenaltyScorerDecodeErrorZ_clone"))) TS_CResult_FixedPenaltyScorerDecodeErrorZ_clone(uint64_t orig) {
12686         LDKCResult_FixedPenaltyScorerDecodeErrorZ* orig_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)untag_ptr(orig);
12687         LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
12688         *ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_clone(orig_conv);
12689         return tag_ptr(ret_conv, true);
12690 }
12691
12692 static inline uint64_t C2Tuple_u64u64Z_clone_ptr(LDKC2Tuple_u64u64Z *NONNULL_PTR arg) {
12693         LDKC2Tuple_u64u64Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
12694         *ret_conv = C2Tuple_u64u64Z_clone(arg);
12695         return tag_ptr(ret_conv, true);
12696 }
12697 int64_t  __attribute__((export_name("TS_C2Tuple_u64u64Z_clone_ptr"))) TS_C2Tuple_u64u64Z_clone_ptr(uint64_t arg) {
12698         LDKC2Tuple_u64u64Z* arg_conv = (LDKC2Tuple_u64u64Z*)untag_ptr(arg);
12699         int64_t ret_conv = C2Tuple_u64u64Z_clone_ptr(arg_conv);
12700         return ret_conv;
12701 }
12702
12703 uint64_t  __attribute__((export_name("TS_C2Tuple_u64u64Z_clone"))) TS_C2Tuple_u64u64Z_clone(uint64_t orig) {
12704         LDKC2Tuple_u64u64Z* orig_conv = (LDKC2Tuple_u64u64Z*)untag_ptr(orig);
12705         LDKC2Tuple_u64u64Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
12706         *ret_conv = C2Tuple_u64u64Z_clone(orig_conv);
12707         return tag_ptr(ret_conv, true);
12708 }
12709
12710 uint64_t  __attribute__((export_name("TS_C2Tuple_u64u64Z_new"))) TS_C2Tuple_u64u64Z_new(int64_t a, int64_t b) {
12711         LDKC2Tuple_u64u64Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
12712         *ret_conv = C2Tuple_u64u64Z_new(a, b);
12713         return tag_ptr(ret_conv, true);
12714 }
12715
12716 void  __attribute__((export_name("TS_C2Tuple_u64u64Z_free"))) TS_C2Tuple_u64u64Z_free(uint64_t _res) {
12717         if (!ptr_is_owned(_res)) return;
12718         void* _res_ptr = untag_ptr(_res);
12719         CHECK_ACCESS(_res_ptr);
12720         LDKC2Tuple_u64u64Z _res_conv = *(LDKC2Tuple_u64u64Z*)(_res_ptr);
12721         FREE(untag_ptr(_res));
12722         C2Tuple_u64u64Z_free(_res_conv);
12723 }
12724
12725 uint64_t  __attribute__((export_name("TS_COption_C2Tuple_u64u64ZZ_some"))) TS_COption_C2Tuple_u64u64ZZ_some(uint64_t o) {
12726         void* o_ptr = untag_ptr(o);
12727         CHECK_ACCESS(o_ptr);
12728         LDKC2Tuple_u64u64Z o_conv = *(LDKC2Tuple_u64u64Z*)(o_ptr);
12729         o_conv = C2Tuple_u64u64Z_clone((LDKC2Tuple_u64u64Z*)untag_ptr(o));
12730         LDKCOption_C2Tuple_u64u64ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u64ZZ), "LDKCOption_C2Tuple_u64u64ZZ");
12731         *ret_copy = COption_C2Tuple_u64u64ZZ_some(o_conv);
12732         uint64_t ret_ref = tag_ptr(ret_copy, true);
12733         return ret_ref;
12734 }
12735
12736 uint64_t  __attribute__((export_name("TS_COption_C2Tuple_u64u64ZZ_none"))) TS_COption_C2Tuple_u64u64ZZ_none() {
12737         LDKCOption_C2Tuple_u64u64ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u64ZZ), "LDKCOption_C2Tuple_u64u64ZZ");
12738         *ret_copy = COption_C2Tuple_u64u64ZZ_none();
12739         uint64_t ret_ref = tag_ptr(ret_copy, true);
12740         return ret_ref;
12741 }
12742
12743 void  __attribute__((export_name("TS_COption_C2Tuple_u64u64ZZ_free"))) TS_COption_C2Tuple_u64u64ZZ_free(uint64_t _res) {
12744         if (!ptr_is_owned(_res)) return;
12745         void* _res_ptr = untag_ptr(_res);
12746         CHECK_ACCESS(_res_ptr);
12747         LDKCOption_C2Tuple_u64u64ZZ _res_conv = *(LDKCOption_C2Tuple_u64u64ZZ*)(_res_ptr);
12748         FREE(untag_ptr(_res));
12749         COption_C2Tuple_u64u64ZZ_free(_res_conv);
12750 }
12751
12752 static inline uint64_t COption_C2Tuple_u64u64ZZ_clone_ptr(LDKCOption_C2Tuple_u64u64ZZ *NONNULL_PTR arg) {
12753         LDKCOption_C2Tuple_u64u64ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u64ZZ), "LDKCOption_C2Tuple_u64u64ZZ");
12754         *ret_copy = COption_C2Tuple_u64u64ZZ_clone(arg);
12755         uint64_t ret_ref = tag_ptr(ret_copy, true);
12756         return ret_ref;
12757 }
12758 int64_t  __attribute__((export_name("TS_COption_C2Tuple_u64u64ZZ_clone_ptr"))) TS_COption_C2Tuple_u64u64ZZ_clone_ptr(uint64_t arg) {
12759         LDKCOption_C2Tuple_u64u64ZZ* arg_conv = (LDKCOption_C2Tuple_u64u64ZZ*)untag_ptr(arg);
12760         int64_t ret_conv = COption_C2Tuple_u64u64ZZ_clone_ptr(arg_conv);
12761         return ret_conv;
12762 }
12763
12764 uint64_t  __attribute__((export_name("TS_COption_C2Tuple_u64u64ZZ_clone"))) TS_COption_C2Tuple_u64u64ZZ_clone(uint64_t orig) {
12765         LDKCOption_C2Tuple_u64u64ZZ* orig_conv = (LDKCOption_C2Tuple_u64u64ZZ*)untag_ptr(orig);
12766         LDKCOption_C2Tuple_u64u64ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u64ZZ), "LDKCOption_C2Tuple_u64u64ZZ");
12767         *ret_copy = COption_C2Tuple_u64u64ZZ_clone(orig_conv);
12768         uint64_t ret_ref = tag_ptr(ret_copy, true);
12769         return ret_ref;
12770 }
12771
12772 void  __attribute__((export_name("TS_CVec_NodeIdZ_free"))) TS_CVec_NodeIdZ_free(uint64_tArray _res) {
12773         LDKCVec_NodeIdZ _res_constr;
12774         _res_constr.datalen = _res->arr_len;
12775         if (_res_constr.datalen > 0)
12776                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKNodeId), "LDKCVec_NodeIdZ Elements");
12777         else
12778                 _res_constr.data = NULL;
12779         uint64_t* _res_vals = _res->elems;
12780         for (size_t i = 0; i < _res_constr.datalen; i++) {
12781                 uint64_t _res_conv_8 = _res_vals[i];
12782                 LDKNodeId _res_conv_8_conv;
12783                 _res_conv_8_conv.inner = untag_ptr(_res_conv_8);
12784                 _res_conv_8_conv.is_owned = ptr_is_owned(_res_conv_8);
12785                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_8_conv);
12786                 _res_constr.data[i] = _res_conv_8_conv;
12787         }
12788         FREE(_res);
12789         CVec_NodeIdZ_free(_res_constr);
12790 }
12791
12792 uint64_t  __attribute__((export_name("TS_CResult_ProbabilisticScorerDecodeErrorZ_ok"))) TS_CResult_ProbabilisticScorerDecodeErrorZ_ok(uint64_t o) {
12793         LDKProbabilisticScorer o_conv;
12794         o_conv.inner = untag_ptr(o);
12795         o_conv.is_owned = ptr_is_owned(o);
12796         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12797         // WARNING: we need a move here but no clone is available for LDKProbabilisticScorer
12798         
12799         LDKCResult_ProbabilisticScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ProbabilisticScorerDecodeErrorZ), "LDKCResult_ProbabilisticScorerDecodeErrorZ");
12800         *ret_conv = CResult_ProbabilisticScorerDecodeErrorZ_ok(o_conv);
12801         return tag_ptr(ret_conv, true);
12802 }
12803
12804 uint64_t  __attribute__((export_name("TS_CResult_ProbabilisticScorerDecodeErrorZ_err"))) TS_CResult_ProbabilisticScorerDecodeErrorZ_err(uint64_t e) {
12805         LDKDecodeError e_conv;
12806         e_conv.inner = untag_ptr(e);
12807         e_conv.is_owned = ptr_is_owned(e);
12808         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
12809         e_conv = DecodeError_clone(&e_conv);
12810         LDKCResult_ProbabilisticScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ProbabilisticScorerDecodeErrorZ), "LDKCResult_ProbabilisticScorerDecodeErrorZ");
12811         *ret_conv = CResult_ProbabilisticScorerDecodeErrorZ_err(e_conv);
12812         return tag_ptr(ret_conv, true);
12813 }
12814
12815 jboolean  __attribute__((export_name("TS_CResult_ProbabilisticScorerDecodeErrorZ_is_ok"))) TS_CResult_ProbabilisticScorerDecodeErrorZ_is_ok(uint64_t o) {
12816         LDKCResult_ProbabilisticScorerDecodeErrorZ* o_conv = (LDKCResult_ProbabilisticScorerDecodeErrorZ*)untag_ptr(o);
12817         jboolean ret_conv = CResult_ProbabilisticScorerDecodeErrorZ_is_ok(o_conv);
12818         return ret_conv;
12819 }
12820
12821 void  __attribute__((export_name("TS_CResult_ProbabilisticScorerDecodeErrorZ_free"))) TS_CResult_ProbabilisticScorerDecodeErrorZ_free(uint64_t _res) {
12822         if (!ptr_is_owned(_res)) return;
12823         void* _res_ptr = untag_ptr(_res);
12824         CHECK_ACCESS(_res_ptr);
12825         LDKCResult_ProbabilisticScorerDecodeErrorZ _res_conv = *(LDKCResult_ProbabilisticScorerDecodeErrorZ*)(_res_ptr);
12826         FREE(untag_ptr(_res));
12827         CResult_ProbabilisticScorerDecodeErrorZ_free(_res_conv);
12828 }
12829
12830 uint64_t  __attribute__((export_name("TS_CResult_InitFeaturesDecodeErrorZ_ok"))) TS_CResult_InitFeaturesDecodeErrorZ_ok(uint64_t o) {
12831         LDKInitFeatures o_conv;
12832         o_conv.inner = untag_ptr(o);
12833         o_conv.is_owned = ptr_is_owned(o);
12834         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12835         o_conv = InitFeatures_clone(&o_conv);
12836         LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
12837         *ret_conv = CResult_InitFeaturesDecodeErrorZ_ok(o_conv);
12838         return tag_ptr(ret_conv, true);
12839 }
12840
12841 uint64_t  __attribute__((export_name("TS_CResult_InitFeaturesDecodeErrorZ_err"))) TS_CResult_InitFeaturesDecodeErrorZ_err(uint64_t e) {
12842         LDKDecodeError e_conv;
12843         e_conv.inner = untag_ptr(e);
12844         e_conv.is_owned = ptr_is_owned(e);
12845         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
12846         e_conv = DecodeError_clone(&e_conv);
12847         LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
12848         *ret_conv = CResult_InitFeaturesDecodeErrorZ_err(e_conv);
12849         return tag_ptr(ret_conv, true);
12850 }
12851
12852 jboolean  __attribute__((export_name("TS_CResult_InitFeaturesDecodeErrorZ_is_ok"))) TS_CResult_InitFeaturesDecodeErrorZ_is_ok(uint64_t o) {
12853         LDKCResult_InitFeaturesDecodeErrorZ* o_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)untag_ptr(o);
12854         jboolean ret_conv = CResult_InitFeaturesDecodeErrorZ_is_ok(o_conv);
12855         return ret_conv;
12856 }
12857
12858 void  __attribute__((export_name("TS_CResult_InitFeaturesDecodeErrorZ_free"))) TS_CResult_InitFeaturesDecodeErrorZ_free(uint64_t _res) {
12859         if (!ptr_is_owned(_res)) return;
12860         void* _res_ptr = untag_ptr(_res);
12861         CHECK_ACCESS(_res_ptr);
12862         LDKCResult_InitFeaturesDecodeErrorZ _res_conv = *(LDKCResult_InitFeaturesDecodeErrorZ*)(_res_ptr);
12863         FREE(untag_ptr(_res));
12864         CResult_InitFeaturesDecodeErrorZ_free(_res_conv);
12865 }
12866
12867 static inline uint64_t CResult_InitFeaturesDecodeErrorZ_clone_ptr(LDKCResult_InitFeaturesDecodeErrorZ *NONNULL_PTR arg) {
12868         LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
12869         *ret_conv = CResult_InitFeaturesDecodeErrorZ_clone(arg);
12870         return tag_ptr(ret_conv, true);
12871 }
12872 int64_t  __attribute__((export_name("TS_CResult_InitFeaturesDecodeErrorZ_clone_ptr"))) TS_CResult_InitFeaturesDecodeErrorZ_clone_ptr(uint64_t arg) {
12873         LDKCResult_InitFeaturesDecodeErrorZ* arg_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)untag_ptr(arg);
12874         int64_t ret_conv = CResult_InitFeaturesDecodeErrorZ_clone_ptr(arg_conv);
12875         return ret_conv;
12876 }
12877
12878 uint64_t  __attribute__((export_name("TS_CResult_InitFeaturesDecodeErrorZ_clone"))) TS_CResult_InitFeaturesDecodeErrorZ_clone(uint64_t orig) {
12879         LDKCResult_InitFeaturesDecodeErrorZ* orig_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)untag_ptr(orig);
12880         LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
12881         *ret_conv = CResult_InitFeaturesDecodeErrorZ_clone(orig_conv);
12882         return tag_ptr(ret_conv, true);
12883 }
12884
12885 uint64_t  __attribute__((export_name("TS_CResult_ChannelFeaturesDecodeErrorZ_ok"))) TS_CResult_ChannelFeaturesDecodeErrorZ_ok(uint64_t o) {
12886         LDKChannelFeatures o_conv;
12887         o_conv.inner = untag_ptr(o);
12888         o_conv.is_owned = ptr_is_owned(o);
12889         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12890         o_conv = ChannelFeatures_clone(&o_conv);
12891         LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
12892         *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_ok(o_conv);
12893         return tag_ptr(ret_conv, true);
12894 }
12895
12896 uint64_t  __attribute__((export_name("TS_CResult_ChannelFeaturesDecodeErrorZ_err"))) TS_CResult_ChannelFeaturesDecodeErrorZ_err(uint64_t e) {
12897         LDKDecodeError e_conv;
12898         e_conv.inner = untag_ptr(e);
12899         e_conv.is_owned = ptr_is_owned(e);
12900         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
12901         e_conv = DecodeError_clone(&e_conv);
12902         LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
12903         *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_err(e_conv);
12904         return tag_ptr(ret_conv, true);
12905 }
12906
12907 jboolean  __attribute__((export_name("TS_CResult_ChannelFeaturesDecodeErrorZ_is_ok"))) TS_CResult_ChannelFeaturesDecodeErrorZ_is_ok(uint64_t o) {
12908         LDKCResult_ChannelFeaturesDecodeErrorZ* o_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)untag_ptr(o);
12909         jboolean ret_conv = CResult_ChannelFeaturesDecodeErrorZ_is_ok(o_conv);
12910         return ret_conv;
12911 }
12912
12913 void  __attribute__((export_name("TS_CResult_ChannelFeaturesDecodeErrorZ_free"))) TS_CResult_ChannelFeaturesDecodeErrorZ_free(uint64_t _res) {
12914         if (!ptr_is_owned(_res)) return;
12915         void* _res_ptr = untag_ptr(_res);
12916         CHECK_ACCESS(_res_ptr);
12917         LDKCResult_ChannelFeaturesDecodeErrorZ _res_conv = *(LDKCResult_ChannelFeaturesDecodeErrorZ*)(_res_ptr);
12918         FREE(untag_ptr(_res));
12919         CResult_ChannelFeaturesDecodeErrorZ_free(_res_conv);
12920 }
12921
12922 static inline uint64_t CResult_ChannelFeaturesDecodeErrorZ_clone_ptr(LDKCResult_ChannelFeaturesDecodeErrorZ *NONNULL_PTR arg) {
12923         LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
12924         *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_clone(arg);
12925         return tag_ptr(ret_conv, true);
12926 }
12927 int64_t  __attribute__((export_name("TS_CResult_ChannelFeaturesDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelFeaturesDecodeErrorZ_clone_ptr(uint64_t arg) {
12928         LDKCResult_ChannelFeaturesDecodeErrorZ* arg_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)untag_ptr(arg);
12929         int64_t ret_conv = CResult_ChannelFeaturesDecodeErrorZ_clone_ptr(arg_conv);
12930         return ret_conv;
12931 }
12932
12933 uint64_t  __attribute__((export_name("TS_CResult_ChannelFeaturesDecodeErrorZ_clone"))) TS_CResult_ChannelFeaturesDecodeErrorZ_clone(uint64_t orig) {
12934         LDKCResult_ChannelFeaturesDecodeErrorZ* orig_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)untag_ptr(orig);
12935         LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
12936         *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_clone(orig_conv);
12937         return tag_ptr(ret_conv, true);
12938 }
12939
12940 uint64_t  __attribute__((export_name("TS_CResult_NodeFeaturesDecodeErrorZ_ok"))) TS_CResult_NodeFeaturesDecodeErrorZ_ok(uint64_t o) {
12941         LDKNodeFeatures o_conv;
12942         o_conv.inner = untag_ptr(o);
12943         o_conv.is_owned = ptr_is_owned(o);
12944         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12945         o_conv = NodeFeatures_clone(&o_conv);
12946         LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
12947         *ret_conv = CResult_NodeFeaturesDecodeErrorZ_ok(o_conv);
12948         return tag_ptr(ret_conv, true);
12949 }
12950
12951 uint64_t  __attribute__((export_name("TS_CResult_NodeFeaturesDecodeErrorZ_err"))) TS_CResult_NodeFeaturesDecodeErrorZ_err(uint64_t e) {
12952         LDKDecodeError e_conv;
12953         e_conv.inner = untag_ptr(e);
12954         e_conv.is_owned = ptr_is_owned(e);
12955         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
12956         e_conv = DecodeError_clone(&e_conv);
12957         LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
12958         *ret_conv = CResult_NodeFeaturesDecodeErrorZ_err(e_conv);
12959         return tag_ptr(ret_conv, true);
12960 }
12961
12962 jboolean  __attribute__((export_name("TS_CResult_NodeFeaturesDecodeErrorZ_is_ok"))) TS_CResult_NodeFeaturesDecodeErrorZ_is_ok(uint64_t o) {
12963         LDKCResult_NodeFeaturesDecodeErrorZ* o_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)untag_ptr(o);
12964         jboolean ret_conv = CResult_NodeFeaturesDecodeErrorZ_is_ok(o_conv);
12965         return ret_conv;
12966 }
12967
12968 void  __attribute__((export_name("TS_CResult_NodeFeaturesDecodeErrorZ_free"))) TS_CResult_NodeFeaturesDecodeErrorZ_free(uint64_t _res) {
12969         if (!ptr_is_owned(_res)) return;
12970         void* _res_ptr = untag_ptr(_res);
12971         CHECK_ACCESS(_res_ptr);
12972         LDKCResult_NodeFeaturesDecodeErrorZ _res_conv = *(LDKCResult_NodeFeaturesDecodeErrorZ*)(_res_ptr);
12973         FREE(untag_ptr(_res));
12974         CResult_NodeFeaturesDecodeErrorZ_free(_res_conv);
12975 }
12976
12977 static inline uint64_t CResult_NodeFeaturesDecodeErrorZ_clone_ptr(LDKCResult_NodeFeaturesDecodeErrorZ *NONNULL_PTR arg) {
12978         LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
12979         *ret_conv = CResult_NodeFeaturesDecodeErrorZ_clone(arg);
12980         return tag_ptr(ret_conv, true);
12981 }
12982 int64_t  __attribute__((export_name("TS_CResult_NodeFeaturesDecodeErrorZ_clone_ptr"))) TS_CResult_NodeFeaturesDecodeErrorZ_clone_ptr(uint64_t arg) {
12983         LDKCResult_NodeFeaturesDecodeErrorZ* arg_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)untag_ptr(arg);
12984         int64_t ret_conv = CResult_NodeFeaturesDecodeErrorZ_clone_ptr(arg_conv);
12985         return ret_conv;
12986 }
12987
12988 uint64_t  __attribute__((export_name("TS_CResult_NodeFeaturesDecodeErrorZ_clone"))) TS_CResult_NodeFeaturesDecodeErrorZ_clone(uint64_t orig) {
12989         LDKCResult_NodeFeaturesDecodeErrorZ* orig_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)untag_ptr(orig);
12990         LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
12991         *ret_conv = CResult_NodeFeaturesDecodeErrorZ_clone(orig_conv);
12992         return tag_ptr(ret_conv, true);
12993 }
12994
12995 uint64_t  __attribute__((export_name("TS_CResult_InvoiceFeaturesDecodeErrorZ_ok"))) TS_CResult_InvoiceFeaturesDecodeErrorZ_ok(uint64_t o) {
12996         LDKInvoiceFeatures o_conv;
12997         o_conv.inner = untag_ptr(o);
12998         o_conv.is_owned = ptr_is_owned(o);
12999         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13000         o_conv = InvoiceFeatures_clone(&o_conv);
13001         LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
13002         *ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_ok(o_conv);
13003         return tag_ptr(ret_conv, true);
13004 }
13005
13006 uint64_t  __attribute__((export_name("TS_CResult_InvoiceFeaturesDecodeErrorZ_err"))) TS_CResult_InvoiceFeaturesDecodeErrorZ_err(uint64_t e) {
13007         LDKDecodeError e_conv;
13008         e_conv.inner = untag_ptr(e);
13009         e_conv.is_owned = ptr_is_owned(e);
13010         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
13011         e_conv = DecodeError_clone(&e_conv);
13012         LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
13013         *ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_err(e_conv);
13014         return tag_ptr(ret_conv, true);
13015 }
13016
13017 jboolean  __attribute__((export_name("TS_CResult_InvoiceFeaturesDecodeErrorZ_is_ok"))) TS_CResult_InvoiceFeaturesDecodeErrorZ_is_ok(uint64_t o) {
13018         LDKCResult_InvoiceFeaturesDecodeErrorZ* o_conv = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)untag_ptr(o);
13019         jboolean ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_is_ok(o_conv);
13020         return ret_conv;
13021 }
13022
13023 void  __attribute__((export_name("TS_CResult_InvoiceFeaturesDecodeErrorZ_free"))) TS_CResult_InvoiceFeaturesDecodeErrorZ_free(uint64_t _res) {
13024         if (!ptr_is_owned(_res)) return;
13025         void* _res_ptr = untag_ptr(_res);
13026         CHECK_ACCESS(_res_ptr);
13027         LDKCResult_InvoiceFeaturesDecodeErrorZ _res_conv = *(LDKCResult_InvoiceFeaturesDecodeErrorZ*)(_res_ptr);
13028         FREE(untag_ptr(_res));
13029         CResult_InvoiceFeaturesDecodeErrorZ_free(_res_conv);
13030 }
13031
13032 static inline uint64_t CResult_InvoiceFeaturesDecodeErrorZ_clone_ptr(LDKCResult_InvoiceFeaturesDecodeErrorZ *NONNULL_PTR arg) {
13033         LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
13034         *ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_clone(arg);
13035         return tag_ptr(ret_conv, true);
13036 }
13037 int64_t  __attribute__((export_name("TS_CResult_InvoiceFeaturesDecodeErrorZ_clone_ptr"))) TS_CResult_InvoiceFeaturesDecodeErrorZ_clone_ptr(uint64_t arg) {
13038         LDKCResult_InvoiceFeaturesDecodeErrorZ* arg_conv = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)untag_ptr(arg);
13039         int64_t ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_clone_ptr(arg_conv);
13040         return ret_conv;
13041 }
13042
13043 uint64_t  __attribute__((export_name("TS_CResult_InvoiceFeaturesDecodeErrorZ_clone"))) TS_CResult_InvoiceFeaturesDecodeErrorZ_clone(uint64_t orig) {
13044         LDKCResult_InvoiceFeaturesDecodeErrorZ* orig_conv = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)untag_ptr(orig);
13045         LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
13046         *ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_clone(orig_conv);
13047         return tag_ptr(ret_conv, true);
13048 }
13049
13050 uint64_t  __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_ok"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_ok(uint64_t o) {
13051         LDKChannelTypeFeatures o_conv;
13052         o_conv.inner = untag_ptr(o);
13053         o_conv.is_owned = ptr_is_owned(o);
13054         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13055         o_conv = ChannelTypeFeatures_clone(&o_conv);
13056         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
13057         *ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_ok(o_conv);
13058         return tag_ptr(ret_conv, true);
13059 }
13060
13061 uint64_t  __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_err"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_err(uint64_t e) {
13062         LDKDecodeError e_conv;
13063         e_conv.inner = untag_ptr(e);
13064         e_conv.is_owned = ptr_is_owned(e);
13065         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
13066         e_conv = DecodeError_clone(&e_conv);
13067         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
13068         *ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_err(e_conv);
13069         return tag_ptr(ret_conv, true);
13070 }
13071
13072 jboolean  __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_is_ok"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_is_ok(uint64_t o) {
13073         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* o_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)untag_ptr(o);
13074         jboolean ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_is_ok(o_conv);
13075         return ret_conv;
13076 }
13077
13078 void  __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_free"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_free(uint64_t _res) {
13079         if (!ptr_is_owned(_res)) return;
13080         void* _res_ptr = untag_ptr(_res);
13081         CHECK_ACCESS(_res_ptr);
13082         LDKCResult_ChannelTypeFeaturesDecodeErrorZ _res_conv = *(LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)(_res_ptr);
13083         FREE(untag_ptr(_res));
13084         CResult_ChannelTypeFeaturesDecodeErrorZ_free(_res_conv);
13085 }
13086
13087 static inline uint64_t CResult_ChannelTypeFeaturesDecodeErrorZ_clone_ptr(LDKCResult_ChannelTypeFeaturesDecodeErrorZ *NONNULL_PTR arg) {
13088         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
13089         *ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_clone(arg);
13090         return tag_ptr(ret_conv, true);
13091 }
13092 int64_t  __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_clone_ptr(uint64_t arg) {
13093         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* arg_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)untag_ptr(arg);
13094         int64_t ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_clone_ptr(arg_conv);
13095         return ret_conv;
13096 }
13097
13098 uint64_t  __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_clone"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_clone(uint64_t orig) {
13099         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* orig_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)untag_ptr(orig);
13100         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
13101         *ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_clone(orig_conv);
13102         return tag_ptr(ret_conv, true);
13103 }
13104
13105 uint64_t  __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_ok"))) TS_CResult_NodeIdDecodeErrorZ_ok(uint64_t o) {
13106         LDKNodeId o_conv;
13107         o_conv.inner = untag_ptr(o);
13108         o_conv.is_owned = ptr_is_owned(o);
13109         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13110         o_conv = NodeId_clone(&o_conv);
13111         LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
13112         *ret_conv = CResult_NodeIdDecodeErrorZ_ok(o_conv);
13113         return tag_ptr(ret_conv, true);
13114 }
13115
13116 uint64_t  __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_err"))) TS_CResult_NodeIdDecodeErrorZ_err(uint64_t e) {
13117         LDKDecodeError e_conv;
13118         e_conv.inner = untag_ptr(e);
13119         e_conv.is_owned = ptr_is_owned(e);
13120         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
13121         e_conv = DecodeError_clone(&e_conv);
13122         LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
13123         *ret_conv = CResult_NodeIdDecodeErrorZ_err(e_conv);
13124         return tag_ptr(ret_conv, true);
13125 }
13126
13127 jboolean  __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_is_ok"))) TS_CResult_NodeIdDecodeErrorZ_is_ok(uint64_t o) {
13128         LDKCResult_NodeIdDecodeErrorZ* o_conv = (LDKCResult_NodeIdDecodeErrorZ*)untag_ptr(o);
13129         jboolean ret_conv = CResult_NodeIdDecodeErrorZ_is_ok(o_conv);
13130         return ret_conv;
13131 }
13132
13133 void  __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_free"))) TS_CResult_NodeIdDecodeErrorZ_free(uint64_t _res) {
13134         if (!ptr_is_owned(_res)) return;
13135         void* _res_ptr = untag_ptr(_res);
13136         CHECK_ACCESS(_res_ptr);
13137         LDKCResult_NodeIdDecodeErrorZ _res_conv = *(LDKCResult_NodeIdDecodeErrorZ*)(_res_ptr);
13138         FREE(untag_ptr(_res));
13139         CResult_NodeIdDecodeErrorZ_free(_res_conv);
13140 }
13141
13142 static inline uint64_t CResult_NodeIdDecodeErrorZ_clone_ptr(LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR arg) {
13143         LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
13144         *ret_conv = CResult_NodeIdDecodeErrorZ_clone(arg);
13145         return tag_ptr(ret_conv, true);
13146 }
13147 int64_t  __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_clone_ptr"))) TS_CResult_NodeIdDecodeErrorZ_clone_ptr(uint64_t arg) {
13148         LDKCResult_NodeIdDecodeErrorZ* arg_conv = (LDKCResult_NodeIdDecodeErrorZ*)untag_ptr(arg);
13149         int64_t ret_conv = CResult_NodeIdDecodeErrorZ_clone_ptr(arg_conv);
13150         return ret_conv;
13151 }
13152
13153 uint64_t  __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_clone"))) TS_CResult_NodeIdDecodeErrorZ_clone(uint64_t orig) {
13154         LDKCResult_NodeIdDecodeErrorZ* orig_conv = (LDKCResult_NodeIdDecodeErrorZ*)untag_ptr(orig);
13155         LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
13156         *ret_conv = CResult_NodeIdDecodeErrorZ_clone(orig_conv);
13157         return tag_ptr(ret_conv, true);
13158 }
13159
13160 uint64_t  __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_ok"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_ok(uint64_t o) {
13161         void* o_ptr = untag_ptr(o);
13162         CHECK_ACCESS(o_ptr);
13163         LDKCOption_NetworkUpdateZ o_conv = *(LDKCOption_NetworkUpdateZ*)(o_ptr);
13164         o_conv = COption_NetworkUpdateZ_clone((LDKCOption_NetworkUpdateZ*)untag_ptr(o));
13165         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
13166         *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_ok(o_conv);
13167         return tag_ptr(ret_conv, true);
13168 }
13169
13170 uint64_t  __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_err"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_err(uint64_t e) {
13171         LDKDecodeError e_conv;
13172         e_conv.inner = untag_ptr(e);
13173         e_conv.is_owned = ptr_is_owned(e);
13174         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
13175         e_conv = DecodeError_clone(&e_conv);
13176         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
13177         *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_err(e_conv);
13178         return tag_ptr(ret_conv, true);
13179 }
13180
13181 jboolean  __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_is_ok"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_is_ok(uint64_t o) {
13182         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* o_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)untag_ptr(o);
13183         jboolean ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_is_ok(o_conv);
13184         return ret_conv;
13185 }
13186
13187 void  __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_free"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_free(uint64_t _res) {
13188         if (!ptr_is_owned(_res)) return;
13189         void* _res_ptr = untag_ptr(_res);
13190         CHECK_ACCESS(_res_ptr);
13191         LDKCResult_COption_NetworkUpdateZDecodeErrorZ _res_conv = *(LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)(_res_ptr);
13192         FREE(untag_ptr(_res));
13193         CResult_COption_NetworkUpdateZDecodeErrorZ_free(_res_conv);
13194 }
13195
13196 static inline uint64_t CResult_COption_NetworkUpdateZDecodeErrorZ_clone_ptr(LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR arg) {
13197         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
13198         *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_clone(arg);
13199         return tag_ptr(ret_conv, true);
13200 }
13201 int64_t  __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_clone_ptr"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_clone_ptr(uint64_t arg) {
13202         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* arg_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)untag_ptr(arg);
13203         int64_t ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_clone_ptr(arg_conv);
13204         return ret_conv;
13205 }
13206
13207 uint64_t  __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_clone"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_clone(uint64_t orig) {
13208         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* orig_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)untag_ptr(orig);
13209         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
13210         *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_clone(orig_conv);
13211         return tag_ptr(ret_conv, true);
13212 }
13213
13214 uint64_t  __attribute__((export_name("TS_COption_AccessZ_some"))) TS_COption_AccessZ_some(uint64_t o) {
13215         void* o_ptr = untag_ptr(o);
13216         CHECK_ACCESS(o_ptr);
13217         LDKAccess o_conv = *(LDKAccess*)(o_ptr);
13218         if (o_conv.free == LDKAccess_JCalls_free) {
13219                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
13220                 LDKAccess_JCalls_cloned(&o_conv);
13221         }
13222         LDKCOption_AccessZ *ret_copy = MALLOC(sizeof(LDKCOption_AccessZ), "LDKCOption_AccessZ");
13223         *ret_copy = COption_AccessZ_some(o_conv);
13224         uint64_t ret_ref = tag_ptr(ret_copy, true);
13225         return ret_ref;
13226 }
13227
13228 uint64_t  __attribute__((export_name("TS_COption_AccessZ_none"))) TS_COption_AccessZ_none() {
13229         LDKCOption_AccessZ *ret_copy = MALLOC(sizeof(LDKCOption_AccessZ), "LDKCOption_AccessZ");
13230         *ret_copy = COption_AccessZ_none();
13231         uint64_t ret_ref = tag_ptr(ret_copy, true);
13232         return ret_ref;
13233 }
13234
13235 void  __attribute__((export_name("TS_COption_AccessZ_free"))) TS_COption_AccessZ_free(uint64_t _res) {
13236         if (!ptr_is_owned(_res)) return;
13237         void* _res_ptr = untag_ptr(_res);
13238         CHECK_ACCESS(_res_ptr);
13239         LDKCOption_AccessZ _res_conv = *(LDKCOption_AccessZ*)(_res_ptr);
13240         FREE(untag_ptr(_res));
13241         COption_AccessZ_free(_res_conv);
13242 }
13243
13244 uint64_t  __attribute__((export_name("TS_CResult_boolLightningErrorZ_ok"))) TS_CResult_boolLightningErrorZ_ok(jboolean o) {
13245         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
13246         *ret_conv = CResult_boolLightningErrorZ_ok(o);
13247         return tag_ptr(ret_conv, true);
13248 }
13249
13250 uint64_t  __attribute__((export_name("TS_CResult_boolLightningErrorZ_err"))) TS_CResult_boolLightningErrorZ_err(uint64_t e) {
13251         LDKLightningError e_conv;
13252         e_conv.inner = untag_ptr(e);
13253         e_conv.is_owned = ptr_is_owned(e);
13254         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
13255         e_conv = LightningError_clone(&e_conv);
13256         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
13257         *ret_conv = CResult_boolLightningErrorZ_err(e_conv);
13258         return tag_ptr(ret_conv, true);
13259 }
13260
13261 jboolean  __attribute__((export_name("TS_CResult_boolLightningErrorZ_is_ok"))) TS_CResult_boolLightningErrorZ_is_ok(uint64_t o) {
13262         LDKCResult_boolLightningErrorZ* o_conv = (LDKCResult_boolLightningErrorZ*)untag_ptr(o);
13263         jboolean ret_conv = CResult_boolLightningErrorZ_is_ok(o_conv);
13264         return ret_conv;
13265 }
13266
13267 void  __attribute__((export_name("TS_CResult_boolLightningErrorZ_free"))) TS_CResult_boolLightningErrorZ_free(uint64_t _res) {
13268         if (!ptr_is_owned(_res)) return;
13269         void* _res_ptr = untag_ptr(_res);
13270         CHECK_ACCESS(_res_ptr);
13271         LDKCResult_boolLightningErrorZ _res_conv = *(LDKCResult_boolLightningErrorZ*)(_res_ptr);
13272         FREE(untag_ptr(_res));
13273         CResult_boolLightningErrorZ_free(_res_conv);
13274 }
13275
13276 static inline uint64_t CResult_boolLightningErrorZ_clone_ptr(LDKCResult_boolLightningErrorZ *NONNULL_PTR arg) {
13277         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
13278         *ret_conv = CResult_boolLightningErrorZ_clone(arg);
13279         return tag_ptr(ret_conv, true);
13280 }
13281 int64_t  __attribute__((export_name("TS_CResult_boolLightningErrorZ_clone_ptr"))) TS_CResult_boolLightningErrorZ_clone_ptr(uint64_t arg) {
13282         LDKCResult_boolLightningErrorZ* arg_conv = (LDKCResult_boolLightningErrorZ*)untag_ptr(arg);
13283         int64_t ret_conv = CResult_boolLightningErrorZ_clone_ptr(arg_conv);
13284         return ret_conv;
13285 }
13286
13287 uint64_t  __attribute__((export_name("TS_CResult_boolLightningErrorZ_clone"))) TS_CResult_boolLightningErrorZ_clone(uint64_t orig) {
13288         LDKCResult_boolLightningErrorZ* orig_conv = (LDKCResult_boolLightningErrorZ*)untag_ptr(orig);
13289         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
13290         *ret_conv = CResult_boolLightningErrorZ_clone(orig_conv);
13291         return tag_ptr(ret_conv, true);
13292 }
13293
13294 static inline uint64_t C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone_ptr(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR arg) {
13295         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
13296         *ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(arg);
13297         return tag_ptr(ret_conv, true);
13298 }
13299 int64_t  __attribute__((export_name("TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone_ptr"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone_ptr(uint64_t arg) {
13300         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* arg_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(arg);
13301         int64_t ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone_ptr(arg_conv);
13302         return ret_conv;
13303 }
13304
13305 uint64_t  __attribute__((export_name("TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(uint64_t orig) {
13306         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* orig_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(orig);
13307         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
13308         *ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(orig_conv);
13309         return tag_ptr(ret_conv, true);
13310 }
13311
13312 uint64_t  __attribute__((export_name("TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(uint64_t a, uint64_t b, uint64_t c) {
13313         LDKChannelAnnouncement a_conv;
13314         a_conv.inner = untag_ptr(a);
13315         a_conv.is_owned = ptr_is_owned(a);
13316         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
13317         a_conv = ChannelAnnouncement_clone(&a_conv);
13318         LDKChannelUpdate b_conv;
13319         b_conv.inner = untag_ptr(b);
13320         b_conv.is_owned = ptr_is_owned(b);
13321         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
13322         b_conv = ChannelUpdate_clone(&b_conv);
13323         LDKChannelUpdate c_conv;
13324         c_conv.inner = untag_ptr(c);
13325         c_conv.is_owned = ptr_is_owned(c);
13326         CHECK_INNER_FIELD_ACCESS_OR_NULL(c_conv);
13327         c_conv = ChannelUpdate_clone(&c_conv);
13328         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
13329         *ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(a_conv, b_conv, c_conv);
13330         return tag_ptr(ret_conv, true);
13331 }
13332
13333 void  __attribute__((export_name("TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(uint64_t _res) {
13334         if (!ptr_is_owned(_res)) return;
13335         void* _res_ptr = untag_ptr(_res);
13336         CHECK_ACCESS(_res_ptr);
13337         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ _res_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(_res_ptr);
13338         FREE(untag_ptr(_res));
13339         C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(_res_conv);
13340 }
13341
13342 void  __attribute__((export_name("TS_CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free"))) TS_CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(uint64_tArray _res) {
13343         LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ _res_constr;
13344         _res_constr.datalen = _res->arr_len;
13345         if (_res_constr.datalen > 0)
13346                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ Elements");
13347         else
13348                 _res_constr.data = NULL;
13349         uint64_t* _res_vals = _res->elems;
13350         for (size_t h = 0; h < _res_constr.datalen; h++) {
13351                 uint64_t _res_conv_59 = _res_vals[h];
13352                 void* _res_conv_59_ptr = untag_ptr(_res_conv_59);
13353                 CHECK_ACCESS(_res_conv_59_ptr);
13354                 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ _res_conv_59_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(_res_conv_59_ptr);
13355                 FREE(untag_ptr(_res_conv_59));
13356                 _res_constr.data[h] = _res_conv_59_conv;
13357         }
13358         FREE(_res);
13359         CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(_res_constr);
13360 }
13361
13362 void  __attribute__((export_name("TS_CVec_NodeAnnouncementZ_free"))) TS_CVec_NodeAnnouncementZ_free(uint64_tArray _res) {
13363         LDKCVec_NodeAnnouncementZ _res_constr;
13364         _res_constr.datalen = _res->arr_len;
13365         if (_res_constr.datalen > 0)
13366                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKNodeAnnouncement), "LDKCVec_NodeAnnouncementZ Elements");
13367         else
13368                 _res_constr.data = NULL;
13369         uint64_t* _res_vals = _res->elems;
13370         for (size_t s = 0; s < _res_constr.datalen; s++) {
13371                 uint64_t _res_conv_18 = _res_vals[s];
13372                 LDKNodeAnnouncement _res_conv_18_conv;
13373                 _res_conv_18_conv.inner = untag_ptr(_res_conv_18);
13374                 _res_conv_18_conv.is_owned = ptr_is_owned(_res_conv_18);
13375                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_18_conv);
13376                 _res_constr.data[s] = _res_conv_18_conv;
13377         }
13378         FREE(_res);
13379         CVec_NodeAnnouncementZ_free(_res_constr);
13380 }
13381
13382 uint64_t  __attribute__((export_name("TS_CResult_NoneLightningErrorZ_ok"))) TS_CResult_NoneLightningErrorZ_ok() {
13383         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
13384         *ret_conv = CResult_NoneLightningErrorZ_ok();
13385         return tag_ptr(ret_conv, true);
13386 }
13387
13388 uint64_t  __attribute__((export_name("TS_CResult_NoneLightningErrorZ_err"))) TS_CResult_NoneLightningErrorZ_err(uint64_t e) {
13389         LDKLightningError e_conv;
13390         e_conv.inner = untag_ptr(e);
13391         e_conv.is_owned = ptr_is_owned(e);
13392         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
13393         e_conv = LightningError_clone(&e_conv);
13394         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
13395         *ret_conv = CResult_NoneLightningErrorZ_err(e_conv);
13396         return tag_ptr(ret_conv, true);
13397 }
13398
13399 jboolean  __attribute__((export_name("TS_CResult_NoneLightningErrorZ_is_ok"))) TS_CResult_NoneLightningErrorZ_is_ok(uint64_t o) {
13400         LDKCResult_NoneLightningErrorZ* o_conv = (LDKCResult_NoneLightningErrorZ*)untag_ptr(o);
13401         jboolean ret_conv = CResult_NoneLightningErrorZ_is_ok(o_conv);
13402         return ret_conv;
13403 }
13404
13405 void  __attribute__((export_name("TS_CResult_NoneLightningErrorZ_free"))) TS_CResult_NoneLightningErrorZ_free(uint64_t _res) {
13406         if (!ptr_is_owned(_res)) return;
13407         void* _res_ptr = untag_ptr(_res);
13408         CHECK_ACCESS(_res_ptr);
13409         LDKCResult_NoneLightningErrorZ _res_conv = *(LDKCResult_NoneLightningErrorZ*)(_res_ptr);
13410         FREE(untag_ptr(_res));
13411         CResult_NoneLightningErrorZ_free(_res_conv);
13412 }
13413
13414 static inline uint64_t CResult_NoneLightningErrorZ_clone_ptr(LDKCResult_NoneLightningErrorZ *NONNULL_PTR arg) {
13415         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
13416         *ret_conv = CResult_NoneLightningErrorZ_clone(arg);
13417         return tag_ptr(ret_conv, true);
13418 }
13419 int64_t  __attribute__((export_name("TS_CResult_NoneLightningErrorZ_clone_ptr"))) TS_CResult_NoneLightningErrorZ_clone_ptr(uint64_t arg) {
13420         LDKCResult_NoneLightningErrorZ* arg_conv = (LDKCResult_NoneLightningErrorZ*)untag_ptr(arg);
13421         int64_t ret_conv = CResult_NoneLightningErrorZ_clone_ptr(arg_conv);
13422         return ret_conv;
13423 }
13424
13425 uint64_t  __attribute__((export_name("TS_CResult_NoneLightningErrorZ_clone"))) TS_CResult_NoneLightningErrorZ_clone(uint64_t orig) {
13426         LDKCResult_NoneLightningErrorZ* orig_conv = (LDKCResult_NoneLightningErrorZ*)untag_ptr(orig);
13427         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
13428         *ret_conv = CResult_NoneLightningErrorZ_clone(orig_conv);
13429         return tag_ptr(ret_conv, true);
13430 }
13431
13432 uint64_t  __attribute__((export_name("TS_CResult_ChannelUpdateInfoDecodeErrorZ_ok"))) TS_CResult_ChannelUpdateInfoDecodeErrorZ_ok(uint64_t o) {
13433         LDKChannelUpdateInfo o_conv;
13434         o_conv.inner = untag_ptr(o);
13435         o_conv.is_owned = ptr_is_owned(o);
13436         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13437         o_conv = ChannelUpdateInfo_clone(&o_conv);
13438         LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
13439         *ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_ok(o_conv);
13440         return tag_ptr(ret_conv, true);
13441 }
13442
13443 uint64_t  __attribute__((export_name("TS_CResult_ChannelUpdateInfoDecodeErrorZ_err"))) TS_CResult_ChannelUpdateInfoDecodeErrorZ_err(uint64_t e) {
13444         LDKDecodeError e_conv;
13445         e_conv.inner = untag_ptr(e);
13446         e_conv.is_owned = ptr_is_owned(e);
13447         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
13448         e_conv = DecodeError_clone(&e_conv);
13449         LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
13450         *ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_err(e_conv);
13451         return tag_ptr(ret_conv, true);
13452 }
13453
13454 jboolean  __attribute__((export_name("TS_CResult_ChannelUpdateInfoDecodeErrorZ_is_ok"))) TS_CResult_ChannelUpdateInfoDecodeErrorZ_is_ok(uint64_t o) {
13455         LDKCResult_ChannelUpdateInfoDecodeErrorZ* o_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)untag_ptr(o);
13456         jboolean ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_is_ok(o_conv);
13457         return ret_conv;
13458 }
13459
13460 void  __attribute__((export_name("TS_CResult_ChannelUpdateInfoDecodeErrorZ_free"))) TS_CResult_ChannelUpdateInfoDecodeErrorZ_free(uint64_t _res) {
13461         if (!ptr_is_owned(_res)) return;
13462         void* _res_ptr = untag_ptr(_res);
13463         CHECK_ACCESS(_res_ptr);
13464         LDKCResult_ChannelUpdateInfoDecodeErrorZ _res_conv = *(LDKCResult_ChannelUpdateInfoDecodeErrorZ*)(_res_ptr);
13465         FREE(untag_ptr(_res));
13466         CResult_ChannelUpdateInfoDecodeErrorZ_free(_res_conv);
13467 }
13468
13469 static inline uint64_t CResult_ChannelUpdateInfoDecodeErrorZ_clone_ptr(LDKCResult_ChannelUpdateInfoDecodeErrorZ *NONNULL_PTR arg) {
13470         LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
13471         *ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_clone(arg);
13472         return tag_ptr(ret_conv, true);
13473 }
13474 int64_t  __attribute__((export_name("TS_CResult_ChannelUpdateInfoDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelUpdateInfoDecodeErrorZ_clone_ptr(uint64_t arg) {
13475         LDKCResult_ChannelUpdateInfoDecodeErrorZ* arg_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)untag_ptr(arg);
13476         int64_t ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_clone_ptr(arg_conv);
13477         return ret_conv;
13478 }
13479
13480 uint64_t  __attribute__((export_name("TS_CResult_ChannelUpdateInfoDecodeErrorZ_clone"))) TS_CResult_ChannelUpdateInfoDecodeErrorZ_clone(uint64_t orig) {
13481         LDKCResult_ChannelUpdateInfoDecodeErrorZ* orig_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)untag_ptr(orig);
13482         LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
13483         *ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_clone(orig_conv);
13484         return tag_ptr(ret_conv, true);
13485 }
13486
13487 uint64_t  __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_ok"))) TS_CResult_ChannelInfoDecodeErrorZ_ok(uint64_t o) {
13488         LDKChannelInfo o_conv;
13489         o_conv.inner = untag_ptr(o);
13490         o_conv.is_owned = ptr_is_owned(o);
13491         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13492         o_conv = ChannelInfo_clone(&o_conv);
13493         LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
13494         *ret_conv = CResult_ChannelInfoDecodeErrorZ_ok(o_conv);
13495         return tag_ptr(ret_conv, true);
13496 }
13497
13498 uint64_t  __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_err"))) TS_CResult_ChannelInfoDecodeErrorZ_err(uint64_t e) {
13499         LDKDecodeError e_conv;
13500         e_conv.inner = untag_ptr(e);
13501         e_conv.is_owned = ptr_is_owned(e);
13502         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
13503         e_conv = DecodeError_clone(&e_conv);
13504         LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
13505         *ret_conv = CResult_ChannelInfoDecodeErrorZ_err(e_conv);
13506         return tag_ptr(ret_conv, true);
13507 }
13508
13509 jboolean  __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_is_ok"))) TS_CResult_ChannelInfoDecodeErrorZ_is_ok(uint64_t o) {
13510         LDKCResult_ChannelInfoDecodeErrorZ* o_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)untag_ptr(o);
13511         jboolean ret_conv = CResult_ChannelInfoDecodeErrorZ_is_ok(o_conv);
13512         return ret_conv;
13513 }
13514
13515 void  __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_free"))) TS_CResult_ChannelInfoDecodeErrorZ_free(uint64_t _res) {
13516         if (!ptr_is_owned(_res)) return;
13517         void* _res_ptr = untag_ptr(_res);
13518         CHECK_ACCESS(_res_ptr);
13519         LDKCResult_ChannelInfoDecodeErrorZ _res_conv = *(LDKCResult_ChannelInfoDecodeErrorZ*)(_res_ptr);
13520         FREE(untag_ptr(_res));
13521         CResult_ChannelInfoDecodeErrorZ_free(_res_conv);
13522 }
13523
13524 static inline uint64_t CResult_ChannelInfoDecodeErrorZ_clone_ptr(LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR arg) {
13525         LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
13526         *ret_conv = CResult_ChannelInfoDecodeErrorZ_clone(arg);
13527         return tag_ptr(ret_conv, true);
13528 }
13529 int64_t  __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelInfoDecodeErrorZ_clone_ptr(uint64_t arg) {
13530         LDKCResult_ChannelInfoDecodeErrorZ* arg_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)untag_ptr(arg);
13531         int64_t ret_conv = CResult_ChannelInfoDecodeErrorZ_clone_ptr(arg_conv);
13532         return ret_conv;
13533 }
13534
13535 uint64_t  __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_clone"))) TS_CResult_ChannelInfoDecodeErrorZ_clone(uint64_t orig) {
13536         LDKCResult_ChannelInfoDecodeErrorZ* orig_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)untag_ptr(orig);
13537         LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
13538         *ret_conv = CResult_ChannelInfoDecodeErrorZ_clone(orig_conv);
13539         return tag_ptr(ret_conv, true);
13540 }
13541
13542 uint64_t  __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_ok"))) TS_CResult_RoutingFeesDecodeErrorZ_ok(uint64_t o) {
13543         LDKRoutingFees o_conv;
13544         o_conv.inner = untag_ptr(o);
13545         o_conv.is_owned = ptr_is_owned(o);
13546         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13547         o_conv = RoutingFees_clone(&o_conv);
13548         LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
13549         *ret_conv = CResult_RoutingFeesDecodeErrorZ_ok(o_conv);
13550         return tag_ptr(ret_conv, true);
13551 }
13552
13553 uint64_t  __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_err"))) TS_CResult_RoutingFeesDecodeErrorZ_err(uint64_t e) {
13554         LDKDecodeError e_conv;
13555         e_conv.inner = untag_ptr(e);
13556         e_conv.is_owned = ptr_is_owned(e);
13557         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
13558         e_conv = DecodeError_clone(&e_conv);
13559         LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
13560         *ret_conv = CResult_RoutingFeesDecodeErrorZ_err(e_conv);
13561         return tag_ptr(ret_conv, true);
13562 }
13563
13564 jboolean  __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_is_ok"))) TS_CResult_RoutingFeesDecodeErrorZ_is_ok(uint64_t o) {
13565         LDKCResult_RoutingFeesDecodeErrorZ* o_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)untag_ptr(o);
13566         jboolean ret_conv = CResult_RoutingFeesDecodeErrorZ_is_ok(o_conv);
13567         return ret_conv;
13568 }
13569
13570 void  __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_free"))) TS_CResult_RoutingFeesDecodeErrorZ_free(uint64_t _res) {
13571         if (!ptr_is_owned(_res)) return;
13572         void* _res_ptr = untag_ptr(_res);
13573         CHECK_ACCESS(_res_ptr);
13574         LDKCResult_RoutingFeesDecodeErrorZ _res_conv = *(LDKCResult_RoutingFeesDecodeErrorZ*)(_res_ptr);
13575         FREE(untag_ptr(_res));
13576         CResult_RoutingFeesDecodeErrorZ_free(_res_conv);
13577 }
13578
13579 static inline uint64_t CResult_RoutingFeesDecodeErrorZ_clone_ptr(LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR arg) {
13580         LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
13581         *ret_conv = CResult_RoutingFeesDecodeErrorZ_clone(arg);
13582         return tag_ptr(ret_conv, true);
13583 }
13584 int64_t  __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_clone_ptr"))) TS_CResult_RoutingFeesDecodeErrorZ_clone_ptr(uint64_t arg) {
13585         LDKCResult_RoutingFeesDecodeErrorZ* arg_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)untag_ptr(arg);
13586         int64_t ret_conv = CResult_RoutingFeesDecodeErrorZ_clone_ptr(arg_conv);
13587         return ret_conv;
13588 }
13589
13590 uint64_t  __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_clone"))) TS_CResult_RoutingFeesDecodeErrorZ_clone(uint64_t orig) {
13591         LDKCResult_RoutingFeesDecodeErrorZ* orig_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)untag_ptr(orig);
13592         LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
13593         *ret_conv = CResult_RoutingFeesDecodeErrorZ_clone(orig_conv);
13594         return tag_ptr(ret_conv, true);
13595 }
13596
13597 void  __attribute__((export_name("TS_CVec_NetAddressZ_free"))) TS_CVec_NetAddressZ_free(uint64_tArray _res) {
13598         LDKCVec_NetAddressZ _res_constr;
13599         _res_constr.datalen = _res->arr_len;
13600         if (_res_constr.datalen > 0)
13601                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
13602         else
13603                 _res_constr.data = NULL;
13604         uint64_t* _res_vals = _res->elems;
13605         for (size_t m = 0; m < _res_constr.datalen; m++) {
13606                 uint64_t _res_conv_12 = _res_vals[m];
13607                 void* _res_conv_12_ptr = untag_ptr(_res_conv_12);
13608                 CHECK_ACCESS(_res_conv_12_ptr);
13609                 LDKNetAddress _res_conv_12_conv = *(LDKNetAddress*)(_res_conv_12_ptr);
13610                 FREE(untag_ptr(_res_conv_12));
13611                 _res_constr.data[m] = _res_conv_12_conv;
13612         }
13613         FREE(_res);
13614         CVec_NetAddressZ_free(_res_constr);
13615 }
13616
13617 uint64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_ok"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_ok(uint64_t o) {
13618         LDKNodeAnnouncementInfo o_conv;
13619         o_conv.inner = untag_ptr(o);
13620         o_conv.is_owned = ptr_is_owned(o);
13621         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13622         o_conv = NodeAnnouncementInfo_clone(&o_conv);
13623         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
13624         *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_ok(o_conv);
13625         return tag_ptr(ret_conv, true);
13626 }
13627
13628 uint64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_err"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_err(uint64_t e) {
13629         LDKDecodeError e_conv;
13630         e_conv.inner = untag_ptr(e);
13631         e_conv.is_owned = ptr_is_owned(e);
13632         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
13633         e_conv = DecodeError_clone(&e_conv);
13634         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
13635         *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_err(e_conv);
13636         return tag_ptr(ret_conv, true);
13637 }
13638
13639 jboolean  __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_is_ok"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_is_ok(uint64_t o) {
13640         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* o_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)untag_ptr(o);
13641         jboolean ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_is_ok(o_conv);
13642         return ret_conv;
13643 }
13644
13645 void  __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_free"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_free(uint64_t _res) {
13646         if (!ptr_is_owned(_res)) return;
13647         void* _res_ptr = untag_ptr(_res);
13648         CHECK_ACCESS(_res_ptr);
13649         LDKCResult_NodeAnnouncementInfoDecodeErrorZ _res_conv = *(LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(_res_ptr);
13650         FREE(untag_ptr(_res));
13651         CResult_NodeAnnouncementInfoDecodeErrorZ_free(_res_conv);
13652 }
13653
13654 static inline uint64_t CResult_NodeAnnouncementInfoDecodeErrorZ_clone_ptr(LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR arg) {
13655         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
13656         *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_clone(arg);
13657         return tag_ptr(ret_conv, true);
13658 }
13659 int64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_clone_ptr"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_clone_ptr(uint64_t arg) {
13660         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* arg_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)untag_ptr(arg);
13661         int64_t ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_clone_ptr(arg_conv);
13662         return ret_conv;
13663 }
13664
13665 uint64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_clone"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_clone(uint64_t orig) {
13666         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* orig_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)untag_ptr(orig);
13667         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
13668         *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_clone(orig_conv);
13669         return tag_ptr(ret_conv, true);
13670 }
13671
13672 uint64_t  __attribute__((export_name("TS_CResult_NodeAliasDecodeErrorZ_ok"))) TS_CResult_NodeAliasDecodeErrorZ_ok(uint64_t o) {
13673         LDKNodeAlias o_conv;
13674         o_conv.inner = untag_ptr(o);
13675         o_conv.is_owned = ptr_is_owned(o);
13676         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13677         o_conv = NodeAlias_clone(&o_conv);
13678         LDKCResult_NodeAliasDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAliasDecodeErrorZ), "LDKCResult_NodeAliasDecodeErrorZ");
13679         *ret_conv = CResult_NodeAliasDecodeErrorZ_ok(o_conv);
13680         return tag_ptr(ret_conv, true);
13681 }
13682
13683 uint64_t  __attribute__((export_name("TS_CResult_NodeAliasDecodeErrorZ_err"))) TS_CResult_NodeAliasDecodeErrorZ_err(uint64_t e) {
13684         LDKDecodeError e_conv;
13685         e_conv.inner = untag_ptr(e);
13686         e_conv.is_owned = ptr_is_owned(e);
13687         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
13688         e_conv = DecodeError_clone(&e_conv);
13689         LDKCResult_NodeAliasDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAliasDecodeErrorZ), "LDKCResult_NodeAliasDecodeErrorZ");
13690         *ret_conv = CResult_NodeAliasDecodeErrorZ_err(e_conv);
13691         return tag_ptr(ret_conv, true);
13692 }
13693
13694 jboolean  __attribute__((export_name("TS_CResult_NodeAliasDecodeErrorZ_is_ok"))) TS_CResult_NodeAliasDecodeErrorZ_is_ok(uint64_t o) {
13695         LDKCResult_NodeAliasDecodeErrorZ* o_conv = (LDKCResult_NodeAliasDecodeErrorZ*)untag_ptr(o);
13696         jboolean ret_conv = CResult_NodeAliasDecodeErrorZ_is_ok(o_conv);
13697         return ret_conv;
13698 }
13699
13700 void  __attribute__((export_name("TS_CResult_NodeAliasDecodeErrorZ_free"))) TS_CResult_NodeAliasDecodeErrorZ_free(uint64_t _res) {
13701         if (!ptr_is_owned(_res)) return;
13702         void* _res_ptr = untag_ptr(_res);
13703         CHECK_ACCESS(_res_ptr);
13704         LDKCResult_NodeAliasDecodeErrorZ _res_conv = *(LDKCResult_NodeAliasDecodeErrorZ*)(_res_ptr);
13705         FREE(untag_ptr(_res));
13706         CResult_NodeAliasDecodeErrorZ_free(_res_conv);
13707 }
13708
13709 static inline uint64_t CResult_NodeAliasDecodeErrorZ_clone_ptr(LDKCResult_NodeAliasDecodeErrorZ *NONNULL_PTR arg) {
13710         LDKCResult_NodeAliasDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAliasDecodeErrorZ), "LDKCResult_NodeAliasDecodeErrorZ");
13711         *ret_conv = CResult_NodeAliasDecodeErrorZ_clone(arg);
13712         return tag_ptr(ret_conv, true);
13713 }
13714 int64_t  __attribute__((export_name("TS_CResult_NodeAliasDecodeErrorZ_clone_ptr"))) TS_CResult_NodeAliasDecodeErrorZ_clone_ptr(uint64_t arg) {
13715         LDKCResult_NodeAliasDecodeErrorZ* arg_conv = (LDKCResult_NodeAliasDecodeErrorZ*)untag_ptr(arg);
13716         int64_t ret_conv = CResult_NodeAliasDecodeErrorZ_clone_ptr(arg_conv);
13717         return ret_conv;
13718 }
13719
13720 uint64_t  __attribute__((export_name("TS_CResult_NodeAliasDecodeErrorZ_clone"))) TS_CResult_NodeAliasDecodeErrorZ_clone(uint64_t orig) {
13721         LDKCResult_NodeAliasDecodeErrorZ* orig_conv = (LDKCResult_NodeAliasDecodeErrorZ*)untag_ptr(orig);
13722         LDKCResult_NodeAliasDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAliasDecodeErrorZ), "LDKCResult_NodeAliasDecodeErrorZ");
13723         *ret_conv = CResult_NodeAliasDecodeErrorZ_clone(orig_conv);
13724         return tag_ptr(ret_conv, true);
13725 }
13726
13727 uint64_t  __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_ok"))) TS_CResult_NodeInfoDecodeErrorZ_ok(uint64_t o) {
13728         LDKNodeInfo o_conv;
13729         o_conv.inner = untag_ptr(o);
13730         o_conv.is_owned = ptr_is_owned(o);
13731         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13732         o_conv = NodeInfo_clone(&o_conv);
13733         LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
13734         *ret_conv = CResult_NodeInfoDecodeErrorZ_ok(o_conv);
13735         return tag_ptr(ret_conv, true);
13736 }
13737
13738 uint64_t  __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_err"))) TS_CResult_NodeInfoDecodeErrorZ_err(uint64_t e) {
13739         LDKDecodeError e_conv;
13740         e_conv.inner = untag_ptr(e);
13741         e_conv.is_owned = ptr_is_owned(e);
13742         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
13743         e_conv = DecodeError_clone(&e_conv);
13744         LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
13745         *ret_conv = CResult_NodeInfoDecodeErrorZ_err(e_conv);
13746         return tag_ptr(ret_conv, true);
13747 }
13748
13749 jboolean  __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_is_ok"))) TS_CResult_NodeInfoDecodeErrorZ_is_ok(uint64_t o) {
13750         LDKCResult_NodeInfoDecodeErrorZ* o_conv = (LDKCResult_NodeInfoDecodeErrorZ*)untag_ptr(o);
13751         jboolean ret_conv = CResult_NodeInfoDecodeErrorZ_is_ok(o_conv);
13752         return ret_conv;
13753 }
13754
13755 void  __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_free"))) TS_CResult_NodeInfoDecodeErrorZ_free(uint64_t _res) {
13756         if (!ptr_is_owned(_res)) return;
13757         void* _res_ptr = untag_ptr(_res);
13758         CHECK_ACCESS(_res_ptr);
13759         LDKCResult_NodeInfoDecodeErrorZ _res_conv = *(LDKCResult_NodeInfoDecodeErrorZ*)(_res_ptr);
13760         FREE(untag_ptr(_res));
13761         CResult_NodeInfoDecodeErrorZ_free(_res_conv);
13762 }
13763
13764 static inline uint64_t CResult_NodeInfoDecodeErrorZ_clone_ptr(LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR arg) {
13765         LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
13766         *ret_conv = CResult_NodeInfoDecodeErrorZ_clone(arg);
13767         return tag_ptr(ret_conv, true);
13768 }
13769 int64_t  __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_clone_ptr"))) TS_CResult_NodeInfoDecodeErrorZ_clone_ptr(uint64_t arg) {
13770         LDKCResult_NodeInfoDecodeErrorZ* arg_conv = (LDKCResult_NodeInfoDecodeErrorZ*)untag_ptr(arg);
13771         int64_t ret_conv = CResult_NodeInfoDecodeErrorZ_clone_ptr(arg_conv);
13772         return ret_conv;
13773 }
13774
13775 uint64_t  __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_clone"))) TS_CResult_NodeInfoDecodeErrorZ_clone(uint64_t orig) {
13776         LDKCResult_NodeInfoDecodeErrorZ* orig_conv = (LDKCResult_NodeInfoDecodeErrorZ*)untag_ptr(orig);
13777         LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
13778         *ret_conv = CResult_NodeInfoDecodeErrorZ_clone(orig_conv);
13779         return tag_ptr(ret_conv, true);
13780 }
13781
13782 uint64_t  __attribute__((export_name("TS_CResult_NetworkGraphDecodeErrorZ_ok"))) TS_CResult_NetworkGraphDecodeErrorZ_ok(uint64_t o) {
13783         LDKNetworkGraph o_conv;
13784         o_conv.inner = untag_ptr(o);
13785         o_conv.is_owned = ptr_is_owned(o);
13786         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13787         // WARNING: we need a move here but no clone is available for LDKNetworkGraph
13788         
13789         LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
13790         *ret_conv = CResult_NetworkGraphDecodeErrorZ_ok(o_conv);
13791         return tag_ptr(ret_conv, true);
13792 }
13793
13794 uint64_t  __attribute__((export_name("TS_CResult_NetworkGraphDecodeErrorZ_err"))) TS_CResult_NetworkGraphDecodeErrorZ_err(uint64_t e) {
13795         LDKDecodeError e_conv;
13796         e_conv.inner = untag_ptr(e);
13797         e_conv.is_owned = ptr_is_owned(e);
13798         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
13799         e_conv = DecodeError_clone(&e_conv);
13800         LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
13801         *ret_conv = CResult_NetworkGraphDecodeErrorZ_err(e_conv);
13802         return tag_ptr(ret_conv, true);
13803 }
13804
13805 jboolean  __attribute__((export_name("TS_CResult_NetworkGraphDecodeErrorZ_is_ok"))) TS_CResult_NetworkGraphDecodeErrorZ_is_ok(uint64_t o) {
13806         LDKCResult_NetworkGraphDecodeErrorZ* o_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)untag_ptr(o);
13807         jboolean ret_conv = CResult_NetworkGraphDecodeErrorZ_is_ok(o_conv);
13808         return ret_conv;
13809 }
13810
13811 void  __attribute__((export_name("TS_CResult_NetworkGraphDecodeErrorZ_free"))) TS_CResult_NetworkGraphDecodeErrorZ_free(uint64_t _res) {
13812         if (!ptr_is_owned(_res)) return;
13813         void* _res_ptr = untag_ptr(_res);
13814         CHECK_ACCESS(_res_ptr);
13815         LDKCResult_NetworkGraphDecodeErrorZ _res_conv = *(LDKCResult_NetworkGraphDecodeErrorZ*)(_res_ptr);
13816         FREE(untag_ptr(_res));
13817         CResult_NetworkGraphDecodeErrorZ_free(_res_conv);
13818 }
13819
13820 uint64_t  __attribute__((export_name("TS_COption_CVec_NetAddressZZ_some"))) TS_COption_CVec_NetAddressZZ_some(uint64_tArray o) {
13821         LDKCVec_NetAddressZ o_constr;
13822         o_constr.datalen = o->arr_len;
13823         if (o_constr.datalen > 0)
13824                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
13825         else
13826                 o_constr.data = NULL;
13827         uint64_t* o_vals = o->elems;
13828         for (size_t m = 0; m < o_constr.datalen; m++) {
13829                 uint64_t o_conv_12 = o_vals[m];
13830                 void* o_conv_12_ptr = untag_ptr(o_conv_12);
13831                 CHECK_ACCESS(o_conv_12_ptr);
13832                 LDKNetAddress o_conv_12_conv = *(LDKNetAddress*)(o_conv_12_ptr);
13833                 o_conv_12_conv = NetAddress_clone((LDKNetAddress*)untag_ptr(o_conv_12));
13834                 o_constr.data[m] = o_conv_12_conv;
13835         }
13836         FREE(o);
13837         LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
13838         *ret_copy = COption_CVec_NetAddressZZ_some(o_constr);
13839         uint64_t ret_ref = tag_ptr(ret_copy, true);
13840         return ret_ref;
13841 }
13842
13843 uint64_t  __attribute__((export_name("TS_COption_CVec_NetAddressZZ_none"))) TS_COption_CVec_NetAddressZZ_none() {
13844         LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
13845         *ret_copy = COption_CVec_NetAddressZZ_none();
13846         uint64_t ret_ref = tag_ptr(ret_copy, true);
13847         return ret_ref;
13848 }
13849
13850 void  __attribute__((export_name("TS_COption_CVec_NetAddressZZ_free"))) TS_COption_CVec_NetAddressZZ_free(uint64_t _res) {
13851         if (!ptr_is_owned(_res)) return;
13852         void* _res_ptr = untag_ptr(_res);
13853         CHECK_ACCESS(_res_ptr);
13854         LDKCOption_CVec_NetAddressZZ _res_conv = *(LDKCOption_CVec_NetAddressZZ*)(_res_ptr);
13855         FREE(untag_ptr(_res));
13856         COption_CVec_NetAddressZZ_free(_res_conv);
13857 }
13858
13859 static inline uint64_t COption_CVec_NetAddressZZ_clone_ptr(LDKCOption_CVec_NetAddressZZ *NONNULL_PTR arg) {
13860         LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
13861         *ret_copy = COption_CVec_NetAddressZZ_clone(arg);
13862         uint64_t ret_ref = tag_ptr(ret_copy, true);
13863         return ret_ref;
13864 }
13865 int64_t  __attribute__((export_name("TS_COption_CVec_NetAddressZZ_clone_ptr"))) TS_COption_CVec_NetAddressZZ_clone_ptr(uint64_t arg) {
13866         LDKCOption_CVec_NetAddressZZ* arg_conv = (LDKCOption_CVec_NetAddressZZ*)untag_ptr(arg);
13867         int64_t ret_conv = COption_CVec_NetAddressZZ_clone_ptr(arg_conv);
13868         return ret_conv;
13869 }
13870
13871 uint64_t  __attribute__((export_name("TS_COption_CVec_NetAddressZZ_clone"))) TS_COption_CVec_NetAddressZZ_clone(uint64_t orig) {
13872         LDKCOption_CVec_NetAddressZZ* orig_conv = (LDKCOption_CVec_NetAddressZZ*)untag_ptr(orig);
13873         LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
13874         *ret_copy = COption_CVec_NetAddressZZ_clone(orig_conv);
13875         uint64_t ret_ref = tag_ptr(ret_copy, true);
13876         return ret_ref;
13877 }
13878
13879 uint64_t  __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(uint64_t o) {
13880         LDKDelayedPaymentOutputDescriptor o_conv;
13881         o_conv.inner = untag_ptr(o);
13882         o_conv.is_owned = ptr_is_owned(o);
13883         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13884         o_conv = DelayedPaymentOutputDescriptor_clone(&o_conv);
13885         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
13886         *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(o_conv);
13887         return tag_ptr(ret_conv, true);
13888 }
13889
13890 uint64_t  __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(uint64_t e) {
13891         LDKDecodeError e_conv;
13892         e_conv.inner = untag_ptr(e);
13893         e_conv.is_owned = ptr_is_owned(e);
13894         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
13895         e_conv = DecodeError_clone(&e_conv);
13896         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
13897         *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(e_conv);
13898         return tag_ptr(ret_conv, true);
13899 }
13900
13901 jboolean  __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_is_ok"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_is_ok(uint64_t o) {
13902         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* o_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(o);
13903         jboolean ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_is_ok(o_conv);
13904         return ret_conv;
13905 }
13906
13907 void  __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(uint64_t _res) {
13908         if (!ptr_is_owned(_res)) return;
13909         void* _res_ptr = untag_ptr(_res);
13910         CHECK_ACCESS(_res_ptr);
13911         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(_res_ptr);
13912         FREE(untag_ptr(_res));
13913         CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(_res_conv);
13914 }
13915
13916 static inline uint64_t CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone_ptr(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR arg) {
13917         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
13918         *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(arg);
13919         return tag_ptr(ret_conv, true);
13920 }
13921 int64_t  __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone_ptr"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone_ptr(uint64_t arg) {
13922         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* arg_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(arg);
13923         int64_t ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone_ptr(arg_conv);
13924         return ret_conv;
13925 }
13926
13927 uint64_t  __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(uint64_t orig) {
13928         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(orig);
13929         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
13930         *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(orig_conv);
13931         return tag_ptr(ret_conv, true);
13932 }
13933
13934 uint64_t  __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok(uint64_t o) {
13935         LDKStaticPaymentOutputDescriptor o_conv;
13936         o_conv.inner = untag_ptr(o);
13937         o_conv.is_owned = ptr_is_owned(o);
13938         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13939         o_conv = StaticPaymentOutputDescriptor_clone(&o_conv);
13940         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
13941         *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok(o_conv);
13942         return tag_ptr(ret_conv, true);
13943 }
13944
13945 uint64_t  __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(uint64_t e) {
13946         LDKDecodeError e_conv;
13947         e_conv.inner = untag_ptr(e);
13948         e_conv.is_owned = ptr_is_owned(e);
13949         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
13950         e_conv = DecodeError_clone(&e_conv);
13951         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
13952         *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(e_conv);
13953         return tag_ptr(ret_conv, true);
13954 }
13955
13956 jboolean  __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_is_ok"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_is_ok(uint64_t o) {
13957         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* o_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(o);
13958         jboolean ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_is_ok(o_conv);
13959         return ret_conv;
13960 }
13961
13962 void  __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(uint64_t _res) {
13963         if (!ptr_is_owned(_res)) return;
13964         void* _res_ptr = untag_ptr(_res);
13965         CHECK_ACCESS(_res_ptr);
13966         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(_res_ptr);
13967         FREE(untag_ptr(_res));
13968         CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(_res_conv);
13969 }
13970
13971 static inline uint64_t CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone_ptr(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR arg) {
13972         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
13973         *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(arg);
13974         return tag_ptr(ret_conv, true);
13975 }
13976 int64_t  __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone_ptr"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone_ptr(uint64_t arg) {
13977         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* arg_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(arg);
13978         int64_t ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone_ptr(arg_conv);
13979         return ret_conv;
13980 }
13981
13982 uint64_t  __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(uint64_t orig) {
13983         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(orig);
13984         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
13985         *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(orig_conv);
13986         return tag_ptr(ret_conv, true);
13987 }
13988
13989 uint64_t  __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_ok"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_ok(uint64_t o) {
13990         void* o_ptr = untag_ptr(o);
13991         CHECK_ACCESS(o_ptr);
13992         LDKSpendableOutputDescriptor o_conv = *(LDKSpendableOutputDescriptor*)(o_ptr);
13993         o_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(o));
13994         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
13995         *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_ok(o_conv);
13996         return tag_ptr(ret_conv, true);
13997 }
13998
13999 uint64_t  __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_err"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_err(uint64_t e) {
14000         LDKDecodeError e_conv;
14001         e_conv.inner = untag_ptr(e);
14002         e_conv.is_owned = ptr_is_owned(e);
14003         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14004         e_conv = DecodeError_clone(&e_conv);
14005         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
14006         *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_err(e_conv);
14007         return tag_ptr(ret_conv, true);
14008 }
14009
14010 jboolean  __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_is_ok"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_is_ok(uint64_t o) {
14011         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* o_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)untag_ptr(o);
14012         jboolean ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_is_ok(o_conv);
14013         return ret_conv;
14014 }
14015
14016 void  __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_free"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_free(uint64_t _res) {
14017         if (!ptr_is_owned(_res)) return;
14018         void* _res_ptr = untag_ptr(_res);
14019         CHECK_ACCESS(_res_ptr);
14020         LDKCResult_SpendableOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(_res_ptr);
14021         FREE(untag_ptr(_res));
14022         CResult_SpendableOutputDescriptorDecodeErrorZ_free(_res_conv);
14023 }
14024
14025 static inline uint64_t CResult_SpendableOutputDescriptorDecodeErrorZ_clone_ptr(LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR arg) {
14026         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
14027         *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_clone(arg);
14028         return tag_ptr(ret_conv, true);
14029 }
14030 int64_t  __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_clone_ptr"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_clone_ptr(uint64_t arg) {
14031         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* arg_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)untag_ptr(arg);
14032         int64_t ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_clone_ptr(arg_conv);
14033         return ret_conv;
14034 }
14035
14036 uint64_t  __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_clone"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_clone(uint64_t orig) {
14037         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)untag_ptr(orig);
14038         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
14039         *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_clone(orig_conv);
14040         return tag_ptr(ret_conv, true);
14041 }
14042
14043 void  __attribute__((export_name("TS_CVec_PaymentPreimageZ_free"))) TS_CVec_PaymentPreimageZ_free(ptrArray _res) {
14044         LDKCVec_PaymentPreimageZ _res_constr;
14045         _res_constr.datalen = _res->arr_len;
14046         if (_res_constr.datalen > 0)
14047                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_PaymentPreimageZ Elements");
14048         else
14049                 _res_constr.data = NULL;
14050         int8_tArray* _res_vals = (void*) _res->elems;
14051         for (size_t m = 0; m < _res_constr.datalen; m++) {
14052                 int8_tArray _res_conv_12 = _res_vals[m];
14053                 LDKThirtyTwoBytes _res_conv_12_ref;
14054                 CHECK(_res_conv_12->arr_len == 32);
14055                 memcpy(_res_conv_12_ref.data, _res_conv_12->elems, 32); FREE(_res_conv_12);
14056                 _res_constr.data[m] = _res_conv_12_ref;
14057         }
14058         FREE(_res);
14059         CVec_PaymentPreimageZ_free(_res_constr);
14060 }
14061
14062 static inline uint64_t C2Tuple_SignatureCVec_SignatureZZ_clone_ptr(LDKC2Tuple_SignatureCVec_SignatureZZ *NONNULL_PTR arg) {
14063         LDKC2Tuple_SignatureCVec_SignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
14064         *ret_conv = C2Tuple_SignatureCVec_SignatureZZ_clone(arg);
14065         return tag_ptr(ret_conv, true);
14066 }
14067 int64_t  __attribute__((export_name("TS_C2Tuple_SignatureCVec_SignatureZZ_clone_ptr"))) TS_C2Tuple_SignatureCVec_SignatureZZ_clone_ptr(uint64_t arg) {
14068         LDKC2Tuple_SignatureCVec_SignatureZZ* arg_conv = (LDKC2Tuple_SignatureCVec_SignatureZZ*)untag_ptr(arg);
14069         int64_t ret_conv = C2Tuple_SignatureCVec_SignatureZZ_clone_ptr(arg_conv);
14070         return ret_conv;
14071 }
14072
14073 uint64_t  __attribute__((export_name("TS_C2Tuple_SignatureCVec_SignatureZZ_clone"))) TS_C2Tuple_SignatureCVec_SignatureZZ_clone(uint64_t orig) {
14074         LDKC2Tuple_SignatureCVec_SignatureZZ* orig_conv = (LDKC2Tuple_SignatureCVec_SignatureZZ*)untag_ptr(orig);
14075         LDKC2Tuple_SignatureCVec_SignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
14076         *ret_conv = C2Tuple_SignatureCVec_SignatureZZ_clone(orig_conv);
14077         return tag_ptr(ret_conv, true);
14078 }
14079
14080 uint64_t  __attribute__((export_name("TS_C2Tuple_SignatureCVec_SignatureZZ_new"))) TS_C2Tuple_SignatureCVec_SignatureZZ_new(int8_tArray a, ptrArray b) {
14081         LDKSignature a_ref;
14082         CHECK(a->arr_len == 64);
14083         memcpy(a_ref.compact_form, a->elems, 64); FREE(a);
14084         LDKCVec_SignatureZ b_constr;
14085         b_constr.datalen = b->arr_len;
14086         if (b_constr.datalen > 0)
14087                 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
14088         else
14089                 b_constr.data = NULL;
14090         int8_tArray* b_vals = (void*) b->elems;
14091         for (size_t m = 0; m < b_constr.datalen; m++) {
14092                 int8_tArray b_conv_12 = b_vals[m];
14093                 LDKSignature b_conv_12_ref;
14094                 CHECK(b_conv_12->arr_len == 64);
14095                 memcpy(b_conv_12_ref.compact_form, b_conv_12->elems, 64); FREE(b_conv_12);
14096                 b_constr.data[m] = b_conv_12_ref;
14097         }
14098         FREE(b);
14099         LDKC2Tuple_SignatureCVec_SignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
14100         *ret_conv = C2Tuple_SignatureCVec_SignatureZZ_new(a_ref, b_constr);
14101         return tag_ptr(ret_conv, true);
14102 }
14103
14104 void  __attribute__((export_name("TS_C2Tuple_SignatureCVec_SignatureZZ_free"))) TS_C2Tuple_SignatureCVec_SignatureZZ_free(uint64_t _res) {
14105         if (!ptr_is_owned(_res)) return;
14106         void* _res_ptr = untag_ptr(_res);
14107         CHECK_ACCESS(_res_ptr);
14108         LDKC2Tuple_SignatureCVec_SignatureZZ _res_conv = *(LDKC2Tuple_SignatureCVec_SignatureZZ*)(_res_ptr);
14109         FREE(untag_ptr(_res));
14110         C2Tuple_SignatureCVec_SignatureZZ_free(_res_conv);
14111 }
14112
14113 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(uint64_t o) {
14114         void* o_ptr = untag_ptr(o);
14115         CHECK_ACCESS(o_ptr);
14116         LDKC2Tuple_SignatureCVec_SignatureZZ o_conv = *(LDKC2Tuple_SignatureCVec_SignatureZZ*)(o_ptr);
14117         o_conv = C2Tuple_SignatureCVec_SignatureZZ_clone((LDKC2Tuple_SignatureCVec_SignatureZZ*)untag_ptr(o));
14118         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
14119         *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(o_conv);
14120         return tag_ptr(ret_conv, true);
14121 }
14122
14123 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err() {
14124         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
14125         *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err();
14126         return tag_ptr(ret_conv, true);
14127 }
14128
14129 jboolean  __attribute__((export_name("TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_is_ok"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_is_ok(uint64_t o) {
14130         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* o_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)untag_ptr(o);
14131         jboolean ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_is_ok(o_conv);
14132         return ret_conv;
14133 }
14134
14135 void  __attribute__((export_name("TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(uint64_t _res) {
14136         if (!ptr_is_owned(_res)) return;
14137         void* _res_ptr = untag_ptr(_res);
14138         CHECK_ACCESS(_res_ptr);
14139         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ _res_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(_res_ptr);
14140         FREE(untag_ptr(_res));
14141         CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(_res_conv);
14142 }
14143
14144 static inline uint64_t CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone_ptr(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *NONNULL_PTR arg) {
14145         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
14146         *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(arg);
14147         return tag_ptr(ret_conv, true);
14148 }
14149 int64_t  __attribute__((export_name("TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone_ptr"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone_ptr(uint64_t arg) {
14150         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* arg_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)untag_ptr(arg);
14151         int64_t ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone_ptr(arg_conv);
14152         return ret_conv;
14153 }
14154
14155 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(uint64_t orig) {
14156         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* orig_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)untag_ptr(orig);
14157         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
14158         *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(orig_conv);
14159         return tag_ptr(ret_conv, true);
14160 }
14161
14162 uint64_t  __attribute__((export_name("TS_CResult_SignatureNoneZ_ok"))) TS_CResult_SignatureNoneZ_ok(int8_tArray o) {
14163         LDKSignature o_ref;
14164         CHECK(o->arr_len == 64);
14165         memcpy(o_ref.compact_form, o->elems, 64); FREE(o);
14166         LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
14167         *ret_conv = CResult_SignatureNoneZ_ok(o_ref);
14168         return tag_ptr(ret_conv, true);
14169 }
14170
14171 uint64_t  __attribute__((export_name("TS_CResult_SignatureNoneZ_err"))) TS_CResult_SignatureNoneZ_err() {
14172         LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
14173         *ret_conv = CResult_SignatureNoneZ_err();
14174         return tag_ptr(ret_conv, true);
14175 }
14176
14177 jboolean  __attribute__((export_name("TS_CResult_SignatureNoneZ_is_ok"))) TS_CResult_SignatureNoneZ_is_ok(uint64_t o) {
14178         LDKCResult_SignatureNoneZ* o_conv = (LDKCResult_SignatureNoneZ*)untag_ptr(o);
14179         jboolean ret_conv = CResult_SignatureNoneZ_is_ok(o_conv);
14180         return ret_conv;
14181 }
14182
14183 void  __attribute__((export_name("TS_CResult_SignatureNoneZ_free"))) TS_CResult_SignatureNoneZ_free(uint64_t _res) {
14184         if (!ptr_is_owned(_res)) return;
14185         void* _res_ptr = untag_ptr(_res);
14186         CHECK_ACCESS(_res_ptr);
14187         LDKCResult_SignatureNoneZ _res_conv = *(LDKCResult_SignatureNoneZ*)(_res_ptr);
14188         FREE(untag_ptr(_res));
14189         CResult_SignatureNoneZ_free(_res_conv);
14190 }
14191
14192 static inline uint64_t CResult_SignatureNoneZ_clone_ptr(LDKCResult_SignatureNoneZ *NONNULL_PTR arg) {
14193         LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
14194         *ret_conv = CResult_SignatureNoneZ_clone(arg);
14195         return tag_ptr(ret_conv, true);
14196 }
14197 int64_t  __attribute__((export_name("TS_CResult_SignatureNoneZ_clone_ptr"))) TS_CResult_SignatureNoneZ_clone_ptr(uint64_t arg) {
14198         LDKCResult_SignatureNoneZ* arg_conv = (LDKCResult_SignatureNoneZ*)untag_ptr(arg);
14199         int64_t ret_conv = CResult_SignatureNoneZ_clone_ptr(arg_conv);
14200         return ret_conv;
14201 }
14202
14203 uint64_t  __attribute__((export_name("TS_CResult_SignatureNoneZ_clone"))) TS_CResult_SignatureNoneZ_clone(uint64_t orig) {
14204         LDKCResult_SignatureNoneZ* orig_conv = (LDKCResult_SignatureNoneZ*)untag_ptr(orig);
14205         LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
14206         *ret_conv = CResult_SignatureNoneZ_clone(orig_conv);
14207         return tag_ptr(ret_conv, true);
14208 }
14209
14210 static inline uint64_t C2Tuple_SignatureSignatureZ_clone_ptr(LDKC2Tuple_SignatureSignatureZ *NONNULL_PTR arg) {
14211         LDKC2Tuple_SignatureSignatureZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureSignatureZ), "LDKC2Tuple_SignatureSignatureZ");
14212         *ret_conv = C2Tuple_SignatureSignatureZ_clone(arg);
14213         return tag_ptr(ret_conv, true);
14214 }
14215 int64_t  __attribute__((export_name("TS_C2Tuple_SignatureSignatureZ_clone_ptr"))) TS_C2Tuple_SignatureSignatureZ_clone_ptr(uint64_t arg) {
14216         LDKC2Tuple_SignatureSignatureZ* arg_conv = (LDKC2Tuple_SignatureSignatureZ*)untag_ptr(arg);
14217         int64_t ret_conv = C2Tuple_SignatureSignatureZ_clone_ptr(arg_conv);
14218         return ret_conv;
14219 }
14220
14221 uint64_t  __attribute__((export_name("TS_C2Tuple_SignatureSignatureZ_clone"))) TS_C2Tuple_SignatureSignatureZ_clone(uint64_t orig) {
14222         LDKC2Tuple_SignatureSignatureZ* orig_conv = (LDKC2Tuple_SignatureSignatureZ*)untag_ptr(orig);
14223         LDKC2Tuple_SignatureSignatureZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureSignatureZ), "LDKC2Tuple_SignatureSignatureZ");
14224         *ret_conv = C2Tuple_SignatureSignatureZ_clone(orig_conv);
14225         return tag_ptr(ret_conv, true);
14226 }
14227
14228 uint64_t  __attribute__((export_name("TS_C2Tuple_SignatureSignatureZ_new"))) TS_C2Tuple_SignatureSignatureZ_new(int8_tArray a, int8_tArray b) {
14229         LDKSignature a_ref;
14230         CHECK(a->arr_len == 64);
14231         memcpy(a_ref.compact_form, a->elems, 64); FREE(a);
14232         LDKSignature b_ref;
14233         CHECK(b->arr_len == 64);
14234         memcpy(b_ref.compact_form, b->elems, 64); FREE(b);
14235         LDKC2Tuple_SignatureSignatureZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureSignatureZ), "LDKC2Tuple_SignatureSignatureZ");
14236         *ret_conv = C2Tuple_SignatureSignatureZ_new(a_ref, b_ref);
14237         return tag_ptr(ret_conv, true);
14238 }
14239
14240 void  __attribute__((export_name("TS_C2Tuple_SignatureSignatureZ_free"))) TS_C2Tuple_SignatureSignatureZ_free(uint64_t _res) {
14241         if (!ptr_is_owned(_res)) return;
14242         void* _res_ptr = untag_ptr(_res);
14243         CHECK_ACCESS(_res_ptr);
14244         LDKC2Tuple_SignatureSignatureZ _res_conv = *(LDKC2Tuple_SignatureSignatureZ*)(_res_ptr);
14245         FREE(untag_ptr(_res));
14246         C2Tuple_SignatureSignatureZ_free(_res_conv);
14247 }
14248
14249 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_SignatureSignatureZNoneZ_ok"))) TS_CResult_C2Tuple_SignatureSignatureZNoneZ_ok(uint64_t o) {
14250         void* o_ptr = untag_ptr(o);
14251         CHECK_ACCESS(o_ptr);
14252         LDKC2Tuple_SignatureSignatureZ o_conv = *(LDKC2Tuple_SignatureSignatureZ*)(o_ptr);
14253         o_conv = C2Tuple_SignatureSignatureZ_clone((LDKC2Tuple_SignatureSignatureZ*)untag_ptr(o));
14254         LDKCResult_C2Tuple_SignatureSignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureSignatureZNoneZ), "LDKCResult_C2Tuple_SignatureSignatureZNoneZ");
14255         *ret_conv = CResult_C2Tuple_SignatureSignatureZNoneZ_ok(o_conv);
14256         return tag_ptr(ret_conv, true);
14257 }
14258
14259 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_SignatureSignatureZNoneZ_err"))) TS_CResult_C2Tuple_SignatureSignatureZNoneZ_err() {
14260         LDKCResult_C2Tuple_SignatureSignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureSignatureZNoneZ), "LDKCResult_C2Tuple_SignatureSignatureZNoneZ");
14261         *ret_conv = CResult_C2Tuple_SignatureSignatureZNoneZ_err();
14262         return tag_ptr(ret_conv, true);
14263 }
14264
14265 jboolean  __attribute__((export_name("TS_CResult_C2Tuple_SignatureSignatureZNoneZ_is_ok"))) TS_CResult_C2Tuple_SignatureSignatureZNoneZ_is_ok(uint64_t o) {
14266         LDKCResult_C2Tuple_SignatureSignatureZNoneZ* o_conv = (LDKCResult_C2Tuple_SignatureSignatureZNoneZ*)untag_ptr(o);
14267         jboolean ret_conv = CResult_C2Tuple_SignatureSignatureZNoneZ_is_ok(o_conv);
14268         return ret_conv;
14269 }
14270
14271 void  __attribute__((export_name("TS_CResult_C2Tuple_SignatureSignatureZNoneZ_free"))) TS_CResult_C2Tuple_SignatureSignatureZNoneZ_free(uint64_t _res) {
14272         if (!ptr_is_owned(_res)) return;
14273         void* _res_ptr = untag_ptr(_res);
14274         CHECK_ACCESS(_res_ptr);
14275         LDKCResult_C2Tuple_SignatureSignatureZNoneZ _res_conv = *(LDKCResult_C2Tuple_SignatureSignatureZNoneZ*)(_res_ptr);
14276         FREE(untag_ptr(_res));
14277         CResult_C2Tuple_SignatureSignatureZNoneZ_free(_res_conv);
14278 }
14279
14280 static inline uint64_t CResult_C2Tuple_SignatureSignatureZNoneZ_clone_ptr(LDKCResult_C2Tuple_SignatureSignatureZNoneZ *NONNULL_PTR arg) {
14281         LDKCResult_C2Tuple_SignatureSignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureSignatureZNoneZ), "LDKCResult_C2Tuple_SignatureSignatureZNoneZ");
14282         *ret_conv = CResult_C2Tuple_SignatureSignatureZNoneZ_clone(arg);
14283         return tag_ptr(ret_conv, true);
14284 }
14285 int64_t  __attribute__((export_name("TS_CResult_C2Tuple_SignatureSignatureZNoneZ_clone_ptr"))) TS_CResult_C2Tuple_SignatureSignatureZNoneZ_clone_ptr(uint64_t arg) {
14286         LDKCResult_C2Tuple_SignatureSignatureZNoneZ* arg_conv = (LDKCResult_C2Tuple_SignatureSignatureZNoneZ*)untag_ptr(arg);
14287         int64_t ret_conv = CResult_C2Tuple_SignatureSignatureZNoneZ_clone_ptr(arg_conv);
14288         return ret_conv;
14289 }
14290
14291 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_SignatureSignatureZNoneZ_clone"))) TS_CResult_C2Tuple_SignatureSignatureZNoneZ_clone(uint64_t orig) {
14292         LDKCResult_C2Tuple_SignatureSignatureZNoneZ* orig_conv = (LDKCResult_C2Tuple_SignatureSignatureZNoneZ*)untag_ptr(orig);
14293         LDKCResult_C2Tuple_SignatureSignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureSignatureZNoneZ), "LDKCResult_C2Tuple_SignatureSignatureZNoneZ");
14294         *ret_conv = CResult_C2Tuple_SignatureSignatureZNoneZ_clone(orig_conv);
14295         return tag_ptr(ret_conv, true);
14296 }
14297
14298 uint64_t  __attribute__((export_name("TS_CResult_SecretKeyNoneZ_ok"))) TS_CResult_SecretKeyNoneZ_ok(int8_tArray o) {
14299         LDKSecretKey o_ref;
14300         CHECK(o->arr_len == 32);
14301         memcpy(o_ref.bytes, o->elems, 32); FREE(o);
14302         LDKCResult_SecretKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyNoneZ), "LDKCResult_SecretKeyNoneZ");
14303         *ret_conv = CResult_SecretKeyNoneZ_ok(o_ref);
14304         return tag_ptr(ret_conv, true);
14305 }
14306
14307 uint64_t  __attribute__((export_name("TS_CResult_SecretKeyNoneZ_err"))) TS_CResult_SecretKeyNoneZ_err() {
14308         LDKCResult_SecretKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyNoneZ), "LDKCResult_SecretKeyNoneZ");
14309         *ret_conv = CResult_SecretKeyNoneZ_err();
14310         return tag_ptr(ret_conv, true);
14311 }
14312
14313 jboolean  __attribute__((export_name("TS_CResult_SecretKeyNoneZ_is_ok"))) TS_CResult_SecretKeyNoneZ_is_ok(uint64_t o) {
14314         LDKCResult_SecretKeyNoneZ* o_conv = (LDKCResult_SecretKeyNoneZ*)untag_ptr(o);
14315         jboolean ret_conv = CResult_SecretKeyNoneZ_is_ok(o_conv);
14316         return ret_conv;
14317 }
14318
14319 void  __attribute__((export_name("TS_CResult_SecretKeyNoneZ_free"))) TS_CResult_SecretKeyNoneZ_free(uint64_t _res) {
14320         if (!ptr_is_owned(_res)) return;
14321         void* _res_ptr = untag_ptr(_res);
14322         CHECK_ACCESS(_res_ptr);
14323         LDKCResult_SecretKeyNoneZ _res_conv = *(LDKCResult_SecretKeyNoneZ*)(_res_ptr);
14324         FREE(untag_ptr(_res));
14325         CResult_SecretKeyNoneZ_free(_res_conv);
14326 }
14327
14328 static inline uint64_t CResult_SecretKeyNoneZ_clone_ptr(LDKCResult_SecretKeyNoneZ *NONNULL_PTR arg) {
14329         LDKCResult_SecretKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyNoneZ), "LDKCResult_SecretKeyNoneZ");
14330         *ret_conv = CResult_SecretKeyNoneZ_clone(arg);
14331         return tag_ptr(ret_conv, true);
14332 }
14333 int64_t  __attribute__((export_name("TS_CResult_SecretKeyNoneZ_clone_ptr"))) TS_CResult_SecretKeyNoneZ_clone_ptr(uint64_t arg) {
14334         LDKCResult_SecretKeyNoneZ* arg_conv = (LDKCResult_SecretKeyNoneZ*)untag_ptr(arg);
14335         int64_t ret_conv = CResult_SecretKeyNoneZ_clone_ptr(arg_conv);
14336         return ret_conv;
14337 }
14338
14339 uint64_t  __attribute__((export_name("TS_CResult_SecretKeyNoneZ_clone"))) TS_CResult_SecretKeyNoneZ_clone(uint64_t orig) {
14340         LDKCResult_SecretKeyNoneZ* orig_conv = (LDKCResult_SecretKeyNoneZ*)untag_ptr(orig);
14341         LDKCResult_SecretKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyNoneZ), "LDKCResult_SecretKeyNoneZ");
14342         *ret_conv = CResult_SecretKeyNoneZ_clone(orig_conv);
14343         return tag_ptr(ret_conv, true);
14344 }
14345
14346 uint64_t  __attribute__((export_name("TS_CResult_SignDecodeErrorZ_ok"))) TS_CResult_SignDecodeErrorZ_ok(uint64_t o) {
14347         void* o_ptr = untag_ptr(o);
14348         CHECK_ACCESS(o_ptr);
14349         LDKSign o_conv = *(LDKSign*)(o_ptr);
14350         if (o_conv.free == LDKSign_JCalls_free) {
14351                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
14352                 LDKSign_JCalls_cloned(&o_conv);
14353         }
14354         LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
14355         *ret_conv = CResult_SignDecodeErrorZ_ok(o_conv);
14356         return tag_ptr(ret_conv, true);
14357 }
14358
14359 uint64_t  __attribute__((export_name("TS_CResult_SignDecodeErrorZ_err"))) TS_CResult_SignDecodeErrorZ_err(uint64_t e) {
14360         LDKDecodeError e_conv;
14361         e_conv.inner = untag_ptr(e);
14362         e_conv.is_owned = ptr_is_owned(e);
14363         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14364         e_conv = DecodeError_clone(&e_conv);
14365         LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
14366         *ret_conv = CResult_SignDecodeErrorZ_err(e_conv);
14367         return tag_ptr(ret_conv, true);
14368 }
14369
14370 jboolean  __attribute__((export_name("TS_CResult_SignDecodeErrorZ_is_ok"))) TS_CResult_SignDecodeErrorZ_is_ok(uint64_t o) {
14371         LDKCResult_SignDecodeErrorZ* o_conv = (LDKCResult_SignDecodeErrorZ*)untag_ptr(o);
14372         jboolean ret_conv = CResult_SignDecodeErrorZ_is_ok(o_conv);
14373         return ret_conv;
14374 }
14375
14376 void  __attribute__((export_name("TS_CResult_SignDecodeErrorZ_free"))) TS_CResult_SignDecodeErrorZ_free(uint64_t _res) {
14377         if (!ptr_is_owned(_res)) return;
14378         void* _res_ptr = untag_ptr(_res);
14379         CHECK_ACCESS(_res_ptr);
14380         LDKCResult_SignDecodeErrorZ _res_conv = *(LDKCResult_SignDecodeErrorZ*)(_res_ptr);
14381         FREE(untag_ptr(_res));
14382         CResult_SignDecodeErrorZ_free(_res_conv);
14383 }
14384
14385 static inline uint64_t CResult_SignDecodeErrorZ_clone_ptr(LDKCResult_SignDecodeErrorZ *NONNULL_PTR arg) {
14386         LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
14387         *ret_conv = CResult_SignDecodeErrorZ_clone(arg);
14388         return tag_ptr(ret_conv, true);
14389 }
14390 int64_t  __attribute__((export_name("TS_CResult_SignDecodeErrorZ_clone_ptr"))) TS_CResult_SignDecodeErrorZ_clone_ptr(uint64_t arg) {
14391         LDKCResult_SignDecodeErrorZ* arg_conv = (LDKCResult_SignDecodeErrorZ*)untag_ptr(arg);
14392         int64_t ret_conv = CResult_SignDecodeErrorZ_clone_ptr(arg_conv);
14393         return ret_conv;
14394 }
14395
14396 uint64_t  __attribute__((export_name("TS_CResult_SignDecodeErrorZ_clone"))) TS_CResult_SignDecodeErrorZ_clone(uint64_t orig) {
14397         LDKCResult_SignDecodeErrorZ* orig_conv = (LDKCResult_SignDecodeErrorZ*)untag_ptr(orig);
14398         LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
14399         *ret_conv = CResult_SignDecodeErrorZ_clone(orig_conv);
14400         return tag_ptr(ret_conv, true);
14401 }
14402
14403 void  __attribute__((export_name("TS_CVec_u5Z_free"))) TS_CVec_u5Z_free(ptrArray _res) {
14404         LDKCVec_u5Z _res_constr;
14405         _res_constr.datalen = _res->arr_len;
14406         if (_res_constr.datalen > 0)
14407                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKu5), "LDKCVec_u5Z Elements");
14408         else
14409                 _res_constr.data = NULL;
14410         int8_t* _res_vals = (void*) _res->elems;
14411         for (size_t h = 0; h < _res_constr.datalen; h++) {
14412                 int8_t _res_conv_7 = _res_vals[h];
14413                 
14414                 _res_constr.data[h] = (LDKu5){ ._0 = _res_conv_7 };
14415         }
14416         FREE(_res);
14417         CVec_u5Z_free(_res_constr);
14418 }
14419
14420 uint64_t  __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_ok"))) TS_CResult_RecoverableSignatureNoneZ_ok(int8_tArray o) {
14421         LDKRecoverableSignature o_ref;
14422         CHECK(o->arr_len == 68);
14423         memcpy(o_ref.serialized_form, o->elems, 68); FREE(o);
14424         LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
14425         *ret_conv = CResult_RecoverableSignatureNoneZ_ok(o_ref);
14426         return tag_ptr(ret_conv, true);
14427 }
14428
14429 uint64_t  __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_err"))) TS_CResult_RecoverableSignatureNoneZ_err() {
14430         LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
14431         *ret_conv = CResult_RecoverableSignatureNoneZ_err();
14432         return tag_ptr(ret_conv, true);
14433 }
14434
14435 jboolean  __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_is_ok"))) TS_CResult_RecoverableSignatureNoneZ_is_ok(uint64_t o) {
14436         LDKCResult_RecoverableSignatureNoneZ* o_conv = (LDKCResult_RecoverableSignatureNoneZ*)untag_ptr(o);
14437         jboolean ret_conv = CResult_RecoverableSignatureNoneZ_is_ok(o_conv);
14438         return ret_conv;
14439 }
14440
14441 void  __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_free"))) TS_CResult_RecoverableSignatureNoneZ_free(uint64_t _res) {
14442         if (!ptr_is_owned(_res)) return;
14443         void* _res_ptr = untag_ptr(_res);
14444         CHECK_ACCESS(_res_ptr);
14445         LDKCResult_RecoverableSignatureNoneZ _res_conv = *(LDKCResult_RecoverableSignatureNoneZ*)(_res_ptr);
14446         FREE(untag_ptr(_res));
14447         CResult_RecoverableSignatureNoneZ_free(_res_conv);
14448 }
14449
14450 static inline uint64_t CResult_RecoverableSignatureNoneZ_clone_ptr(LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR arg) {
14451         LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
14452         *ret_conv = CResult_RecoverableSignatureNoneZ_clone(arg);
14453         return tag_ptr(ret_conv, true);
14454 }
14455 int64_t  __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_clone_ptr"))) TS_CResult_RecoverableSignatureNoneZ_clone_ptr(uint64_t arg) {
14456         LDKCResult_RecoverableSignatureNoneZ* arg_conv = (LDKCResult_RecoverableSignatureNoneZ*)untag_ptr(arg);
14457         int64_t ret_conv = CResult_RecoverableSignatureNoneZ_clone_ptr(arg_conv);
14458         return ret_conv;
14459 }
14460
14461 uint64_t  __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_clone"))) TS_CResult_RecoverableSignatureNoneZ_clone(uint64_t orig) {
14462         LDKCResult_RecoverableSignatureNoneZ* orig_conv = (LDKCResult_RecoverableSignatureNoneZ*)untag_ptr(orig);
14463         LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
14464         *ret_conv = CResult_RecoverableSignatureNoneZ_clone(orig_conv);
14465         return tag_ptr(ret_conv, true);
14466 }
14467
14468 void  __attribute__((export_name("TS_CVec_u8Z_free"))) TS_CVec_u8Z_free(int8_tArray _res) {
14469         LDKCVec_u8Z _res_ref;
14470         _res_ref.datalen = _res->arr_len;
14471         _res_ref.data = MALLOC(_res_ref.datalen, "LDKCVec_u8Z Bytes");
14472         memcpy(_res_ref.data, _res->elems, _res_ref.datalen); FREE(_res);
14473         CVec_u8Z_free(_res_ref);
14474 }
14475
14476 void  __attribute__((export_name("TS_CVec_CVec_u8ZZ_free"))) TS_CVec_CVec_u8ZZ_free(ptrArray _res) {
14477         LDKCVec_CVec_u8ZZ _res_constr;
14478         _res_constr.datalen = _res->arr_len;
14479         if (_res_constr.datalen > 0)
14480                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCVec_u8Z), "LDKCVec_CVec_u8ZZ Elements");
14481         else
14482                 _res_constr.data = NULL;
14483         int8_tArray* _res_vals = (void*) _res->elems;
14484         for (size_t m = 0; m < _res_constr.datalen; m++) {
14485                 int8_tArray _res_conv_12 = _res_vals[m];
14486                 LDKCVec_u8Z _res_conv_12_ref;
14487                 _res_conv_12_ref.datalen = _res_conv_12->arr_len;
14488                 _res_conv_12_ref.data = MALLOC(_res_conv_12_ref.datalen, "LDKCVec_u8Z Bytes");
14489                 memcpy(_res_conv_12_ref.data, _res_conv_12->elems, _res_conv_12_ref.datalen); FREE(_res_conv_12);
14490                 _res_constr.data[m] = _res_conv_12_ref;
14491         }
14492         FREE(_res);
14493         CVec_CVec_u8ZZ_free(_res_constr);
14494 }
14495
14496 uint64_t  __attribute__((export_name("TS_CResult_CVec_CVec_u8ZZNoneZ_ok"))) TS_CResult_CVec_CVec_u8ZZNoneZ_ok(ptrArray o) {
14497         LDKCVec_CVec_u8ZZ o_constr;
14498         o_constr.datalen = o->arr_len;
14499         if (o_constr.datalen > 0)
14500                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKCVec_u8Z), "LDKCVec_CVec_u8ZZ Elements");
14501         else
14502                 o_constr.data = NULL;
14503         int8_tArray* o_vals = (void*) o->elems;
14504         for (size_t m = 0; m < o_constr.datalen; m++) {
14505                 int8_tArray o_conv_12 = o_vals[m];
14506                 LDKCVec_u8Z o_conv_12_ref;
14507                 o_conv_12_ref.datalen = o_conv_12->arr_len;
14508                 o_conv_12_ref.data = MALLOC(o_conv_12_ref.datalen, "LDKCVec_u8Z Bytes");
14509                 memcpy(o_conv_12_ref.data, o_conv_12->elems, o_conv_12_ref.datalen); FREE(o_conv_12);
14510                 o_constr.data[m] = o_conv_12_ref;
14511         }
14512         FREE(o);
14513         LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
14514         *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_ok(o_constr);
14515         return tag_ptr(ret_conv, true);
14516 }
14517
14518 uint64_t  __attribute__((export_name("TS_CResult_CVec_CVec_u8ZZNoneZ_err"))) TS_CResult_CVec_CVec_u8ZZNoneZ_err() {
14519         LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
14520         *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_err();
14521         return tag_ptr(ret_conv, true);
14522 }
14523
14524 jboolean  __attribute__((export_name("TS_CResult_CVec_CVec_u8ZZNoneZ_is_ok"))) TS_CResult_CVec_CVec_u8ZZNoneZ_is_ok(uint64_t o) {
14525         LDKCResult_CVec_CVec_u8ZZNoneZ* o_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)untag_ptr(o);
14526         jboolean ret_conv = CResult_CVec_CVec_u8ZZNoneZ_is_ok(o_conv);
14527         return ret_conv;
14528 }
14529
14530 void  __attribute__((export_name("TS_CResult_CVec_CVec_u8ZZNoneZ_free"))) TS_CResult_CVec_CVec_u8ZZNoneZ_free(uint64_t _res) {
14531         if (!ptr_is_owned(_res)) return;
14532         void* _res_ptr = untag_ptr(_res);
14533         CHECK_ACCESS(_res_ptr);
14534         LDKCResult_CVec_CVec_u8ZZNoneZ _res_conv = *(LDKCResult_CVec_CVec_u8ZZNoneZ*)(_res_ptr);
14535         FREE(untag_ptr(_res));
14536         CResult_CVec_CVec_u8ZZNoneZ_free(_res_conv);
14537 }
14538
14539 static inline uint64_t CResult_CVec_CVec_u8ZZNoneZ_clone_ptr(LDKCResult_CVec_CVec_u8ZZNoneZ *NONNULL_PTR arg) {
14540         LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
14541         *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_clone(arg);
14542         return tag_ptr(ret_conv, true);
14543 }
14544 int64_t  __attribute__((export_name("TS_CResult_CVec_CVec_u8ZZNoneZ_clone_ptr"))) TS_CResult_CVec_CVec_u8ZZNoneZ_clone_ptr(uint64_t arg) {
14545         LDKCResult_CVec_CVec_u8ZZNoneZ* arg_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)untag_ptr(arg);
14546         int64_t ret_conv = CResult_CVec_CVec_u8ZZNoneZ_clone_ptr(arg_conv);
14547         return ret_conv;
14548 }
14549
14550 uint64_t  __attribute__((export_name("TS_CResult_CVec_CVec_u8ZZNoneZ_clone"))) TS_CResult_CVec_CVec_u8ZZNoneZ_clone(uint64_t orig) {
14551         LDKCResult_CVec_CVec_u8ZZNoneZ* orig_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)untag_ptr(orig);
14552         LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
14553         *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_clone(orig_conv);
14554         return tag_ptr(ret_conv, true);
14555 }
14556
14557 uint64_t  __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_ok"))) TS_CResult_InMemorySignerDecodeErrorZ_ok(uint64_t o) {
14558         LDKInMemorySigner o_conv;
14559         o_conv.inner = untag_ptr(o);
14560         o_conv.is_owned = ptr_is_owned(o);
14561         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14562         o_conv = InMemorySigner_clone(&o_conv);
14563         LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
14564         *ret_conv = CResult_InMemorySignerDecodeErrorZ_ok(o_conv);
14565         return tag_ptr(ret_conv, true);
14566 }
14567
14568 uint64_t  __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_err"))) TS_CResult_InMemorySignerDecodeErrorZ_err(uint64_t e) {
14569         LDKDecodeError e_conv;
14570         e_conv.inner = untag_ptr(e);
14571         e_conv.is_owned = ptr_is_owned(e);
14572         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14573         e_conv = DecodeError_clone(&e_conv);
14574         LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
14575         *ret_conv = CResult_InMemorySignerDecodeErrorZ_err(e_conv);
14576         return tag_ptr(ret_conv, true);
14577 }
14578
14579 jboolean  __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_is_ok"))) TS_CResult_InMemorySignerDecodeErrorZ_is_ok(uint64_t o) {
14580         LDKCResult_InMemorySignerDecodeErrorZ* o_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)untag_ptr(o);
14581         jboolean ret_conv = CResult_InMemorySignerDecodeErrorZ_is_ok(o_conv);
14582         return ret_conv;
14583 }
14584
14585 void  __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_free"))) TS_CResult_InMemorySignerDecodeErrorZ_free(uint64_t _res) {
14586         if (!ptr_is_owned(_res)) return;
14587         void* _res_ptr = untag_ptr(_res);
14588         CHECK_ACCESS(_res_ptr);
14589         LDKCResult_InMemorySignerDecodeErrorZ _res_conv = *(LDKCResult_InMemorySignerDecodeErrorZ*)(_res_ptr);
14590         FREE(untag_ptr(_res));
14591         CResult_InMemorySignerDecodeErrorZ_free(_res_conv);
14592 }
14593
14594 static inline uint64_t CResult_InMemorySignerDecodeErrorZ_clone_ptr(LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR arg) {
14595         LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
14596         *ret_conv = CResult_InMemorySignerDecodeErrorZ_clone(arg);
14597         return tag_ptr(ret_conv, true);
14598 }
14599 int64_t  __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_clone_ptr"))) TS_CResult_InMemorySignerDecodeErrorZ_clone_ptr(uint64_t arg) {
14600         LDKCResult_InMemorySignerDecodeErrorZ* arg_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)untag_ptr(arg);
14601         int64_t ret_conv = CResult_InMemorySignerDecodeErrorZ_clone_ptr(arg_conv);
14602         return ret_conv;
14603 }
14604
14605 uint64_t  __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_clone"))) TS_CResult_InMemorySignerDecodeErrorZ_clone(uint64_t orig) {
14606         LDKCResult_InMemorySignerDecodeErrorZ* orig_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)untag_ptr(orig);
14607         LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
14608         *ret_conv = CResult_InMemorySignerDecodeErrorZ_clone(orig_conv);
14609         return tag_ptr(ret_conv, true);
14610 }
14611
14612 void  __attribute__((export_name("TS_CVec_TxOutZ_free"))) TS_CVec_TxOutZ_free(uint64_tArray _res) {
14613         LDKCVec_TxOutZ _res_constr;
14614         _res_constr.datalen = _res->arr_len;
14615         if (_res_constr.datalen > 0)
14616                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
14617         else
14618                 _res_constr.data = NULL;
14619         uint64_t* _res_vals = _res->elems;
14620         for (size_t h = 0; h < _res_constr.datalen; h++) {
14621                 uint64_t _res_conv_7 = _res_vals[h];
14622                 void* _res_conv_7_ptr = untag_ptr(_res_conv_7);
14623                 CHECK_ACCESS(_res_conv_7_ptr);
14624                 LDKTxOut _res_conv_7_conv = *(LDKTxOut*)(_res_conv_7_ptr);
14625                 FREE(untag_ptr(_res_conv_7));
14626                 _res_constr.data[h] = _res_conv_7_conv;
14627         }
14628         FREE(_res);
14629         CVec_TxOutZ_free(_res_constr);
14630 }
14631
14632 uint64_t  __attribute__((export_name("TS_CResult_TransactionNoneZ_ok"))) TS_CResult_TransactionNoneZ_ok(int8_tArray o) {
14633         LDKTransaction o_ref;
14634         o_ref.datalen = o->arr_len;
14635         o_ref.data = MALLOC(o_ref.datalen, "LDKTransaction Bytes");
14636         memcpy(o_ref.data, o->elems, o_ref.datalen); FREE(o);
14637         o_ref.data_is_owned = true;
14638         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
14639         *ret_conv = CResult_TransactionNoneZ_ok(o_ref);
14640         return tag_ptr(ret_conv, true);
14641 }
14642
14643 uint64_t  __attribute__((export_name("TS_CResult_TransactionNoneZ_err"))) TS_CResult_TransactionNoneZ_err() {
14644         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
14645         *ret_conv = CResult_TransactionNoneZ_err();
14646         return tag_ptr(ret_conv, true);
14647 }
14648
14649 jboolean  __attribute__((export_name("TS_CResult_TransactionNoneZ_is_ok"))) TS_CResult_TransactionNoneZ_is_ok(uint64_t o) {
14650         LDKCResult_TransactionNoneZ* o_conv = (LDKCResult_TransactionNoneZ*)untag_ptr(o);
14651         jboolean ret_conv = CResult_TransactionNoneZ_is_ok(o_conv);
14652         return ret_conv;
14653 }
14654
14655 void  __attribute__((export_name("TS_CResult_TransactionNoneZ_free"))) TS_CResult_TransactionNoneZ_free(uint64_t _res) {
14656         if (!ptr_is_owned(_res)) return;
14657         void* _res_ptr = untag_ptr(_res);
14658         CHECK_ACCESS(_res_ptr);
14659         LDKCResult_TransactionNoneZ _res_conv = *(LDKCResult_TransactionNoneZ*)(_res_ptr);
14660         FREE(untag_ptr(_res));
14661         CResult_TransactionNoneZ_free(_res_conv);
14662 }
14663
14664 static inline uint64_t CResult_TransactionNoneZ_clone_ptr(LDKCResult_TransactionNoneZ *NONNULL_PTR arg) {
14665         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
14666         *ret_conv = CResult_TransactionNoneZ_clone(arg);
14667         return tag_ptr(ret_conv, true);
14668 }
14669 int64_t  __attribute__((export_name("TS_CResult_TransactionNoneZ_clone_ptr"))) TS_CResult_TransactionNoneZ_clone_ptr(uint64_t arg) {
14670         LDKCResult_TransactionNoneZ* arg_conv = (LDKCResult_TransactionNoneZ*)untag_ptr(arg);
14671         int64_t ret_conv = CResult_TransactionNoneZ_clone_ptr(arg_conv);
14672         return ret_conv;
14673 }
14674
14675 uint64_t  __attribute__((export_name("TS_CResult_TransactionNoneZ_clone"))) TS_CResult_TransactionNoneZ_clone(uint64_t orig) {
14676         LDKCResult_TransactionNoneZ* orig_conv = (LDKCResult_TransactionNoneZ*)untag_ptr(orig);
14677         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
14678         *ret_conv = CResult_TransactionNoneZ_clone(orig_conv);
14679         return tag_ptr(ret_conv, true);
14680 }
14681
14682 uint64_t  __attribute__((export_name("TS_COption_u16Z_some"))) TS_COption_u16Z_some(int16_t o) {
14683         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
14684         *ret_copy = COption_u16Z_some(o);
14685         uint64_t ret_ref = tag_ptr(ret_copy, true);
14686         return ret_ref;
14687 }
14688
14689 uint64_t  __attribute__((export_name("TS_COption_u16Z_none"))) TS_COption_u16Z_none() {
14690         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
14691         *ret_copy = COption_u16Z_none();
14692         uint64_t ret_ref = tag_ptr(ret_copy, true);
14693         return ret_ref;
14694 }
14695
14696 void  __attribute__((export_name("TS_COption_u16Z_free"))) TS_COption_u16Z_free(uint64_t _res) {
14697         if (!ptr_is_owned(_res)) return;
14698         void* _res_ptr = untag_ptr(_res);
14699         CHECK_ACCESS(_res_ptr);
14700         LDKCOption_u16Z _res_conv = *(LDKCOption_u16Z*)(_res_ptr);
14701         FREE(untag_ptr(_res));
14702         COption_u16Z_free(_res_conv);
14703 }
14704
14705 static inline uint64_t COption_u16Z_clone_ptr(LDKCOption_u16Z *NONNULL_PTR arg) {
14706         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
14707         *ret_copy = COption_u16Z_clone(arg);
14708         uint64_t ret_ref = tag_ptr(ret_copy, true);
14709         return ret_ref;
14710 }
14711 int64_t  __attribute__((export_name("TS_COption_u16Z_clone_ptr"))) TS_COption_u16Z_clone_ptr(uint64_t arg) {
14712         LDKCOption_u16Z* arg_conv = (LDKCOption_u16Z*)untag_ptr(arg);
14713         int64_t ret_conv = COption_u16Z_clone_ptr(arg_conv);
14714         return ret_conv;
14715 }
14716
14717 uint64_t  __attribute__((export_name("TS_COption_u16Z_clone"))) TS_COption_u16Z_clone(uint64_t orig) {
14718         LDKCOption_u16Z* orig_conv = (LDKCOption_u16Z*)untag_ptr(orig);
14719         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
14720         *ret_copy = COption_u16Z_clone(orig_conv);
14721         uint64_t ret_ref = tag_ptr(ret_copy, true);
14722         return ret_ref;
14723 }
14724
14725 uint64_t  __attribute__((export_name("TS_CResult_NoneAPIErrorZ_ok"))) TS_CResult_NoneAPIErrorZ_ok() {
14726         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
14727         *ret_conv = CResult_NoneAPIErrorZ_ok();
14728         return tag_ptr(ret_conv, true);
14729 }
14730
14731 uint64_t  __attribute__((export_name("TS_CResult_NoneAPIErrorZ_err"))) TS_CResult_NoneAPIErrorZ_err(uint64_t e) {
14732         void* e_ptr = untag_ptr(e);
14733         CHECK_ACCESS(e_ptr);
14734         LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
14735         e_conv = APIError_clone((LDKAPIError*)untag_ptr(e));
14736         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
14737         *ret_conv = CResult_NoneAPIErrorZ_err(e_conv);
14738         return tag_ptr(ret_conv, true);
14739 }
14740
14741 jboolean  __attribute__((export_name("TS_CResult_NoneAPIErrorZ_is_ok"))) TS_CResult_NoneAPIErrorZ_is_ok(uint64_t o) {
14742         LDKCResult_NoneAPIErrorZ* o_conv = (LDKCResult_NoneAPIErrorZ*)untag_ptr(o);
14743         jboolean ret_conv = CResult_NoneAPIErrorZ_is_ok(o_conv);
14744         return ret_conv;
14745 }
14746
14747 void  __attribute__((export_name("TS_CResult_NoneAPIErrorZ_free"))) TS_CResult_NoneAPIErrorZ_free(uint64_t _res) {
14748         if (!ptr_is_owned(_res)) return;
14749         void* _res_ptr = untag_ptr(_res);
14750         CHECK_ACCESS(_res_ptr);
14751         LDKCResult_NoneAPIErrorZ _res_conv = *(LDKCResult_NoneAPIErrorZ*)(_res_ptr);
14752         FREE(untag_ptr(_res));
14753         CResult_NoneAPIErrorZ_free(_res_conv);
14754 }
14755
14756 static inline uint64_t CResult_NoneAPIErrorZ_clone_ptr(LDKCResult_NoneAPIErrorZ *NONNULL_PTR arg) {
14757         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
14758         *ret_conv = CResult_NoneAPIErrorZ_clone(arg);
14759         return tag_ptr(ret_conv, true);
14760 }
14761 int64_t  __attribute__((export_name("TS_CResult_NoneAPIErrorZ_clone_ptr"))) TS_CResult_NoneAPIErrorZ_clone_ptr(uint64_t arg) {
14762         LDKCResult_NoneAPIErrorZ* arg_conv = (LDKCResult_NoneAPIErrorZ*)untag_ptr(arg);
14763         int64_t ret_conv = CResult_NoneAPIErrorZ_clone_ptr(arg_conv);
14764         return ret_conv;
14765 }
14766
14767 uint64_t  __attribute__((export_name("TS_CResult_NoneAPIErrorZ_clone"))) TS_CResult_NoneAPIErrorZ_clone(uint64_t orig) {
14768         LDKCResult_NoneAPIErrorZ* orig_conv = (LDKCResult_NoneAPIErrorZ*)untag_ptr(orig);
14769         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
14770         *ret_conv = CResult_NoneAPIErrorZ_clone(orig_conv);
14771         return tag_ptr(ret_conv, true);
14772 }
14773
14774 void  __attribute__((export_name("TS_CVec_CResult_NoneAPIErrorZZ_free"))) TS_CVec_CResult_NoneAPIErrorZZ_free(uint64_tArray _res) {
14775         LDKCVec_CResult_NoneAPIErrorZZ _res_constr;
14776         _res_constr.datalen = _res->arr_len;
14777         if (_res_constr.datalen > 0)
14778                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
14779         else
14780                 _res_constr.data = NULL;
14781         uint64_t* _res_vals = _res->elems;
14782         for (size_t w = 0; w < _res_constr.datalen; w++) {
14783                 uint64_t _res_conv_22 = _res_vals[w];
14784                 void* _res_conv_22_ptr = untag_ptr(_res_conv_22);
14785                 CHECK_ACCESS(_res_conv_22_ptr);
14786                 LDKCResult_NoneAPIErrorZ _res_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(_res_conv_22_ptr);
14787                 FREE(untag_ptr(_res_conv_22));
14788                 _res_constr.data[w] = _res_conv_22_conv;
14789         }
14790         FREE(_res);
14791         CVec_CResult_NoneAPIErrorZZ_free(_res_constr);
14792 }
14793
14794 void  __attribute__((export_name("TS_CVec_APIErrorZ_free"))) TS_CVec_APIErrorZ_free(uint64_tArray _res) {
14795         LDKCVec_APIErrorZ _res_constr;
14796         _res_constr.datalen = _res->arr_len;
14797         if (_res_constr.datalen > 0)
14798                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKAPIError), "LDKCVec_APIErrorZ Elements");
14799         else
14800                 _res_constr.data = NULL;
14801         uint64_t* _res_vals = _res->elems;
14802         for (size_t k = 0; k < _res_constr.datalen; k++) {
14803                 uint64_t _res_conv_10 = _res_vals[k];
14804                 void* _res_conv_10_ptr = untag_ptr(_res_conv_10);
14805                 CHECK_ACCESS(_res_conv_10_ptr);
14806                 LDKAPIError _res_conv_10_conv = *(LDKAPIError*)(_res_conv_10_ptr);
14807                 FREE(untag_ptr(_res_conv_10));
14808                 _res_constr.data[k] = _res_conv_10_conv;
14809         }
14810         FREE(_res);
14811         CVec_APIErrorZ_free(_res_constr);
14812 }
14813
14814 uint64_t  __attribute__((export_name("TS_CResult__u832APIErrorZ_ok"))) TS_CResult__u832APIErrorZ_ok(int8_tArray o) {
14815         LDKThirtyTwoBytes o_ref;
14816         CHECK(o->arr_len == 32);
14817         memcpy(o_ref.data, o->elems, 32); FREE(o);
14818         LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
14819         *ret_conv = CResult__u832APIErrorZ_ok(o_ref);
14820         return tag_ptr(ret_conv, true);
14821 }
14822
14823 uint64_t  __attribute__((export_name("TS_CResult__u832APIErrorZ_err"))) TS_CResult__u832APIErrorZ_err(uint64_t e) {
14824         void* e_ptr = untag_ptr(e);
14825         CHECK_ACCESS(e_ptr);
14826         LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
14827         e_conv = APIError_clone((LDKAPIError*)untag_ptr(e));
14828         LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
14829         *ret_conv = CResult__u832APIErrorZ_err(e_conv);
14830         return tag_ptr(ret_conv, true);
14831 }
14832
14833 jboolean  __attribute__((export_name("TS_CResult__u832APIErrorZ_is_ok"))) TS_CResult__u832APIErrorZ_is_ok(uint64_t o) {
14834         LDKCResult__u832APIErrorZ* o_conv = (LDKCResult__u832APIErrorZ*)untag_ptr(o);
14835         jboolean ret_conv = CResult__u832APIErrorZ_is_ok(o_conv);
14836         return ret_conv;
14837 }
14838
14839 void  __attribute__((export_name("TS_CResult__u832APIErrorZ_free"))) TS_CResult__u832APIErrorZ_free(uint64_t _res) {
14840         if (!ptr_is_owned(_res)) return;
14841         void* _res_ptr = untag_ptr(_res);
14842         CHECK_ACCESS(_res_ptr);
14843         LDKCResult__u832APIErrorZ _res_conv = *(LDKCResult__u832APIErrorZ*)(_res_ptr);
14844         FREE(untag_ptr(_res));
14845         CResult__u832APIErrorZ_free(_res_conv);
14846 }
14847
14848 static inline uint64_t CResult__u832APIErrorZ_clone_ptr(LDKCResult__u832APIErrorZ *NONNULL_PTR arg) {
14849         LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
14850         *ret_conv = CResult__u832APIErrorZ_clone(arg);
14851         return tag_ptr(ret_conv, true);
14852 }
14853 int64_t  __attribute__((export_name("TS_CResult__u832APIErrorZ_clone_ptr"))) TS_CResult__u832APIErrorZ_clone_ptr(uint64_t arg) {
14854         LDKCResult__u832APIErrorZ* arg_conv = (LDKCResult__u832APIErrorZ*)untag_ptr(arg);
14855         int64_t ret_conv = CResult__u832APIErrorZ_clone_ptr(arg_conv);
14856         return ret_conv;
14857 }
14858
14859 uint64_t  __attribute__((export_name("TS_CResult__u832APIErrorZ_clone"))) TS_CResult__u832APIErrorZ_clone(uint64_t orig) {
14860         LDKCResult__u832APIErrorZ* orig_conv = (LDKCResult__u832APIErrorZ*)untag_ptr(orig);
14861         LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
14862         *ret_conv = CResult__u832APIErrorZ_clone(orig_conv);
14863         return tag_ptr(ret_conv, true);
14864 }
14865
14866 uint64_t  __attribute__((export_name("TS_CResult_PaymentIdPaymentSendFailureZ_ok"))) TS_CResult_PaymentIdPaymentSendFailureZ_ok(int8_tArray o) {
14867         LDKThirtyTwoBytes o_ref;
14868         CHECK(o->arr_len == 32);
14869         memcpy(o_ref.data, o->elems, 32); FREE(o);
14870         LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
14871         *ret_conv = CResult_PaymentIdPaymentSendFailureZ_ok(o_ref);
14872         return tag_ptr(ret_conv, true);
14873 }
14874
14875 uint64_t  __attribute__((export_name("TS_CResult_PaymentIdPaymentSendFailureZ_err"))) TS_CResult_PaymentIdPaymentSendFailureZ_err(uint64_t e) {
14876         void* e_ptr = untag_ptr(e);
14877         CHECK_ACCESS(e_ptr);
14878         LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(e_ptr);
14879         e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)untag_ptr(e));
14880         LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
14881         *ret_conv = CResult_PaymentIdPaymentSendFailureZ_err(e_conv);
14882         return tag_ptr(ret_conv, true);
14883 }
14884
14885 jboolean  __attribute__((export_name("TS_CResult_PaymentIdPaymentSendFailureZ_is_ok"))) TS_CResult_PaymentIdPaymentSendFailureZ_is_ok(uint64_t o) {
14886         LDKCResult_PaymentIdPaymentSendFailureZ* o_conv = (LDKCResult_PaymentIdPaymentSendFailureZ*)untag_ptr(o);
14887         jboolean ret_conv = CResult_PaymentIdPaymentSendFailureZ_is_ok(o_conv);
14888         return ret_conv;
14889 }
14890
14891 void  __attribute__((export_name("TS_CResult_PaymentIdPaymentSendFailureZ_free"))) TS_CResult_PaymentIdPaymentSendFailureZ_free(uint64_t _res) {
14892         if (!ptr_is_owned(_res)) return;
14893         void* _res_ptr = untag_ptr(_res);
14894         CHECK_ACCESS(_res_ptr);
14895         LDKCResult_PaymentIdPaymentSendFailureZ _res_conv = *(LDKCResult_PaymentIdPaymentSendFailureZ*)(_res_ptr);
14896         FREE(untag_ptr(_res));
14897         CResult_PaymentIdPaymentSendFailureZ_free(_res_conv);
14898 }
14899
14900 static inline uint64_t CResult_PaymentIdPaymentSendFailureZ_clone_ptr(LDKCResult_PaymentIdPaymentSendFailureZ *NONNULL_PTR arg) {
14901         LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
14902         *ret_conv = CResult_PaymentIdPaymentSendFailureZ_clone(arg);
14903         return tag_ptr(ret_conv, true);
14904 }
14905 int64_t  __attribute__((export_name("TS_CResult_PaymentIdPaymentSendFailureZ_clone_ptr"))) TS_CResult_PaymentIdPaymentSendFailureZ_clone_ptr(uint64_t arg) {
14906         LDKCResult_PaymentIdPaymentSendFailureZ* arg_conv = (LDKCResult_PaymentIdPaymentSendFailureZ*)untag_ptr(arg);
14907         int64_t ret_conv = CResult_PaymentIdPaymentSendFailureZ_clone_ptr(arg_conv);
14908         return ret_conv;
14909 }
14910
14911 uint64_t  __attribute__((export_name("TS_CResult_PaymentIdPaymentSendFailureZ_clone"))) TS_CResult_PaymentIdPaymentSendFailureZ_clone(uint64_t orig) {
14912         LDKCResult_PaymentIdPaymentSendFailureZ* orig_conv = (LDKCResult_PaymentIdPaymentSendFailureZ*)untag_ptr(orig);
14913         LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
14914         *ret_conv = CResult_PaymentIdPaymentSendFailureZ_clone(orig_conv);
14915         return tag_ptr(ret_conv, true);
14916 }
14917
14918 uint64_t  __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_ok"))) TS_CResult_NonePaymentSendFailureZ_ok() {
14919         LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
14920         *ret_conv = CResult_NonePaymentSendFailureZ_ok();
14921         return tag_ptr(ret_conv, true);
14922 }
14923
14924 uint64_t  __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_err"))) TS_CResult_NonePaymentSendFailureZ_err(uint64_t e) {
14925         void* e_ptr = untag_ptr(e);
14926         CHECK_ACCESS(e_ptr);
14927         LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(e_ptr);
14928         e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)untag_ptr(e));
14929         LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
14930         *ret_conv = CResult_NonePaymentSendFailureZ_err(e_conv);
14931         return tag_ptr(ret_conv, true);
14932 }
14933
14934 jboolean  __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_is_ok"))) TS_CResult_NonePaymentSendFailureZ_is_ok(uint64_t o) {
14935         LDKCResult_NonePaymentSendFailureZ* o_conv = (LDKCResult_NonePaymentSendFailureZ*)untag_ptr(o);
14936         jboolean ret_conv = CResult_NonePaymentSendFailureZ_is_ok(o_conv);
14937         return ret_conv;
14938 }
14939
14940 void  __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_free"))) TS_CResult_NonePaymentSendFailureZ_free(uint64_t _res) {
14941         if (!ptr_is_owned(_res)) return;
14942         void* _res_ptr = untag_ptr(_res);
14943         CHECK_ACCESS(_res_ptr);
14944         LDKCResult_NonePaymentSendFailureZ _res_conv = *(LDKCResult_NonePaymentSendFailureZ*)(_res_ptr);
14945         FREE(untag_ptr(_res));
14946         CResult_NonePaymentSendFailureZ_free(_res_conv);
14947 }
14948
14949 static inline uint64_t CResult_NonePaymentSendFailureZ_clone_ptr(LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR arg) {
14950         LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
14951         *ret_conv = CResult_NonePaymentSendFailureZ_clone(arg);
14952         return tag_ptr(ret_conv, true);
14953 }
14954 int64_t  __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_clone_ptr"))) TS_CResult_NonePaymentSendFailureZ_clone_ptr(uint64_t arg) {
14955         LDKCResult_NonePaymentSendFailureZ* arg_conv = (LDKCResult_NonePaymentSendFailureZ*)untag_ptr(arg);
14956         int64_t ret_conv = CResult_NonePaymentSendFailureZ_clone_ptr(arg_conv);
14957         return ret_conv;
14958 }
14959
14960 uint64_t  __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_clone"))) TS_CResult_NonePaymentSendFailureZ_clone(uint64_t orig) {
14961         LDKCResult_NonePaymentSendFailureZ* orig_conv = (LDKCResult_NonePaymentSendFailureZ*)untag_ptr(orig);
14962         LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
14963         *ret_conv = CResult_NonePaymentSendFailureZ_clone(orig_conv);
14964         return tag_ptr(ret_conv, true);
14965 }
14966
14967 static inline uint64_t C2Tuple_PaymentHashPaymentIdZ_clone_ptr(LDKC2Tuple_PaymentHashPaymentIdZ *NONNULL_PTR arg) {
14968         LDKC2Tuple_PaymentHashPaymentIdZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentIdZ), "LDKC2Tuple_PaymentHashPaymentIdZ");
14969         *ret_conv = C2Tuple_PaymentHashPaymentIdZ_clone(arg);
14970         return tag_ptr(ret_conv, true);
14971 }
14972 int64_t  __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentIdZ_clone_ptr"))) TS_C2Tuple_PaymentHashPaymentIdZ_clone_ptr(uint64_t arg) {
14973         LDKC2Tuple_PaymentHashPaymentIdZ* arg_conv = (LDKC2Tuple_PaymentHashPaymentIdZ*)untag_ptr(arg);
14974         int64_t ret_conv = C2Tuple_PaymentHashPaymentIdZ_clone_ptr(arg_conv);
14975         return ret_conv;
14976 }
14977
14978 uint64_t  __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentIdZ_clone"))) TS_C2Tuple_PaymentHashPaymentIdZ_clone(uint64_t orig) {
14979         LDKC2Tuple_PaymentHashPaymentIdZ* orig_conv = (LDKC2Tuple_PaymentHashPaymentIdZ*)untag_ptr(orig);
14980         LDKC2Tuple_PaymentHashPaymentIdZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentIdZ), "LDKC2Tuple_PaymentHashPaymentIdZ");
14981         *ret_conv = C2Tuple_PaymentHashPaymentIdZ_clone(orig_conv);
14982         return tag_ptr(ret_conv, true);
14983 }
14984
14985 uint64_t  __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentIdZ_new"))) TS_C2Tuple_PaymentHashPaymentIdZ_new(int8_tArray a, int8_tArray b) {
14986         LDKThirtyTwoBytes a_ref;
14987         CHECK(a->arr_len == 32);
14988         memcpy(a_ref.data, a->elems, 32); FREE(a);
14989         LDKThirtyTwoBytes b_ref;
14990         CHECK(b->arr_len == 32);
14991         memcpy(b_ref.data, b->elems, 32); FREE(b);
14992         LDKC2Tuple_PaymentHashPaymentIdZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentIdZ), "LDKC2Tuple_PaymentHashPaymentIdZ");
14993         *ret_conv = C2Tuple_PaymentHashPaymentIdZ_new(a_ref, b_ref);
14994         return tag_ptr(ret_conv, true);
14995 }
14996
14997 void  __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentIdZ_free"))) TS_C2Tuple_PaymentHashPaymentIdZ_free(uint64_t _res) {
14998         if (!ptr_is_owned(_res)) return;
14999         void* _res_ptr = untag_ptr(_res);
15000         CHECK_ACCESS(_res_ptr);
15001         LDKC2Tuple_PaymentHashPaymentIdZ _res_conv = *(LDKC2Tuple_PaymentHashPaymentIdZ*)(_res_ptr);
15002         FREE(untag_ptr(_res));
15003         C2Tuple_PaymentHashPaymentIdZ_free(_res_conv);
15004 }
15005
15006 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_ok"))) TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_ok(uint64_t o) {
15007         void* o_ptr = untag_ptr(o);
15008         CHECK_ACCESS(o_ptr);
15009         LDKC2Tuple_PaymentHashPaymentIdZ o_conv = *(LDKC2Tuple_PaymentHashPaymentIdZ*)(o_ptr);
15010         o_conv = C2Tuple_PaymentHashPaymentIdZ_clone((LDKC2Tuple_PaymentHashPaymentIdZ*)untag_ptr(o));
15011         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
15012         *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_ok(o_conv);
15013         return tag_ptr(ret_conv, true);
15014 }
15015
15016 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_err"))) TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_err(uint64_t e) {
15017         void* e_ptr = untag_ptr(e);
15018         CHECK_ACCESS(e_ptr);
15019         LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(e_ptr);
15020         e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)untag_ptr(e));
15021         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
15022         *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_err(e_conv);
15023         return tag_ptr(ret_conv, true);
15024 }
15025
15026 jboolean  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_is_ok"))) TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_is_ok(uint64_t o) {
15027         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* o_conv = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)untag_ptr(o);
15028         jboolean ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_is_ok(o_conv);
15029         return ret_conv;
15030 }
15031
15032 void  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_free"))) TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_free(uint64_t _res) {
15033         if (!ptr_is_owned(_res)) return;
15034         void* _res_ptr = untag_ptr(_res);
15035         CHECK_ACCESS(_res_ptr);
15036         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ _res_conv = *(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)(_res_ptr);
15037         FREE(untag_ptr(_res));
15038         CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_free(_res_conv);
15039 }
15040
15041 static inline uint64_t CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone_ptr(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ *NONNULL_PTR arg) {
15042         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
15043         *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone(arg);
15044         return tag_ptr(ret_conv, true);
15045 }
15046 int64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone_ptr"))) TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone_ptr(uint64_t arg) {
15047         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* arg_conv = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)untag_ptr(arg);
15048         int64_t ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone_ptr(arg_conv);
15049         return ret_conv;
15050 }
15051
15052 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone"))) TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone(uint64_t orig) {
15053         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* orig_conv = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)untag_ptr(orig);
15054         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
15055         *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone(orig_conv);
15056         return tag_ptr(ret_conv, true);
15057 }
15058
15059 void  __attribute__((export_name("TS_CVec_ThirtyTwoBytesZ_free"))) TS_CVec_ThirtyTwoBytesZ_free(ptrArray _res) {
15060         LDKCVec_ThirtyTwoBytesZ _res_constr;
15061         _res_constr.datalen = _res->arr_len;
15062         if (_res_constr.datalen > 0)
15063                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_ThirtyTwoBytesZ Elements");
15064         else
15065                 _res_constr.data = NULL;
15066         int8_tArray* _res_vals = (void*) _res->elems;
15067         for (size_t m = 0; m < _res_constr.datalen; m++) {
15068                 int8_tArray _res_conv_12 = _res_vals[m];
15069                 LDKThirtyTwoBytes _res_conv_12_ref;
15070                 CHECK(_res_conv_12->arr_len == 32);
15071                 memcpy(_res_conv_12_ref.data, _res_conv_12->elems, 32); FREE(_res_conv_12);
15072                 _res_constr.data[m] = _res_conv_12_ref;
15073         }
15074         FREE(_res);
15075         CVec_ThirtyTwoBytesZ_free(_res_constr);
15076 }
15077
15078 static inline uint64_t C2Tuple_PaymentHashPaymentSecretZ_clone_ptr(LDKC2Tuple_PaymentHashPaymentSecretZ *NONNULL_PTR arg) {
15079         LDKC2Tuple_PaymentHashPaymentSecretZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
15080         *ret_conv = C2Tuple_PaymentHashPaymentSecretZ_clone(arg);
15081         return tag_ptr(ret_conv, true);
15082 }
15083 int64_t  __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentSecretZ_clone_ptr"))) TS_C2Tuple_PaymentHashPaymentSecretZ_clone_ptr(uint64_t arg) {
15084         LDKC2Tuple_PaymentHashPaymentSecretZ* arg_conv = (LDKC2Tuple_PaymentHashPaymentSecretZ*)untag_ptr(arg);
15085         int64_t ret_conv = C2Tuple_PaymentHashPaymentSecretZ_clone_ptr(arg_conv);
15086         return ret_conv;
15087 }
15088
15089 uint64_t  __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentSecretZ_clone"))) TS_C2Tuple_PaymentHashPaymentSecretZ_clone(uint64_t orig) {
15090         LDKC2Tuple_PaymentHashPaymentSecretZ* orig_conv = (LDKC2Tuple_PaymentHashPaymentSecretZ*)untag_ptr(orig);
15091         LDKC2Tuple_PaymentHashPaymentSecretZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
15092         *ret_conv = C2Tuple_PaymentHashPaymentSecretZ_clone(orig_conv);
15093         return tag_ptr(ret_conv, true);
15094 }
15095
15096 uint64_t  __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentSecretZ_new"))) TS_C2Tuple_PaymentHashPaymentSecretZ_new(int8_tArray a, int8_tArray b) {
15097         LDKThirtyTwoBytes a_ref;
15098         CHECK(a->arr_len == 32);
15099         memcpy(a_ref.data, a->elems, 32); FREE(a);
15100         LDKThirtyTwoBytes b_ref;
15101         CHECK(b->arr_len == 32);
15102         memcpy(b_ref.data, b->elems, 32); FREE(b);
15103         LDKC2Tuple_PaymentHashPaymentSecretZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
15104         *ret_conv = C2Tuple_PaymentHashPaymentSecretZ_new(a_ref, b_ref);
15105         return tag_ptr(ret_conv, true);
15106 }
15107
15108 void  __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentSecretZ_free"))) TS_C2Tuple_PaymentHashPaymentSecretZ_free(uint64_t _res) {
15109         if (!ptr_is_owned(_res)) return;
15110         void* _res_ptr = untag_ptr(_res);
15111         CHECK_ACCESS(_res_ptr);
15112         LDKC2Tuple_PaymentHashPaymentSecretZ _res_conv = *(LDKC2Tuple_PaymentHashPaymentSecretZ*)(_res_ptr);
15113         FREE(untag_ptr(_res));
15114         C2Tuple_PaymentHashPaymentSecretZ_free(_res_conv);
15115 }
15116
15117 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_ok"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_ok(uint64_t o) {
15118         void* o_ptr = untag_ptr(o);
15119         CHECK_ACCESS(o_ptr);
15120         LDKC2Tuple_PaymentHashPaymentSecretZ o_conv = *(LDKC2Tuple_PaymentHashPaymentSecretZ*)(o_ptr);
15121         o_conv = C2Tuple_PaymentHashPaymentSecretZ_clone((LDKC2Tuple_PaymentHashPaymentSecretZ*)untag_ptr(o));
15122         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
15123         *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_ok(o_conv);
15124         return tag_ptr(ret_conv, true);
15125 }
15126
15127 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_err"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_err() {
15128         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
15129         *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_err();
15130         return tag_ptr(ret_conv, true);
15131 }
15132
15133 jboolean  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_is_ok"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_is_ok(uint64_t o) {
15134         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* o_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)untag_ptr(o);
15135         jboolean ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_is_ok(o_conv);
15136         return ret_conv;
15137 }
15138
15139 void  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_free"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_free(uint64_t _res) {
15140         if (!ptr_is_owned(_res)) return;
15141         void* _res_ptr = untag_ptr(_res);
15142         CHECK_ACCESS(_res_ptr);
15143         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ _res_conv = *(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)(_res_ptr);
15144         FREE(untag_ptr(_res));
15145         CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_free(_res_conv);
15146 }
15147
15148 static inline uint64_t CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone_ptr(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ *NONNULL_PTR arg) {
15149         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
15150         *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone(arg);
15151         return tag_ptr(ret_conv, true);
15152 }
15153 int64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone_ptr"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone_ptr(uint64_t arg) {
15154         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* arg_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)untag_ptr(arg);
15155         int64_t ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone_ptr(arg_conv);
15156         return ret_conv;
15157 }
15158
15159 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone(uint64_t orig) {
15160         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* orig_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)untag_ptr(orig);
15161         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
15162         *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone(orig_conv);
15163         return tag_ptr(ret_conv, true);
15164 }
15165
15166 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_ok"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_ok(uint64_t o) {
15167         void* o_ptr = untag_ptr(o);
15168         CHECK_ACCESS(o_ptr);
15169         LDKC2Tuple_PaymentHashPaymentSecretZ o_conv = *(LDKC2Tuple_PaymentHashPaymentSecretZ*)(o_ptr);
15170         o_conv = C2Tuple_PaymentHashPaymentSecretZ_clone((LDKC2Tuple_PaymentHashPaymentSecretZ*)untag_ptr(o));
15171         LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ");
15172         *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_ok(o_conv);
15173         return tag_ptr(ret_conv, true);
15174 }
15175
15176 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_err"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_err(uint64_t e) {
15177         void* e_ptr = untag_ptr(e);
15178         CHECK_ACCESS(e_ptr);
15179         LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
15180         e_conv = APIError_clone((LDKAPIError*)untag_ptr(e));
15181         LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ");
15182         *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_err(e_conv);
15183         return tag_ptr(ret_conv, true);
15184 }
15185
15186 jboolean  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_is_ok"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_is_ok(uint64_t o) {
15187         LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* o_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)untag_ptr(o);
15188         jboolean ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_is_ok(o_conv);
15189         return ret_conv;
15190 }
15191
15192 void  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_free"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_free(uint64_t _res) {
15193         if (!ptr_is_owned(_res)) return;
15194         void* _res_ptr = untag_ptr(_res);
15195         CHECK_ACCESS(_res_ptr);
15196         LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ _res_conv = *(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)(_res_ptr);
15197         FREE(untag_ptr(_res));
15198         CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_free(_res_conv);
15199 }
15200
15201 static inline uint64_t CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone_ptr(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ *NONNULL_PTR arg) {
15202         LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ");
15203         *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone(arg);
15204         return tag_ptr(ret_conv, true);
15205 }
15206 int64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone_ptr"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone_ptr(uint64_t arg) {
15207         LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* arg_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)untag_ptr(arg);
15208         int64_t ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone_ptr(arg_conv);
15209         return ret_conv;
15210 }
15211
15212 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone(uint64_t orig) {
15213         LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* orig_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)untag_ptr(orig);
15214         LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ");
15215         *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone(orig_conv);
15216         return tag_ptr(ret_conv, true);
15217 }
15218
15219 uint64_t  __attribute__((export_name("TS_CResult_PaymentSecretNoneZ_ok"))) TS_CResult_PaymentSecretNoneZ_ok(int8_tArray o) {
15220         LDKThirtyTwoBytes o_ref;
15221         CHECK(o->arr_len == 32);
15222         memcpy(o_ref.data, o->elems, 32); FREE(o);
15223         LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
15224         *ret_conv = CResult_PaymentSecretNoneZ_ok(o_ref);
15225         return tag_ptr(ret_conv, true);
15226 }
15227
15228 uint64_t  __attribute__((export_name("TS_CResult_PaymentSecretNoneZ_err"))) TS_CResult_PaymentSecretNoneZ_err() {
15229         LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
15230         *ret_conv = CResult_PaymentSecretNoneZ_err();
15231         return tag_ptr(ret_conv, true);
15232 }
15233
15234 jboolean  __attribute__((export_name("TS_CResult_PaymentSecretNoneZ_is_ok"))) TS_CResult_PaymentSecretNoneZ_is_ok(uint64_t o) {
15235         LDKCResult_PaymentSecretNoneZ* o_conv = (LDKCResult_PaymentSecretNoneZ*)untag_ptr(o);
15236         jboolean ret_conv = CResult_PaymentSecretNoneZ_is_ok(o_conv);
15237         return ret_conv;
15238 }
15239
15240 void  __attribute__((export_name("TS_CResult_PaymentSecretNoneZ_free"))) TS_CResult_PaymentSecretNoneZ_free(uint64_t _res) {
15241         if (!ptr_is_owned(_res)) return;
15242         void* _res_ptr = untag_ptr(_res);
15243         CHECK_ACCESS(_res_ptr);
15244         LDKCResult_PaymentSecretNoneZ _res_conv = *(LDKCResult_PaymentSecretNoneZ*)(_res_ptr);
15245         FREE(untag_ptr(_res));
15246         CResult_PaymentSecretNoneZ_free(_res_conv);
15247 }
15248
15249 static inline uint64_t CResult_PaymentSecretNoneZ_clone_ptr(LDKCResult_PaymentSecretNoneZ *NONNULL_PTR arg) {
15250         LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
15251         *ret_conv = CResult_PaymentSecretNoneZ_clone(arg);
15252         return tag_ptr(ret_conv, true);
15253 }
15254 int64_t  __attribute__((export_name("TS_CResult_PaymentSecretNoneZ_clone_ptr"))) TS_CResult_PaymentSecretNoneZ_clone_ptr(uint64_t arg) {
15255         LDKCResult_PaymentSecretNoneZ* arg_conv = (LDKCResult_PaymentSecretNoneZ*)untag_ptr(arg);
15256         int64_t ret_conv = CResult_PaymentSecretNoneZ_clone_ptr(arg_conv);
15257         return ret_conv;
15258 }
15259
15260 uint64_t  __attribute__((export_name("TS_CResult_PaymentSecretNoneZ_clone"))) TS_CResult_PaymentSecretNoneZ_clone(uint64_t orig) {
15261         LDKCResult_PaymentSecretNoneZ* orig_conv = (LDKCResult_PaymentSecretNoneZ*)untag_ptr(orig);
15262         LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
15263         *ret_conv = CResult_PaymentSecretNoneZ_clone(orig_conv);
15264         return tag_ptr(ret_conv, true);
15265 }
15266
15267 uint64_t  __attribute__((export_name("TS_CResult_PaymentSecretAPIErrorZ_ok"))) TS_CResult_PaymentSecretAPIErrorZ_ok(int8_tArray o) {
15268         LDKThirtyTwoBytes o_ref;
15269         CHECK(o->arr_len == 32);
15270         memcpy(o_ref.data, o->elems, 32); FREE(o);
15271         LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
15272         *ret_conv = CResult_PaymentSecretAPIErrorZ_ok(o_ref);
15273         return tag_ptr(ret_conv, true);
15274 }
15275
15276 uint64_t  __attribute__((export_name("TS_CResult_PaymentSecretAPIErrorZ_err"))) TS_CResult_PaymentSecretAPIErrorZ_err(uint64_t e) {
15277         void* e_ptr = untag_ptr(e);
15278         CHECK_ACCESS(e_ptr);
15279         LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
15280         e_conv = APIError_clone((LDKAPIError*)untag_ptr(e));
15281         LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
15282         *ret_conv = CResult_PaymentSecretAPIErrorZ_err(e_conv);
15283         return tag_ptr(ret_conv, true);
15284 }
15285
15286 jboolean  __attribute__((export_name("TS_CResult_PaymentSecretAPIErrorZ_is_ok"))) TS_CResult_PaymentSecretAPIErrorZ_is_ok(uint64_t o) {
15287         LDKCResult_PaymentSecretAPIErrorZ* o_conv = (LDKCResult_PaymentSecretAPIErrorZ*)untag_ptr(o);
15288         jboolean ret_conv = CResult_PaymentSecretAPIErrorZ_is_ok(o_conv);
15289         return ret_conv;
15290 }
15291
15292 void  __attribute__((export_name("TS_CResult_PaymentSecretAPIErrorZ_free"))) TS_CResult_PaymentSecretAPIErrorZ_free(uint64_t _res) {
15293         if (!ptr_is_owned(_res)) return;
15294         void* _res_ptr = untag_ptr(_res);
15295         CHECK_ACCESS(_res_ptr);
15296         LDKCResult_PaymentSecretAPIErrorZ _res_conv = *(LDKCResult_PaymentSecretAPIErrorZ*)(_res_ptr);
15297         FREE(untag_ptr(_res));
15298         CResult_PaymentSecretAPIErrorZ_free(_res_conv);
15299 }
15300
15301 static inline uint64_t CResult_PaymentSecretAPIErrorZ_clone_ptr(LDKCResult_PaymentSecretAPIErrorZ *NONNULL_PTR arg) {
15302         LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
15303         *ret_conv = CResult_PaymentSecretAPIErrorZ_clone(arg);
15304         return tag_ptr(ret_conv, true);
15305 }
15306 int64_t  __attribute__((export_name("TS_CResult_PaymentSecretAPIErrorZ_clone_ptr"))) TS_CResult_PaymentSecretAPIErrorZ_clone_ptr(uint64_t arg) {
15307         LDKCResult_PaymentSecretAPIErrorZ* arg_conv = (LDKCResult_PaymentSecretAPIErrorZ*)untag_ptr(arg);
15308         int64_t ret_conv = CResult_PaymentSecretAPIErrorZ_clone_ptr(arg_conv);
15309         return ret_conv;
15310 }
15311
15312 uint64_t  __attribute__((export_name("TS_CResult_PaymentSecretAPIErrorZ_clone"))) TS_CResult_PaymentSecretAPIErrorZ_clone(uint64_t orig) {
15313         LDKCResult_PaymentSecretAPIErrorZ* orig_conv = (LDKCResult_PaymentSecretAPIErrorZ*)untag_ptr(orig);
15314         LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
15315         *ret_conv = CResult_PaymentSecretAPIErrorZ_clone(orig_conv);
15316         return tag_ptr(ret_conv, true);
15317 }
15318
15319 uint64_t  __attribute__((export_name("TS_CResult_PaymentPreimageAPIErrorZ_ok"))) TS_CResult_PaymentPreimageAPIErrorZ_ok(int8_tArray o) {
15320         LDKThirtyTwoBytes o_ref;
15321         CHECK(o->arr_len == 32);
15322         memcpy(o_ref.data, o->elems, 32); FREE(o);
15323         LDKCResult_PaymentPreimageAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPreimageAPIErrorZ), "LDKCResult_PaymentPreimageAPIErrorZ");
15324         *ret_conv = CResult_PaymentPreimageAPIErrorZ_ok(o_ref);
15325         return tag_ptr(ret_conv, true);
15326 }
15327
15328 uint64_t  __attribute__((export_name("TS_CResult_PaymentPreimageAPIErrorZ_err"))) TS_CResult_PaymentPreimageAPIErrorZ_err(uint64_t e) {
15329         void* e_ptr = untag_ptr(e);
15330         CHECK_ACCESS(e_ptr);
15331         LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
15332         e_conv = APIError_clone((LDKAPIError*)untag_ptr(e));
15333         LDKCResult_PaymentPreimageAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPreimageAPIErrorZ), "LDKCResult_PaymentPreimageAPIErrorZ");
15334         *ret_conv = CResult_PaymentPreimageAPIErrorZ_err(e_conv);
15335         return tag_ptr(ret_conv, true);
15336 }
15337
15338 jboolean  __attribute__((export_name("TS_CResult_PaymentPreimageAPIErrorZ_is_ok"))) TS_CResult_PaymentPreimageAPIErrorZ_is_ok(uint64_t o) {
15339         LDKCResult_PaymentPreimageAPIErrorZ* o_conv = (LDKCResult_PaymentPreimageAPIErrorZ*)untag_ptr(o);
15340         jboolean ret_conv = CResult_PaymentPreimageAPIErrorZ_is_ok(o_conv);
15341         return ret_conv;
15342 }
15343
15344 void  __attribute__((export_name("TS_CResult_PaymentPreimageAPIErrorZ_free"))) TS_CResult_PaymentPreimageAPIErrorZ_free(uint64_t _res) {
15345         if (!ptr_is_owned(_res)) return;
15346         void* _res_ptr = untag_ptr(_res);
15347         CHECK_ACCESS(_res_ptr);
15348         LDKCResult_PaymentPreimageAPIErrorZ _res_conv = *(LDKCResult_PaymentPreimageAPIErrorZ*)(_res_ptr);
15349         FREE(untag_ptr(_res));
15350         CResult_PaymentPreimageAPIErrorZ_free(_res_conv);
15351 }
15352
15353 static inline uint64_t CResult_PaymentPreimageAPIErrorZ_clone_ptr(LDKCResult_PaymentPreimageAPIErrorZ *NONNULL_PTR arg) {
15354         LDKCResult_PaymentPreimageAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPreimageAPIErrorZ), "LDKCResult_PaymentPreimageAPIErrorZ");
15355         *ret_conv = CResult_PaymentPreimageAPIErrorZ_clone(arg);
15356         return tag_ptr(ret_conv, true);
15357 }
15358 int64_t  __attribute__((export_name("TS_CResult_PaymentPreimageAPIErrorZ_clone_ptr"))) TS_CResult_PaymentPreimageAPIErrorZ_clone_ptr(uint64_t arg) {
15359         LDKCResult_PaymentPreimageAPIErrorZ* arg_conv = (LDKCResult_PaymentPreimageAPIErrorZ*)untag_ptr(arg);
15360         int64_t ret_conv = CResult_PaymentPreimageAPIErrorZ_clone_ptr(arg_conv);
15361         return ret_conv;
15362 }
15363
15364 uint64_t  __attribute__((export_name("TS_CResult_PaymentPreimageAPIErrorZ_clone"))) TS_CResult_PaymentPreimageAPIErrorZ_clone(uint64_t orig) {
15365         LDKCResult_PaymentPreimageAPIErrorZ* orig_conv = (LDKCResult_PaymentPreimageAPIErrorZ*)untag_ptr(orig);
15366         LDKCResult_PaymentPreimageAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPreimageAPIErrorZ), "LDKCResult_PaymentPreimageAPIErrorZ");
15367         *ret_conv = CResult_PaymentPreimageAPIErrorZ_clone(orig_conv);
15368         return tag_ptr(ret_conv, true);
15369 }
15370
15371 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_ok"))) TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_ok(uint64_t o) {
15372         LDKCounterpartyForwardingInfo o_conv;
15373         o_conv.inner = untag_ptr(o);
15374         o_conv.is_owned = ptr_is_owned(o);
15375         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15376         o_conv = CounterpartyForwardingInfo_clone(&o_conv);
15377         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
15378         *ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_ok(o_conv);
15379         return tag_ptr(ret_conv, true);
15380 }
15381
15382 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_err"))) TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_err(uint64_t e) {
15383         LDKDecodeError e_conv;
15384         e_conv.inner = untag_ptr(e);
15385         e_conv.is_owned = ptr_is_owned(e);
15386         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15387         e_conv = DecodeError_clone(&e_conv);
15388         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
15389         *ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_err(e_conv);
15390         return tag_ptr(ret_conv, true);
15391 }
15392
15393 jboolean  __attribute__((export_name("TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_is_ok"))) TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_is_ok(uint64_t o) {
15394         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* o_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)untag_ptr(o);
15395         jboolean ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_is_ok(o_conv);
15396         return ret_conv;
15397 }
15398
15399 void  __attribute__((export_name("TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_free"))) TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_free(uint64_t _res) {
15400         if (!ptr_is_owned(_res)) return;
15401         void* _res_ptr = untag_ptr(_res);
15402         CHECK_ACCESS(_res_ptr);
15403         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ _res_conv = *(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)(_res_ptr);
15404         FREE(untag_ptr(_res));
15405         CResult_CounterpartyForwardingInfoDecodeErrorZ_free(_res_conv);
15406 }
15407
15408 static inline uint64_t CResult_CounterpartyForwardingInfoDecodeErrorZ_clone_ptr(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ *NONNULL_PTR arg) {
15409         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
15410         *ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_clone(arg);
15411         return tag_ptr(ret_conv, true);
15412 }
15413 int64_t  __attribute__((export_name("TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_clone_ptr"))) TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_clone_ptr(uint64_t arg) {
15414         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* arg_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)untag_ptr(arg);
15415         int64_t ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_clone_ptr(arg_conv);
15416         return ret_conv;
15417 }
15418
15419 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_clone"))) TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_clone(uint64_t orig) {
15420         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* orig_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)untag_ptr(orig);
15421         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
15422         *ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_clone(orig_conv);
15423         return tag_ptr(ret_conv, true);
15424 }
15425
15426 uint64_t  __attribute__((export_name("TS_CResult_ChannelCounterpartyDecodeErrorZ_ok"))) TS_CResult_ChannelCounterpartyDecodeErrorZ_ok(uint64_t o) {
15427         LDKChannelCounterparty o_conv;
15428         o_conv.inner = untag_ptr(o);
15429         o_conv.is_owned = ptr_is_owned(o);
15430         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15431         o_conv = ChannelCounterparty_clone(&o_conv);
15432         LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
15433         *ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_ok(o_conv);
15434         return tag_ptr(ret_conv, true);
15435 }
15436
15437 uint64_t  __attribute__((export_name("TS_CResult_ChannelCounterpartyDecodeErrorZ_err"))) TS_CResult_ChannelCounterpartyDecodeErrorZ_err(uint64_t e) {
15438         LDKDecodeError e_conv;
15439         e_conv.inner = untag_ptr(e);
15440         e_conv.is_owned = ptr_is_owned(e);
15441         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15442         e_conv = DecodeError_clone(&e_conv);
15443         LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
15444         *ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_err(e_conv);
15445         return tag_ptr(ret_conv, true);
15446 }
15447
15448 jboolean  __attribute__((export_name("TS_CResult_ChannelCounterpartyDecodeErrorZ_is_ok"))) TS_CResult_ChannelCounterpartyDecodeErrorZ_is_ok(uint64_t o) {
15449         LDKCResult_ChannelCounterpartyDecodeErrorZ* o_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)untag_ptr(o);
15450         jboolean ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_is_ok(o_conv);
15451         return ret_conv;
15452 }
15453
15454 void  __attribute__((export_name("TS_CResult_ChannelCounterpartyDecodeErrorZ_free"))) TS_CResult_ChannelCounterpartyDecodeErrorZ_free(uint64_t _res) {
15455         if (!ptr_is_owned(_res)) return;
15456         void* _res_ptr = untag_ptr(_res);
15457         CHECK_ACCESS(_res_ptr);
15458         LDKCResult_ChannelCounterpartyDecodeErrorZ _res_conv = *(LDKCResult_ChannelCounterpartyDecodeErrorZ*)(_res_ptr);
15459         FREE(untag_ptr(_res));
15460         CResult_ChannelCounterpartyDecodeErrorZ_free(_res_conv);
15461 }
15462
15463 static inline uint64_t CResult_ChannelCounterpartyDecodeErrorZ_clone_ptr(LDKCResult_ChannelCounterpartyDecodeErrorZ *NONNULL_PTR arg) {
15464         LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
15465         *ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_clone(arg);
15466         return tag_ptr(ret_conv, true);
15467 }
15468 int64_t  __attribute__((export_name("TS_CResult_ChannelCounterpartyDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelCounterpartyDecodeErrorZ_clone_ptr(uint64_t arg) {
15469         LDKCResult_ChannelCounterpartyDecodeErrorZ* arg_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)untag_ptr(arg);
15470         int64_t ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_clone_ptr(arg_conv);
15471         return ret_conv;
15472 }
15473
15474 uint64_t  __attribute__((export_name("TS_CResult_ChannelCounterpartyDecodeErrorZ_clone"))) TS_CResult_ChannelCounterpartyDecodeErrorZ_clone(uint64_t orig) {
15475         LDKCResult_ChannelCounterpartyDecodeErrorZ* orig_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)untag_ptr(orig);
15476         LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
15477         *ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_clone(orig_conv);
15478         return tag_ptr(ret_conv, true);
15479 }
15480
15481 uint64_t  __attribute__((export_name("TS_CResult_ChannelDetailsDecodeErrorZ_ok"))) TS_CResult_ChannelDetailsDecodeErrorZ_ok(uint64_t o) {
15482         LDKChannelDetails o_conv;
15483         o_conv.inner = untag_ptr(o);
15484         o_conv.is_owned = ptr_is_owned(o);
15485         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15486         o_conv = ChannelDetails_clone(&o_conv);
15487         LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
15488         *ret_conv = CResult_ChannelDetailsDecodeErrorZ_ok(o_conv);
15489         return tag_ptr(ret_conv, true);
15490 }
15491
15492 uint64_t  __attribute__((export_name("TS_CResult_ChannelDetailsDecodeErrorZ_err"))) TS_CResult_ChannelDetailsDecodeErrorZ_err(uint64_t e) {
15493         LDKDecodeError e_conv;
15494         e_conv.inner = untag_ptr(e);
15495         e_conv.is_owned = ptr_is_owned(e);
15496         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15497         e_conv = DecodeError_clone(&e_conv);
15498         LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
15499         *ret_conv = CResult_ChannelDetailsDecodeErrorZ_err(e_conv);
15500         return tag_ptr(ret_conv, true);
15501 }
15502
15503 jboolean  __attribute__((export_name("TS_CResult_ChannelDetailsDecodeErrorZ_is_ok"))) TS_CResult_ChannelDetailsDecodeErrorZ_is_ok(uint64_t o) {
15504         LDKCResult_ChannelDetailsDecodeErrorZ* o_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)untag_ptr(o);
15505         jboolean ret_conv = CResult_ChannelDetailsDecodeErrorZ_is_ok(o_conv);
15506         return ret_conv;
15507 }
15508
15509 void  __attribute__((export_name("TS_CResult_ChannelDetailsDecodeErrorZ_free"))) TS_CResult_ChannelDetailsDecodeErrorZ_free(uint64_t _res) {
15510         if (!ptr_is_owned(_res)) return;
15511         void* _res_ptr = untag_ptr(_res);
15512         CHECK_ACCESS(_res_ptr);
15513         LDKCResult_ChannelDetailsDecodeErrorZ _res_conv = *(LDKCResult_ChannelDetailsDecodeErrorZ*)(_res_ptr);
15514         FREE(untag_ptr(_res));
15515         CResult_ChannelDetailsDecodeErrorZ_free(_res_conv);
15516 }
15517
15518 static inline uint64_t CResult_ChannelDetailsDecodeErrorZ_clone_ptr(LDKCResult_ChannelDetailsDecodeErrorZ *NONNULL_PTR arg) {
15519         LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
15520         *ret_conv = CResult_ChannelDetailsDecodeErrorZ_clone(arg);
15521         return tag_ptr(ret_conv, true);
15522 }
15523 int64_t  __attribute__((export_name("TS_CResult_ChannelDetailsDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelDetailsDecodeErrorZ_clone_ptr(uint64_t arg) {
15524         LDKCResult_ChannelDetailsDecodeErrorZ* arg_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)untag_ptr(arg);
15525         int64_t ret_conv = CResult_ChannelDetailsDecodeErrorZ_clone_ptr(arg_conv);
15526         return ret_conv;
15527 }
15528
15529 uint64_t  __attribute__((export_name("TS_CResult_ChannelDetailsDecodeErrorZ_clone"))) TS_CResult_ChannelDetailsDecodeErrorZ_clone(uint64_t orig) {
15530         LDKCResult_ChannelDetailsDecodeErrorZ* orig_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)untag_ptr(orig);
15531         LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
15532         *ret_conv = CResult_ChannelDetailsDecodeErrorZ_clone(orig_conv);
15533         return tag_ptr(ret_conv, true);
15534 }
15535
15536 uint64_t  __attribute__((export_name("TS_CResult_PhantomRouteHintsDecodeErrorZ_ok"))) TS_CResult_PhantomRouteHintsDecodeErrorZ_ok(uint64_t o) {
15537         LDKPhantomRouteHints o_conv;
15538         o_conv.inner = untag_ptr(o);
15539         o_conv.is_owned = ptr_is_owned(o);
15540         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15541         o_conv = PhantomRouteHints_clone(&o_conv);
15542         LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
15543         *ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_ok(o_conv);
15544         return tag_ptr(ret_conv, true);
15545 }
15546
15547 uint64_t  __attribute__((export_name("TS_CResult_PhantomRouteHintsDecodeErrorZ_err"))) TS_CResult_PhantomRouteHintsDecodeErrorZ_err(uint64_t e) {
15548         LDKDecodeError e_conv;
15549         e_conv.inner = untag_ptr(e);
15550         e_conv.is_owned = ptr_is_owned(e);
15551         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15552         e_conv = DecodeError_clone(&e_conv);
15553         LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
15554         *ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_err(e_conv);
15555         return tag_ptr(ret_conv, true);
15556 }
15557
15558 jboolean  __attribute__((export_name("TS_CResult_PhantomRouteHintsDecodeErrorZ_is_ok"))) TS_CResult_PhantomRouteHintsDecodeErrorZ_is_ok(uint64_t o) {
15559         LDKCResult_PhantomRouteHintsDecodeErrorZ* o_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)untag_ptr(o);
15560         jboolean ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_is_ok(o_conv);
15561         return ret_conv;
15562 }
15563
15564 void  __attribute__((export_name("TS_CResult_PhantomRouteHintsDecodeErrorZ_free"))) TS_CResult_PhantomRouteHintsDecodeErrorZ_free(uint64_t _res) {
15565         if (!ptr_is_owned(_res)) return;
15566         void* _res_ptr = untag_ptr(_res);
15567         CHECK_ACCESS(_res_ptr);
15568         LDKCResult_PhantomRouteHintsDecodeErrorZ _res_conv = *(LDKCResult_PhantomRouteHintsDecodeErrorZ*)(_res_ptr);
15569         FREE(untag_ptr(_res));
15570         CResult_PhantomRouteHintsDecodeErrorZ_free(_res_conv);
15571 }
15572
15573 static inline uint64_t CResult_PhantomRouteHintsDecodeErrorZ_clone_ptr(LDKCResult_PhantomRouteHintsDecodeErrorZ *NONNULL_PTR arg) {
15574         LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
15575         *ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_clone(arg);
15576         return tag_ptr(ret_conv, true);
15577 }
15578 int64_t  __attribute__((export_name("TS_CResult_PhantomRouteHintsDecodeErrorZ_clone_ptr"))) TS_CResult_PhantomRouteHintsDecodeErrorZ_clone_ptr(uint64_t arg) {
15579         LDKCResult_PhantomRouteHintsDecodeErrorZ* arg_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)untag_ptr(arg);
15580         int64_t ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_clone_ptr(arg_conv);
15581         return ret_conv;
15582 }
15583
15584 uint64_t  __attribute__((export_name("TS_CResult_PhantomRouteHintsDecodeErrorZ_clone"))) TS_CResult_PhantomRouteHintsDecodeErrorZ_clone(uint64_t orig) {
15585         LDKCResult_PhantomRouteHintsDecodeErrorZ* orig_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)untag_ptr(orig);
15586         LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
15587         *ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_clone(orig_conv);
15588         return tag_ptr(ret_conv, true);
15589 }
15590
15591 void  __attribute__((export_name("TS_CVec_ChannelMonitorZ_free"))) TS_CVec_ChannelMonitorZ_free(uint64_tArray _res) {
15592         LDKCVec_ChannelMonitorZ _res_constr;
15593         _res_constr.datalen = _res->arr_len;
15594         if (_res_constr.datalen > 0)
15595                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
15596         else
15597                 _res_constr.data = NULL;
15598         uint64_t* _res_vals = _res->elems;
15599         for (size_t q = 0; q < _res_constr.datalen; q++) {
15600                 uint64_t _res_conv_16 = _res_vals[q];
15601                 LDKChannelMonitor _res_conv_16_conv;
15602                 _res_conv_16_conv.inner = untag_ptr(_res_conv_16);
15603                 _res_conv_16_conv.is_owned = ptr_is_owned(_res_conv_16);
15604                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_16_conv);
15605                 _res_constr.data[q] = _res_conv_16_conv;
15606         }
15607         FREE(_res);
15608         CVec_ChannelMonitorZ_free(_res_constr);
15609 }
15610
15611 uint64_t  __attribute__((export_name("TS_C2Tuple_BlockHashChannelManagerZ_new"))) TS_C2Tuple_BlockHashChannelManagerZ_new(int8_tArray a, uint64_t b) {
15612         LDKThirtyTwoBytes a_ref;
15613         CHECK(a->arr_len == 32);
15614         memcpy(a_ref.data, a->elems, 32); FREE(a);
15615         LDKChannelManager b_conv;
15616         b_conv.inner = untag_ptr(b);
15617         b_conv.is_owned = ptr_is_owned(b);
15618         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
15619         // WARNING: we need a move here but no clone is available for LDKChannelManager
15620         
15621         LDKC2Tuple_BlockHashChannelManagerZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelManagerZ), "LDKC2Tuple_BlockHashChannelManagerZ");
15622         *ret_conv = C2Tuple_BlockHashChannelManagerZ_new(a_ref, b_conv);
15623         return tag_ptr(ret_conv, true);
15624 }
15625
15626 void  __attribute__((export_name("TS_C2Tuple_BlockHashChannelManagerZ_free"))) TS_C2Tuple_BlockHashChannelManagerZ_free(uint64_t _res) {
15627         if (!ptr_is_owned(_res)) return;
15628         void* _res_ptr = untag_ptr(_res);
15629         CHECK_ACCESS(_res_ptr);
15630         LDKC2Tuple_BlockHashChannelManagerZ _res_conv = *(LDKC2Tuple_BlockHashChannelManagerZ*)(_res_ptr);
15631         FREE(untag_ptr(_res));
15632         C2Tuple_BlockHashChannelManagerZ_free(_res_conv);
15633 }
15634
15635 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok"))) TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(uint64_t o) {
15636         void* o_ptr = untag_ptr(o);
15637         CHECK_ACCESS(o_ptr);
15638         LDKC2Tuple_BlockHashChannelManagerZ o_conv = *(LDKC2Tuple_BlockHashChannelManagerZ*)(o_ptr);
15639         // WARNING: we may need a move here but no clone is available for LDKC2Tuple_BlockHashChannelManagerZ
15640         LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
15641         *ret_conv = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(o_conv);
15642         return tag_ptr(ret_conv, true);
15643 }
15644
15645 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err"))) TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(uint64_t e) {
15646         LDKDecodeError e_conv;
15647         e_conv.inner = untag_ptr(e);
15648         e_conv.is_owned = ptr_is_owned(e);
15649         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15650         e_conv = DecodeError_clone(&e_conv);
15651         LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
15652         *ret_conv = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(e_conv);
15653         return tag_ptr(ret_conv, true);
15654 }
15655
15656 jboolean  __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_is_ok"))) TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_is_ok(uint64_t o) {
15657         LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* o_conv = (LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)untag_ptr(o);
15658         jboolean ret_conv = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_is_ok(o_conv);
15659         return ret_conv;
15660 }
15661
15662 void  __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free"))) TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(uint64_t _res) {
15663         if (!ptr_is_owned(_res)) return;
15664         void* _res_ptr = untag_ptr(_res);
15665         CHECK_ACCESS(_res_ptr);
15666         LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ _res_conv = *(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)(_res_ptr);
15667         FREE(untag_ptr(_res));
15668         CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(_res_conv);
15669 }
15670
15671 uint64_t  __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_ok"))) TS_CResult_ChannelConfigDecodeErrorZ_ok(uint64_t o) {
15672         LDKChannelConfig o_conv;
15673         o_conv.inner = untag_ptr(o);
15674         o_conv.is_owned = ptr_is_owned(o);
15675         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15676         o_conv = ChannelConfig_clone(&o_conv);
15677         LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
15678         *ret_conv = CResult_ChannelConfigDecodeErrorZ_ok(o_conv);
15679         return tag_ptr(ret_conv, true);
15680 }
15681
15682 uint64_t  __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_err"))) TS_CResult_ChannelConfigDecodeErrorZ_err(uint64_t e) {
15683         LDKDecodeError e_conv;
15684         e_conv.inner = untag_ptr(e);
15685         e_conv.is_owned = ptr_is_owned(e);
15686         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15687         e_conv = DecodeError_clone(&e_conv);
15688         LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
15689         *ret_conv = CResult_ChannelConfigDecodeErrorZ_err(e_conv);
15690         return tag_ptr(ret_conv, true);
15691 }
15692
15693 jboolean  __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_is_ok"))) TS_CResult_ChannelConfigDecodeErrorZ_is_ok(uint64_t o) {
15694         LDKCResult_ChannelConfigDecodeErrorZ* o_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)untag_ptr(o);
15695         jboolean ret_conv = CResult_ChannelConfigDecodeErrorZ_is_ok(o_conv);
15696         return ret_conv;
15697 }
15698
15699 void  __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_free"))) TS_CResult_ChannelConfigDecodeErrorZ_free(uint64_t _res) {
15700         if (!ptr_is_owned(_res)) return;
15701         void* _res_ptr = untag_ptr(_res);
15702         CHECK_ACCESS(_res_ptr);
15703         LDKCResult_ChannelConfigDecodeErrorZ _res_conv = *(LDKCResult_ChannelConfigDecodeErrorZ*)(_res_ptr);
15704         FREE(untag_ptr(_res));
15705         CResult_ChannelConfigDecodeErrorZ_free(_res_conv);
15706 }
15707
15708 static inline uint64_t CResult_ChannelConfigDecodeErrorZ_clone_ptr(LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR arg) {
15709         LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
15710         *ret_conv = CResult_ChannelConfigDecodeErrorZ_clone(arg);
15711         return tag_ptr(ret_conv, true);
15712 }
15713 int64_t  __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelConfigDecodeErrorZ_clone_ptr(uint64_t arg) {
15714         LDKCResult_ChannelConfigDecodeErrorZ* arg_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)untag_ptr(arg);
15715         int64_t ret_conv = CResult_ChannelConfigDecodeErrorZ_clone_ptr(arg_conv);
15716         return ret_conv;
15717 }
15718
15719 uint64_t  __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_clone"))) TS_CResult_ChannelConfigDecodeErrorZ_clone(uint64_t orig) {
15720         LDKCResult_ChannelConfigDecodeErrorZ* orig_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)untag_ptr(orig);
15721         LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
15722         *ret_conv = CResult_ChannelConfigDecodeErrorZ_clone(orig_conv);
15723         return tag_ptr(ret_conv, true);
15724 }
15725
15726 uint64_t  __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_ok"))) TS_CResult_OutPointDecodeErrorZ_ok(uint64_t o) {
15727         LDKOutPoint o_conv;
15728         o_conv.inner = untag_ptr(o);
15729         o_conv.is_owned = ptr_is_owned(o);
15730         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15731         o_conv = OutPoint_clone(&o_conv);
15732         LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
15733         *ret_conv = CResult_OutPointDecodeErrorZ_ok(o_conv);
15734         return tag_ptr(ret_conv, true);
15735 }
15736
15737 uint64_t  __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_err"))) TS_CResult_OutPointDecodeErrorZ_err(uint64_t e) {
15738         LDKDecodeError e_conv;
15739         e_conv.inner = untag_ptr(e);
15740         e_conv.is_owned = ptr_is_owned(e);
15741         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15742         e_conv = DecodeError_clone(&e_conv);
15743         LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
15744         *ret_conv = CResult_OutPointDecodeErrorZ_err(e_conv);
15745         return tag_ptr(ret_conv, true);
15746 }
15747
15748 jboolean  __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_is_ok"))) TS_CResult_OutPointDecodeErrorZ_is_ok(uint64_t o) {
15749         LDKCResult_OutPointDecodeErrorZ* o_conv = (LDKCResult_OutPointDecodeErrorZ*)untag_ptr(o);
15750         jboolean ret_conv = CResult_OutPointDecodeErrorZ_is_ok(o_conv);
15751         return ret_conv;
15752 }
15753
15754 void  __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_free"))) TS_CResult_OutPointDecodeErrorZ_free(uint64_t _res) {
15755         if (!ptr_is_owned(_res)) return;
15756         void* _res_ptr = untag_ptr(_res);
15757         CHECK_ACCESS(_res_ptr);
15758         LDKCResult_OutPointDecodeErrorZ _res_conv = *(LDKCResult_OutPointDecodeErrorZ*)(_res_ptr);
15759         FREE(untag_ptr(_res));
15760         CResult_OutPointDecodeErrorZ_free(_res_conv);
15761 }
15762
15763 static inline uint64_t CResult_OutPointDecodeErrorZ_clone_ptr(LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR arg) {
15764         LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
15765         *ret_conv = CResult_OutPointDecodeErrorZ_clone(arg);
15766         return tag_ptr(ret_conv, true);
15767 }
15768 int64_t  __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_clone_ptr"))) TS_CResult_OutPointDecodeErrorZ_clone_ptr(uint64_t arg) {
15769         LDKCResult_OutPointDecodeErrorZ* arg_conv = (LDKCResult_OutPointDecodeErrorZ*)untag_ptr(arg);
15770         int64_t ret_conv = CResult_OutPointDecodeErrorZ_clone_ptr(arg_conv);
15771         return ret_conv;
15772 }
15773
15774 uint64_t  __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_clone"))) TS_CResult_OutPointDecodeErrorZ_clone(uint64_t orig) {
15775         LDKCResult_OutPointDecodeErrorZ* orig_conv = (LDKCResult_OutPointDecodeErrorZ*)untag_ptr(orig);
15776         LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
15777         *ret_conv = CResult_OutPointDecodeErrorZ_clone(orig_conv);
15778         return tag_ptr(ret_conv, true);
15779 }
15780
15781 uint64_t  __attribute__((export_name("TS_COption_TypeZ_some"))) TS_COption_TypeZ_some(uint64_t o) {
15782         void* o_ptr = untag_ptr(o);
15783         CHECK_ACCESS(o_ptr);
15784         LDKType o_conv = *(LDKType*)(o_ptr);
15785         if (o_conv.free == LDKType_JCalls_free) {
15786                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
15787                 LDKType_JCalls_cloned(&o_conv);
15788         }
15789         LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
15790         *ret_copy = COption_TypeZ_some(o_conv);
15791         uint64_t ret_ref = tag_ptr(ret_copy, true);
15792         return ret_ref;
15793 }
15794
15795 uint64_t  __attribute__((export_name("TS_COption_TypeZ_none"))) TS_COption_TypeZ_none() {
15796         LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
15797         *ret_copy = COption_TypeZ_none();
15798         uint64_t ret_ref = tag_ptr(ret_copy, true);
15799         return ret_ref;
15800 }
15801
15802 void  __attribute__((export_name("TS_COption_TypeZ_free"))) TS_COption_TypeZ_free(uint64_t _res) {
15803         if (!ptr_is_owned(_res)) return;
15804         void* _res_ptr = untag_ptr(_res);
15805         CHECK_ACCESS(_res_ptr);
15806         LDKCOption_TypeZ _res_conv = *(LDKCOption_TypeZ*)(_res_ptr);
15807         FREE(untag_ptr(_res));
15808         COption_TypeZ_free(_res_conv);
15809 }
15810
15811 static inline uint64_t COption_TypeZ_clone_ptr(LDKCOption_TypeZ *NONNULL_PTR arg) {
15812         LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
15813         *ret_copy = COption_TypeZ_clone(arg);
15814         uint64_t ret_ref = tag_ptr(ret_copy, true);
15815         return ret_ref;
15816 }
15817 int64_t  __attribute__((export_name("TS_COption_TypeZ_clone_ptr"))) TS_COption_TypeZ_clone_ptr(uint64_t arg) {
15818         LDKCOption_TypeZ* arg_conv = (LDKCOption_TypeZ*)untag_ptr(arg);
15819         int64_t ret_conv = COption_TypeZ_clone_ptr(arg_conv);
15820         return ret_conv;
15821 }
15822
15823 uint64_t  __attribute__((export_name("TS_COption_TypeZ_clone"))) TS_COption_TypeZ_clone(uint64_t orig) {
15824         LDKCOption_TypeZ* orig_conv = (LDKCOption_TypeZ*)untag_ptr(orig);
15825         LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
15826         *ret_copy = COption_TypeZ_clone(orig_conv);
15827         uint64_t ret_ref = tag_ptr(ret_copy, true);
15828         return ret_ref;
15829 }
15830
15831 uint64_t  __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_ok"))) TS_CResult_COption_TypeZDecodeErrorZ_ok(uint64_t o) {
15832         void* o_ptr = untag_ptr(o);
15833         CHECK_ACCESS(o_ptr);
15834         LDKCOption_TypeZ o_conv = *(LDKCOption_TypeZ*)(o_ptr);
15835         o_conv = COption_TypeZ_clone((LDKCOption_TypeZ*)untag_ptr(o));
15836         LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
15837         *ret_conv = CResult_COption_TypeZDecodeErrorZ_ok(o_conv);
15838         return tag_ptr(ret_conv, true);
15839 }
15840
15841 uint64_t  __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_err"))) TS_CResult_COption_TypeZDecodeErrorZ_err(uint64_t e) {
15842         LDKDecodeError e_conv;
15843         e_conv.inner = untag_ptr(e);
15844         e_conv.is_owned = ptr_is_owned(e);
15845         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15846         e_conv = DecodeError_clone(&e_conv);
15847         LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
15848         *ret_conv = CResult_COption_TypeZDecodeErrorZ_err(e_conv);
15849         return tag_ptr(ret_conv, true);
15850 }
15851
15852 jboolean  __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_is_ok"))) TS_CResult_COption_TypeZDecodeErrorZ_is_ok(uint64_t o) {
15853         LDKCResult_COption_TypeZDecodeErrorZ* o_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)untag_ptr(o);
15854         jboolean ret_conv = CResult_COption_TypeZDecodeErrorZ_is_ok(o_conv);
15855         return ret_conv;
15856 }
15857
15858 void  __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_free"))) TS_CResult_COption_TypeZDecodeErrorZ_free(uint64_t _res) {
15859         if (!ptr_is_owned(_res)) return;
15860         void* _res_ptr = untag_ptr(_res);
15861         CHECK_ACCESS(_res_ptr);
15862         LDKCResult_COption_TypeZDecodeErrorZ _res_conv = *(LDKCResult_COption_TypeZDecodeErrorZ*)(_res_ptr);
15863         FREE(untag_ptr(_res));
15864         CResult_COption_TypeZDecodeErrorZ_free(_res_conv);
15865 }
15866
15867 static inline uint64_t CResult_COption_TypeZDecodeErrorZ_clone_ptr(LDKCResult_COption_TypeZDecodeErrorZ *NONNULL_PTR arg) {
15868         LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
15869         *ret_conv = CResult_COption_TypeZDecodeErrorZ_clone(arg);
15870         return tag_ptr(ret_conv, true);
15871 }
15872 int64_t  __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_clone_ptr"))) TS_CResult_COption_TypeZDecodeErrorZ_clone_ptr(uint64_t arg) {
15873         LDKCResult_COption_TypeZDecodeErrorZ* arg_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)untag_ptr(arg);
15874         int64_t ret_conv = CResult_COption_TypeZDecodeErrorZ_clone_ptr(arg_conv);
15875         return ret_conv;
15876 }
15877
15878 uint64_t  __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_clone"))) TS_CResult_COption_TypeZDecodeErrorZ_clone(uint64_t orig) {
15879         LDKCResult_COption_TypeZDecodeErrorZ* orig_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)untag_ptr(orig);
15880         LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
15881         *ret_conv = CResult_COption_TypeZDecodeErrorZ_clone(orig_conv);
15882         return tag_ptr(ret_conv, true);
15883 }
15884
15885 uint64_t  __attribute__((export_name("TS_CResult_PaymentIdPaymentErrorZ_ok"))) TS_CResult_PaymentIdPaymentErrorZ_ok(int8_tArray o) {
15886         LDKThirtyTwoBytes o_ref;
15887         CHECK(o->arr_len == 32);
15888         memcpy(o_ref.data, o->elems, 32); FREE(o);
15889         LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
15890         *ret_conv = CResult_PaymentIdPaymentErrorZ_ok(o_ref);
15891         return tag_ptr(ret_conv, true);
15892 }
15893
15894 uint64_t  __attribute__((export_name("TS_CResult_PaymentIdPaymentErrorZ_err"))) TS_CResult_PaymentIdPaymentErrorZ_err(uint64_t e) {
15895         void* e_ptr = untag_ptr(e);
15896         CHECK_ACCESS(e_ptr);
15897         LDKPaymentError e_conv = *(LDKPaymentError*)(e_ptr);
15898         e_conv = PaymentError_clone((LDKPaymentError*)untag_ptr(e));
15899         LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
15900         *ret_conv = CResult_PaymentIdPaymentErrorZ_err(e_conv);
15901         return tag_ptr(ret_conv, true);
15902 }
15903
15904 jboolean  __attribute__((export_name("TS_CResult_PaymentIdPaymentErrorZ_is_ok"))) TS_CResult_PaymentIdPaymentErrorZ_is_ok(uint64_t o) {
15905         LDKCResult_PaymentIdPaymentErrorZ* o_conv = (LDKCResult_PaymentIdPaymentErrorZ*)untag_ptr(o);
15906         jboolean ret_conv = CResult_PaymentIdPaymentErrorZ_is_ok(o_conv);
15907         return ret_conv;
15908 }
15909
15910 void  __attribute__((export_name("TS_CResult_PaymentIdPaymentErrorZ_free"))) TS_CResult_PaymentIdPaymentErrorZ_free(uint64_t _res) {
15911         if (!ptr_is_owned(_res)) return;
15912         void* _res_ptr = untag_ptr(_res);
15913         CHECK_ACCESS(_res_ptr);
15914         LDKCResult_PaymentIdPaymentErrorZ _res_conv = *(LDKCResult_PaymentIdPaymentErrorZ*)(_res_ptr);
15915         FREE(untag_ptr(_res));
15916         CResult_PaymentIdPaymentErrorZ_free(_res_conv);
15917 }
15918
15919 static inline uint64_t CResult_PaymentIdPaymentErrorZ_clone_ptr(LDKCResult_PaymentIdPaymentErrorZ *NONNULL_PTR arg) {
15920         LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
15921         *ret_conv = CResult_PaymentIdPaymentErrorZ_clone(arg);
15922         return tag_ptr(ret_conv, true);
15923 }
15924 int64_t  __attribute__((export_name("TS_CResult_PaymentIdPaymentErrorZ_clone_ptr"))) TS_CResult_PaymentIdPaymentErrorZ_clone_ptr(uint64_t arg) {
15925         LDKCResult_PaymentIdPaymentErrorZ* arg_conv = (LDKCResult_PaymentIdPaymentErrorZ*)untag_ptr(arg);
15926         int64_t ret_conv = CResult_PaymentIdPaymentErrorZ_clone_ptr(arg_conv);
15927         return ret_conv;
15928 }
15929
15930 uint64_t  __attribute__((export_name("TS_CResult_PaymentIdPaymentErrorZ_clone"))) TS_CResult_PaymentIdPaymentErrorZ_clone(uint64_t orig) {
15931         LDKCResult_PaymentIdPaymentErrorZ* orig_conv = (LDKCResult_PaymentIdPaymentErrorZ*)untag_ptr(orig);
15932         LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
15933         *ret_conv = CResult_PaymentIdPaymentErrorZ_clone(orig_conv);
15934         return tag_ptr(ret_conv, true);
15935 }
15936
15937 uint64_t  __attribute__((export_name("TS_CResult_SiPrefixParseErrorZ_ok"))) TS_CResult_SiPrefixParseErrorZ_ok(uint32_t o) {
15938         LDKSiPrefix o_conv = LDKSiPrefix_from_js(o);
15939         LDKCResult_SiPrefixParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixParseErrorZ), "LDKCResult_SiPrefixParseErrorZ");
15940         *ret_conv = CResult_SiPrefixParseErrorZ_ok(o_conv);
15941         return tag_ptr(ret_conv, true);
15942 }
15943
15944 uint64_t  __attribute__((export_name("TS_CResult_SiPrefixParseErrorZ_err"))) TS_CResult_SiPrefixParseErrorZ_err(uint64_t e) {
15945         void* e_ptr = untag_ptr(e);
15946         CHECK_ACCESS(e_ptr);
15947         LDKParseError e_conv = *(LDKParseError*)(e_ptr);
15948         e_conv = ParseError_clone((LDKParseError*)untag_ptr(e));
15949         LDKCResult_SiPrefixParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixParseErrorZ), "LDKCResult_SiPrefixParseErrorZ");
15950         *ret_conv = CResult_SiPrefixParseErrorZ_err(e_conv);
15951         return tag_ptr(ret_conv, true);
15952 }
15953
15954 jboolean  __attribute__((export_name("TS_CResult_SiPrefixParseErrorZ_is_ok"))) TS_CResult_SiPrefixParseErrorZ_is_ok(uint64_t o) {
15955         LDKCResult_SiPrefixParseErrorZ* o_conv = (LDKCResult_SiPrefixParseErrorZ*)untag_ptr(o);
15956         jboolean ret_conv = CResult_SiPrefixParseErrorZ_is_ok(o_conv);
15957         return ret_conv;
15958 }
15959
15960 void  __attribute__((export_name("TS_CResult_SiPrefixParseErrorZ_free"))) TS_CResult_SiPrefixParseErrorZ_free(uint64_t _res) {
15961         if (!ptr_is_owned(_res)) return;
15962         void* _res_ptr = untag_ptr(_res);
15963         CHECK_ACCESS(_res_ptr);
15964         LDKCResult_SiPrefixParseErrorZ _res_conv = *(LDKCResult_SiPrefixParseErrorZ*)(_res_ptr);
15965         FREE(untag_ptr(_res));
15966         CResult_SiPrefixParseErrorZ_free(_res_conv);
15967 }
15968
15969 static inline uint64_t CResult_SiPrefixParseErrorZ_clone_ptr(LDKCResult_SiPrefixParseErrorZ *NONNULL_PTR arg) {
15970         LDKCResult_SiPrefixParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixParseErrorZ), "LDKCResult_SiPrefixParseErrorZ");
15971         *ret_conv = CResult_SiPrefixParseErrorZ_clone(arg);
15972         return tag_ptr(ret_conv, true);
15973 }
15974 int64_t  __attribute__((export_name("TS_CResult_SiPrefixParseErrorZ_clone_ptr"))) TS_CResult_SiPrefixParseErrorZ_clone_ptr(uint64_t arg) {
15975         LDKCResult_SiPrefixParseErrorZ* arg_conv = (LDKCResult_SiPrefixParseErrorZ*)untag_ptr(arg);
15976         int64_t ret_conv = CResult_SiPrefixParseErrorZ_clone_ptr(arg_conv);
15977         return ret_conv;
15978 }
15979
15980 uint64_t  __attribute__((export_name("TS_CResult_SiPrefixParseErrorZ_clone"))) TS_CResult_SiPrefixParseErrorZ_clone(uint64_t orig) {
15981         LDKCResult_SiPrefixParseErrorZ* orig_conv = (LDKCResult_SiPrefixParseErrorZ*)untag_ptr(orig);
15982         LDKCResult_SiPrefixParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixParseErrorZ), "LDKCResult_SiPrefixParseErrorZ");
15983         *ret_conv = CResult_SiPrefixParseErrorZ_clone(orig_conv);
15984         return tag_ptr(ret_conv, true);
15985 }
15986
15987 uint64_t  __attribute__((export_name("TS_CResult_InvoiceParseOrSemanticErrorZ_ok"))) TS_CResult_InvoiceParseOrSemanticErrorZ_ok(uint64_t o) {
15988         LDKInvoice o_conv;
15989         o_conv.inner = untag_ptr(o);
15990         o_conv.is_owned = ptr_is_owned(o);
15991         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15992         o_conv = Invoice_clone(&o_conv);
15993         LDKCResult_InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceParseOrSemanticErrorZ), "LDKCResult_InvoiceParseOrSemanticErrorZ");
15994         *ret_conv = CResult_InvoiceParseOrSemanticErrorZ_ok(o_conv);
15995         return tag_ptr(ret_conv, true);
15996 }
15997
15998 uint64_t  __attribute__((export_name("TS_CResult_InvoiceParseOrSemanticErrorZ_err"))) TS_CResult_InvoiceParseOrSemanticErrorZ_err(uint64_t e) {
15999         void* e_ptr = untag_ptr(e);
16000         CHECK_ACCESS(e_ptr);
16001         LDKParseOrSemanticError e_conv = *(LDKParseOrSemanticError*)(e_ptr);
16002         e_conv = ParseOrSemanticError_clone((LDKParseOrSemanticError*)untag_ptr(e));
16003         LDKCResult_InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceParseOrSemanticErrorZ), "LDKCResult_InvoiceParseOrSemanticErrorZ");
16004         *ret_conv = CResult_InvoiceParseOrSemanticErrorZ_err(e_conv);
16005         return tag_ptr(ret_conv, true);
16006 }
16007
16008 jboolean  __attribute__((export_name("TS_CResult_InvoiceParseOrSemanticErrorZ_is_ok"))) TS_CResult_InvoiceParseOrSemanticErrorZ_is_ok(uint64_t o) {
16009         LDKCResult_InvoiceParseOrSemanticErrorZ* o_conv = (LDKCResult_InvoiceParseOrSemanticErrorZ*)untag_ptr(o);
16010         jboolean ret_conv = CResult_InvoiceParseOrSemanticErrorZ_is_ok(o_conv);
16011         return ret_conv;
16012 }
16013
16014 void  __attribute__((export_name("TS_CResult_InvoiceParseOrSemanticErrorZ_free"))) TS_CResult_InvoiceParseOrSemanticErrorZ_free(uint64_t _res) {
16015         if (!ptr_is_owned(_res)) return;
16016         void* _res_ptr = untag_ptr(_res);
16017         CHECK_ACCESS(_res_ptr);
16018         LDKCResult_InvoiceParseOrSemanticErrorZ _res_conv = *(LDKCResult_InvoiceParseOrSemanticErrorZ*)(_res_ptr);
16019         FREE(untag_ptr(_res));
16020         CResult_InvoiceParseOrSemanticErrorZ_free(_res_conv);
16021 }
16022
16023 static inline uint64_t CResult_InvoiceParseOrSemanticErrorZ_clone_ptr(LDKCResult_InvoiceParseOrSemanticErrorZ *NONNULL_PTR arg) {
16024         LDKCResult_InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceParseOrSemanticErrorZ), "LDKCResult_InvoiceParseOrSemanticErrorZ");
16025         *ret_conv = CResult_InvoiceParseOrSemanticErrorZ_clone(arg);
16026         return tag_ptr(ret_conv, true);
16027 }
16028 int64_t  __attribute__((export_name("TS_CResult_InvoiceParseOrSemanticErrorZ_clone_ptr"))) TS_CResult_InvoiceParseOrSemanticErrorZ_clone_ptr(uint64_t arg) {
16029         LDKCResult_InvoiceParseOrSemanticErrorZ* arg_conv = (LDKCResult_InvoiceParseOrSemanticErrorZ*)untag_ptr(arg);
16030         int64_t ret_conv = CResult_InvoiceParseOrSemanticErrorZ_clone_ptr(arg_conv);
16031         return ret_conv;
16032 }
16033
16034 uint64_t  __attribute__((export_name("TS_CResult_InvoiceParseOrSemanticErrorZ_clone"))) TS_CResult_InvoiceParseOrSemanticErrorZ_clone(uint64_t orig) {
16035         LDKCResult_InvoiceParseOrSemanticErrorZ* orig_conv = (LDKCResult_InvoiceParseOrSemanticErrorZ*)untag_ptr(orig);
16036         LDKCResult_InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceParseOrSemanticErrorZ), "LDKCResult_InvoiceParseOrSemanticErrorZ");
16037         *ret_conv = CResult_InvoiceParseOrSemanticErrorZ_clone(orig_conv);
16038         return tag_ptr(ret_conv, true);
16039 }
16040
16041 uint64_t  __attribute__((export_name("TS_CResult_SignedRawInvoiceParseErrorZ_ok"))) TS_CResult_SignedRawInvoiceParseErrorZ_ok(uint64_t o) {
16042         LDKSignedRawInvoice o_conv;
16043         o_conv.inner = untag_ptr(o);
16044         o_conv.is_owned = ptr_is_owned(o);
16045         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16046         o_conv = SignedRawInvoice_clone(&o_conv);
16047         LDKCResult_SignedRawInvoiceParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceParseErrorZ), "LDKCResult_SignedRawInvoiceParseErrorZ");
16048         *ret_conv = CResult_SignedRawInvoiceParseErrorZ_ok(o_conv);
16049         return tag_ptr(ret_conv, true);
16050 }
16051
16052 uint64_t  __attribute__((export_name("TS_CResult_SignedRawInvoiceParseErrorZ_err"))) TS_CResult_SignedRawInvoiceParseErrorZ_err(uint64_t e) {
16053         void* e_ptr = untag_ptr(e);
16054         CHECK_ACCESS(e_ptr);
16055         LDKParseError e_conv = *(LDKParseError*)(e_ptr);
16056         e_conv = ParseError_clone((LDKParseError*)untag_ptr(e));
16057         LDKCResult_SignedRawInvoiceParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceParseErrorZ), "LDKCResult_SignedRawInvoiceParseErrorZ");
16058         *ret_conv = CResult_SignedRawInvoiceParseErrorZ_err(e_conv);
16059         return tag_ptr(ret_conv, true);
16060 }
16061
16062 jboolean  __attribute__((export_name("TS_CResult_SignedRawInvoiceParseErrorZ_is_ok"))) TS_CResult_SignedRawInvoiceParseErrorZ_is_ok(uint64_t o) {
16063         LDKCResult_SignedRawInvoiceParseErrorZ* o_conv = (LDKCResult_SignedRawInvoiceParseErrorZ*)untag_ptr(o);
16064         jboolean ret_conv = CResult_SignedRawInvoiceParseErrorZ_is_ok(o_conv);
16065         return ret_conv;
16066 }
16067
16068 void  __attribute__((export_name("TS_CResult_SignedRawInvoiceParseErrorZ_free"))) TS_CResult_SignedRawInvoiceParseErrorZ_free(uint64_t _res) {
16069         if (!ptr_is_owned(_res)) return;
16070         void* _res_ptr = untag_ptr(_res);
16071         CHECK_ACCESS(_res_ptr);
16072         LDKCResult_SignedRawInvoiceParseErrorZ _res_conv = *(LDKCResult_SignedRawInvoiceParseErrorZ*)(_res_ptr);
16073         FREE(untag_ptr(_res));
16074         CResult_SignedRawInvoiceParseErrorZ_free(_res_conv);
16075 }
16076
16077 static inline uint64_t CResult_SignedRawInvoiceParseErrorZ_clone_ptr(LDKCResult_SignedRawInvoiceParseErrorZ *NONNULL_PTR arg) {
16078         LDKCResult_SignedRawInvoiceParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceParseErrorZ), "LDKCResult_SignedRawInvoiceParseErrorZ");
16079         *ret_conv = CResult_SignedRawInvoiceParseErrorZ_clone(arg);
16080         return tag_ptr(ret_conv, true);
16081 }
16082 int64_t  __attribute__((export_name("TS_CResult_SignedRawInvoiceParseErrorZ_clone_ptr"))) TS_CResult_SignedRawInvoiceParseErrorZ_clone_ptr(uint64_t arg) {
16083         LDKCResult_SignedRawInvoiceParseErrorZ* arg_conv = (LDKCResult_SignedRawInvoiceParseErrorZ*)untag_ptr(arg);
16084         int64_t ret_conv = CResult_SignedRawInvoiceParseErrorZ_clone_ptr(arg_conv);
16085         return ret_conv;
16086 }
16087
16088 uint64_t  __attribute__((export_name("TS_CResult_SignedRawInvoiceParseErrorZ_clone"))) TS_CResult_SignedRawInvoiceParseErrorZ_clone(uint64_t orig) {
16089         LDKCResult_SignedRawInvoiceParseErrorZ* orig_conv = (LDKCResult_SignedRawInvoiceParseErrorZ*)untag_ptr(orig);
16090         LDKCResult_SignedRawInvoiceParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceParseErrorZ), "LDKCResult_SignedRawInvoiceParseErrorZ");
16091         *ret_conv = CResult_SignedRawInvoiceParseErrorZ_clone(orig_conv);
16092         return tag_ptr(ret_conv, true);
16093 }
16094
16095 static inline uint64_t C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone_ptr(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *NONNULL_PTR arg) {
16096         LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
16097         *ret_conv = C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone(arg);
16098         return tag_ptr(ret_conv, true);
16099 }
16100 int64_t  __attribute__((export_name("TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone_ptr"))) TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone_ptr(uint64_t arg) {
16101         LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* arg_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)untag_ptr(arg);
16102         int64_t ret_conv = C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone_ptr(arg_conv);
16103         return ret_conv;
16104 }
16105
16106 uint64_t  __attribute__((export_name("TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone"))) TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone(uint64_t orig) {
16107         LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* orig_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)untag_ptr(orig);
16108         LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
16109         *ret_conv = C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone(orig_conv);
16110         return tag_ptr(ret_conv, true);
16111 }
16112
16113 uint64_t  __attribute__((export_name("TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_new"))) TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_new(uint64_t a, int8_tArray b, uint64_t c) {
16114         LDKRawInvoice a_conv;
16115         a_conv.inner = untag_ptr(a);
16116         a_conv.is_owned = ptr_is_owned(a);
16117         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
16118         a_conv = RawInvoice_clone(&a_conv);
16119         LDKThirtyTwoBytes b_ref;
16120         CHECK(b->arr_len == 32);
16121         memcpy(b_ref.data, b->elems, 32); FREE(b);
16122         LDKInvoiceSignature c_conv;
16123         c_conv.inner = untag_ptr(c);
16124         c_conv.is_owned = ptr_is_owned(c);
16125         CHECK_INNER_FIELD_ACCESS_OR_NULL(c_conv);
16126         c_conv = InvoiceSignature_clone(&c_conv);
16127         LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
16128         *ret_conv = C3Tuple_RawInvoice_u832InvoiceSignatureZ_new(a_conv, b_ref, c_conv);
16129         return tag_ptr(ret_conv, true);
16130 }
16131
16132 void  __attribute__((export_name("TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_free"))) TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_free(uint64_t _res) {
16133         if (!ptr_is_owned(_res)) return;
16134         void* _res_ptr = untag_ptr(_res);
16135         CHECK_ACCESS(_res_ptr);
16136         LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ _res_conv = *(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(_res_ptr);
16137         FREE(untag_ptr(_res));
16138         C3Tuple_RawInvoice_u832InvoiceSignatureZ_free(_res_conv);
16139 }
16140
16141 uint64_t  __attribute__((export_name("TS_CResult_PayeePubKeyErrorZ_ok"))) TS_CResult_PayeePubKeyErrorZ_ok(uint64_t o) {
16142         LDKPayeePubKey o_conv;
16143         o_conv.inner = untag_ptr(o);
16144         o_conv.is_owned = ptr_is_owned(o);
16145         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16146         o_conv = PayeePubKey_clone(&o_conv);
16147         LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
16148         *ret_conv = CResult_PayeePubKeyErrorZ_ok(o_conv);
16149         return tag_ptr(ret_conv, true);
16150 }
16151
16152 uint64_t  __attribute__((export_name("TS_CResult_PayeePubKeyErrorZ_err"))) TS_CResult_PayeePubKeyErrorZ_err(uint32_t e) {
16153         LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_js(e);
16154         LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
16155         *ret_conv = CResult_PayeePubKeyErrorZ_err(e_conv);
16156         return tag_ptr(ret_conv, true);
16157 }
16158
16159 jboolean  __attribute__((export_name("TS_CResult_PayeePubKeyErrorZ_is_ok"))) TS_CResult_PayeePubKeyErrorZ_is_ok(uint64_t o) {
16160         LDKCResult_PayeePubKeyErrorZ* o_conv = (LDKCResult_PayeePubKeyErrorZ*)untag_ptr(o);
16161         jboolean ret_conv = CResult_PayeePubKeyErrorZ_is_ok(o_conv);
16162         return ret_conv;
16163 }
16164
16165 void  __attribute__((export_name("TS_CResult_PayeePubKeyErrorZ_free"))) TS_CResult_PayeePubKeyErrorZ_free(uint64_t _res) {
16166         if (!ptr_is_owned(_res)) return;
16167         void* _res_ptr = untag_ptr(_res);
16168         CHECK_ACCESS(_res_ptr);
16169         LDKCResult_PayeePubKeyErrorZ _res_conv = *(LDKCResult_PayeePubKeyErrorZ*)(_res_ptr);
16170         FREE(untag_ptr(_res));
16171         CResult_PayeePubKeyErrorZ_free(_res_conv);
16172 }
16173
16174 static inline uint64_t CResult_PayeePubKeyErrorZ_clone_ptr(LDKCResult_PayeePubKeyErrorZ *NONNULL_PTR arg) {
16175         LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
16176         *ret_conv = CResult_PayeePubKeyErrorZ_clone(arg);
16177         return tag_ptr(ret_conv, true);
16178 }
16179 int64_t  __attribute__((export_name("TS_CResult_PayeePubKeyErrorZ_clone_ptr"))) TS_CResult_PayeePubKeyErrorZ_clone_ptr(uint64_t arg) {
16180         LDKCResult_PayeePubKeyErrorZ* arg_conv = (LDKCResult_PayeePubKeyErrorZ*)untag_ptr(arg);
16181         int64_t ret_conv = CResult_PayeePubKeyErrorZ_clone_ptr(arg_conv);
16182         return ret_conv;
16183 }
16184
16185 uint64_t  __attribute__((export_name("TS_CResult_PayeePubKeyErrorZ_clone"))) TS_CResult_PayeePubKeyErrorZ_clone(uint64_t orig) {
16186         LDKCResult_PayeePubKeyErrorZ* orig_conv = (LDKCResult_PayeePubKeyErrorZ*)untag_ptr(orig);
16187         LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
16188         *ret_conv = CResult_PayeePubKeyErrorZ_clone(orig_conv);
16189         return tag_ptr(ret_conv, true);
16190 }
16191
16192 void  __attribute__((export_name("TS_CVec_PrivateRouteZ_free"))) TS_CVec_PrivateRouteZ_free(uint64_tArray _res) {
16193         LDKCVec_PrivateRouteZ _res_constr;
16194         _res_constr.datalen = _res->arr_len;
16195         if (_res_constr.datalen > 0)
16196                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPrivateRoute), "LDKCVec_PrivateRouteZ Elements");
16197         else
16198                 _res_constr.data = NULL;
16199         uint64_t* _res_vals = _res->elems;
16200         for (size_t o = 0; o < _res_constr.datalen; o++) {
16201                 uint64_t _res_conv_14 = _res_vals[o];
16202                 LDKPrivateRoute _res_conv_14_conv;
16203                 _res_conv_14_conv.inner = untag_ptr(_res_conv_14);
16204                 _res_conv_14_conv.is_owned = ptr_is_owned(_res_conv_14);
16205                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_14_conv);
16206                 _res_constr.data[o] = _res_conv_14_conv;
16207         }
16208         FREE(_res);
16209         CVec_PrivateRouteZ_free(_res_constr);
16210 }
16211
16212 uint64_t  __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_ok"))) TS_CResult_PositiveTimestampCreationErrorZ_ok(uint64_t o) {
16213         LDKPositiveTimestamp o_conv;
16214         o_conv.inner = untag_ptr(o);
16215         o_conv.is_owned = ptr_is_owned(o);
16216         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16217         o_conv = PositiveTimestamp_clone(&o_conv);
16218         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
16219         *ret_conv = CResult_PositiveTimestampCreationErrorZ_ok(o_conv);
16220         return tag_ptr(ret_conv, true);
16221 }
16222
16223 uint64_t  __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_err"))) TS_CResult_PositiveTimestampCreationErrorZ_err(uint32_t e) {
16224         LDKCreationError e_conv = LDKCreationError_from_js(e);
16225         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
16226         *ret_conv = CResult_PositiveTimestampCreationErrorZ_err(e_conv);
16227         return tag_ptr(ret_conv, true);
16228 }
16229
16230 jboolean  __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_is_ok"))) TS_CResult_PositiveTimestampCreationErrorZ_is_ok(uint64_t o) {
16231         LDKCResult_PositiveTimestampCreationErrorZ* o_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)untag_ptr(o);
16232         jboolean ret_conv = CResult_PositiveTimestampCreationErrorZ_is_ok(o_conv);
16233         return ret_conv;
16234 }
16235
16236 void  __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_free"))) TS_CResult_PositiveTimestampCreationErrorZ_free(uint64_t _res) {
16237         if (!ptr_is_owned(_res)) return;
16238         void* _res_ptr = untag_ptr(_res);
16239         CHECK_ACCESS(_res_ptr);
16240         LDKCResult_PositiveTimestampCreationErrorZ _res_conv = *(LDKCResult_PositiveTimestampCreationErrorZ*)(_res_ptr);
16241         FREE(untag_ptr(_res));
16242         CResult_PositiveTimestampCreationErrorZ_free(_res_conv);
16243 }
16244
16245 static inline uint64_t CResult_PositiveTimestampCreationErrorZ_clone_ptr(LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR arg) {
16246         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
16247         *ret_conv = CResult_PositiveTimestampCreationErrorZ_clone(arg);
16248         return tag_ptr(ret_conv, true);
16249 }
16250 int64_t  __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_clone_ptr"))) TS_CResult_PositiveTimestampCreationErrorZ_clone_ptr(uint64_t arg) {
16251         LDKCResult_PositiveTimestampCreationErrorZ* arg_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)untag_ptr(arg);
16252         int64_t ret_conv = CResult_PositiveTimestampCreationErrorZ_clone_ptr(arg_conv);
16253         return ret_conv;
16254 }
16255
16256 uint64_t  __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_clone"))) TS_CResult_PositiveTimestampCreationErrorZ_clone(uint64_t orig) {
16257         LDKCResult_PositiveTimestampCreationErrorZ* orig_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)untag_ptr(orig);
16258         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
16259         *ret_conv = CResult_PositiveTimestampCreationErrorZ_clone(orig_conv);
16260         return tag_ptr(ret_conv, true);
16261 }
16262
16263 uint64_t  __attribute__((export_name("TS_CResult_NoneSemanticErrorZ_ok"))) TS_CResult_NoneSemanticErrorZ_ok() {
16264         LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
16265         *ret_conv = CResult_NoneSemanticErrorZ_ok();
16266         return tag_ptr(ret_conv, true);
16267 }
16268
16269 uint64_t  __attribute__((export_name("TS_CResult_NoneSemanticErrorZ_err"))) TS_CResult_NoneSemanticErrorZ_err(uint32_t e) {
16270         LDKSemanticError e_conv = LDKSemanticError_from_js(e);
16271         LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
16272         *ret_conv = CResult_NoneSemanticErrorZ_err(e_conv);
16273         return tag_ptr(ret_conv, true);
16274 }
16275
16276 jboolean  __attribute__((export_name("TS_CResult_NoneSemanticErrorZ_is_ok"))) TS_CResult_NoneSemanticErrorZ_is_ok(uint64_t o) {
16277         LDKCResult_NoneSemanticErrorZ* o_conv = (LDKCResult_NoneSemanticErrorZ*)untag_ptr(o);
16278         jboolean ret_conv = CResult_NoneSemanticErrorZ_is_ok(o_conv);
16279         return ret_conv;
16280 }
16281
16282 void  __attribute__((export_name("TS_CResult_NoneSemanticErrorZ_free"))) TS_CResult_NoneSemanticErrorZ_free(uint64_t _res) {
16283         if (!ptr_is_owned(_res)) return;
16284         void* _res_ptr = untag_ptr(_res);
16285         CHECK_ACCESS(_res_ptr);
16286         LDKCResult_NoneSemanticErrorZ _res_conv = *(LDKCResult_NoneSemanticErrorZ*)(_res_ptr);
16287         FREE(untag_ptr(_res));
16288         CResult_NoneSemanticErrorZ_free(_res_conv);
16289 }
16290
16291 static inline uint64_t CResult_NoneSemanticErrorZ_clone_ptr(LDKCResult_NoneSemanticErrorZ *NONNULL_PTR arg) {
16292         LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
16293         *ret_conv = CResult_NoneSemanticErrorZ_clone(arg);
16294         return tag_ptr(ret_conv, true);
16295 }
16296 int64_t  __attribute__((export_name("TS_CResult_NoneSemanticErrorZ_clone_ptr"))) TS_CResult_NoneSemanticErrorZ_clone_ptr(uint64_t arg) {
16297         LDKCResult_NoneSemanticErrorZ* arg_conv = (LDKCResult_NoneSemanticErrorZ*)untag_ptr(arg);
16298         int64_t ret_conv = CResult_NoneSemanticErrorZ_clone_ptr(arg_conv);
16299         return ret_conv;
16300 }
16301
16302 uint64_t  __attribute__((export_name("TS_CResult_NoneSemanticErrorZ_clone"))) TS_CResult_NoneSemanticErrorZ_clone(uint64_t orig) {
16303         LDKCResult_NoneSemanticErrorZ* orig_conv = (LDKCResult_NoneSemanticErrorZ*)untag_ptr(orig);
16304         LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
16305         *ret_conv = CResult_NoneSemanticErrorZ_clone(orig_conv);
16306         return tag_ptr(ret_conv, true);
16307 }
16308
16309 uint64_t  __attribute__((export_name("TS_CResult_InvoiceSemanticErrorZ_ok"))) TS_CResult_InvoiceSemanticErrorZ_ok(uint64_t o) {
16310         LDKInvoice o_conv;
16311         o_conv.inner = untag_ptr(o);
16312         o_conv.is_owned = ptr_is_owned(o);
16313         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16314         o_conv = Invoice_clone(&o_conv);
16315         LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
16316         *ret_conv = CResult_InvoiceSemanticErrorZ_ok(o_conv);
16317         return tag_ptr(ret_conv, true);
16318 }
16319
16320 uint64_t  __attribute__((export_name("TS_CResult_InvoiceSemanticErrorZ_err"))) TS_CResult_InvoiceSemanticErrorZ_err(uint32_t e) {
16321         LDKSemanticError e_conv = LDKSemanticError_from_js(e);
16322         LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
16323         *ret_conv = CResult_InvoiceSemanticErrorZ_err(e_conv);
16324         return tag_ptr(ret_conv, true);
16325 }
16326
16327 jboolean  __attribute__((export_name("TS_CResult_InvoiceSemanticErrorZ_is_ok"))) TS_CResult_InvoiceSemanticErrorZ_is_ok(uint64_t o) {
16328         LDKCResult_InvoiceSemanticErrorZ* o_conv = (LDKCResult_InvoiceSemanticErrorZ*)untag_ptr(o);
16329         jboolean ret_conv = CResult_InvoiceSemanticErrorZ_is_ok(o_conv);
16330         return ret_conv;
16331 }
16332
16333 void  __attribute__((export_name("TS_CResult_InvoiceSemanticErrorZ_free"))) TS_CResult_InvoiceSemanticErrorZ_free(uint64_t _res) {
16334         if (!ptr_is_owned(_res)) return;
16335         void* _res_ptr = untag_ptr(_res);
16336         CHECK_ACCESS(_res_ptr);
16337         LDKCResult_InvoiceSemanticErrorZ _res_conv = *(LDKCResult_InvoiceSemanticErrorZ*)(_res_ptr);
16338         FREE(untag_ptr(_res));
16339         CResult_InvoiceSemanticErrorZ_free(_res_conv);
16340 }
16341
16342 static inline uint64_t CResult_InvoiceSemanticErrorZ_clone_ptr(LDKCResult_InvoiceSemanticErrorZ *NONNULL_PTR arg) {
16343         LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
16344         *ret_conv = CResult_InvoiceSemanticErrorZ_clone(arg);
16345         return tag_ptr(ret_conv, true);
16346 }
16347 int64_t  __attribute__((export_name("TS_CResult_InvoiceSemanticErrorZ_clone_ptr"))) TS_CResult_InvoiceSemanticErrorZ_clone_ptr(uint64_t arg) {
16348         LDKCResult_InvoiceSemanticErrorZ* arg_conv = (LDKCResult_InvoiceSemanticErrorZ*)untag_ptr(arg);
16349         int64_t ret_conv = CResult_InvoiceSemanticErrorZ_clone_ptr(arg_conv);
16350         return ret_conv;
16351 }
16352
16353 uint64_t  __attribute__((export_name("TS_CResult_InvoiceSemanticErrorZ_clone"))) TS_CResult_InvoiceSemanticErrorZ_clone(uint64_t orig) {
16354         LDKCResult_InvoiceSemanticErrorZ* orig_conv = (LDKCResult_InvoiceSemanticErrorZ*)untag_ptr(orig);
16355         LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
16356         *ret_conv = CResult_InvoiceSemanticErrorZ_clone(orig_conv);
16357         return tag_ptr(ret_conv, true);
16358 }
16359
16360 uint64_t  __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_ok"))) TS_CResult_DescriptionCreationErrorZ_ok(uint64_t o) {
16361         LDKDescription o_conv;
16362         o_conv.inner = untag_ptr(o);
16363         o_conv.is_owned = ptr_is_owned(o);
16364         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16365         o_conv = Description_clone(&o_conv);
16366         LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
16367         *ret_conv = CResult_DescriptionCreationErrorZ_ok(o_conv);
16368         return tag_ptr(ret_conv, true);
16369 }
16370
16371 uint64_t  __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_err"))) TS_CResult_DescriptionCreationErrorZ_err(uint32_t e) {
16372         LDKCreationError e_conv = LDKCreationError_from_js(e);
16373         LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
16374         *ret_conv = CResult_DescriptionCreationErrorZ_err(e_conv);
16375         return tag_ptr(ret_conv, true);
16376 }
16377
16378 jboolean  __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_is_ok"))) TS_CResult_DescriptionCreationErrorZ_is_ok(uint64_t o) {
16379         LDKCResult_DescriptionCreationErrorZ* o_conv = (LDKCResult_DescriptionCreationErrorZ*)untag_ptr(o);
16380         jboolean ret_conv = CResult_DescriptionCreationErrorZ_is_ok(o_conv);
16381         return ret_conv;
16382 }
16383
16384 void  __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_free"))) TS_CResult_DescriptionCreationErrorZ_free(uint64_t _res) {
16385         if (!ptr_is_owned(_res)) return;
16386         void* _res_ptr = untag_ptr(_res);
16387         CHECK_ACCESS(_res_ptr);
16388         LDKCResult_DescriptionCreationErrorZ _res_conv = *(LDKCResult_DescriptionCreationErrorZ*)(_res_ptr);
16389         FREE(untag_ptr(_res));
16390         CResult_DescriptionCreationErrorZ_free(_res_conv);
16391 }
16392
16393 static inline uint64_t CResult_DescriptionCreationErrorZ_clone_ptr(LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR arg) {
16394         LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
16395         *ret_conv = CResult_DescriptionCreationErrorZ_clone(arg);
16396         return tag_ptr(ret_conv, true);
16397 }
16398 int64_t  __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_clone_ptr"))) TS_CResult_DescriptionCreationErrorZ_clone_ptr(uint64_t arg) {
16399         LDKCResult_DescriptionCreationErrorZ* arg_conv = (LDKCResult_DescriptionCreationErrorZ*)untag_ptr(arg);
16400         int64_t ret_conv = CResult_DescriptionCreationErrorZ_clone_ptr(arg_conv);
16401         return ret_conv;
16402 }
16403
16404 uint64_t  __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_clone"))) TS_CResult_DescriptionCreationErrorZ_clone(uint64_t orig) {
16405         LDKCResult_DescriptionCreationErrorZ* orig_conv = (LDKCResult_DescriptionCreationErrorZ*)untag_ptr(orig);
16406         LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
16407         *ret_conv = CResult_DescriptionCreationErrorZ_clone(orig_conv);
16408         return tag_ptr(ret_conv, true);
16409 }
16410
16411 uint64_t  __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_ok"))) TS_CResult_PrivateRouteCreationErrorZ_ok(uint64_t o) {
16412         LDKPrivateRoute o_conv;
16413         o_conv.inner = untag_ptr(o);
16414         o_conv.is_owned = ptr_is_owned(o);
16415         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16416         o_conv = PrivateRoute_clone(&o_conv);
16417         LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
16418         *ret_conv = CResult_PrivateRouteCreationErrorZ_ok(o_conv);
16419         return tag_ptr(ret_conv, true);
16420 }
16421
16422 uint64_t  __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_err"))) TS_CResult_PrivateRouteCreationErrorZ_err(uint32_t e) {
16423         LDKCreationError e_conv = LDKCreationError_from_js(e);
16424         LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
16425         *ret_conv = CResult_PrivateRouteCreationErrorZ_err(e_conv);
16426         return tag_ptr(ret_conv, true);
16427 }
16428
16429 jboolean  __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_is_ok"))) TS_CResult_PrivateRouteCreationErrorZ_is_ok(uint64_t o) {
16430         LDKCResult_PrivateRouteCreationErrorZ* o_conv = (LDKCResult_PrivateRouteCreationErrorZ*)untag_ptr(o);
16431         jboolean ret_conv = CResult_PrivateRouteCreationErrorZ_is_ok(o_conv);
16432         return ret_conv;
16433 }
16434
16435 void  __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_free"))) TS_CResult_PrivateRouteCreationErrorZ_free(uint64_t _res) {
16436         if (!ptr_is_owned(_res)) return;
16437         void* _res_ptr = untag_ptr(_res);
16438         CHECK_ACCESS(_res_ptr);
16439         LDKCResult_PrivateRouteCreationErrorZ _res_conv = *(LDKCResult_PrivateRouteCreationErrorZ*)(_res_ptr);
16440         FREE(untag_ptr(_res));
16441         CResult_PrivateRouteCreationErrorZ_free(_res_conv);
16442 }
16443
16444 static inline uint64_t CResult_PrivateRouteCreationErrorZ_clone_ptr(LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR arg) {
16445         LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
16446         *ret_conv = CResult_PrivateRouteCreationErrorZ_clone(arg);
16447         return tag_ptr(ret_conv, true);
16448 }
16449 int64_t  __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_clone_ptr"))) TS_CResult_PrivateRouteCreationErrorZ_clone_ptr(uint64_t arg) {
16450         LDKCResult_PrivateRouteCreationErrorZ* arg_conv = (LDKCResult_PrivateRouteCreationErrorZ*)untag_ptr(arg);
16451         int64_t ret_conv = CResult_PrivateRouteCreationErrorZ_clone_ptr(arg_conv);
16452         return ret_conv;
16453 }
16454
16455 uint64_t  __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_clone"))) TS_CResult_PrivateRouteCreationErrorZ_clone(uint64_t orig) {
16456         LDKCResult_PrivateRouteCreationErrorZ* orig_conv = (LDKCResult_PrivateRouteCreationErrorZ*)untag_ptr(orig);
16457         LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
16458         *ret_conv = CResult_PrivateRouteCreationErrorZ_clone(orig_conv);
16459         return tag_ptr(ret_conv, true);
16460 }
16461
16462 uint64_t  __attribute__((export_name("TS_CResult_StringErrorZ_ok"))) TS_CResult_StringErrorZ_ok(jstring o) {
16463         LDKStr o_conv = str_ref_to_owned_c(o);
16464         LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
16465         *ret_conv = CResult_StringErrorZ_ok(o_conv);
16466         return tag_ptr(ret_conv, true);
16467 }
16468
16469 uint64_t  __attribute__((export_name("TS_CResult_StringErrorZ_err"))) TS_CResult_StringErrorZ_err(uint32_t e) {
16470         LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_js(e);
16471         LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
16472         *ret_conv = CResult_StringErrorZ_err(e_conv);
16473         return tag_ptr(ret_conv, true);
16474 }
16475
16476 jboolean  __attribute__((export_name("TS_CResult_StringErrorZ_is_ok"))) TS_CResult_StringErrorZ_is_ok(uint64_t o) {
16477         LDKCResult_StringErrorZ* o_conv = (LDKCResult_StringErrorZ*)untag_ptr(o);
16478         jboolean ret_conv = CResult_StringErrorZ_is_ok(o_conv);
16479         return ret_conv;
16480 }
16481
16482 void  __attribute__((export_name("TS_CResult_StringErrorZ_free"))) TS_CResult_StringErrorZ_free(uint64_t _res) {
16483         if (!ptr_is_owned(_res)) return;
16484         void* _res_ptr = untag_ptr(_res);
16485         CHECK_ACCESS(_res_ptr);
16486         LDKCResult_StringErrorZ _res_conv = *(LDKCResult_StringErrorZ*)(_res_ptr);
16487         FREE(untag_ptr(_res));
16488         CResult_StringErrorZ_free(_res_conv);
16489 }
16490
16491 static inline uint64_t CResult_StringErrorZ_clone_ptr(LDKCResult_StringErrorZ *NONNULL_PTR arg) {
16492         LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
16493         *ret_conv = CResult_StringErrorZ_clone(arg);
16494         return tag_ptr(ret_conv, true);
16495 }
16496 int64_t  __attribute__((export_name("TS_CResult_StringErrorZ_clone_ptr"))) TS_CResult_StringErrorZ_clone_ptr(uint64_t arg) {
16497         LDKCResult_StringErrorZ* arg_conv = (LDKCResult_StringErrorZ*)untag_ptr(arg);
16498         int64_t ret_conv = CResult_StringErrorZ_clone_ptr(arg_conv);
16499         return ret_conv;
16500 }
16501
16502 uint64_t  __attribute__((export_name("TS_CResult_StringErrorZ_clone"))) TS_CResult_StringErrorZ_clone(uint64_t orig) {
16503         LDKCResult_StringErrorZ* orig_conv = (LDKCResult_StringErrorZ*)untag_ptr(orig);
16504         LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
16505         *ret_conv = CResult_StringErrorZ_clone(orig_conv);
16506         return tag_ptr(ret_conv, true);
16507 }
16508
16509 uint64_t  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_ok"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_ok(uint64_t o) {
16510         LDKChannelMonitorUpdate o_conv;
16511         o_conv.inner = untag_ptr(o);
16512         o_conv.is_owned = ptr_is_owned(o);
16513         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16514         o_conv = ChannelMonitorUpdate_clone(&o_conv);
16515         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
16516         *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_ok(o_conv);
16517         return tag_ptr(ret_conv, true);
16518 }
16519
16520 uint64_t  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_err"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_err(uint64_t e) {
16521         LDKDecodeError e_conv;
16522         e_conv.inner = untag_ptr(e);
16523         e_conv.is_owned = ptr_is_owned(e);
16524         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
16525         e_conv = DecodeError_clone(&e_conv);
16526         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
16527         *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_err(e_conv);
16528         return tag_ptr(ret_conv, true);
16529 }
16530
16531 jboolean  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_is_ok"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_is_ok(uint64_t o) {
16532         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* o_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)untag_ptr(o);
16533         jboolean ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_is_ok(o_conv);
16534         return ret_conv;
16535 }
16536
16537 void  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_free"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_free(uint64_t _res) {
16538         if (!ptr_is_owned(_res)) return;
16539         void* _res_ptr = untag_ptr(_res);
16540         CHECK_ACCESS(_res_ptr);
16541         LDKCResult_ChannelMonitorUpdateDecodeErrorZ _res_conv = *(LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(_res_ptr);
16542         FREE(untag_ptr(_res));
16543         CResult_ChannelMonitorUpdateDecodeErrorZ_free(_res_conv);
16544 }
16545
16546 static inline uint64_t CResult_ChannelMonitorUpdateDecodeErrorZ_clone_ptr(LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR arg) {
16547         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
16548         *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_clone(arg);
16549         return tag_ptr(ret_conv, true);
16550 }
16551 int64_t  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_clone_ptr(uint64_t arg) {
16552         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* arg_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)untag_ptr(arg);
16553         int64_t ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_clone_ptr(arg_conv);
16554         return ret_conv;
16555 }
16556
16557 uint64_t  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_clone"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_clone(uint64_t orig) {
16558         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* orig_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)untag_ptr(orig);
16559         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
16560         *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_clone(orig_conv);
16561         return tag_ptr(ret_conv, true);
16562 }
16563
16564 uint64_t  __attribute__((export_name("TS_COption_MonitorEventZ_some"))) TS_COption_MonitorEventZ_some(uint64_t o) {
16565         void* o_ptr = untag_ptr(o);
16566         CHECK_ACCESS(o_ptr);
16567         LDKMonitorEvent o_conv = *(LDKMonitorEvent*)(o_ptr);
16568         o_conv = MonitorEvent_clone((LDKMonitorEvent*)untag_ptr(o));
16569         LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
16570         *ret_copy = COption_MonitorEventZ_some(o_conv);
16571         uint64_t ret_ref = tag_ptr(ret_copy, true);
16572         return ret_ref;
16573 }
16574
16575 uint64_t  __attribute__((export_name("TS_COption_MonitorEventZ_none"))) TS_COption_MonitorEventZ_none() {
16576         LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
16577         *ret_copy = COption_MonitorEventZ_none();
16578         uint64_t ret_ref = tag_ptr(ret_copy, true);
16579         return ret_ref;
16580 }
16581
16582 void  __attribute__((export_name("TS_COption_MonitorEventZ_free"))) TS_COption_MonitorEventZ_free(uint64_t _res) {
16583         if (!ptr_is_owned(_res)) return;
16584         void* _res_ptr = untag_ptr(_res);
16585         CHECK_ACCESS(_res_ptr);
16586         LDKCOption_MonitorEventZ _res_conv = *(LDKCOption_MonitorEventZ*)(_res_ptr);
16587         FREE(untag_ptr(_res));
16588         COption_MonitorEventZ_free(_res_conv);
16589 }
16590
16591 static inline uint64_t COption_MonitorEventZ_clone_ptr(LDKCOption_MonitorEventZ *NONNULL_PTR arg) {
16592         LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
16593         *ret_copy = COption_MonitorEventZ_clone(arg);
16594         uint64_t ret_ref = tag_ptr(ret_copy, true);
16595         return ret_ref;
16596 }
16597 int64_t  __attribute__((export_name("TS_COption_MonitorEventZ_clone_ptr"))) TS_COption_MonitorEventZ_clone_ptr(uint64_t arg) {
16598         LDKCOption_MonitorEventZ* arg_conv = (LDKCOption_MonitorEventZ*)untag_ptr(arg);
16599         int64_t ret_conv = COption_MonitorEventZ_clone_ptr(arg_conv);
16600         return ret_conv;
16601 }
16602
16603 uint64_t  __attribute__((export_name("TS_COption_MonitorEventZ_clone"))) TS_COption_MonitorEventZ_clone(uint64_t orig) {
16604         LDKCOption_MonitorEventZ* orig_conv = (LDKCOption_MonitorEventZ*)untag_ptr(orig);
16605         LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
16606         *ret_copy = COption_MonitorEventZ_clone(orig_conv);
16607         uint64_t ret_ref = tag_ptr(ret_copy, true);
16608         return ret_ref;
16609 }
16610
16611 uint64_t  __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_ok"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_ok(uint64_t o) {
16612         void* o_ptr = untag_ptr(o);
16613         CHECK_ACCESS(o_ptr);
16614         LDKCOption_MonitorEventZ o_conv = *(LDKCOption_MonitorEventZ*)(o_ptr);
16615         o_conv = COption_MonitorEventZ_clone((LDKCOption_MonitorEventZ*)untag_ptr(o));
16616         LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
16617         *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_ok(o_conv);
16618         return tag_ptr(ret_conv, true);
16619 }
16620
16621 uint64_t  __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_err"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_err(uint64_t e) {
16622         LDKDecodeError e_conv;
16623         e_conv.inner = untag_ptr(e);
16624         e_conv.is_owned = ptr_is_owned(e);
16625         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
16626         e_conv = DecodeError_clone(&e_conv);
16627         LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
16628         *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_err(e_conv);
16629         return tag_ptr(ret_conv, true);
16630 }
16631
16632 jboolean  __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_is_ok"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_is_ok(uint64_t o) {
16633         LDKCResult_COption_MonitorEventZDecodeErrorZ* o_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)untag_ptr(o);
16634         jboolean ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_is_ok(o_conv);
16635         return ret_conv;
16636 }
16637
16638 void  __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_free"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_free(uint64_t _res) {
16639         if (!ptr_is_owned(_res)) return;
16640         void* _res_ptr = untag_ptr(_res);
16641         CHECK_ACCESS(_res_ptr);
16642         LDKCResult_COption_MonitorEventZDecodeErrorZ _res_conv = *(LDKCResult_COption_MonitorEventZDecodeErrorZ*)(_res_ptr);
16643         FREE(untag_ptr(_res));
16644         CResult_COption_MonitorEventZDecodeErrorZ_free(_res_conv);
16645 }
16646
16647 static inline uint64_t CResult_COption_MonitorEventZDecodeErrorZ_clone_ptr(LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR arg) {
16648         LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
16649         *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_clone(arg);
16650         return tag_ptr(ret_conv, true);
16651 }
16652 int64_t  __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_clone_ptr"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_clone_ptr(uint64_t arg) {
16653         LDKCResult_COption_MonitorEventZDecodeErrorZ* arg_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)untag_ptr(arg);
16654         int64_t ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_clone_ptr(arg_conv);
16655         return ret_conv;
16656 }
16657
16658 uint64_t  __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_clone"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_clone(uint64_t orig) {
16659         LDKCResult_COption_MonitorEventZDecodeErrorZ* orig_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)untag_ptr(orig);
16660         LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
16661         *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_clone(orig_conv);
16662         return tag_ptr(ret_conv, true);
16663 }
16664
16665 uint64_t  __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_ok"))) TS_CResult_HTLCUpdateDecodeErrorZ_ok(uint64_t o) {
16666         LDKHTLCUpdate o_conv;
16667         o_conv.inner = untag_ptr(o);
16668         o_conv.is_owned = ptr_is_owned(o);
16669         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16670         o_conv = HTLCUpdate_clone(&o_conv);
16671         LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
16672         *ret_conv = CResult_HTLCUpdateDecodeErrorZ_ok(o_conv);
16673         return tag_ptr(ret_conv, true);
16674 }
16675
16676 uint64_t  __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_err"))) TS_CResult_HTLCUpdateDecodeErrorZ_err(uint64_t e) {
16677         LDKDecodeError e_conv;
16678         e_conv.inner = untag_ptr(e);
16679         e_conv.is_owned = ptr_is_owned(e);
16680         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
16681         e_conv = DecodeError_clone(&e_conv);
16682         LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
16683         *ret_conv = CResult_HTLCUpdateDecodeErrorZ_err(e_conv);
16684         return tag_ptr(ret_conv, true);
16685 }
16686
16687 jboolean  __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_is_ok"))) TS_CResult_HTLCUpdateDecodeErrorZ_is_ok(uint64_t o) {
16688         LDKCResult_HTLCUpdateDecodeErrorZ* o_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)untag_ptr(o);
16689         jboolean ret_conv = CResult_HTLCUpdateDecodeErrorZ_is_ok(o_conv);
16690         return ret_conv;
16691 }
16692
16693 void  __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_free"))) TS_CResult_HTLCUpdateDecodeErrorZ_free(uint64_t _res) {
16694         if (!ptr_is_owned(_res)) return;
16695         void* _res_ptr = untag_ptr(_res);
16696         CHECK_ACCESS(_res_ptr);
16697         LDKCResult_HTLCUpdateDecodeErrorZ _res_conv = *(LDKCResult_HTLCUpdateDecodeErrorZ*)(_res_ptr);
16698         FREE(untag_ptr(_res));
16699         CResult_HTLCUpdateDecodeErrorZ_free(_res_conv);
16700 }
16701
16702 static inline uint64_t CResult_HTLCUpdateDecodeErrorZ_clone_ptr(LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR arg) {
16703         LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
16704         *ret_conv = CResult_HTLCUpdateDecodeErrorZ_clone(arg);
16705         return tag_ptr(ret_conv, true);
16706 }
16707 int64_t  __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_clone_ptr"))) TS_CResult_HTLCUpdateDecodeErrorZ_clone_ptr(uint64_t arg) {
16708         LDKCResult_HTLCUpdateDecodeErrorZ* arg_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)untag_ptr(arg);
16709         int64_t ret_conv = CResult_HTLCUpdateDecodeErrorZ_clone_ptr(arg_conv);
16710         return ret_conv;
16711 }
16712
16713 uint64_t  __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_clone"))) TS_CResult_HTLCUpdateDecodeErrorZ_clone(uint64_t orig) {
16714         LDKCResult_HTLCUpdateDecodeErrorZ* orig_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)untag_ptr(orig);
16715         LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
16716         *ret_conv = CResult_HTLCUpdateDecodeErrorZ_clone(orig_conv);
16717         return tag_ptr(ret_conv, true);
16718 }
16719
16720 static inline uint64_t C2Tuple_OutPointScriptZ_clone_ptr(LDKC2Tuple_OutPointScriptZ *NONNULL_PTR arg) {
16721         LDKC2Tuple_OutPointScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
16722         *ret_conv = C2Tuple_OutPointScriptZ_clone(arg);
16723         return tag_ptr(ret_conv, true);
16724 }
16725 int64_t  __attribute__((export_name("TS_C2Tuple_OutPointScriptZ_clone_ptr"))) TS_C2Tuple_OutPointScriptZ_clone_ptr(uint64_t arg) {
16726         LDKC2Tuple_OutPointScriptZ* arg_conv = (LDKC2Tuple_OutPointScriptZ*)untag_ptr(arg);
16727         int64_t ret_conv = C2Tuple_OutPointScriptZ_clone_ptr(arg_conv);
16728         return ret_conv;
16729 }
16730
16731 uint64_t  __attribute__((export_name("TS_C2Tuple_OutPointScriptZ_clone"))) TS_C2Tuple_OutPointScriptZ_clone(uint64_t orig) {
16732         LDKC2Tuple_OutPointScriptZ* orig_conv = (LDKC2Tuple_OutPointScriptZ*)untag_ptr(orig);
16733         LDKC2Tuple_OutPointScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
16734         *ret_conv = C2Tuple_OutPointScriptZ_clone(orig_conv);
16735         return tag_ptr(ret_conv, true);
16736 }
16737
16738 uint64_t  __attribute__((export_name("TS_C2Tuple_OutPointScriptZ_new"))) TS_C2Tuple_OutPointScriptZ_new(uint64_t a, int8_tArray b) {
16739         LDKOutPoint a_conv;
16740         a_conv.inner = untag_ptr(a);
16741         a_conv.is_owned = ptr_is_owned(a);
16742         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
16743         a_conv = OutPoint_clone(&a_conv);
16744         LDKCVec_u8Z b_ref;
16745         b_ref.datalen = b->arr_len;
16746         b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
16747         memcpy(b_ref.data, b->elems, b_ref.datalen); FREE(b);
16748         LDKC2Tuple_OutPointScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
16749         *ret_conv = C2Tuple_OutPointScriptZ_new(a_conv, b_ref);
16750         return tag_ptr(ret_conv, true);
16751 }
16752
16753 void  __attribute__((export_name("TS_C2Tuple_OutPointScriptZ_free"))) TS_C2Tuple_OutPointScriptZ_free(uint64_t _res) {
16754         if (!ptr_is_owned(_res)) return;
16755         void* _res_ptr = untag_ptr(_res);
16756         CHECK_ACCESS(_res_ptr);
16757         LDKC2Tuple_OutPointScriptZ _res_conv = *(LDKC2Tuple_OutPointScriptZ*)(_res_ptr);
16758         FREE(untag_ptr(_res));
16759         C2Tuple_OutPointScriptZ_free(_res_conv);
16760 }
16761
16762 static inline uint64_t C2Tuple_u32ScriptZ_clone_ptr(LDKC2Tuple_u32ScriptZ *NONNULL_PTR arg) {
16763         LDKC2Tuple_u32ScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
16764         *ret_conv = C2Tuple_u32ScriptZ_clone(arg);
16765         return tag_ptr(ret_conv, true);
16766 }
16767 int64_t  __attribute__((export_name("TS_C2Tuple_u32ScriptZ_clone_ptr"))) TS_C2Tuple_u32ScriptZ_clone_ptr(uint64_t arg) {
16768         LDKC2Tuple_u32ScriptZ* arg_conv = (LDKC2Tuple_u32ScriptZ*)untag_ptr(arg);
16769         int64_t ret_conv = C2Tuple_u32ScriptZ_clone_ptr(arg_conv);
16770         return ret_conv;
16771 }
16772
16773 uint64_t  __attribute__((export_name("TS_C2Tuple_u32ScriptZ_clone"))) TS_C2Tuple_u32ScriptZ_clone(uint64_t orig) {
16774         LDKC2Tuple_u32ScriptZ* orig_conv = (LDKC2Tuple_u32ScriptZ*)untag_ptr(orig);
16775         LDKC2Tuple_u32ScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
16776         *ret_conv = C2Tuple_u32ScriptZ_clone(orig_conv);
16777         return tag_ptr(ret_conv, true);
16778 }
16779
16780 uint64_t  __attribute__((export_name("TS_C2Tuple_u32ScriptZ_new"))) TS_C2Tuple_u32ScriptZ_new(int32_t a, int8_tArray b) {
16781         LDKCVec_u8Z b_ref;
16782         b_ref.datalen = b->arr_len;
16783         b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
16784         memcpy(b_ref.data, b->elems, b_ref.datalen); FREE(b);
16785         LDKC2Tuple_u32ScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
16786         *ret_conv = C2Tuple_u32ScriptZ_new(a, b_ref);
16787         return tag_ptr(ret_conv, true);
16788 }
16789
16790 void  __attribute__((export_name("TS_C2Tuple_u32ScriptZ_free"))) TS_C2Tuple_u32ScriptZ_free(uint64_t _res) {
16791         if (!ptr_is_owned(_res)) return;
16792         void* _res_ptr = untag_ptr(_res);
16793         CHECK_ACCESS(_res_ptr);
16794         LDKC2Tuple_u32ScriptZ _res_conv = *(LDKC2Tuple_u32ScriptZ*)(_res_ptr);
16795         FREE(untag_ptr(_res));
16796         C2Tuple_u32ScriptZ_free(_res_conv);
16797 }
16798
16799 void  __attribute__((export_name("TS_CVec_C2Tuple_u32ScriptZZ_free"))) TS_CVec_C2Tuple_u32ScriptZZ_free(uint64_tArray _res) {
16800         LDKCVec_C2Tuple_u32ScriptZZ _res_constr;
16801         _res_constr.datalen = _res->arr_len;
16802         if (_res_constr.datalen > 0)
16803                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_u32ScriptZ), "LDKCVec_C2Tuple_u32ScriptZZ Elements");
16804         else
16805                 _res_constr.data = NULL;
16806         uint64_t* _res_vals = _res->elems;
16807         for (size_t v = 0; v < _res_constr.datalen; v++) {
16808                 uint64_t _res_conv_21 = _res_vals[v];
16809                 void* _res_conv_21_ptr = untag_ptr(_res_conv_21);
16810                 CHECK_ACCESS(_res_conv_21_ptr);
16811                 LDKC2Tuple_u32ScriptZ _res_conv_21_conv = *(LDKC2Tuple_u32ScriptZ*)(_res_conv_21_ptr);
16812                 FREE(untag_ptr(_res_conv_21));
16813                 _res_constr.data[v] = _res_conv_21_conv;
16814         }
16815         FREE(_res);
16816         CVec_C2Tuple_u32ScriptZZ_free(_res_constr);
16817 }
16818
16819 static inline uint64_t C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone_ptr(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *NONNULL_PTR arg) {
16820         LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
16821         *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(arg);
16822         return tag_ptr(ret_conv, true);
16823 }
16824 int64_t  __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone_ptr"))) TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone_ptr(uint64_t arg) {
16825         LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* arg_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)untag_ptr(arg);
16826         int64_t ret_conv = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone_ptr(arg_conv);
16827         return ret_conv;
16828 }
16829
16830 uint64_t  __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone"))) TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(uint64_t orig) {
16831         LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* orig_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)untag_ptr(orig);
16832         LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
16833         *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(orig_conv);
16834         return tag_ptr(ret_conv, true);
16835 }
16836
16837 uint64_t  __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_new"))) TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_new(int8_tArray a, uint64_tArray b) {
16838         LDKThirtyTwoBytes a_ref;
16839         CHECK(a->arr_len == 32);
16840         memcpy(a_ref.data, a->elems, 32); FREE(a);
16841         LDKCVec_C2Tuple_u32ScriptZZ b_constr;
16842         b_constr.datalen = b->arr_len;
16843         if (b_constr.datalen > 0)
16844                 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32ScriptZ), "LDKCVec_C2Tuple_u32ScriptZZ Elements");
16845         else
16846                 b_constr.data = NULL;
16847         uint64_t* b_vals = b->elems;
16848         for (size_t v = 0; v < b_constr.datalen; v++) {
16849                 uint64_t b_conv_21 = b_vals[v];
16850                 void* b_conv_21_ptr = untag_ptr(b_conv_21);
16851                 CHECK_ACCESS(b_conv_21_ptr);
16852                 LDKC2Tuple_u32ScriptZ b_conv_21_conv = *(LDKC2Tuple_u32ScriptZ*)(b_conv_21_ptr);
16853                 b_conv_21_conv = C2Tuple_u32ScriptZ_clone((LDKC2Tuple_u32ScriptZ*)untag_ptr(b_conv_21));
16854                 b_constr.data[v] = b_conv_21_conv;
16855         }
16856         FREE(b);
16857         LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
16858         *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_new(a_ref, b_constr);
16859         return tag_ptr(ret_conv, true);
16860 }
16861
16862 void  __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free"))) TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free(uint64_t _res) {
16863         if (!ptr_is_owned(_res)) return;
16864         void* _res_ptr = untag_ptr(_res);
16865         CHECK_ACCESS(_res_ptr);
16866         LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ _res_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(_res_ptr);
16867         FREE(untag_ptr(_res));
16868         C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free(_res_conv);
16869 }
16870
16871 void  __attribute__((export_name("TS_CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free"))) TS_CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(uint64_tArray _res) {
16872         LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ _res_constr;
16873         _res_constr.datalen = _res->arr_len;
16874         if (_res_constr.datalen > 0)
16875                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ Elements");
16876         else
16877                 _res_constr.data = NULL;
16878         uint64_t* _res_vals = _res->elems;
16879         for (size_t o = 0; o < _res_constr.datalen; o++) {
16880                 uint64_t _res_conv_40 = _res_vals[o];
16881                 void* _res_conv_40_ptr = untag_ptr(_res_conv_40);
16882                 CHECK_ACCESS(_res_conv_40_ptr);
16883                 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ _res_conv_40_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(_res_conv_40_ptr);
16884                 FREE(untag_ptr(_res_conv_40));
16885                 _res_constr.data[o] = _res_conv_40_conv;
16886         }
16887         FREE(_res);
16888         CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(_res_constr);
16889 }
16890
16891 void  __attribute__((export_name("TS_CVec_EventZ_free"))) TS_CVec_EventZ_free(uint64_tArray _res) {
16892         LDKCVec_EventZ _res_constr;
16893         _res_constr.datalen = _res->arr_len;
16894         if (_res_constr.datalen > 0)
16895                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKEvent), "LDKCVec_EventZ Elements");
16896         else
16897                 _res_constr.data = NULL;
16898         uint64_t* _res_vals = _res->elems;
16899         for (size_t h = 0; h < _res_constr.datalen; h++) {
16900                 uint64_t _res_conv_7 = _res_vals[h];
16901                 void* _res_conv_7_ptr = untag_ptr(_res_conv_7);
16902                 CHECK_ACCESS(_res_conv_7_ptr);
16903                 LDKEvent _res_conv_7_conv = *(LDKEvent*)(_res_conv_7_ptr);
16904                 FREE(untag_ptr(_res_conv_7));
16905                 _res_constr.data[h] = _res_conv_7_conv;
16906         }
16907         FREE(_res);
16908         CVec_EventZ_free(_res_constr);
16909 }
16910
16911 void  __attribute__((export_name("TS_CVec_TransactionZ_free"))) TS_CVec_TransactionZ_free(ptrArray _res) {
16912         LDKCVec_TransactionZ _res_constr;
16913         _res_constr.datalen = _res->arr_len;
16914         if (_res_constr.datalen > 0)
16915                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKTransaction), "LDKCVec_TransactionZ Elements");
16916         else
16917                 _res_constr.data = NULL;
16918         int8_tArray* _res_vals = (void*) _res->elems;
16919         for (size_t m = 0; m < _res_constr.datalen; m++) {
16920                 int8_tArray _res_conv_12 = _res_vals[m];
16921                 LDKTransaction _res_conv_12_ref;
16922                 _res_conv_12_ref.datalen = _res_conv_12->arr_len;
16923                 _res_conv_12_ref.data = MALLOC(_res_conv_12_ref.datalen, "LDKTransaction Bytes");
16924                 memcpy(_res_conv_12_ref.data, _res_conv_12->elems, _res_conv_12_ref.datalen); FREE(_res_conv_12);
16925                 _res_conv_12_ref.data_is_owned = true;
16926                 _res_constr.data[m] = _res_conv_12_ref;
16927         }
16928         FREE(_res);
16929         CVec_TransactionZ_free(_res_constr);
16930 }
16931
16932 static inline uint64_t C2Tuple_u32TxOutZ_clone_ptr(LDKC2Tuple_u32TxOutZ *NONNULL_PTR arg) {
16933         LDKC2Tuple_u32TxOutZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
16934         *ret_conv = C2Tuple_u32TxOutZ_clone(arg);
16935         return tag_ptr(ret_conv, true);
16936 }
16937 int64_t  __attribute__((export_name("TS_C2Tuple_u32TxOutZ_clone_ptr"))) TS_C2Tuple_u32TxOutZ_clone_ptr(uint64_t arg) {
16938         LDKC2Tuple_u32TxOutZ* arg_conv = (LDKC2Tuple_u32TxOutZ*)untag_ptr(arg);
16939         int64_t ret_conv = C2Tuple_u32TxOutZ_clone_ptr(arg_conv);
16940         return ret_conv;
16941 }
16942
16943 uint64_t  __attribute__((export_name("TS_C2Tuple_u32TxOutZ_clone"))) TS_C2Tuple_u32TxOutZ_clone(uint64_t orig) {
16944         LDKC2Tuple_u32TxOutZ* orig_conv = (LDKC2Tuple_u32TxOutZ*)untag_ptr(orig);
16945         LDKC2Tuple_u32TxOutZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
16946         *ret_conv = C2Tuple_u32TxOutZ_clone(orig_conv);
16947         return tag_ptr(ret_conv, true);
16948 }
16949
16950 uint64_t  __attribute__((export_name("TS_C2Tuple_u32TxOutZ_new"))) TS_C2Tuple_u32TxOutZ_new(int32_t a, uint64_t b) {
16951         void* b_ptr = untag_ptr(b);
16952         CHECK_ACCESS(b_ptr);
16953         LDKTxOut b_conv = *(LDKTxOut*)(b_ptr);
16954         b_conv = TxOut_clone((LDKTxOut*)untag_ptr(b));
16955         LDKC2Tuple_u32TxOutZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
16956         *ret_conv = C2Tuple_u32TxOutZ_new(a, b_conv);
16957         return tag_ptr(ret_conv, true);
16958 }
16959
16960 void  __attribute__((export_name("TS_C2Tuple_u32TxOutZ_free"))) TS_C2Tuple_u32TxOutZ_free(uint64_t _res) {
16961         if (!ptr_is_owned(_res)) return;
16962         void* _res_ptr = untag_ptr(_res);
16963         CHECK_ACCESS(_res_ptr);
16964         LDKC2Tuple_u32TxOutZ _res_conv = *(LDKC2Tuple_u32TxOutZ*)(_res_ptr);
16965         FREE(untag_ptr(_res));
16966         C2Tuple_u32TxOutZ_free(_res_conv);
16967 }
16968
16969 void  __attribute__((export_name("TS_CVec_C2Tuple_u32TxOutZZ_free"))) TS_CVec_C2Tuple_u32TxOutZZ_free(uint64_tArray _res) {
16970         LDKCVec_C2Tuple_u32TxOutZZ _res_constr;
16971         _res_constr.datalen = _res->arr_len;
16972         if (_res_constr.datalen > 0)
16973                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
16974         else
16975                 _res_constr.data = NULL;
16976         uint64_t* _res_vals = _res->elems;
16977         for (size_t u = 0; u < _res_constr.datalen; u++) {
16978                 uint64_t _res_conv_20 = _res_vals[u];
16979                 void* _res_conv_20_ptr = untag_ptr(_res_conv_20);
16980                 CHECK_ACCESS(_res_conv_20_ptr);
16981                 LDKC2Tuple_u32TxOutZ _res_conv_20_conv = *(LDKC2Tuple_u32TxOutZ*)(_res_conv_20_ptr);
16982                 FREE(untag_ptr(_res_conv_20));
16983                 _res_constr.data[u] = _res_conv_20_conv;
16984         }
16985         FREE(_res);
16986         CVec_C2Tuple_u32TxOutZZ_free(_res_constr);
16987 }
16988
16989 static inline uint64_t C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone_ptr(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR arg) {
16990         LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
16991         *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(arg);
16992         return tag_ptr(ret_conv, true);
16993 }
16994 int64_t  __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone_ptr"))) TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone_ptr(uint64_t arg) {
16995         LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* arg_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)untag_ptr(arg);
16996         int64_t ret_conv = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone_ptr(arg_conv);
16997         return ret_conv;
16998 }
16999
17000 uint64_t  __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone"))) TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(uint64_t orig) {
17001         LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* orig_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)untag_ptr(orig);
17002         LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
17003         *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(orig_conv);
17004         return tag_ptr(ret_conv, true);
17005 }
17006
17007 uint64_t  __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new"))) TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new(int8_tArray a, uint64_tArray b) {
17008         LDKThirtyTwoBytes a_ref;
17009         CHECK(a->arr_len == 32);
17010         memcpy(a_ref.data, a->elems, 32); FREE(a);
17011         LDKCVec_C2Tuple_u32TxOutZZ b_constr;
17012         b_constr.datalen = b->arr_len;
17013         if (b_constr.datalen > 0)
17014                 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
17015         else
17016                 b_constr.data = NULL;
17017         uint64_t* b_vals = b->elems;
17018         for (size_t u = 0; u < b_constr.datalen; u++) {
17019                 uint64_t b_conv_20 = b_vals[u];
17020                 void* b_conv_20_ptr = untag_ptr(b_conv_20);
17021                 CHECK_ACCESS(b_conv_20_ptr);
17022                 LDKC2Tuple_u32TxOutZ b_conv_20_conv = *(LDKC2Tuple_u32TxOutZ*)(b_conv_20_ptr);
17023                 b_conv_20_conv = C2Tuple_u32TxOutZ_clone((LDKC2Tuple_u32TxOutZ*)untag_ptr(b_conv_20));
17024                 b_constr.data[u] = b_conv_20_conv;
17025         }
17026         FREE(b);
17027         LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
17028         *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new(a_ref, b_constr);
17029         return tag_ptr(ret_conv, true);
17030 }
17031
17032 void  __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free"))) TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(uint64_t _res) {
17033         if (!ptr_is_owned(_res)) return;
17034         void* _res_ptr = untag_ptr(_res);
17035         CHECK_ACCESS(_res_ptr);
17036         LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ _res_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(_res_ptr);
17037         FREE(untag_ptr(_res));
17038         C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(_res_conv);
17039 }
17040
17041 void  __attribute__((export_name("TS_CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_free"))) TS_CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_free(uint64_tArray _res) {
17042         LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ _res_constr;
17043         _res_constr.datalen = _res->arr_len;
17044         if (_res_constr.datalen > 0)
17045                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ Elements");
17046         else
17047                 _res_constr.data = NULL;
17048         uint64_t* _res_vals = _res->elems;
17049         for (size_t n = 0; n < _res_constr.datalen; n++) {
17050                 uint64_t _res_conv_39 = _res_vals[n];
17051                 void* _res_conv_39_ptr = untag_ptr(_res_conv_39);
17052                 CHECK_ACCESS(_res_conv_39_ptr);
17053                 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ _res_conv_39_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(_res_conv_39_ptr);
17054                 FREE(untag_ptr(_res_conv_39));
17055                 _res_constr.data[n] = _res_conv_39_conv;
17056         }
17057         FREE(_res);
17058         CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_free(_res_constr);
17059 }
17060
17061 void  __attribute__((export_name("TS_CVec_BalanceZ_free"))) TS_CVec_BalanceZ_free(uint64_tArray _res) {
17062         LDKCVec_BalanceZ _res_constr;
17063         _res_constr.datalen = _res->arr_len;
17064         if (_res_constr.datalen > 0)
17065                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKBalance), "LDKCVec_BalanceZ Elements");
17066         else
17067                 _res_constr.data = NULL;
17068         uint64_t* _res_vals = _res->elems;
17069         for (size_t j = 0; j < _res_constr.datalen; j++) {
17070                 uint64_t _res_conv_9 = _res_vals[j];
17071                 void* _res_conv_9_ptr = untag_ptr(_res_conv_9);
17072                 CHECK_ACCESS(_res_conv_9_ptr);
17073                 LDKBalance _res_conv_9_conv = *(LDKBalance*)(_res_conv_9_ptr);
17074                 FREE(untag_ptr(_res_conv_9));
17075                 _res_constr.data[j] = _res_conv_9_conv;
17076         }
17077         FREE(_res);
17078         CVec_BalanceZ_free(_res_constr);
17079 }
17080
17081 static inline uint64_t C2Tuple_BlockHashChannelMonitorZ_clone_ptr(LDKC2Tuple_BlockHashChannelMonitorZ *NONNULL_PTR arg) {
17082         LDKC2Tuple_BlockHashChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
17083         *ret_conv = C2Tuple_BlockHashChannelMonitorZ_clone(arg);
17084         return tag_ptr(ret_conv, true);
17085 }
17086 int64_t  __attribute__((export_name("TS_C2Tuple_BlockHashChannelMonitorZ_clone_ptr"))) TS_C2Tuple_BlockHashChannelMonitorZ_clone_ptr(uint64_t arg) {
17087         LDKC2Tuple_BlockHashChannelMonitorZ* arg_conv = (LDKC2Tuple_BlockHashChannelMonitorZ*)untag_ptr(arg);
17088         int64_t ret_conv = C2Tuple_BlockHashChannelMonitorZ_clone_ptr(arg_conv);
17089         return ret_conv;
17090 }
17091
17092 uint64_t  __attribute__((export_name("TS_C2Tuple_BlockHashChannelMonitorZ_clone"))) TS_C2Tuple_BlockHashChannelMonitorZ_clone(uint64_t orig) {
17093         LDKC2Tuple_BlockHashChannelMonitorZ* orig_conv = (LDKC2Tuple_BlockHashChannelMonitorZ*)untag_ptr(orig);
17094         LDKC2Tuple_BlockHashChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
17095         *ret_conv = C2Tuple_BlockHashChannelMonitorZ_clone(orig_conv);
17096         return tag_ptr(ret_conv, true);
17097 }
17098
17099 uint64_t  __attribute__((export_name("TS_C2Tuple_BlockHashChannelMonitorZ_new"))) TS_C2Tuple_BlockHashChannelMonitorZ_new(int8_tArray a, uint64_t b) {
17100         LDKThirtyTwoBytes a_ref;
17101         CHECK(a->arr_len == 32);
17102         memcpy(a_ref.data, a->elems, 32); FREE(a);
17103         LDKChannelMonitor b_conv;
17104         b_conv.inner = untag_ptr(b);
17105         b_conv.is_owned = ptr_is_owned(b);
17106         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
17107         b_conv = ChannelMonitor_clone(&b_conv);
17108         LDKC2Tuple_BlockHashChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
17109         *ret_conv = C2Tuple_BlockHashChannelMonitorZ_new(a_ref, b_conv);
17110         return tag_ptr(ret_conv, true);
17111 }
17112
17113 void  __attribute__((export_name("TS_C2Tuple_BlockHashChannelMonitorZ_free"))) TS_C2Tuple_BlockHashChannelMonitorZ_free(uint64_t _res) {
17114         if (!ptr_is_owned(_res)) return;
17115         void* _res_ptr = untag_ptr(_res);
17116         CHECK_ACCESS(_res_ptr);
17117         LDKC2Tuple_BlockHashChannelMonitorZ _res_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(_res_ptr);
17118         FREE(untag_ptr(_res));
17119         C2Tuple_BlockHashChannelMonitorZ_free(_res_conv);
17120 }
17121
17122 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(uint64_t o) {
17123         void* o_ptr = untag_ptr(o);
17124         CHECK_ACCESS(o_ptr);
17125         LDKC2Tuple_BlockHashChannelMonitorZ o_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(o_ptr);
17126         o_conv = C2Tuple_BlockHashChannelMonitorZ_clone((LDKC2Tuple_BlockHashChannelMonitorZ*)untag_ptr(o));
17127         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
17128         *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(o_conv);
17129         return tag_ptr(ret_conv, true);
17130 }
17131
17132 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(uint64_t e) {
17133         LDKDecodeError e_conv;
17134         e_conv.inner = untag_ptr(e);
17135         e_conv.is_owned = ptr_is_owned(e);
17136         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
17137         e_conv = DecodeError_clone(&e_conv);
17138         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
17139         *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(e_conv);
17140         return tag_ptr(ret_conv, true);
17141 }
17142
17143 jboolean  __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_is_ok"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_is_ok(uint64_t o) {
17144         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* o_conv = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)untag_ptr(o);
17145         jboolean ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_is_ok(o_conv);
17146         return ret_conv;
17147 }
17148
17149 void  __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(uint64_t _res) {
17150         if (!ptr_is_owned(_res)) return;
17151         void* _res_ptr = untag_ptr(_res);
17152         CHECK_ACCESS(_res_ptr);
17153         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ _res_conv = *(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(_res_ptr);
17154         FREE(untag_ptr(_res));
17155         CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(_res_conv);
17156 }
17157
17158 static inline uint64_t CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone_ptr(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *NONNULL_PTR arg) {
17159         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
17160         *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone(arg);
17161         return tag_ptr(ret_conv, true);
17162 }
17163 int64_t  __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone_ptr"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone_ptr(uint64_t arg) {
17164         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* arg_conv = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)untag_ptr(arg);
17165         int64_t ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone_ptr(arg_conv);
17166         return ret_conv;
17167 }
17168
17169 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone(uint64_t orig) {
17170         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* orig_conv = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)untag_ptr(orig);
17171         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
17172         *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone(orig_conv);
17173         return tag_ptr(ret_conv, true);
17174 }
17175
17176 static inline uint64_t C2Tuple_PublicKeyTypeZ_clone_ptr(LDKC2Tuple_PublicKeyTypeZ *NONNULL_PTR arg) {
17177         LDKC2Tuple_PublicKeyTypeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
17178         *ret_conv = C2Tuple_PublicKeyTypeZ_clone(arg);
17179         return tag_ptr(ret_conv, true);
17180 }
17181 int64_t  __attribute__((export_name("TS_C2Tuple_PublicKeyTypeZ_clone_ptr"))) TS_C2Tuple_PublicKeyTypeZ_clone_ptr(uint64_t arg) {
17182         LDKC2Tuple_PublicKeyTypeZ* arg_conv = (LDKC2Tuple_PublicKeyTypeZ*)untag_ptr(arg);
17183         int64_t ret_conv = C2Tuple_PublicKeyTypeZ_clone_ptr(arg_conv);
17184         return ret_conv;
17185 }
17186
17187 uint64_t  __attribute__((export_name("TS_C2Tuple_PublicKeyTypeZ_clone"))) TS_C2Tuple_PublicKeyTypeZ_clone(uint64_t orig) {
17188         LDKC2Tuple_PublicKeyTypeZ* orig_conv = (LDKC2Tuple_PublicKeyTypeZ*)untag_ptr(orig);
17189         LDKC2Tuple_PublicKeyTypeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
17190         *ret_conv = C2Tuple_PublicKeyTypeZ_clone(orig_conv);
17191         return tag_ptr(ret_conv, true);
17192 }
17193
17194 uint64_t  __attribute__((export_name("TS_C2Tuple_PublicKeyTypeZ_new"))) TS_C2Tuple_PublicKeyTypeZ_new(int8_tArray a, uint64_t b) {
17195         LDKPublicKey a_ref;
17196         CHECK(a->arr_len == 33);
17197         memcpy(a_ref.compressed_form, a->elems, 33); FREE(a);
17198         void* b_ptr = untag_ptr(b);
17199         CHECK_ACCESS(b_ptr);
17200         LDKType b_conv = *(LDKType*)(b_ptr);
17201         if (b_conv.free == LDKType_JCalls_free) {
17202                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
17203                 LDKType_JCalls_cloned(&b_conv);
17204         }
17205         LDKC2Tuple_PublicKeyTypeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
17206         *ret_conv = C2Tuple_PublicKeyTypeZ_new(a_ref, b_conv);
17207         return tag_ptr(ret_conv, true);
17208 }
17209
17210 void  __attribute__((export_name("TS_C2Tuple_PublicKeyTypeZ_free"))) TS_C2Tuple_PublicKeyTypeZ_free(uint64_t _res) {
17211         if (!ptr_is_owned(_res)) return;
17212         void* _res_ptr = untag_ptr(_res);
17213         CHECK_ACCESS(_res_ptr);
17214         LDKC2Tuple_PublicKeyTypeZ _res_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(_res_ptr);
17215         FREE(untag_ptr(_res));
17216         C2Tuple_PublicKeyTypeZ_free(_res_conv);
17217 }
17218
17219 void  __attribute__((export_name("TS_CVec_C2Tuple_PublicKeyTypeZZ_free"))) TS_CVec_C2Tuple_PublicKeyTypeZZ_free(uint64_tArray _res) {
17220         LDKCVec_C2Tuple_PublicKeyTypeZZ _res_constr;
17221         _res_constr.datalen = _res->arr_len;
17222         if (_res_constr.datalen > 0)
17223                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKCVec_C2Tuple_PublicKeyTypeZZ Elements");
17224         else
17225                 _res_constr.data = NULL;
17226         uint64_t* _res_vals = _res->elems;
17227         for (size_t z = 0; z < _res_constr.datalen; z++) {
17228                 uint64_t _res_conv_25 = _res_vals[z];
17229                 void* _res_conv_25_ptr = untag_ptr(_res_conv_25);
17230                 CHECK_ACCESS(_res_conv_25_ptr);
17231                 LDKC2Tuple_PublicKeyTypeZ _res_conv_25_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(_res_conv_25_ptr);
17232                 FREE(untag_ptr(_res_conv_25));
17233                 _res_constr.data[z] = _res_conv_25_conv;
17234         }
17235         FREE(_res);
17236         CVec_C2Tuple_PublicKeyTypeZZ_free(_res_constr);
17237 }
17238
17239 uint64_t  __attribute__((export_name("TS_COption_NetAddressZ_some"))) TS_COption_NetAddressZ_some(uint64_t o) {
17240         void* o_ptr = untag_ptr(o);
17241         CHECK_ACCESS(o_ptr);
17242         LDKNetAddress o_conv = *(LDKNetAddress*)(o_ptr);
17243         o_conv = NetAddress_clone((LDKNetAddress*)untag_ptr(o));
17244         LDKCOption_NetAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_NetAddressZ), "LDKCOption_NetAddressZ");
17245         *ret_copy = COption_NetAddressZ_some(o_conv);
17246         uint64_t ret_ref = tag_ptr(ret_copy, true);
17247         return ret_ref;
17248 }
17249
17250 uint64_t  __attribute__((export_name("TS_COption_NetAddressZ_none"))) TS_COption_NetAddressZ_none() {
17251         LDKCOption_NetAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_NetAddressZ), "LDKCOption_NetAddressZ");
17252         *ret_copy = COption_NetAddressZ_none();
17253         uint64_t ret_ref = tag_ptr(ret_copy, true);
17254         return ret_ref;
17255 }
17256
17257 void  __attribute__((export_name("TS_COption_NetAddressZ_free"))) TS_COption_NetAddressZ_free(uint64_t _res) {
17258         if (!ptr_is_owned(_res)) return;
17259         void* _res_ptr = untag_ptr(_res);
17260         CHECK_ACCESS(_res_ptr);
17261         LDKCOption_NetAddressZ _res_conv = *(LDKCOption_NetAddressZ*)(_res_ptr);
17262         FREE(untag_ptr(_res));
17263         COption_NetAddressZ_free(_res_conv);
17264 }
17265
17266 static inline uint64_t COption_NetAddressZ_clone_ptr(LDKCOption_NetAddressZ *NONNULL_PTR arg) {
17267         LDKCOption_NetAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_NetAddressZ), "LDKCOption_NetAddressZ");
17268         *ret_copy = COption_NetAddressZ_clone(arg);
17269         uint64_t ret_ref = tag_ptr(ret_copy, true);
17270         return ret_ref;
17271 }
17272 int64_t  __attribute__((export_name("TS_COption_NetAddressZ_clone_ptr"))) TS_COption_NetAddressZ_clone_ptr(uint64_t arg) {
17273         LDKCOption_NetAddressZ* arg_conv = (LDKCOption_NetAddressZ*)untag_ptr(arg);
17274         int64_t ret_conv = COption_NetAddressZ_clone_ptr(arg_conv);
17275         return ret_conv;
17276 }
17277
17278 uint64_t  __attribute__((export_name("TS_COption_NetAddressZ_clone"))) TS_COption_NetAddressZ_clone(uint64_t orig) {
17279         LDKCOption_NetAddressZ* orig_conv = (LDKCOption_NetAddressZ*)untag_ptr(orig);
17280         LDKCOption_NetAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_NetAddressZ), "LDKCOption_NetAddressZ");
17281         *ret_copy = COption_NetAddressZ_clone(orig_conv);
17282         uint64_t ret_ref = tag_ptr(ret_copy, true);
17283         return ret_ref;
17284 }
17285
17286 uint64_t  __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_ok"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_ok(int8_tArray o) {
17287         LDKCVec_u8Z o_ref;
17288         o_ref.datalen = o->arr_len;
17289         o_ref.data = MALLOC(o_ref.datalen, "LDKCVec_u8Z Bytes");
17290         memcpy(o_ref.data, o->elems, o_ref.datalen); FREE(o);
17291         LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
17292         *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_ok(o_ref);
17293         return tag_ptr(ret_conv, true);
17294 }
17295
17296 uint64_t  __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_err"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_err(uint64_t e) {
17297         LDKPeerHandleError e_conv;
17298         e_conv.inner = untag_ptr(e);
17299         e_conv.is_owned = ptr_is_owned(e);
17300         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
17301         e_conv = PeerHandleError_clone(&e_conv);
17302         LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
17303         *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_err(e_conv);
17304         return tag_ptr(ret_conv, true);
17305 }
17306
17307 jboolean  __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_is_ok"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_is_ok(uint64_t o) {
17308         LDKCResult_CVec_u8ZPeerHandleErrorZ* o_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)untag_ptr(o);
17309         jboolean ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_is_ok(o_conv);
17310         return ret_conv;
17311 }
17312
17313 void  __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_free"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_free(uint64_t _res) {
17314         if (!ptr_is_owned(_res)) return;
17315         void* _res_ptr = untag_ptr(_res);
17316         CHECK_ACCESS(_res_ptr);
17317         LDKCResult_CVec_u8ZPeerHandleErrorZ _res_conv = *(LDKCResult_CVec_u8ZPeerHandleErrorZ*)(_res_ptr);
17318         FREE(untag_ptr(_res));
17319         CResult_CVec_u8ZPeerHandleErrorZ_free(_res_conv);
17320 }
17321
17322 static inline uint64_t CResult_CVec_u8ZPeerHandleErrorZ_clone_ptr(LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR arg) {
17323         LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
17324         *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_clone(arg);
17325         return tag_ptr(ret_conv, true);
17326 }
17327 int64_t  __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_clone_ptr"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_clone_ptr(uint64_t arg) {
17328         LDKCResult_CVec_u8ZPeerHandleErrorZ* arg_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)untag_ptr(arg);
17329         int64_t ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_clone_ptr(arg_conv);
17330         return ret_conv;
17331 }
17332
17333 uint64_t  __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_clone"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_clone(uint64_t orig) {
17334         LDKCResult_CVec_u8ZPeerHandleErrorZ* orig_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)untag_ptr(orig);
17335         LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
17336         *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_clone(orig_conv);
17337         return tag_ptr(ret_conv, true);
17338 }
17339
17340 uint64_t  __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_ok"))) TS_CResult_NonePeerHandleErrorZ_ok() {
17341         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
17342         *ret_conv = CResult_NonePeerHandleErrorZ_ok();
17343         return tag_ptr(ret_conv, true);
17344 }
17345
17346 uint64_t  __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_err"))) TS_CResult_NonePeerHandleErrorZ_err(uint64_t e) {
17347         LDKPeerHandleError e_conv;
17348         e_conv.inner = untag_ptr(e);
17349         e_conv.is_owned = ptr_is_owned(e);
17350         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
17351         e_conv = PeerHandleError_clone(&e_conv);
17352         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
17353         *ret_conv = CResult_NonePeerHandleErrorZ_err(e_conv);
17354         return tag_ptr(ret_conv, true);
17355 }
17356
17357 jboolean  __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_is_ok"))) TS_CResult_NonePeerHandleErrorZ_is_ok(uint64_t o) {
17358         LDKCResult_NonePeerHandleErrorZ* o_conv = (LDKCResult_NonePeerHandleErrorZ*)untag_ptr(o);
17359         jboolean ret_conv = CResult_NonePeerHandleErrorZ_is_ok(o_conv);
17360         return ret_conv;
17361 }
17362
17363 void  __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_free"))) TS_CResult_NonePeerHandleErrorZ_free(uint64_t _res) {
17364         if (!ptr_is_owned(_res)) return;
17365         void* _res_ptr = untag_ptr(_res);
17366         CHECK_ACCESS(_res_ptr);
17367         LDKCResult_NonePeerHandleErrorZ _res_conv = *(LDKCResult_NonePeerHandleErrorZ*)(_res_ptr);
17368         FREE(untag_ptr(_res));
17369         CResult_NonePeerHandleErrorZ_free(_res_conv);
17370 }
17371
17372 static inline uint64_t CResult_NonePeerHandleErrorZ_clone_ptr(LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR arg) {
17373         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
17374         *ret_conv = CResult_NonePeerHandleErrorZ_clone(arg);
17375         return tag_ptr(ret_conv, true);
17376 }
17377 int64_t  __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_clone_ptr"))) TS_CResult_NonePeerHandleErrorZ_clone_ptr(uint64_t arg) {
17378         LDKCResult_NonePeerHandleErrorZ* arg_conv = (LDKCResult_NonePeerHandleErrorZ*)untag_ptr(arg);
17379         int64_t ret_conv = CResult_NonePeerHandleErrorZ_clone_ptr(arg_conv);
17380         return ret_conv;
17381 }
17382
17383 uint64_t  __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_clone"))) TS_CResult_NonePeerHandleErrorZ_clone(uint64_t orig) {
17384         LDKCResult_NonePeerHandleErrorZ* orig_conv = (LDKCResult_NonePeerHandleErrorZ*)untag_ptr(orig);
17385         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
17386         *ret_conv = CResult_NonePeerHandleErrorZ_clone(orig_conv);
17387         return tag_ptr(ret_conv, true);
17388 }
17389
17390 uint64_t  __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_ok"))) TS_CResult_boolPeerHandleErrorZ_ok(jboolean o) {
17391         LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
17392         *ret_conv = CResult_boolPeerHandleErrorZ_ok(o);
17393         return tag_ptr(ret_conv, true);
17394 }
17395
17396 uint64_t  __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_err"))) TS_CResult_boolPeerHandleErrorZ_err(uint64_t e) {
17397         LDKPeerHandleError e_conv;
17398         e_conv.inner = untag_ptr(e);
17399         e_conv.is_owned = ptr_is_owned(e);
17400         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
17401         e_conv = PeerHandleError_clone(&e_conv);
17402         LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
17403         *ret_conv = CResult_boolPeerHandleErrorZ_err(e_conv);
17404         return tag_ptr(ret_conv, true);
17405 }
17406
17407 jboolean  __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_is_ok"))) TS_CResult_boolPeerHandleErrorZ_is_ok(uint64_t o) {
17408         LDKCResult_boolPeerHandleErrorZ* o_conv = (LDKCResult_boolPeerHandleErrorZ*)untag_ptr(o);
17409         jboolean ret_conv = CResult_boolPeerHandleErrorZ_is_ok(o_conv);
17410         return ret_conv;
17411 }
17412
17413 void  __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_free"))) TS_CResult_boolPeerHandleErrorZ_free(uint64_t _res) {
17414         if (!ptr_is_owned(_res)) return;
17415         void* _res_ptr = untag_ptr(_res);
17416         CHECK_ACCESS(_res_ptr);
17417         LDKCResult_boolPeerHandleErrorZ _res_conv = *(LDKCResult_boolPeerHandleErrorZ*)(_res_ptr);
17418         FREE(untag_ptr(_res));
17419         CResult_boolPeerHandleErrorZ_free(_res_conv);
17420 }
17421
17422 static inline uint64_t CResult_boolPeerHandleErrorZ_clone_ptr(LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR arg) {
17423         LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
17424         *ret_conv = CResult_boolPeerHandleErrorZ_clone(arg);
17425         return tag_ptr(ret_conv, true);
17426 }
17427 int64_t  __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_clone_ptr"))) TS_CResult_boolPeerHandleErrorZ_clone_ptr(uint64_t arg) {
17428         LDKCResult_boolPeerHandleErrorZ* arg_conv = (LDKCResult_boolPeerHandleErrorZ*)untag_ptr(arg);
17429         int64_t ret_conv = CResult_boolPeerHandleErrorZ_clone_ptr(arg_conv);
17430         return ret_conv;
17431 }
17432
17433 uint64_t  __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_clone"))) TS_CResult_boolPeerHandleErrorZ_clone(uint64_t orig) {
17434         LDKCResult_boolPeerHandleErrorZ* orig_conv = (LDKCResult_boolPeerHandleErrorZ*)untag_ptr(orig);
17435         LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
17436         *ret_conv = CResult_boolPeerHandleErrorZ_clone(orig_conv);
17437         return tag_ptr(ret_conv, true);
17438 }
17439
17440 uint64_t  __attribute__((export_name("TS_CResult_NoneErrorZ_ok"))) TS_CResult_NoneErrorZ_ok() {
17441         LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
17442         *ret_conv = CResult_NoneErrorZ_ok();
17443         return tag_ptr(ret_conv, true);
17444 }
17445
17446 uint64_t  __attribute__((export_name("TS_CResult_NoneErrorZ_err"))) TS_CResult_NoneErrorZ_err(uint32_t e) {
17447         LDKIOError e_conv = LDKIOError_from_js(e);
17448         LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
17449         *ret_conv = CResult_NoneErrorZ_err(e_conv);
17450         return tag_ptr(ret_conv, true);
17451 }
17452
17453 jboolean  __attribute__((export_name("TS_CResult_NoneErrorZ_is_ok"))) TS_CResult_NoneErrorZ_is_ok(uint64_t o) {
17454         LDKCResult_NoneErrorZ* o_conv = (LDKCResult_NoneErrorZ*)untag_ptr(o);
17455         jboolean ret_conv = CResult_NoneErrorZ_is_ok(o_conv);
17456         return ret_conv;
17457 }
17458
17459 void  __attribute__((export_name("TS_CResult_NoneErrorZ_free"))) TS_CResult_NoneErrorZ_free(uint64_t _res) {
17460         if (!ptr_is_owned(_res)) return;
17461         void* _res_ptr = untag_ptr(_res);
17462         CHECK_ACCESS(_res_ptr);
17463         LDKCResult_NoneErrorZ _res_conv = *(LDKCResult_NoneErrorZ*)(_res_ptr);
17464         FREE(untag_ptr(_res));
17465         CResult_NoneErrorZ_free(_res_conv);
17466 }
17467
17468 static inline uint64_t CResult_NoneErrorZ_clone_ptr(LDKCResult_NoneErrorZ *NONNULL_PTR arg) {
17469         LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
17470         *ret_conv = CResult_NoneErrorZ_clone(arg);
17471         return tag_ptr(ret_conv, true);
17472 }
17473 int64_t  __attribute__((export_name("TS_CResult_NoneErrorZ_clone_ptr"))) TS_CResult_NoneErrorZ_clone_ptr(uint64_t arg) {
17474         LDKCResult_NoneErrorZ* arg_conv = (LDKCResult_NoneErrorZ*)untag_ptr(arg);
17475         int64_t ret_conv = CResult_NoneErrorZ_clone_ptr(arg_conv);
17476         return ret_conv;
17477 }
17478
17479 uint64_t  __attribute__((export_name("TS_CResult_NoneErrorZ_clone"))) TS_CResult_NoneErrorZ_clone(uint64_t orig) {
17480         LDKCResult_NoneErrorZ* orig_conv = (LDKCResult_NoneErrorZ*)untag_ptr(orig);
17481         LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
17482         *ret_conv = CResult_NoneErrorZ_clone(orig_conv);
17483         return tag_ptr(ret_conv, true);
17484 }
17485
17486 uint64_t  __attribute__((export_name("TS_CResult_NetAddressDecodeErrorZ_ok"))) TS_CResult_NetAddressDecodeErrorZ_ok(uint64_t o) {
17487         void* o_ptr = untag_ptr(o);
17488         CHECK_ACCESS(o_ptr);
17489         LDKNetAddress o_conv = *(LDKNetAddress*)(o_ptr);
17490         o_conv = NetAddress_clone((LDKNetAddress*)untag_ptr(o));
17491         LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
17492         *ret_conv = CResult_NetAddressDecodeErrorZ_ok(o_conv);
17493         return tag_ptr(ret_conv, true);
17494 }
17495
17496 uint64_t  __attribute__((export_name("TS_CResult_NetAddressDecodeErrorZ_err"))) TS_CResult_NetAddressDecodeErrorZ_err(uint64_t e) {
17497         LDKDecodeError e_conv;
17498         e_conv.inner = untag_ptr(e);
17499         e_conv.is_owned = ptr_is_owned(e);
17500         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
17501         e_conv = DecodeError_clone(&e_conv);
17502         LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
17503         *ret_conv = CResult_NetAddressDecodeErrorZ_err(e_conv);
17504         return tag_ptr(ret_conv, true);
17505 }
17506
17507 jboolean  __attribute__((export_name("TS_CResult_NetAddressDecodeErrorZ_is_ok"))) TS_CResult_NetAddressDecodeErrorZ_is_ok(uint64_t o) {
17508         LDKCResult_NetAddressDecodeErrorZ* o_conv = (LDKCResult_NetAddressDecodeErrorZ*)untag_ptr(o);
17509         jboolean ret_conv = CResult_NetAddressDecodeErrorZ_is_ok(o_conv);
17510         return ret_conv;
17511 }
17512
17513 void  __attribute__((export_name("TS_CResult_NetAddressDecodeErrorZ_free"))) TS_CResult_NetAddressDecodeErrorZ_free(uint64_t _res) {
17514         if (!ptr_is_owned(_res)) return;
17515         void* _res_ptr = untag_ptr(_res);
17516         CHECK_ACCESS(_res_ptr);
17517         LDKCResult_NetAddressDecodeErrorZ _res_conv = *(LDKCResult_NetAddressDecodeErrorZ*)(_res_ptr);
17518         FREE(untag_ptr(_res));
17519         CResult_NetAddressDecodeErrorZ_free(_res_conv);
17520 }
17521
17522 static inline uint64_t CResult_NetAddressDecodeErrorZ_clone_ptr(LDKCResult_NetAddressDecodeErrorZ *NONNULL_PTR arg) {
17523         LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
17524         *ret_conv = CResult_NetAddressDecodeErrorZ_clone(arg);
17525         return tag_ptr(ret_conv, true);
17526 }
17527 int64_t  __attribute__((export_name("TS_CResult_NetAddressDecodeErrorZ_clone_ptr"))) TS_CResult_NetAddressDecodeErrorZ_clone_ptr(uint64_t arg) {
17528         LDKCResult_NetAddressDecodeErrorZ* arg_conv = (LDKCResult_NetAddressDecodeErrorZ*)untag_ptr(arg);
17529         int64_t ret_conv = CResult_NetAddressDecodeErrorZ_clone_ptr(arg_conv);
17530         return ret_conv;
17531 }
17532
17533 uint64_t  __attribute__((export_name("TS_CResult_NetAddressDecodeErrorZ_clone"))) TS_CResult_NetAddressDecodeErrorZ_clone(uint64_t orig) {
17534         LDKCResult_NetAddressDecodeErrorZ* orig_conv = (LDKCResult_NetAddressDecodeErrorZ*)untag_ptr(orig);
17535         LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
17536         *ret_conv = CResult_NetAddressDecodeErrorZ_clone(orig_conv);
17537         return tag_ptr(ret_conv, true);
17538 }
17539
17540 void  __attribute__((export_name("TS_CVec_UpdateAddHTLCZ_free"))) TS_CVec_UpdateAddHTLCZ_free(uint64_tArray _res) {
17541         LDKCVec_UpdateAddHTLCZ _res_constr;
17542         _res_constr.datalen = _res->arr_len;
17543         if (_res_constr.datalen > 0)
17544                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
17545         else
17546                 _res_constr.data = NULL;
17547         uint64_t* _res_vals = _res->elems;
17548         for (size_t p = 0; p < _res_constr.datalen; p++) {
17549                 uint64_t _res_conv_15 = _res_vals[p];
17550                 LDKUpdateAddHTLC _res_conv_15_conv;
17551                 _res_conv_15_conv.inner = untag_ptr(_res_conv_15);
17552                 _res_conv_15_conv.is_owned = ptr_is_owned(_res_conv_15);
17553                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_15_conv);
17554                 _res_constr.data[p] = _res_conv_15_conv;
17555         }
17556         FREE(_res);
17557         CVec_UpdateAddHTLCZ_free(_res_constr);
17558 }
17559
17560 void  __attribute__((export_name("TS_CVec_UpdateFulfillHTLCZ_free"))) TS_CVec_UpdateFulfillHTLCZ_free(uint64_tArray _res) {
17561         LDKCVec_UpdateFulfillHTLCZ _res_constr;
17562         _res_constr.datalen = _res->arr_len;
17563         if (_res_constr.datalen > 0)
17564                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
17565         else
17566                 _res_constr.data = NULL;
17567         uint64_t* _res_vals = _res->elems;
17568         for (size_t t = 0; t < _res_constr.datalen; t++) {
17569                 uint64_t _res_conv_19 = _res_vals[t];
17570                 LDKUpdateFulfillHTLC _res_conv_19_conv;
17571                 _res_conv_19_conv.inner = untag_ptr(_res_conv_19);
17572                 _res_conv_19_conv.is_owned = ptr_is_owned(_res_conv_19);
17573                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_19_conv);
17574                 _res_constr.data[t] = _res_conv_19_conv;
17575         }
17576         FREE(_res);
17577         CVec_UpdateFulfillHTLCZ_free(_res_constr);
17578 }
17579
17580 void  __attribute__((export_name("TS_CVec_UpdateFailHTLCZ_free"))) TS_CVec_UpdateFailHTLCZ_free(uint64_tArray _res) {
17581         LDKCVec_UpdateFailHTLCZ _res_constr;
17582         _res_constr.datalen = _res->arr_len;
17583         if (_res_constr.datalen > 0)
17584                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
17585         else
17586                 _res_constr.data = NULL;
17587         uint64_t* _res_vals = _res->elems;
17588         for (size_t q = 0; q < _res_constr.datalen; q++) {
17589                 uint64_t _res_conv_16 = _res_vals[q];
17590                 LDKUpdateFailHTLC _res_conv_16_conv;
17591                 _res_conv_16_conv.inner = untag_ptr(_res_conv_16);
17592                 _res_conv_16_conv.is_owned = ptr_is_owned(_res_conv_16);
17593                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_16_conv);
17594                 _res_constr.data[q] = _res_conv_16_conv;
17595         }
17596         FREE(_res);
17597         CVec_UpdateFailHTLCZ_free(_res_constr);
17598 }
17599
17600 void  __attribute__((export_name("TS_CVec_UpdateFailMalformedHTLCZ_free"))) TS_CVec_UpdateFailMalformedHTLCZ_free(uint64_tArray _res) {
17601         LDKCVec_UpdateFailMalformedHTLCZ _res_constr;
17602         _res_constr.datalen = _res->arr_len;
17603         if (_res_constr.datalen > 0)
17604                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
17605         else
17606                 _res_constr.data = NULL;
17607         uint64_t* _res_vals = _res->elems;
17608         for (size_t z = 0; z < _res_constr.datalen; z++) {
17609                 uint64_t _res_conv_25 = _res_vals[z];
17610                 LDKUpdateFailMalformedHTLC _res_conv_25_conv;
17611                 _res_conv_25_conv.inner = untag_ptr(_res_conv_25);
17612                 _res_conv_25_conv.is_owned = ptr_is_owned(_res_conv_25);
17613                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_25_conv);
17614                 _res_constr.data[z] = _res_conv_25_conv;
17615         }
17616         FREE(_res);
17617         CVec_UpdateFailMalformedHTLCZ_free(_res_constr);
17618 }
17619
17620 uint64_t  __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_ok"))) TS_CResult_AcceptChannelDecodeErrorZ_ok(uint64_t o) {
17621         LDKAcceptChannel o_conv;
17622         o_conv.inner = untag_ptr(o);
17623         o_conv.is_owned = ptr_is_owned(o);
17624         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17625         o_conv = AcceptChannel_clone(&o_conv);
17626         LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
17627         *ret_conv = CResult_AcceptChannelDecodeErrorZ_ok(o_conv);
17628         return tag_ptr(ret_conv, true);
17629 }
17630
17631 uint64_t  __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_err"))) TS_CResult_AcceptChannelDecodeErrorZ_err(uint64_t e) {
17632         LDKDecodeError e_conv;
17633         e_conv.inner = untag_ptr(e);
17634         e_conv.is_owned = ptr_is_owned(e);
17635         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
17636         e_conv = DecodeError_clone(&e_conv);
17637         LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
17638         *ret_conv = CResult_AcceptChannelDecodeErrorZ_err(e_conv);
17639         return tag_ptr(ret_conv, true);
17640 }
17641
17642 jboolean  __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_is_ok"))) TS_CResult_AcceptChannelDecodeErrorZ_is_ok(uint64_t o) {
17643         LDKCResult_AcceptChannelDecodeErrorZ* o_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)untag_ptr(o);
17644         jboolean ret_conv = CResult_AcceptChannelDecodeErrorZ_is_ok(o_conv);
17645         return ret_conv;
17646 }
17647
17648 void  __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_free"))) TS_CResult_AcceptChannelDecodeErrorZ_free(uint64_t _res) {
17649         if (!ptr_is_owned(_res)) return;
17650         void* _res_ptr = untag_ptr(_res);
17651         CHECK_ACCESS(_res_ptr);
17652         LDKCResult_AcceptChannelDecodeErrorZ _res_conv = *(LDKCResult_AcceptChannelDecodeErrorZ*)(_res_ptr);
17653         FREE(untag_ptr(_res));
17654         CResult_AcceptChannelDecodeErrorZ_free(_res_conv);
17655 }
17656
17657 static inline uint64_t CResult_AcceptChannelDecodeErrorZ_clone_ptr(LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR arg) {
17658         LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
17659         *ret_conv = CResult_AcceptChannelDecodeErrorZ_clone(arg);
17660         return tag_ptr(ret_conv, true);
17661 }
17662 int64_t  __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_clone_ptr"))) TS_CResult_AcceptChannelDecodeErrorZ_clone_ptr(uint64_t arg) {
17663         LDKCResult_AcceptChannelDecodeErrorZ* arg_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)untag_ptr(arg);
17664         int64_t ret_conv = CResult_AcceptChannelDecodeErrorZ_clone_ptr(arg_conv);
17665         return ret_conv;
17666 }
17667
17668 uint64_t  __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_clone"))) TS_CResult_AcceptChannelDecodeErrorZ_clone(uint64_t orig) {
17669         LDKCResult_AcceptChannelDecodeErrorZ* orig_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)untag_ptr(orig);
17670         LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
17671         *ret_conv = CResult_AcceptChannelDecodeErrorZ_clone(orig_conv);
17672         return tag_ptr(ret_conv, true);
17673 }
17674
17675 uint64_t  __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_ok"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_ok(uint64_t o) {
17676         LDKAnnouncementSignatures o_conv;
17677         o_conv.inner = untag_ptr(o);
17678         o_conv.is_owned = ptr_is_owned(o);
17679         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17680         o_conv = AnnouncementSignatures_clone(&o_conv);
17681         LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
17682         *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_ok(o_conv);
17683         return tag_ptr(ret_conv, true);
17684 }
17685
17686 uint64_t  __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_err"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_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_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
17693         *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_err(e_conv);
17694         return tag_ptr(ret_conv, true);
17695 }
17696
17697 jboolean  __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_is_ok"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_is_ok(uint64_t o) {
17698         LDKCResult_AnnouncementSignaturesDecodeErrorZ* o_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)untag_ptr(o);
17699         jboolean ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_is_ok(o_conv);
17700         return ret_conv;
17701 }
17702
17703 void  __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_free"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_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_AnnouncementSignaturesDecodeErrorZ _res_conv = *(LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(_res_ptr);
17708         FREE(untag_ptr(_res));
17709         CResult_AnnouncementSignaturesDecodeErrorZ_free(_res_conv);
17710 }
17711
17712 static inline uint64_t CResult_AnnouncementSignaturesDecodeErrorZ_clone_ptr(LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR arg) {
17713         LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
17714         *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_clone(arg);
17715         return tag_ptr(ret_conv, true);
17716 }
17717 int64_t  __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_clone_ptr"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_clone_ptr(uint64_t arg) {
17718         LDKCResult_AnnouncementSignaturesDecodeErrorZ* arg_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)untag_ptr(arg);
17719         int64_t ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_clone_ptr(arg_conv);
17720         return ret_conv;
17721 }
17722
17723 uint64_t  __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_clone"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_clone(uint64_t orig) {
17724         LDKCResult_AnnouncementSignaturesDecodeErrorZ* orig_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)untag_ptr(orig);
17725         LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
17726         *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_clone(orig_conv);
17727         return tag_ptr(ret_conv, true);
17728 }
17729
17730 uint64_t  __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_ok"))) TS_CResult_ChannelReestablishDecodeErrorZ_ok(uint64_t o) {
17731         LDKChannelReestablish 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 = ChannelReestablish_clone(&o_conv);
17736         LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
17737         *ret_conv = CResult_ChannelReestablishDecodeErrorZ_ok(o_conv);
17738         return tag_ptr(ret_conv, true);
17739 }
17740
17741 uint64_t  __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_err"))) TS_CResult_ChannelReestablishDecodeErrorZ_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_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
17748         *ret_conv = CResult_ChannelReestablishDecodeErrorZ_err(e_conv);
17749         return tag_ptr(ret_conv, true);
17750 }
17751
17752 jboolean  __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_is_ok"))) TS_CResult_ChannelReestablishDecodeErrorZ_is_ok(uint64_t o) {
17753         LDKCResult_ChannelReestablishDecodeErrorZ* o_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)untag_ptr(o);
17754         jboolean ret_conv = CResult_ChannelReestablishDecodeErrorZ_is_ok(o_conv);
17755         return ret_conv;
17756 }
17757
17758 void  __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_free"))) TS_CResult_ChannelReestablishDecodeErrorZ_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_ChannelReestablishDecodeErrorZ _res_conv = *(LDKCResult_ChannelReestablishDecodeErrorZ*)(_res_ptr);
17763         FREE(untag_ptr(_res));
17764         CResult_ChannelReestablishDecodeErrorZ_free(_res_conv);
17765 }
17766
17767 static inline uint64_t CResult_ChannelReestablishDecodeErrorZ_clone_ptr(LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR arg) {
17768         LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
17769         *ret_conv = CResult_ChannelReestablishDecodeErrorZ_clone(arg);
17770         return tag_ptr(ret_conv, true);
17771 }
17772 int64_t  __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelReestablishDecodeErrorZ_clone_ptr(uint64_t arg) {
17773         LDKCResult_ChannelReestablishDecodeErrorZ* arg_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)untag_ptr(arg);
17774         int64_t ret_conv = CResult_ChannelReestablishDecodeErrorZ_clone_ptr(arg_conv);
17775         return ret_conv;
17776 }
17777
17778 uint64_t  __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_clone"))) TS_CResult_ChannelReestablishDecodeErrorZ_clone(uint64_t orig) {
17779         LDKCResult_ChannelReestablishDecodeErrorZ* orig_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)untag_ptr(orig);
17780         LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
17781         *ret_conv = CResult_ChannelReestablishDecodeErrorZ_clone(orig_conv);
17782         return tag_ptr(ret_conv, true);
17783 }
17784
17785 uint64_t  __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_ok"))) TS_CResult_ClosingSignedDecodeErrorZ_ok(uint64_t o) {
17786         LDKClosingSigned o_conv;
17787         o_conv.inner = untag_ptr(o);
17788         o_conv.is_owned = ptr_is_owned(o);
17789         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17790         o_conv = ClosingSigned_clone(&o_conv);
17791         LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
17792         *ret_conv = CResult_ClosingSignedDecodeErrorZ_ok(o_conv);
17793         return tag_ptr(ret_conv, true);
17794 }
17795
17796 uint64_t  __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_err"))) TS_CResult_ClosingSignedDecodeErrorZ_err(uint64_t e) {
17797         LDKDecodeError e_conv;
17798         e_conv.inner = untag_ptr(e);
17799         e_conv.is_owned = ptr_is_owned(e);
17800         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
17801         e_conv = DecodeError_clone(&e_conv);
17802         LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
17803         *ret_conv = CResult_ClosingSignedDecodeErrorZ_err(e_conv);
17804         return tag_ptr(ret_conv, true);
17805 }
17806
17807 jboolean  __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_is_ok"))) TS_CResult_ClosingSignedDecodeErrorZ_is_ok(uint64_t o) {
17808         LDKCResult_ClosingSignedDecodeErrorZ* o_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)untag_ptr(o);
17809         jboolean ret_conv = CResult_ClosingSignedDecodeErrorZ_is_ok(o_conv);
17810         return ret_conv;
17811 }
17812
17813 void  __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_free"))) TS_CResult_ClosingSignedDecodeErrorZ_free(uint64_t _res) {
17814         if (!ptr_is_owned(_res)) return;
17815         void* _res_ptr = untag_ptr(_res);
17816         CHECK_ACCESS(_res_ptr);
17817         LDKCResult_ClosingSignedDecodeErrorZ _res_conv = *(LDKCResult_ClosingSignedDecodeErrorZ*)(_res_ptr);
17818         FREE(untag_ptr(_res));
17819         CResult_ClosingSignedDecodeErrorZ_free(_res_conv);
17820 }
17821
17822 static inline uint64_t CResult_ClosingSignedDecodeErrorZ_clone_ptr(LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR arg) {
17823         LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
17824         *ret_conv = CResult_ClosingSignedDecodeErrorZ_clone(arg);
17825         return tag_ptr(ret_conv, true);
17826 }
17827 int64_t  __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_clone_ptr"))) TS_CResult_ClosingSignedDecodeErrorZ_clone_ptr(uint64_t arg) {
17828         LDKCResult_ClosingSignedDecodeErrorZ* arg_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)untag_ptr(arg);
17829         int64_t ret_conv = CResult_ClosingSignedDecodeErrorZ_clone_ptr(arg_conv);
17830         return ret_conv;
17831 }
17832
17833 uint64_t  __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_clone"))) TS_CResult_ClosingSignedDecodeErrorZ_clone(uint64_t orig) {
17834         LDKCResult_ClosingSignedDecodeErrorZ* orig_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)untag_ptr(orig);
17835         LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
17836         *ret_conv = CResult_ClosingSignedDecodeErrorZ_clone(orig_conv);
17837         return tag_ptr(ret_conv, true);
17838 }
17839
17840 uint64_t  __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_ok"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(uint64_t o) {
17841         LDKClosingSignedFeeRange o_conv;
17842         o_conv.inner = untag_ptr(o);
17843         o_conv.is_owned = ptr_is_owned(o);
17844         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17845         o_conv = ClosingSignedFeeRange_clone(&o_conv);
17846         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
17847         *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(o_conv);
17848         return tag_ptr(ret_conv, true);
17849 }
17850
17851 uint64_t  __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_err"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_err(uint64_t e) {
17852         LDKDecodeError e_conv;
17853         e_conv.inner = untag_ptr(e);
17854         e_conv.is_owned = ptr_is_owned(e);
17855         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
17856         e_conv = DecodeError_clone(&e_conv);
17857         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
17858         *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_err(e_conv);
17859         return tag_ptr(ret_conv, true);
17860 }
17861
17862 jboolean  __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_is_ok"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_is_ok(uint64_t o) {
17863         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* o_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)untag_ptr(o);
17864         jboolean ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_is_ok(o_conv);
17865         return ret_conv;
17866 }
17867
17868 void  __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_free"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_free(uint64_t _res) {
17869         if (!ptr_is_owned(_res)) return;
17870         void* _res_ptr = untag_ptr(_res);
17871         CHECK_ACCESS(_res_ptr);
17872         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ _res_conv = *(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(_res_ptr);
17873         FREE(untag_ptr(_res));
17874         CResult_ClosingSignedFeeRangeDecodeErrorZ_free(_res_conv);
17875 }
17876
17877 static inline uint64_t CResult_ClosingSignedFeeRangeDecodeErrorZ_clone_ptr(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR arg) {
17878         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
17879         *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(arg);
17880         return tag_ptr(ret_conv, true);
17881 }
17882 int64_t  __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_clone_ptr"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_clone_ptr(uint64_t arg) {
17883         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* arg_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)untag_ptr(arg);
17884         int64_t ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_clone_ptr(arg_conv);
17885         return ret_conv;
17886 }
17887
17888 uint64_t  __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_clone"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(uint64_t orig) {
17889         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* orig_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)untag_ptr(orig);
17890         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
17891         *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(orig_conv);
17892         return tag_ptr(ret_conv, true);
17893 }
17894
17895 uint64_t  __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_ok"))) TS_CResult_CommitmentSignedDecodeErrorZ_ok(uint64_t o) {
17896         LDKCommitmentSigned o_conv;
17897         o_conv.inner = untag_ptr(o);
17898         o_conv.is_owned = ptr_is_owned(o);
17899         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17900         o_conv = CommitmentSigned_clone(&o_conv);
17901         LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
17902         *ret_conv = CResult_CommitmentSignedDecodeErrorZ_ok(o_conv);
17903         return tag_ptr(ret_conv, true);
17904 }
17905
17906 uint64_t  __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_err"))) TS_CResult_CommitmentSignedDecodeErrorZ_err(uint64_t e) {
17907         LDKDecodeError e_conv;
17908         e_conv.inner = untag_ptr(e);
17909         e_conv.is_owned = ptr_is_owned(e);
17910         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
17911         e_conv = DecodeError_clone(&e_conv);
17912         LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
17913         *ret_conv = CResult_CommitmentSignedDecodeErrorZ_err(e_conv);
17914         return tag_ptr(ret_conv, true);
17915 }
17916
17917 jboolean  __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_is_ok"))) TS_CResult_CommitmentSignedDecodeErrorZ_is_ok(uint64_t o) {
17918         LDKCResult_CommitmentSignedDecodeErrorZ* o_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)untag_ptr(o);
17919         jboolean ret_conv = CResult_CommitmentSignedDecodeErrorZ_is_ok(o_conv);
17920         return ret_conv;
17921 }
17922
17923 void  __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_free"))) TS_CResult_CommitmentSignedDecodeErrorZ_free(uint64_t _res) {
17924         if (!ptr_is_owned(_res)) return;
17925         void* _res_ptr = untag_ptr(_res);
17926         CHECK_ACCESS(_res_ptr);
17927         LDKCResult_CommitmentSignedDecodeErrorZ _res_conv = *(LDKCResult_CommitmentSignedDecodeErrorZ*)(_res_ptr);
17928         FREE(untag_ptr(_res));
17929         CResult_CommitmentSignedDecodeErrorZ_free(_res_conv);
17930 }
17931
17932 static inline uint64_t CResult_CommitmentSignedDecodeErrorZ_clone_ptr(LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR arg) {
17933         LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
17934         *ret_conv = CResult_CommitmentSignedDecodeErrorZ_clone(arg);
17935         return tag_ptr(ret_conv, true);
17936 }
17937 int64_t  __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_clone_ptr"))) TS_CResult_CommitmentSignedDecodeErrorZ_clone_ptr(uint64_t arg) {
17938         LDKCResult_CommitmentSignedDecodeErrorZ* arg_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)untag_ptr(arg);
17939         int64_t ret_conv = CResult_CommitmentSignedDecodeErrorZ_clone_ptr(arg_conv);
17940         return ret_conv;
17941 }
17942
17943 uint64_t  __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_clone"))) TS_CResult_CommitmentSignedDecodeErrorZ_clone(uint64_t orig) {
17944         LDKCResult_CommitmentSignedDecodeErrorZ* orig_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)untag_ptr(orig);
17945         LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
17946         *ret_conv = CResult_CommitmentSignedDecodeErrorZ_clone(orig_conv);
17947         return tag_ptr(ret_conv, true);
17948 }
17949
17950 uint64_t  __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_ok"))) TS_CResult_FundingCreatedDecodeErrorZ_ok(uint64_t o) {
17951         LDKFundingCreated o_conv;
17952         o_conv.inner = untag_ptr(o);
17953         o_conv.is_owned = ptr_is_owned(o);
17954         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17955         o_conv = FundingCreated_clone(&o_conv);
17956         LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
17957         *ret_conv = CResult_FundingCreatedDecodeErrorZ_ok(o_conv);
17958         return tag_ptr(ret_conv, true);
17959 }
17960
17961 uint64_t  __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_err"))) TS_CResult_FundingCreatedDecodeErrorZ_err(uint64_t e) {
17962         LDKDecodeError e_conv;
17963         e_conv.inner = untag_ptr(e);
17964         e_conv.is_owned = ptr_is_owned(e);
17965         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
17966         e_conv = DecodeError_clone(&e_conv);
17967         LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
17968         *ret_conv = CResult_FundingCreatedDecodeErrorZ_err(e_conv);
17969         return tag_ptr(ret_conv, true);
17970 }
17971
17972 jboolean  __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_is_ok"))) TS_CResult_FundingCreatedDecodeErrorZ_is_ok(uint64_t o) {
17973         LDKCResult_FundingCreatedDecodeErrorZ* o_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)untag_ptr(o);
17974         jboolean ret_conv = CResult_FundingCreatedDecodeErrorZ_is_ok(o_conv);
17975         return ret_conv;
17976 }
17977
17978 void  __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_free"))) TS_CResult_FundingCreatedDecodeErrorZ_free(uint64_t _res) {
17979         if (!ptr_is_owned(_res)) return;
17980         void* _res_ptr = untag_ptr(_res);
17981         CHECK_ACCESS(_res_ptr);
17982         LDKCResult_FundingCreatedDecodeErrorZ _res_conv = *(LDKCResult_FundingCreatedDecodeErrorZ*)(_res_ptr);
17983         FREE(untag_ptr(_res));
17984         CResult_FundingCreatedDecodeErrorZ_free(_res_conv);
17985 }
17986
17987 static inline uint64_t CResult_FundingCreatedDecodeErrorZ_clone_ptr(LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR arg) {
17988         LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
17989         *ret_conv = CResult_FundingCreatedDecodeErrorZ_clone(arg);
17990         return tag_ptr(ret_conv, true);
17991 }
17992 int64_t  __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_clone_ptr"))) TS_CResult_FundingCreatedDecodeErrorZ_clone_ptr(uint64_t arg) {
17993         LDKCResult_FundingCreatedDecodeErrorZ* arg_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)untag_ptr(arg);
17994         int64_t ret_conv = CResult_FundingCreatedDecodeErrorZ_clone_ptr(arg_conv);
17995         return ret_conv;
17996 }
17997
17998 uint64_t  __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_clone"))) TS_CResult_FundingCreatedDecodeErrorZ_clone(uint64_t orig) {
17999         LDKCResult_FundingCreatedDecodeErrorZ* orig_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)untag_ptr(orig);
18000         LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
18001         *ret_conv = CResult_FundingCreatedDecodeErrorZ_clone(orig_conv);
18002         return tag_ptr(ret_conv, true);
18003 }
18004
18005 uint64_t  __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_ok"))) TS_CResult_FundingSignedDecodeErrorZ_ok(uint64_t o) {
18006         LDKFundingSigned o_conv;
18007         o_conv.inner = untag_ptr(o);
18008         o_conv.is_owned = ptr_is_owned(o);
18009         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18010         o_conv = FundingSigned_clone(&o_conv);
18011         LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
18012         *ret_conv = CResult_FundingSignedDecodeErrorZ_ok(o_conv);
18013         return tag_ptr(ret_conv, true);
18014 }
18015
18016 uint64_t  __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_err"))) TS_CResult_FundingSignedDecodeErrorZ_err(uint64_t e) {
18017         LDKDecodeError e_conv;
18018         e_conv.inner = untag_ptr(e);
18019         e_conv.is_owned = ptr_is_owned(e);
18020         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18021         e_conv = DecodeError_clone(&e_conv);
18022         LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
18023         *ret_conv = CResult_FundingSignedDecodeErrorZ_err(e_conv);
18024         return tag_ptr(ret_conv, true);
18025 }
18026
18027 jboolean  __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_is_ok"))) TS_CResult_FundingSignedDecodeErrorZ_is_ok(uint64_t o) {
18028         LDKCResult_FundingSignedDecodeErrorZ* o_conv = (LDKCResult_FundingSignedDecodeErrorZ*)untag_ptr(o);
18029         jboolean ret_conv = CResult_FundingSignedDecodeErrorZ_is_ok(o_conv);
18030         return ret_conv;
18031 }
18032
18033 void  __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_free"))) TS_CResult_FundingSignedDecodeErrorZ_free(uint64_t _res) {
18034         if (!ptr_is_owned(_res)) return;
18035         void* _res_ptr = untag_ptr(_res);
18036         CHECK_ACCESS(_res_ptr);
18037         LDKCResult_FundingSignedDecodeErrorZ _res_conv = *(LDKCResult_FundingSignedDecodeErrorZ*)(_res_ptr);
18038         FREE(untag_ptr(_res));
18039         CResult_FundingSignedDecodeErrorZ_free(_res_conv);
18040 }
18041
18042 static inline uint64_t CResult_FundingSignedDecodeErrorZ_clone_ptr(LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR arg) {
18043         LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
18044         *ret_conv = CResult_FundingSignedDecodeErrorZ_clone(arg);
18045         return tag_ptr(ret_conv, true);
18046 }
18047 int64_t  __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_clone_ptr"))) TS_CResult_FundingSignedDecodeErrorZ_clone_ptr(uint64_t arg) {
18048         LDKCResult_FundingSignedDecodeErrorZ* arg_conv = (LDKCResult_FundingSignedDecodeErrorZ*)untag_ptr(arg);
18049         int64_t ret_conv = CResult_FundingSignedDecodeErrorZ_clone_ptr(arg_conv);
18050         return ret_conv;
18051 }
18052
18053 uint64_t  __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_clone"))) TS_CResult_FundingSignedDecodeErrorZ_clone(uint64_t orig) {
18054         LDKCResult_FundingSignedDecodeErrorZ* orig_conv = (LDKCResult_FundingSignedDecodeErrorZ*)untag_ptr(orig);
18055         LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
18056         *ret_conv = CResult_FundingSignedDecodeErrorZ_clone(orig_conv);
18057         return tag_ptr(ret_conv, true);
18058 }
18059
18060 uint64_t  __attribute__((export_name("TS_CResult_ChannelReadyDecodeErrorZ_ok"))) TS_CResult_ChannelReadyDecodeErrorZ_ok(uint64_t o) {
18061         LDKChannelReady o_conv;
18062         o_conv.inner = untag_ptr(o);
18063         o_conv.is_owned = ptr_is_owned(o);
18064         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18065         o_conv = ChannelReady_clone(&o_conv);
18066         LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
18067         *ret_conv = CResult_ChannelReadyDecodeErrorZ_ok(o_conv);
18068         return tag_ptr(ret_conv, true);
18069 }
18070
18071 uint64_t  __attribute__((export_name("TS_CResult_ChannelReadyDecodeErrorZ_err"))) TS_CResult_ChannelReadyDecodeErrorZ_err(uint64_t e) {
18072         LDKDecodeError e_conv;
18073         e_conv.inner = untag_ptr(e);
18074         e_conv.is_owned = ptr_is_owned(e);
18075         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18076         e_conv = DecodeError_clone(&e_conv);
18077         LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
18078         *ret_conv = CResult_ChannelReadyDecodeErrorZ_err(e_conv);
18079         return tag_ptr(ret_conv, true);
18080 }
18081
18082 jboolean  __attribute__((export_name("TS_CResult_ChannelReadyDecodeErrorZ_is_ok"))) TS_CResult_ChannelReadyDecodeErrorZ_is_ok(uint64_t o) {
18083         LDKCResult_ChannelReadyDecodeErrorZ* o_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)untag_ptr(o);
18084         jboolean ret_conv = CResult_ChannelReadyDecodeErrorZ_is_ok(o_conv);
18085         return ret_conv;
18086 }
18087
18088 void  __attribute__((export_name("TS_CResult_ChannelReadyDecodeErrorZ_free"))) TS_CResult_ChannelReadyDecodeErrorZ_free(uint64_t _res) {
18089         if (!ptr_is_owned(_res)) return;
18090         void* _res_ptr = untag_ptr(_res);
18091         CHECK_ACCESS(_res_ptr);
18092         LDKCResult_ChannelReadyDecodeErrorZ _res_conv = *(LDKCResult_ChannelReadyDecodeErrorZ*)(_res_ptr);
18093         FREE(untag_ptr(_res));
18094         CResult_ChannelReadyDecodeErrorZ_free(_res_conv);
18095 }
18096
18097 static inline uint64_t CResult_ChannelReadyDecodeErrorZ_clone_ptr(LDKCResult_ChannelReadyDecodeErrorZ *NONNULL_PTR arg) {
18098         LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
18099         *ret_conv = CResult_ChannelReadyDecodeErrorZ_clone(arg);
18100         return tag_ptr(ret_conv, true);
18101 }
18102 int64_t  __attribute__((export_name("TS_CResult_ChannelReadyDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelReadyDecodeErrorZ_clone_ptr(uint64_t arg) {
18103         LDKCResult_ChannelReadyDecodeErrorZ* arg_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)untag_ptr(arg);
18104         int64_t ret_conv = CResult_ChannelReadyDecodeErrorZ_clone_ptr(arg_conv);
18105         return ret_conv;
18106 }
18107
18108 uint64_t  __attribute__((export_name("TS_CResult_ChannelReadyDecodeErrorZ_clone"))) TS_CResult_ChannelReadyDecodeErrorZ_clone(uint64_t orig) {
18109         LDKCResult_ChannelReadyDecodeErrorZ* orig_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)untag_ptr(orig);
18110         LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
18111         *ret_conv = CResult_ChannelReadyDecodeErrorZ_clone(orig_conv);
18112         return tag_ptr(ret_conv, true);
18113 }
18114
18115 uint64_t  __attribute__((export_name("TS_CResult_InitDecodeErrorZ_ok"))) TS_CResult_InitDecodeErrorZ_ok(uint64_t o) {
18116         LDKInit o_conv;
18117         o_conv.inner = untag_ptr(o);
18118         o_conv.is_owned = ptr_is_owned(o);
18119         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18120         o_conv = Init_clone(&o_conv);
18121         LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
18122         *ret_conv = CResult_InitDecodeErrorZ_ok(o_conv);
18123         return tag_ptr(ret_conv, true);
18124 }
18125
18126 uint64_t  __attribute__((export_name("TS_CResult_InitDecodeErrorZ_err"))) TS_CResult_InitDecodeErrorZ_err(uint64_t e) {
18127         LDKDecodeError e_conv;
18128         e_conv.inner = untag_ptr(e);
18129         e_conv.is_owned = ptr_is_owned(e);
18130         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18131         e_conv = DecodeError_clone(&e_conv);
18132         LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
18133         *ret_conv = CResult_InitDecodeErrorZ_err(e_conv);
18134         return tag_ptr(ret_conv, true);
18135 }
18136
18137 jboolean  __attribute__((export_name("TS_CResult_InitDecodeErrorZ_is_ok"))) TS_CResult_InitDecodeErrorZ_is_ok(uint64_t o) {
18138         LDKCResult_InitDecodeErrorZ* o_conv = (LDKCResult_InitDecodeErrorZ*)untag_ptr(o);
18139         jboolean ret_conv = CResult_InitDecodeErrorZ_is_ok(o_conv);
18140         return ret_conv;
18141 }
18142
18143 void  __attribute__((export_name("TS_CResult_InitDecodeErrorZ_free"))) TS_CResult_InitDecodeErrorZ_free(uint64_t _res) {
18144         if (!ptr_is_owned(_res)) return;
18145         void* _res_ptr = untag_ptr(_res);
18146         CHECK_ACCESS(_res_ptr);
18147         LDKCResult_InitDecodeErrorZ _res_conv = *(LDKCResult_InitDecodeErrorZ*)(_res_ptr);
18148         FREE(untag_ptr(_res));
18149         CResult_InitDecodeErrorZ_free(_res_conv);
18150 }
18151
18152 static inline uint64_t CResult_InitDecodeErrorZ_clone_ptr(LDKCResult_InitDecodeErrorZ *NONNULL_PTR arg) {
18153         LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
18154         *ret_conv = CResult_InitDecodeErrorZ_clone(arg);
18155         return tag_ptr(ret_conv, true);
18156 }
18157 int64_t  __attribute__((export_name("TS_CResult_InitDecodeErrorZ_clone_ptr"))) TS_CResult_InitDecodeErrorZ_clone_ptr(uint64_t arg) {
18158         LDKCResult_InitDecodeErrorZ* arg_conv = (LDKCResult_InitDecodeErrorZ*)untag_ptr(arg);
18159         int64_t ret_conv = CResult_InitDecodeErrorZ_clone_ptr(arg_conv);
18160         return ret_conv;
18161 }
18162
18163 uint64_t  __attribute__((export_name("TS_CResult_InitDecodeErrorZ_clone"))) TS_CResult_InitDecodeErrorZ_clone(uint64_t orig) {
18164         LDKCResult_InitDecodeErrorZ* orig_conv = (LDKCResult_InitDecodeErrorZ*)untag_ptr(orig);
18165         LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
18166         *ret_conv = CResult_InitDecodeErrorZ_clone(orig_conv);
18167         return tag_ptr(ret_conv, true);
18168 }
18169
18170 uint64_t  __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_ok"))) TS_CResult_OpenChannelDecodeErrorZ_ok(uint64_t o) {
18171         LDKOpenChannel o_conv;
18172         o_conv.inner = untag_ptr(o);
18173         o_conv.is_owned = ptr_is_owned(o);
18174         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18175         o_conv = OpenChannel_clone(&o_conv);
18176         LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
18177         *ret_conv = CResult_OpenChannelDecodeErrorZ_ok(o_conv);
18178         return tag_ptr(ret_conv, true);
18179 }
18180
18181 uint64_t  __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_err"))) TS_CResult_OpenChannelDecodeErrorZ_err(uint64_t e) {
18182         LDKDecodeError e_conv;
18183         e_conv.inner = untag_ptr(e);
18184         e_conv.is_owned = ptr_is_owned(e);
18185         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18186         e_conv = DecodeError_clone(&e_conv);
18187         LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
18188         *ret_conv = CResult_OpenChannelDecodeErrorZ_err(e_conv);
18189         return tag_ptr(ret_conv, true);
18190 }
18191
18192 jboolean  __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_is_ok"))) TS_CResult_OpenChannelDecodeErrorZ_is_ok(uint64_t o) {
18193         LDKCResult_OpenChannelDecodeErrorZ* o_conv = (LDKCResult_OpenChannelDecodeErrorZ*)untag_ptr(o);
18194         jboolean ret_conv = CResult_OpenChannelDecodeErrorZ_is_ok(o_conv);
18195         return ret_conv;
18196 }
18197
18198 void  __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_free"))) TS_CResult_OpenChannelDecodeErrorZ_free(uint64_t _res) {
18199         if (!ptr_is_owned(_res)) return;
18200         void* _res_ptr = untag_ptr(_res);
18201         CHECK_ACCESS(_res_ptr);
18202         LDKCResult_OpenChannelDecodeErrorZ _res_conv = *(LDKCResult_OpenChannelDecodeErrorZ*)(_res_ptr);
18203         FREE(untag_ptr(_res));
18204         CResult_OpenChannelDecodeErrorZ_free(_res_conv);
18205 }
18206
18207 static inline uint64_t CResult_OpenChannelDecodeErrorZ_clone_ptr(LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR arg) {
18208         LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
18209         *ret_conv = CResult_OpenChannelDecodeErrorZ_clone(arg);
18210         return tag_ptr(ret_conv, true);
18211 }
18212 int64_t  __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_clone_ptr"))) TS_CResult_OpenChannelDecodeErrorZ_clone_ptr(uint64_t arg) {
18213         LDKCResult_OpenChannelDecodeErrorZ* arg_conv = (LDKCResult_OpenChannelDecodeErrorZ*)untag_ptr(arg);
18214         int64_t ret_conv = CResult_OpenChannelDecodeErrorZ_clone_ptr(arg_conv);
18215         return ret_conv;
18216 }
18217
18218 uint64_t  __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_clone"))) TS_CResult_OpenChannelDecodeErrorZ_clone(uint64_t orig) {
18219         LDKCResult_OpenChannelDecodeErrorZ* orig_conv = (LDKCResult_OpenChannelDecodeErrorZ*)untag_ptr(orig);
18220         LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
18221         *ret_conv = CResult_OpenChannelDecodeErrorZ_clone(orig_conv);
18222         return tag_ptr(ret_conv, true);
18223 }
18224
18225 uint64_t  __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_ok"))) TS_CResult_RevokeAndACKDecodeErrorZ_ok(uint64_t o) {
18226         LDKRevokeAndACK o_conv;
18227         o_conv.inner = untag_ptr(o);
18228         o_conv.is_owned = ptr_is_owned(o);
18229         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18230         o_conv = RevokeAndACK_clone(&o_conv);
18231         LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
18232         *ret_conv = CResult_RevokeAndACKDecodeErrorZ_ok(o_conv);
18233         return tag_ptr(ret_conv, true);
18234 }
18235
18236 uint64_t  __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_err"))) TS_CResult_RevokeAndACKDecodeErrorZ_err(uint64_t e) {
18237         LDKDecodeError e_conv;
18238         e_conv.inner = untag_ptr(e);
18239         e_conv.is_owned = ptr_is_owned(e);
18240         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18241         e_conv = DecodeError_clone(&e_conv);
18242         LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
18243         *ret_conv = CResult_RevokeAndACKDecodeErrorZ_err(e_conv);
18244         return tag_ptr(ret_conv, true);
18245 }
18246
18247 jboolean  __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_is_ok"))) TS_CResult_RevokeAndACKDecodeErrorZ_is_ok(uint64_t o) {
18248         LDKCResult_RevokeAndACKDecodeErrorZ* o_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)untag_ptr(o);
18249         jboolean ret_conv = CResult_RevokeAndACKDecodeErrorZ_is_ok(o_conv);
18250         return ret_conv;
18251 }
18252
18253 void  __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_free"))) TS_CResult_RevokeAndACKDecodeErrorZ_free(uint64_t _res) {
18254         if (!ptr_is_owned(_res)) return;
18255         void* _res_ptr = untag_ptr(_res);
18256         CHECK_ACCESS(_res_ptr);
18257         LDKCResult_RevokeAndACKDecodeErrorZ _res_conv = *(LDKCResult_RevokeAndACKDecodeErrorZ*)(_res_ptr);
18258         FREE(untag_ptr(_res));
18259         CResult_RevokeAndACKDecodeErrorZ_free(_res_conv);
18260 }
18261
18262 static inline uint64_t CResult_RevokeAndACKDecodeErrorZ_clone_ptr(LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR arg) {
18263         LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
18264         *ret_conv = CResult_RevokeAndACKDecodeErrorZ_clone(arg);
18265         return tag_ptr(ret_conv, true);
18266 }
18267 int64_t  __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_clone_ptr"))) TS_CResult_RevokeAndACKDecodeErrorZ_clone_ptr(uint64_t arg) {
18268         LDKCResult_RevokeAndACKDecodeErrorZ* arg_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)untag_ptr(arg);
18269         int64_t ret_conv = CResult_RevokeAndACKDecodeErrorZ_clone_ptr(arg_conv);
18270         return ret_conv;
18271 }
18272
18273 uint64_t  __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_clone"))) TS_CResult_RevokeAndACKDecodeErrorZ_clone(uint64_t orig) {
18274         LDKCResult_RevokeAndACKDecodeErrorZ* orig_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)untag_ptr(orig);
18275         LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
18276         *ret_conv = CResult_RevokeAndACKDecodeErrorZ_clone(orig_conv);
18277         return tag_ptr(ret_conv, true);
18278 }
18279
18280 uint64_t  __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_ok"))) TS_CResult_ShutdownDecodeErrorZ_ok(uint64_t o) {
18281         LDKShutdown o_conv;
18282         o_conv.inner = untag_ptr(o);
18283         o_conv.is_owned = ptr_is_owned(o);
18284         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18285         o_conv = Shutdown_clone(&o_conv);
18286         LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
18287         *ret_conv = CResult_ShutdownDecodeErrorZ_ok(o_conv);
18288         return tag_ptr(ret_conv, true);
18289 }
18290
18291 uint64_t  __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_err"))) TS_CResult_ShutdownDecodeErrorZ_err(uint64_t e) {
18292         LDKDecodeError e_conv;
18293         e_conv.inner = untag_ptr(e);
18294         e_conv.is_owned = ptr_is_owned(e);
18295         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18296         e_conv = DecodeError_clone(&e_conv);
18297         LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
18298         *ret_conv = CResult_ShutdownDecodeErrorZ_err(e_conv);
18299         return tag_ptr(ret_conv, true);
18300 }
18301
18302 jboolean  __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_is_ok"))) TS_CResult_ShutdownDecodeErrorZ_is_ok(uint64_t o) {
18303         LDKCResult_ShutdownDecodeErrorZ* o_conv = (LDKCResult_ShutdownDecodeErrorZ*)untag_ptr(o);
18304         jboolean ret_conv = CResult_ShutdownDecodeErrorZ_is_ok(o_conv);
18305         return ret_conv;
18306 }
18307
18308 void  __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_free"))) TS_CResult_ShutdownDecodeErrorZ_free(uint64_t _res) {
18309         if (!ptr_is_owned(_res)) return;
18310         void* _res_ptr = untag_ptr(_res);
18311         CHECK_ACCESS(_res_ptr);
18312         LDKCResult_ShutdownDecodeErrorZ _res_conv = *(LDKCResult_ShutdownDecodeErrorZ*)(_res_ptr);
18313         FREE(untag_ptr(_res));
18314         CResult_ShutdownDecodeErrorZ_free(_res_conv);
18315 }
18316
18317 static inline uint64_t CResult_ShutdownDecodeErrorZ_clone_ptr(LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR arg) {
18318         LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
18319         *ret_conv = CResult_ShutdownDecodeErrorZ_clone(arg);
18320         return tag_ptr(ret_conv, true);
18321 }
18322 int64_t  __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_clone_ptr"))) TS_CResult_ShutdownDecodeErrorZ_clone_ptr(uint64_t arg) {
18323         LDKCResult_ShutdownDecodeErrorZ* arg_conv = (LDKCResult_ShutdownDecodeErrorZ*)untag_ptr(arg);
18324         int64_t ret_conv = CResult_ShutdownDecodeErrorZ_clone_ptr(arg_conv);
18325         return ret_conv;
18326 }
18327
18328 uint64_t  __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_clone"))) TS_CResult_ShutdownDecodeErrorZ_clone(uint64_t orig) {
18329         LDKCResult_ShutdownDecodeErrorZ* orig_conv = (LDKCResult_ShutdownDecodeErrorZ*)untag_ptr(orig);
18330         LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
18331         *ret_conv = CResult_ShutdownDecodeErrorZ_clone(orig_conv);
18332         return tag_ptr(ret_conv, true);
18333 }
18334
18335 uint64_t  __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_ok"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_ok(uint64_t o) {
18336         LDKUpdateFailHTLC o_conv;
18337         o_conv.inner = untag_ptr(o);
18338         o_conv.is_owned = ptr_is_owned(o);
18339         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18340         o_conv = UpdateFailHTLC_clone(&o_conv);
18341         LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
18342         *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_ok(o_conv);
18343         return tag_ptr(ret_conv, true);
18344 }
18345
18346 uint64_t  __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_err"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_err(uint64_t e) {
18347         LDKDecodeError e_conv;
18348         e_conv.inner = untag_ptr(e);
18349         e_conv.is_owned = ptr_is_owned(e);
18350         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18351         e_conv = DecodeError_clone(&e_conv);
18352         LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
18353         *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_err(e_conv);
18354         return tag_ptr(ret_conv, true);
18355 }
18356
18357 jboolean  __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_is_ok"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_is_ok(uint64_t o) {
18358         LDKCResult_UpdateFailHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)untag_ptr(o);
18359         jboolean ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_is_ok(o_conv);
18360         return ret_conv;
18361 }
18362
18363 void  __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_free"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_free(uint64_t _res) {
18364         if (!ptr_is_owned(_res)) return;
18365         void* _res_ptr = untag_ptr(_res);
18366         CHECK_ACCESS(_res_ptr);
18367         LDKCResult_UpdateFailHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFailHTLCDecodeErrorZ*)(_res_ptr);
18368         FREE(untag_ptr(_res));
18369         CResult_UpdateFailHTLCDecodeErrorZ_free(_res_conv);
18370 }
18371
18372 static inline uint64_t CResult_UpdateFailHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR arg) {
18373         LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
18374         *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_clone(arg);
18375         return tag_ptr(ret_conv, true);
18376 }
18377 int64_t  __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_clone_ptr"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_clone_ptr(uint64_t arg) {
18378         LDKCResult_UpdateFailHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)untag_ptr(arg);
18379         int64_t ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_clone_ptr(arg_conv);
18380         return ret_conv;
18381 }
18382
18383 uint64_t  __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_clone"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_clone(uint64_t orig) {
18384         LDKCResult_UpdateFailHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)untag_ptr(orig);
18385         LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
18386         *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_clone(orig_conv);
18387         return tag_ptr(ret_conv, true);
18388 }
18389
18390 uint64_t  __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(uint64_t o) {
18391         LDKUpdateFailMalformedHTLC o_conv;
18392         o_conv.inner = untag_ptr(o);
18393         o_conv.is_owned = ptr_is_owned(o);
18394         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18395         o_conv = UpdateFailMalformedHTLC_clone(&o_conv);
18396         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
18397         *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(o_conv);
18398         return tag_ptr(ret_conv, true);
18399 }
18400
18401 uint64_t  __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_err"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(uint64_t e) {
18402         LDKDecodeError e_conv;
18403         e_conv.inner = untag_ptr(e);
18404         e_conv.is_owned = ptr_is_owned(e);
18405         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18406         e_conv = DecodeError_clone(&e_conv);
18407         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
18408         *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(e_conv);
18409         return tag_ptr(ret_conv, true);
18410 }
18411
18412 jboolean  __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_is_ok"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_is_ok(uint64_t o) {
18413         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)untag_ptr(o);
18414         jboolean ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_is_ok(o_conv);
18415         return ret_conv;
18416 }
18417
18418 void  __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_free"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(uint64_t _res) {
18419         if (!ptr_is_owned(_res)) return;
18420         void* _res_ptr = untag_ptr(_res);
18421         CHECK_ACCESS(_res_ptr);
18422         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(_res_ptr);
18423         FREE(untag_ptr(_res));
18424         CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(_res_conv);
18425 }
18426
18427 static inline uint64_t CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR arg) {
18428         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
18429         *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(arg);
18430         return tag_ptr(ret_conv, true);
18431 }
18432 int64_t  __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone_ptr"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone_ptr(uint64_t arg) {
18433         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)untag_ptr(arg);
18434         int64_t ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone_ptr(arg_conv);
18435         return ret_conv;
18436 }
18437
18438 uint64_t  __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(uint64_t orig) {
18439         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)untag_ptr(orig);
18440         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
18441         *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(orig_conv);
18442         return tag_ptr(ret_conv, true);
18443 }
18444
18445 uint64_t  __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_ok"))) TS_CResult_UpdateFeeDecodeErrorZ_ok(uint64_t o) {
18446         LDKUpdateFee o_conv;
18447         o_conv.inner = untag_ptr(o);
18448         o_conv.is_owned = ptr_is_owned(o);
18449         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18450         o_conv = UpdateFee_clone(&o_conv);
18451         LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
18452         *ret_conv = CResult_UpdateFeeDecodeErrorZ_ok(o_conv);
18453         return tag_ptr(ret_conv, true);
18454 }
18455
18456 uint64_t  __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_err"))) TS_CResult_UpdateFeeDecodeErrorZ_err(uint64_t e) {
18457         LDKDecodeError e_conv;
18458         e_conv.inner = untag_ptr(e);
18459         e_conv.is_owned = ptr_is_owned(e);
18460         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18461         e_conv = DecodeError_clone(&e_conv);
18462         LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
18463         *ret_conv = CResult_UpdateFeeDecodeErrorZ_err(e_conv);
18464         return tag_ptr(ret_conv, true);
18465 }
18466
18467 jboolean  __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_is_ok"))) TS_CResult_UpdateFeeDecodeErrorZ_is_ok(uint64_t o) {
18468         LDKCResult_UpdateFeeDecodeErrorZ* o_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)untag_ptr(o);
18469         jboolean ret_conv = CResult_UpdateFeeDecodeErrorZ_is_ok(o_conv);
18470         return ret_conv;
18471 }
18472
18473 void  __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_free"))) TS_CResult_UpdateFeeDecodeErrorZ_free(uint64_t _res) {
18474         if (!ptr_is_owned(_res)) return;
18475         void* _res_ptr = untag_ptr(_res);
18476         CHECK_ACCESS(_res_ptr);
18477         LDKCResult_UpdateFeeDecodeErrorZ _res_conv = *(LDKCResult_UpdateFeeDecodeErrorZ*)(_res_ptr);
18478         FREE(untag_ptr(_res));
18479         CResult_UpdateFeeDecodeErrorZ_free(_res_conv);
18480 }
18481
18482 static inline uint64_t CResult_UpdateFeeDecodeErrorZ_clone_ptr(LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR arg) {
18483         LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
18484         *ret_conv = CResult_UpdateFeeDecodeErrorZ_clone(arg);
18485         return tag_ptr(ret_conv, true);
18486 }
18487 int64_t  __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_clone_ptr"))) TS_CResult_UpdateFeeDecodeErrorZ_clone_ptr(uint64_t arg) {
18488         LDKCResult_UpdateFeeDecodeErrorZ* arg_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)untag_ptr(arg);
18489         int64_t ret_conv = CResult_UpdateFeeDecodeErrorZ_clone_ptr(arg_conv);
18490         return ret_conv;
18491 }
18492
18493 uint64_t  __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_clone"))) TS_CResult_UpdateFeeDecodeErrorZ_clone(uint64_t orig) {
18494         LDKCResult_UpdateFeeDecodeErrorZ* orig_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)untag_ptr(orig);
18495         LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
18496         *ret_conv = CResult_UpdateFeeDecodeErrorZ_clone(orig_conv);
18497         return tag_ptr(ret_conv, true);
18498 }
18499
18500 uint64_t  __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_ok"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_ok(uint64_t o) {
18501         LDKUpdateFulfillHTLC o_conv;
18502         o_conv.inner = untag_ptr(o);
18503         o_conv.is_owned = ptr_is_owned(o);
18504         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18505         o_conv = UpdateFulfillHTLC_clone(&o_conv);
18506         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
18507         *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_ok(o_conv);
18508         return tag_ptr(ret_conv, true);
18509 }
18510
18511 uint64_t  __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_err"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_err(uint64_t e) {
18512         LDKDecodeError e_conv;
18513         e_conv.inner = untag_ptr(e);
18514         e_conv.is_owned = ptr_is_owned(e);
18515         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18516         e_conv = DecodeError_clone(&e_conv);
18517         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
18518         *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_err(e_conv);
18519         return tag_ptr(ret_conv, true);
18520 }
18521
18522 jboolean  __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_is_ok"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_is_ok(uint64_t o) {
18523         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)untag_ptr(o);
18524         jboolean ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_is_ok(o_conv);
18525         return ret_conv;
18526 }
18527
18528 void  __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_free"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_free(uint64_t _res) {
18529         if (!ptr_is_owned(_res)) return;
18530         void* _res_ptr = untag_ptr(_res);
18531         CHECK_ACCESS(_res_ptr);
18532         LDKCResult_UpdateFulfillHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(_res_ptr);
18533         FREE(untag_ptr(_res));
18534         CResult_UpdateFulfillHTLCDecodeErrorZ_free(_res_conv);
18535 }
18536
18537 static inline uint64_t CResult_UpdateFulfillHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR arg) {
18538         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
18539         *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_clone(arg);
18540         return tag_ptr(ret_conv, true);
18541 }
18542 int64_t  __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_clone_ptr"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_clone_ptr(uint64_t arg) {
18543         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)untag_ptr(arg);
18544         int64_t ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_clone_ptr(arg_conv);
18545         return ret_conv;
18546 }
18547
18548 uint64_t  __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_clone"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_clone(uint64_t orig) {
18549         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)untag_ptr(orig);
18550         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
18551         *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_clone(orig_conv);
18552         return tag_ptr(ret_conv, true);
18553 }
18554
18555 uint64_t  __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_ok"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_ok(uint64_t o) {
18556         LDKUpdateAddHTLC o_conv;
18557         o_conv.inner = untag_ptr(o);
18558         o_conv.is_owned = ptr_is_owned(o);
18559         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18560         o_conv = UpdateAddHTLC_clone(&o_conv);
18561         LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
18562         *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_ok(o_conv);
18563         return tag_ptr(ret_conv, true);
18564 }
18565
18566 uint64_t  __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_err"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_err(uint64_t e) {
18567         LDKDecodeError e_conv;
18568         e_conv.inner = untag_ptr(e);
18569         e_conv.is_owned = ptr_is_owned(e);
18570         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18571         e_conv = DecodeError_clone(&e_conv);
18572         LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
18573         *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_err(e_conv);
18574         return tag_ptr(ret_conv, true);
18575 }
18576
18577 jboolean  __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_is_ok"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_is_ok(uint64_t o) {
18578         LDKCResult_UpdateAddHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)untag_ptr(o);
18579         jboolean ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_is_ok(o_conv);
18580         return ret_conv;
18581 }
18582
18583 void  __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_free"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_free(uint64_t _res) {
18584         if (!ptr_is_owned(_res)) return;
18585         void* _res_ptr = untag_ptr(_res);
18586         CHECK_ACCESS(_res_ptr);
18587         LDKCResult_UpdateAddHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateAddHTLCDecodeErrorZ*)(_res_ptr);
18588         FREE(untag_ptr(_res));
18589         CResult_UpdateAddHTLCDecodeErrorZ_free(_res_conv);
18590 }
18591
18592 static inline uint64_t CResult_UpdateAddHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR arg) {
18593         LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
18594         *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_clone(arg);
18595         return tag_ptr(ret_conv, true);
18596 }
18597 int64_t  __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_clone_ptr"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_clone_ptr(uint64_t arg) {
18598         LDKCResult_UpdateAddHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)untag_ptr(arg);
18599         int64_t ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_clone_ptr(arg_conv);
18600         return ret_conv;
18601 }
18602
18603 uint64_t  __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_clone"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_clone(uint64_t orig) {
18604         LDKCResult_UpdateAddHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)untag_ptr(orig);
18605         LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
18606         *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_clone(orig_conv);
18607         return tag_ptr(ret_conv, true);
18608 }
18609
18610 uint64_t  __attribute__((export_name("TS_CResult_PingDecodeErrorZ_ok"))) TS_CResult_PingDecodeErrorZ_ok(uint64_t o) {
18611         LDKPing o_conv;
18612         o_conv.inner = untag_ptr(o);
18613         o_conv.is_owned = ptr_is_owned(o);
18614         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18615         o_conv = Ping_clone(&o_conv);
18616         LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
18617         *ret_conv = CResult_PingDecodeErrorZ_ok(o_conv);
18618         return tag_ptr(ret_conv, true);
18619 }
18620
18621 uint64_t  __attribute__((export_name("TS_CResult_PingDecodeErrorZ_err"))) TS_CResult_PingDecodeErrorZ_err(uint64_t e) {
18622         LDKDecodeError e_conv;
18623         e_conv.inner = untag_ptr(e);
18624         e_conv.is_owned = ptr_is_owned(e);
18625         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18626         e_conv = DecodeError_clone(&e_conv);
18627         LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
18628         *ret_conv = CResult_PingDecodeErrorZ_err(e_conv);
18629         return tag_ptr(ret_conv, true);
18630 }
18631
18632 jboolean  __attribute__((export_name("TS_CResult_PingDecodeErrorZ_is_ok"))) TS_CResult_PingDecodeErrorZ_is_ok(uint64_t o) {
18633         LDKCResult_PingDecodeErrorZ* o_conv = (LDKCResult_PingDecodeErrorZ*)untag_ptr(o);
18634         jboolean ret_conv = CResult_PingDecodeErrorZ_is_ok(o_conv);
18635         return ret_conv;
18636 }
18637
18638 void  __attribute__((export_name("TS_CResult_PingDecodeErrorZ_free"))) TS_CResult_PingDecodeErrorZ_free(uint64_t _res) {
18639         if (!ptr_is_owned(_res)) return;
18640         void* _res_ptr = untag_ptr(_res);
18641         CHECK_ACCESS(_res_ptr);
18642         LDKCResult_PingDecodeErrorZ _res_conv = *(LDKCResult_PingDecodeErrorZ*)(_res_ptr);
18643         FREE(untag_ptr(_res));
18644         CResult_PingDecodeErrorZ_free(_res_conv);
18645 }
18646
18647 static inline uint64_t CResult_PingDecodeErrorZ_clone_ptr(LDKCResult_PingDecodeErrorZ *NONNULL_PTR arg) {
18648         LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
18649         *ret_conv = CResult_PingDecodeErrorZ_clone(arg);
18650         return tag_ptr(ret_conv, true);
18651 }
18652 int64_t  __attribute__((export_name("TS_CResult_PingDecodeErrorZ_clone_ptr"))) TS_CResult_PingDecodeErrorZ_clone_ptr(uint64_t arg) {
18653         LDKCResult_PingDecodeErrorZ* arg_conv = (LDKCResult_PingDecodeErrorZ*)untag_ptr(arg);
18654         int64_t ret_conv = CResult_PingDecodeErrorZ_clone_ptr(arg_conv);
18655         return ret_conv;
18656 }
18657
18658 uint64_t  __attribute__((export_name("TS_CResult_PingDecodeErrorZ_clone"))) TS_CResult_PingDecodeErrorZ_clone(uint64_t orig) {
18659         LDKCResult_PingDecodeErrorZ* orig_conv = (LDKCResult_PingDecodeErrorZ*)untag_ptr(orig);
18660         LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
18661         *ret_conv = CResult_PingDecodeErrorZ_clone(orig_conv);
18662         return tag_ptr(ret_conv, true);
18663 }
18664
18665 uint64_t  __attribute__((export_name("TS_CResult_PongDecodeErrorZ_ok"))) TS_CResult_PongDecodeErrorZ_ok(uint64_t o) {
18666         LDKPong o_conv;
18667         o_conv.inner = untag_ptr(o);
18668         o_conv.is_owned = ptr_is_owned(o);
18669         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18670         o_conv = Pong_clone(&o_conv);
18671         LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
18672         *ret_conv = CResult_PongDecodeErrorZ_ok(o_conv);
18673         return tag_ptr(ret_conv, true);
18674 }
18675
18676 uint64_t  __attribute__((export_name("TS_CResult_PongDecodeErrorZ_err"))) TS_CResult_PongDecodeErrorZ_err(uint64_t e) {
18677         LDKDecodeError e_conv;
18678         e_conv.inner = untag_ptr(e);
18679         e_conv.is_owned = ptr_is_owned(e);
18680         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18681         e_conv = DecodeError_clone(&e_conv);
18682         LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
18683         *ret_conv = CResult_PongDecodeErrorZ_err(e_conv);
18684         return tag_ptr(ret_conv, true);
18685 }
18686
18687 jboolean  __attribute__((export_name("TS_CResult_PongDecodeErrorZ_is_ok"))) TS_CResult_PongDecodeErrorZ_is_ok(uint64_t o) {
18688         LDKCResult_PongDecodeErrorZ* o_conv = (LDKCResult_PongDecodeErrorZ*)untag_ptr(o);
18689         jboolean ret_conv = CResult_PongDecodeErrorZ_is_ok(o_conv);
18690         return ret_conv;
18691 }
18692
18693 void  __attribute__((export_name("TS_CResult_PongDecodeErrorZ_free"))) TS_CResult_PongDecodeErrorZ_free(uint64_t _res) {
18694         if (!ptr_is_owned(_res)) return;
18695         void* _res_ptr = untag_ptr(_res);
18696         CHECK_ACCESS(_res_ptr);
18697         LDKCResult_PongDecodeErrorZ _res_conv = *(LDKCResult_PongDecodeErrorZ*)(_res_ptr);
18698         FREE(untag_ptr(_res));
18699         CResult_PongDecodeErrorZ_free(_res_conv);
18700 }
18701
18702 static inline uint64_t CResult_PongDecodeErrorZ_clone_ptr(LDKCResult_PongDecodeErrorZ *NONNULL_PTR arg) {
18703         LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
18704         *ret_conv = CResult_PongDecodeErrorZ_clone(arg);
18705         return tag_ptr(ret_conv, true);
18706 }
18707 int64_t  __attribute__((export_name("TS_CResult_PongDecodeErrorZ_clone_ptr"))) TS_CResult_PongDecodeErrorZ_clone_ptr(uint64_t arg) {
18708         LDKCResult_PongDecodeErrorZ* arg_conv = (LDKCResult_PongDecodeErrorZ*)untag_ptr(arg);
18709         int64_t ret_conv = CResult_PongDecodeErrorZ_clone_ptr(arg_conv);
18710         return ret_conv;
18711 }
18712
18713 uint64_t  __attribute__((export_name("TS_CResult_PongDecodeErrorZ_clone"))) TS_CResult_PongDecodeErrorZ_clone(uint64_t orig) {
18714         LDKCResult_PongDecodeErrorZ* orig_conv = (LDKCResult_PongDecodeErrorZ*)untag_ptr(orig);
18715         LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
18716         *ret_conv = CResult_PongDecodeErrorZ_clone(orig_conv);
18717         return tag_ptr(ret_conv, true);
18718 }
18719
18720 uint64_t  __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(uint64_t o) {
18721         LDKUnsignedChannelAnnouncement o_conv;
18722         o_conv.inner = untag_ptr(o);
18723         o_conv.is_owned = ptr_is_owned(o);
18724         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18725         o_conv = UnsignedChannelAnnouncement_clone(&o_conv);
18726         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
18727         *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(o_conv);
18728         return tag_ptr(ret_conv, true);
18729 }
18730
18731 uint64_t  __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_err"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(uint64_t e) {
18732         LDKDecodeError e_conv;
18733         e_conv.inner = untag_ptr(e);
18734         e_conv.is_owned = ptr_is_owned(e);
18735         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18736         e_conv = DecodeError_clone(&e_conv);
18737         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
18738         *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(e_conv);
18739         return tag_ptr(ret_conv, true);
18740 }
18741
18742 jboolean  __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_is_ok"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_is_ok(uint64_t o) {
18743         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* o_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)untag_ptr(o);
18744         jboolean ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_is_ok(o_conv);
18745         return ret_conv;
18746 }
18747
18748 void  __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_free"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(uint64_t _res) {
18749         if (!ptr_is_owned(_res)) return;
18750         void* _res_ptr = untag_ptr(_res);
18751         CHECK_ACCESS(_res_ptr);
18752         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(_res_ptr);
18753         FREE(untag_ptr(_res));
18754         CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(_res_conv);
18755 }
18756
18757 static inline uint64_t CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
18758         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
18759         *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(arg);
18760         return tag_ptr(ret_conv, true);
18761 }
18762 int64_t  __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone_ptr"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone_ptr(uint64_t arg) {
18763         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)untag_ptr(arg);
18764         int64_t ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
18765         return ret_conv;
18766 }
18767
18768 uint64_t  __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(uint64_t orig) {
18769         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)untag_ptr(orig);
18770         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
18771         *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(orig_conv);
18772         return tag_ptr(ret_conv, true);
18773 }
18774
18775 uint64_t  __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_ok"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_ok(uint64_t o) {
18776         LDKChannelAnnouncement o_conv;
18777         o_conv.inner = untag_ptr(o);
18778         o_conv.is_owned = ptr_is_owned(o);
18779         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18780         o_conv = ChannelAnnouncement_clone(&o_conv);
18781         LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
18782         *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_ok(o_conv);
18783         return tag_ptr(ret_conv, true);
18784 }
18785
18786 uint64_t  __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_err"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_err(uint64_t e) {
18787         LDKDecodeError e_conv;
18788         e_conv.inner = untag_ptr(e);
18789         e_conv.is_owned = ptr_is_owned(e);
18790         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18791         e_conv = DecodeError_clone(&e_conv);
18792         LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
18793         *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_err(e_conv);
18794         return tag_ptr(ret_conv, true);
18795 }
18796
18797 jboolean  __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_is_ok"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_is_ok(uint64_t o) {
18798         LDKCResult_ChannelAnnouncementDecodeErrorZ* o_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)untag_ptr(o);
18799         jboolean ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_is_ok(o_conv);
18800         return ret_conv;
18801 }
18802
18803 void  __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_free"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_free(uint64_t _res) {
18804         if (!ptr_is_owned(_res)) return;
18805         void* _res_ptr = untag_ptr(_res);
18806         CHECK_ACCESS(_res_ptr);
18807         LDKCResult_ChannelAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_ChannelAnnouncementDecodeErrorZ*)(_res_ptr);
18808         FREE(untag_ptr(_res));
18809         CResult_ChannelAnnouncementDecodeErrorZ_free(_res_conv);
18810 }
18811
18812 static inline uint64_t CResult_ChannelAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
18813         LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
18814         *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_clone(arg);
18815         return tag_ptr(ret_conv, true);
18816 }
18817 int64_t  __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_clone_ptr(uint64_t arg) {
18818         LDKCResult_ChannelAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)untag_ptr(arg);
18819         int64_t ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
18820         return ret_conv;
18821 }
18822
18823 uint64_t  __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_clone"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_clone(uint64_t orig) {
18824         LDKCResult_ChannelAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)untag_ptr(orig);
18825         LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
18826         *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_clone(orig_conv);
18827         return tag_ptr(ret_conv, true);
18828 }
18829
18830 uint64_t  __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_ok"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_ok(uint64_t o) {
18831         LDKUnsignedChannelUpdate o_conv;
18832         o_conv.inner = untag_ptr(o);
18833         o_conv.is_owned = ptr_is_owned(o);
18834         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18835         o_conv = UnsignedChannelUpdate_clone(&o_conv);
18836         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
18837         *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_ok(o_conv);
18838         return tag_ptr(ret_conv, true);
18839 }
18840
18841 uint64_t  __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_err"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_err(uint64_t e) {
18842         LDKDecodeError e_conv;
18843         e_conv.inner = untag_ptr(e);
18844         e_conv.is_owned = ptr_is_owned(e);
18845         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18846         e_conv = DecodeError_clone(&e_conv);
18847         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
18848         *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_err(e_conv);
18849         return tag_ptr(ret_conv, true);
18850 }
18851
18852 jboolean  __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_is_ok"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_is_ok(uint64_t o) {
18853         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* o_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)untag_ptr(o);
18854         jboolean ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_is_ok(o_conv);
18855         return ret_conv;
18856 }
18857
18858 void  __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_free"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_free(uint64_t _res) {
18859         if (!ptr_is_owned(_res)) return;
18860         void* _res_ptr = untag_ptr(_res);
18861         CHECK_ACCESS(_res_ptr);
18862         LDKCResult_UnsignedChannelUpdateDecodeErrorZ _res_conv = *(LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(_res_ptr);
18863         FREE(untag_ptr(_res));
18864         CResult_UnsignedChannelUpdateDecodeErrorZ_free(_res_conv);
18865 }
18866
18867 static inline uint64_t CResult_UnsignedChannelUpdateDecodeErrorZ_clone_ptr(LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR arg) {
18868         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
18869         *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_clone(arg);
18870         return tag_ptr(ret_conv, true);
18871 }
18872 int64_t  __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_clone_ptr"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_clone_ptr(uint64_t arg) {
18873         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* arg_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)untag_ptr(arg);
18874         int64_t ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_clone_ptr(arg_conv);
18875         return ret_conv;
18876 }
18877
18878 uint64_t  __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_clone"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_clone(uint64_t orig) {
18879         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* orig_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)untag_ptr(orig);
18880         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
18881         *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_clone(orig_conv);
18882         return tag_ptr(ret_conv, true);
18883 }
18884
18885 uint64_t  __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_ok"))) TS_CResult_ChannelUpdateDecodeErrorZ_ok(uint64_t o) {
18886         LDKChannelUpdate o_conv;
18887         o_conv.inner = untag_ptr(o);
18888         o_conv.is_owned = ptr_is_owned(o);
18889         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18890         o_conv = ChannelUpdate_clone(&o_conv);
18891         LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
18892         *ret_conv = CResult_ChannelUpdateDecodeErrorZ_ok(o_conv);
18893         return tag_ptr(ret_conv, true);
18894 }
18895
18896 uint64_t  __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_err"))) TS_CResult_ChannelUpdateDecodeErrorZ_err(uint64_t e) {
18897         LDKDecodeError e_conv;
18898         e_conv.inner = untag_ptr(e);
18899         e_conv.is_owned = ptr_is_owned(e);
18900         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18901         e_conv = DecodeError_clone(&e_conv);
18902         LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
18903         *ret_conv = CResult_ChannelUpdateDecodeErrorZ_err(e_conv);
18904         return tag_ptr(ret_conv, true);
18905 }
18906
18907 jboolean  __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_is_ok"))) TS_CResult_ChannelUpdateDecodeErrorZ_is_ok(uint64_t o) {
18908         LDKCResult_ChannelUpdateDecodeErrorZ* o_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)untag_ptr(o);
18909         jboolean ret_conv = CResult_ChannelUpdateDecodeErrorZ_is_ok(o_conv);
18910         return ret_conv;
18911 }
18912
18913 void  __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_free"))) TS_CResult_ChannelUpdateDecodeErrorZ_free(uint64_t _res) {
18914         if (!ptr_is_owned(_res)) return;
18915         void* _res_ptr = untag_ptr(_res);
18916         CHECK_ACCESS(_res_ptr);
18917         LDKCResult_ChannelUpdateDecodeErrorZ _res_conv = *(LDKCResult_ChannelUpdateDecodeErrorZ*)(_res_ptr);
18918         FREE(untag_ptr(_res));
18919         CResult_ChannelUpdateDecodeErrorZ_free(_res_conv);
18920 }
18921
18922 static inline uint64_t CResult_ChannelUpdateDecodeErrorZ_clone_ptr(LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR arg) {
18923         LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
18924         *ret_conv = CResult_ChannelUpdateDecodeErrorZ_clone(arg);
18925         return tag_ptr(ret_conv, true);
18926 }
18927 int64_t  __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelUpdateDecodeErrorZ_clone_ptr(uint64_t arg) {
18928         LDKCResult_ChannelUpdateDecodeErrorZ* arg_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)untag_ptr(arg);
18929         int64_t ret_conv = CResult_ChannelUpdateDecodeErrorZ_clone_ptr(arg_conv);
18930         return ret_conv;
18931 }
18932
18933 uint64_t  __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_clone"))) TS_CResult_ChannelUpdateDecodeErrorZ_clone(uint64_t orig) {
18934         LDKCResult_ChannelUpdateDecodeErrorZ* orig_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)untag_ptr(orig);
18935         LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
18936         *ret_conv = CResult_ChannelUpdateDecodeErrorZ_clone(orig_conv);
18937         return tag_ptr(ret_conv, true);
18938 }
18939
18940 uint64_t  __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_ok"))) TS_CResult_ErrorMessageDecodeErrorZ_ok(uint64_t o) {
18941         LDKErrorMessage o_conv;
18942         o_conv.inner = untag_ptr(o);
18943         o_conv.is_owned = ptr_is_owned(o);
18944         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18945         o_conv = ErrorMessage_clone(&o_conv);
18946         LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
18947         *ret_conv = CResult_ErrorMessageDecodeErrorZ_ok(o_conv);
18948         return tag_ptr(ret_conv, true);
18949 }
18950
18951 uint64_t  __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_err"))) TS_CResult_ErrorMessageDecodeErrorZ_err(uint64_t e) {
18952         LDKDecodeError e_conv;
18953         e_conv.inner = untag_ptr(e);
18954         e_conv.is_owned = ptr_is_owned(e);
18955         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18956         e_conv = DecodeError_clone(&e_conv);
18957         LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
18958         *ret_conv = CResult_ErrorMessageDecodeErrorZ_err(e_conv);
18959         return tag_ptr(ret_conv, true);
18960 }
18961
18962 jboolean  __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_is_ok"))) TS_CResult_ErrorMessageDecodeErrorZ_is_ok(uint64_t o) {
18963         LDKCResult_ErrorMessageDecodeErrorZ* o_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)untag_ptr(o);
18964         jboolean ret_conv = CResult_ErrorMessageDecodeErrorZ_is_ok(o_conv);
18965         return ret_conv;
18966 }
18967
18968 void  __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_free"))) TS_CResult_ErrorMessageDecodeErrorZ_free(uint64_t _res) {
18969         if (!ptr_is_owned(_res)) return;
18970         void* _res_ptr = untag_ptr(_res);
18971         CHECK_ACCESS(_res_ptr);
18972         LDKCResult_ErrorMessageDecodeErrorZ _res_conv = *(LDKCResult_ErrorMessageDecodeErrorZ*)(_res_ptr);
18973         FREE(untag_ptr(_res));
18974         CResult_ErrorMessageDecodeErrorZ_free(_res_conv);
18975 }
18976
18977 static inline uint64_t CResult_ErrorMessageDecodeErrorZ_clone_ptr(LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR arg) {
18978         LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
18979         *ret_conv = CResult_ErrorMessageDecodeErrorZ_clone(arg);
18980         return tag_ptr(ret_conv, true);
18981 }
18982 int64_t  __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_clone_ptr"))) TS_CResult_ErrorMessageDecodeErrorZ_clone_ptr(uint64_t arg) {
18983         LDKCResult_ErrorMessageDecodeErrorZ* arg_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)untag_ptr(arg);
18984         int64_t ret_conv = CResult_ErrorMessageDecodeErrorZ_clone_ptr(arg_conv);
18985         return ret_conv;
18986 }
18987
18988 uint64_t  __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_clone"))) TS_CResult_ErrorMessageDecodeErrorZ_clone(uint64_t orig) {
18989         LDKCResult_ErrorMessageDecodeErrorZ* orig_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)untag_ptr(orig);
18990         LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
18991         *ret_conv = CResult_ErrorMessageDecodeErrorZ_clone(orig_conv);
18992         return tag_ptr(ret_conv, true);
18993 }
18994
18995 uint64_t  __attribute__((export_name("TS_CResult_WarningMessageDecodeErrorZ_ok"))) TS_CResult_WarningMessageDecodeErrorZ_ok(uint64_t o) {
18996         LDKWarningMessage o_conv;
18997         o_conv.inner = untag_ptr(o);
18998         o_conv.is_owned = ptr_is_owned(o);
18999         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19000         o_conv = WarningMessage_clone(&o_conv);
19001         LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
19002         *ret_conv = CResult_WarningMessageDecodeErrorZ_ok(o_conv);
19003         return tag_ptr(ret_conv, true);
19004 }
19005
19006 uint64_t  __attribute__((export_name("TS_CResult_WarningMessageDecodeErrorZ_err"))) TS_CResult_WarningMessageDecodeErrorZ_err(uint64_t e) {
19007         LDKDecodeError e_conv;
19008         e_conv.inner = untag_ptr(e);
19009         e_conv.is_owned = ptr_is_owned(e);
19010         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
19011         e_conv = DecodeError_clone(&e_conv);
19012         LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
19013         *ret_conv = CResult_WarningMessageDecodeErrorZ_err(e_conv);
19014         return tag_ptr(ret_conv, true);
19015 }
19016
19017 jboolean  __attribute__((export_name("TS_CResult_WarningMessageDecodeErrorZ_is_ok"))) TS_CResult_WarningMessageDecodeErrorZ_is_ok(uint64_t o) {
19018         LDKCResult_WarningMessageDecodeErrorZ* o_conv = (LDKCResult_WarningMessageDecodeErrorZ*)untag_ptr(o);
19019         jboolean ret_conv = CResult_WarningMessageDecodeErrorZ_is_ok(o_conv);
19020         return ret_conv;
19021 }
19022
19023 void  __attribute__((export_name("TS_CResult_WarningMessageDecodeErrorZ_free"))) TS_CResult_WarningMessageDecodeErrorZ_free(uint64_t _res) {
19024         if (!ptr_is_owned(_res)) return;
19025         void* _res_ptr = untag_ptr(_res);
19026         CHECK_ACCESS(_res_ptr);
19027         LDKCResult_WarningMessageDecodeErrorZ _res_conv = *(LDKCResult_WarningMessageDecodeErrorZ*)(_res_ptr);
19028         FREE(untag_ptr(_res));
19029         CResult_WarningMessageDecodeErrorZ_free(_res_conv);
19030 }
19031
19032 static inline uint64_t CResult_WarningMessageDecodeErrorZ_clone_ptr(LDKCResult_WarningMessageDecodeErrorZ *NONNULL_PTR arg) {
19033         LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
19034         *ret_conv = CResult_WarningMessageDecodeErrorZ_clone(arg);
19035         return tag_ptr(ret_conv, true);
19036 }
19037 int64_t  __attribute__((export_name("TS_CResult_WarningMessageDecodeErrorZ_clone_ptr"))) TS_CResult_WarningMessageDecodeErrorZ_clone_ptr(uint64_t arg) {
19038         LDKCResult_WarningMessageDecodeErrorZ* arg_conv = (LDKCResult_WarningMessageDecodeErrorZ*)untag_ptr(arg);
19039         int64_t ret_conv = CResult_WarningMessageDecodeErrorZ_clone_ptr(arg_conv);
19040         return ret_conv;
19041 }
19042
19043 uint64_t  __attribute__((export_name("TS_CResult_WarningMessageDecodeErrorZ_clone"))) TS_CResult_WarningMessageDecodeErrorZ_clone(uint64_t orig) {
19044         LDKCResult_WarningMessageDecodeErrorZ* orig_conv = (LDKCResult_WarningMessageDecodeErrorZ*)untag_ptr(orig);
19045         LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
19046         *ret_conv = CResult_WarningMessageDecodeErrorZ_clone(orig_conv);
19047         return tag_ptr(ret_conv, true);
19048 }
19049
19050 uint64_t  __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(uint64_t o) {
19051         LDKUnsignedNodeAnnouncement o_conv;
19052         o_conv.inner = untag_ptr(o);
19053         o_conv.is_owned = ptr_is_owned(o);
19054         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19055         o_conv = UnsignedNodeAnnouncement_clone(&o_conv);
19056         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
19057         *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(o_conv);
19058         return tag_ptr(ret_conv, true);
19059 }
19060
19061 uint64_t  __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_err"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(uint64_t e) {
19062         LDKDecodeError e_conv;
19063         e_conv.inner = untag_ptr(e);
19064         e_conv.is_owned = ptr_is_owned(e);
19065         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
19066         e_conv = DecodeError_clone(&e_conv);
19067         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
19068         *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(e_conv);
19069         return tag_ptr(ret_conv, true);
19070 }
19071
19072 jboolean  __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_is_ok"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_is_ok(uint64_t o) {
19073         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* o_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)untag_ptr(o);
19074         jboolean ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_is_ok(o_conv);
19075         return ret_conv;
19076 }
19077
19078 void  __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_free"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(uint64_t _res) {
19079         if (!ptr_is_owned(_res)) return;
19080         void* _res_ptr = untag_ptr(_res);
19081         CHECK_ACCESS(_res_ptr);
19082         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(_res_ptr);
19083         FREE(untag_ptr(_res));
19084         CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(_res_conv);
19085 }
19086
19087 static inline uint64_t CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
19088         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
19089         *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(arg);
19090         return tag_ptr(ret_conv, true);
19091 }
19092 int64_t  __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone_ptr"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone_ptr(uint64_t arg) {
19093         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)untag_ptr(arg);
19094         int64_t ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
19095         return ret_conv;
19096 }
19097
19098 uint64_t  __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(uint64_t orig) {
19099         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)untag_ptr(orig);
19100         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
19101         *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(orig_conv);
19102         return tag_ptr(ret_conv, true);
19103 }
19104
19105 uint64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_ok"))) TS_CResult_NodeAnnouncementDecodeErrorZ_ok(uint64_t o) {
19106         LDKNodeAnnouncement o_conv;
19107         o_conv.inner = untag_ptr(o);
19108         o_conv.is_owned = ptr_is_owned(o);
19109         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19110         o_conv = NodeAnnouncement_clone(&o_conv);
19111         LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
19112         *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_ok(o_conv);
19113         return tag_ptr(ret_conv, true);
19114 }
19115
19116 uint64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_err"))) TS_CResult_NodeAnnouncementDecodeErrorZ_err(uint64_t e) {
19117         LDKDecodeError e_conv;
19118         e_conv.inner = untag_ptr(e);
19119         e_conv.is_owned = ptr_is_owned(e);
19120         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
19121         e_conv = DecodeError_clone(&e_conv);
19122         LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
19123         *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_err(e_conv);
19124         return tag_ptr(ret_conv, true);
19125 }
19126
19127 jboolean  __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_is_ok"))) TS_CResult_NodeAnnouncementDecodeErrorZ_is_ok(uint64_t o) {
19128         LDKCResult_NodeAnnouncementDecodeErrorZ* o_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)untag_ptr(o);
19129         jboolean ret_conv = CResult_NodeAnnouncementDecodeErrorZ_is_ok(o_conv);
19130         return ret_conv;
19131 }
19132
19133 void  __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_free"))) TS_CResult_NodeAnnouncementDecodeErrorZ_free(uint64_t _res) {
19134         if (!ptr_is_owned(_res)) return;
19135         void* _res_ptr = untag_ptr(_res);
19136         CHECK_ACCESS(_res_ptr);
19137         LDKCResult_NodeAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_NodeAnnouncementDecodeErrorZ*)(_res_ptr);
19138         FREE(untag_ptr(_res));
19139         CResult_NodeAnnouncementDecodeErrorZ_free(_res_conv);
19140 }
19141
19142 static inline uint64_t CResult_NodeAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
19143         LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
19144         *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_clone(arg);
19145         return tag_ptr(ret_conv, true);
19146 }
19147 int64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_clone_ptr"))) TS_CResult_NodeAnnouncementDecodeErrorZ_clone_ptr(uint64_t arg) {
19148         LDKCResult_NodeAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)untag_ptr(arg);
19149         int64_t ret_conv = CResult_NodeAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
19150         return ret_conv;
19151 }
19152
19153 uint64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_clone"))) TS_CResult_NodeAnnouncementDecodeErrorZ_clone(uint64_t orig) {
19154         LDKCResult_NodeAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)untag_ptr(orig);
19155         LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
19156         *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_clone(orig_conv);
19157         return tag_ptr(ret_conv, true);
19158 }
19159
19160 uint64_t  __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_ok"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_ok(uint64_t o) {
19161         LDKQueryShortChannelIds o_conv;
19162         o_conv.inner = untag_ptr(o);
19163         o_conv.is_owned = ptr_is_owned(o);
19164         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19165         o_conv = QueryShortChannelIds_clone(&o_conv);
19166         LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
19167         *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_ok(o_conv);
19168         return tag_ptr(ret_conv, true);
19169 }
19170
19171 uint64_t  __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_err"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_err(uint64_t e) {
19172         LDKDecodeError e_conv;
19173         e_conv.inner = untag_ptr(e);
19174         e_conv.is_owned = ptr_is_owned(e);
19175         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
19176         e_conv = DecodeError_clone(&e_conv);
19177         LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
19178         *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_err(e_conv);
19179         return tag_ptr(ret_conv, true);
19180 }
19181
19182 jboolean  __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_is_ok"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_is_ok(uint64_t o) {
19183         LDKCResult_QueryShortChannelIdsDecodeErrorZ* o_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)untag_ptr(o);
19184         jboolean ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_is_ok(o_conv);
19185         return ret_conv;
19186 }
19187
19188 void  __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_free"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_free(uint64_t _res) {
19189         if (!ptr_is_owned(_res)) return;
19190         void* _res_ptr = untag_ptr(_res);
19191         CHECK_ACCESS(_res_ptr);
19192         LDKCResult_QueryShortChannelIdsDecodeErrorZ _res_conv = *(LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(_res_ptr);
19193         FREE(untag_ptr(_res));
19194         CResult_QueryShortChannelIdsDecodeErrorZ_free(_res_conv);
19195 }
19196
19197 static inline uint64_t CResult_QueryShortChannelIdsDecodeErrorZ_clone_ptr(LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR arg) {
19198         LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
19199         *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_clone(arg);
19200         return tag_ptr(ret_conv, true);
19201 }
19202 int64_t  __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_clone_ptr"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_clone_ptr(uint64_t arg) {
19203         LDKCResult_QueryShortChannelIdsDecodeErrorZ* arg_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)untag_ptr(arg);
19204         int64_t ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_clone_ptr(arg_conv);
19205         return ret_conv;
19206 }
19207
19208 uint64_t  __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_clone"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_clone(uint64_t orig) {
19209         LDKCResult_QueryShortChannelIdsDecodeErrorZ* orig_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)untag_ptr(orig);
19210         LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
19211         *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_clone(orig_conv);
19212         return tag_ptr(ret_conv, true);
19213 }
19214
19215 uint64_t  __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(uint64_t o) {
19216         LDKReplyShortChannelIdsEnd o_conv;
19217         o_conv.inner = untag_ptr(o);
19218         o_conv.is_owned = ptr_is_owned(o);
19219         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19220         o_conv = ReplyShortChannelIdsEnd_clone(&o_conv);
19221         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
19222         *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(o_conv);
19223         return tag_ptr(ret_conv, true);
19224 }
19225
19226 uint64_t  __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_err"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(uint64_t e) {
19227         LDKDecodeError e_conv;
19228         e_conv.inner = untag_ptr(e);
19229         e_conv.is_owned = ptr_is_owned(e);
19230         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
19231         e_conv = DecodeError_clone(&e_conv);
19232         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
19233         *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(e_conv);
19234         return tag_ptr(ret_conv, true);
19235 }
19236
19237 jboolean  __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_is_ok"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_is_ok(uint64_t o) {
19238         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* o_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)untag_ptr(o);
19239         jboolean ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_is_ok(o_conv);
19240         return ret_conv;
19241 }
19242
19243 void  __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_free"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(uint64_t _res) {
19244         if (!ptr_is_owned(_res)) return;
19245         void* _res_ptr = untag_ptr(_res);
19246         CHECK_ACCESS(_res_ptr);
19247         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ _res_conv = *(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(_res_ptr);
19248         FREE(untag_ptr(_res));
19249         CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(_res_conv);
19250 }
19251
19252 static inline uint64_t CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone_ptr(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR arg) {
19253         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
19254         *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(arg);
19255         return tag_ptr(ret_conv, true);
19256 }
19257 int64_t  __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone_ptr"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone_ptr(uint64_t arg) {
19258         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* arg_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)untag_ptr(arg);
19259         int64_t ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone_ptr(arg_conv);
19260         return ret_conv;
19261 }
19262
19263 uint64_t  __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(uint64_t orig) {
19264         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* orig_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)untag_ptr(orig);
19265         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
19266         *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(orig_conv);
19267         return tag_ptr(ret_conv, true);
19268 }
19269
19270 uint64_t  __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_ok"))) TS_CResult_QueryChannelRangeDecodeErrorZ_ok(uint64_t o) {
19271         LDKQueryChannelRange o_conv;
19272         o_conv.inner = untag_ptr(o);
19273         o_conv.is_owned = ptr_is_owned(o);
19274         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19275         o_conv = QueryChannelRange_clone(&o_conv);
19276         LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
19277         *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_ok(o_conv);
19278         return tag_ptr(ret_conv, true);
19279 }
19280
19281 uint64_t  __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_err"))) TS_CResult_QueryChannelRangeDecodeErrorZ_err(uint64_t e) {
19282         LDKDecodeError e_conv;
19283         e_conv.inner = untag_ptr(e);
19284         e_conv.is_owned = ptr_is_owned(e);
19285         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
19286         e_conv = DecodeError_clone(&e_conv);
19287         LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
19288         *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_err(e_conv);
19289         return tag_ptr(ret_conv, true);
19290 }
19291
19292 jboolean  __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_is_ok"))) TS_CResult_QueryChannelRangeDecodeErrorZ_is_ok(uint64_t o) {
19293         LDKCResult_QueryChannelRangeDecodeErrorZ* o_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)untag_ptr(o);
19294         jboolean ret_conv = CResult_QueryChannelRangeDecodeErrorZ_is_ok(o_conv);
19295         return ret_conv;
19296 }
19297
19298 void  __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_free"))) TS_CResult_QueryChannelRangeDecodeErrorZ_free(uint64_t _res) {
19299         if (!ptr_is_owned(_res)) return;
19300         void* _res_ptr = untag_ptr(_res);
19301         CHECK_ACCESS(_res_ptr);
19302         LDKCResult_QueryChannelRangeDecodeErrorZ _res_conv = *(LDKCResult_QueryChannelRangeDecodeErrorZ*)(_res_ptr);
19303         FREE(untag_ptr(_res));
19304         CResult_QueryChannelRangeDecodeErrorZ_free(_res_conv);
19305 }
19306
19307 static inline uint64_t CResult_QueryChannelRangeDecodeErrorZ_clone_ptr(LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR arg) {
19308         LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
19309         *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_clone(arg);
19310         return tag_ptr(ret_conv, true);
19311 }
19312 int64_t  __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_clone_ptr"))) TS_CResult_QueryChannelRangeDecodeErrorZ_clone_ptr(uint64_t arg) {
19313         LDKCResult_QueryChannelRangeDecodeErrorZ* arg_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)untag_ptr(arg);
19314         int64_t ret_conv = CResult_QueryChannelRangeDecodeErrorZ_clone_ptr(arg_conv);
19315         return ret_conv;
19316 }
19317
19318 uint64_t  __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_clone"))) TS_CResult_QueryChannelRangeDecodeErrorZ_clone(uint64_t orig) {
19319         LDKCResult_QueryChannelRangeDecodeErrorZ* orig_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)untag_ptr(orig);
19320         LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
19321         *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_clone(orig_conv);
19322         return tag_ptr(ret_conv, true);
19323 }
19324
19325 uint64_t  __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_ok"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_ok(uint64_t o) {
19326         LDKReplyChannelRange o_conv;
19327         o_conv.inner = untag_ptr(o);
19328         o_conv.is_owned = ptr_is_owned(o);
19329         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19330         o_conv = ReplyChannelRange_clone(&o_conv);
19331         LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
19332         *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_ok(o_conv);
19333         return tag_ptr(ret_conv, true);
19334 }
19335
19336 uint64_t  __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_err"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_err(uint64_t e) {
19337         LDKDecodeError e_conv;
19338         e_conv.inner = untag_ptr(e);
19339         e_conv.is_owned = ptr_is_owned(e);
19340         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
19341         e_conv = DecodeError_clone(&e_conv);
19342         LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
19343         *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_err(e_conv);
19344         return tag_ptr(ret_conv, true);
19345 }
19346
19347 jboolean  __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_is_ok"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_is_ok(uint64_t o) {
19348         LDKCResult_ReplyChannelRangeDecodeErrorZ* o_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)untag_ptr(o);
19349         jboolean ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_is_ok(o_conv);
19350         return ret_conv;
19351 }
19352
19353 void  __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_free"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_free(uint64_t _res) {
19354         if (!ptr_is_owned(_res)) return;
19355         void* _res_ptr = untag_ptr(_res);
19356         CHECK_ACCESS(_res_ptr);
19357         LDKCResult_ReplyChannelRangeDecodeErrorZ _res_conv = *(LDKCResult_ReplyChannelRangeDecodeErrorZ*)(_res_ptr);
19358         FREE(untag_ptr(_res));
19359         CResult_ReplyChannelRangeDecodeErrorZ_free(_res_conv);
19360 }
19361
19362 static inline uint64_t CResult_ReplyChannelRangeDecodeErrorZ_clone_ptr(LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR arg) {
19363         LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
19364         *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_clone(arg);
19365         return tag_ptr(ret_conv, true);
19366 }
19367 int64_t  __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_clone_ptr"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_clone_ptr(uint64_t arg) {
19368         LDKCResult_ReplyChannelRangeDecodeErrorZ* arg_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)untag_ptr(arg);
19369         int64_t ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_clone_ptr(arg_conv);
19370         return ret_conv;
19371 }
19372
19373 uint64_t  __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_clone"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_clone(uint64_t orig) {
19374         LDKCResult_ReplyChannelRangeDecodeErrorZ* orig_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)untag_ptr(orig);
19375         LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
19376         *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_clone(orig_conv);
19377         return tag_ptr(ret_conv, true);
19378 }
19379
19380 uint64_t  __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_ok"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_ok(uint64_t o) {
19381         LDKGossipTimestampFilter o_conv;
19382         o_conv.inner = untag_ptr(o);
19383         o_conv.is_owned = ptr_is_owned(o);
19384         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19385         o_conv = GossipTimestampFilter_clone(&o_conv);
19386         LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
19387         *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_ok(o_conv);
19388         return tag_ptr(ret_conv, true);
19389 }
19390
19391 uint64_t  __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_err"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_err(uint64_t e) {
19392         LDKDecodeError e_conv;
19393         e_conv.inner = untag_ptr(e);
19394         e_conv.is_owned = ptr_is_owned(e);
19395         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
19396         e_conv = DecodeError_clone(&e_conv);
19397         LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
19398         *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_err(e_conv);
19399         return tag_ptr(ret_conv, true);
19400 }
19401
19402 jboolean  __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_is_ok"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_is_ok(uint64_t o) {
19403         LDKCResult_GossipTimestampFilterDecodeErrorZ* o_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)untag_ptr(o);
19404         jboolean ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_is_ok(o_conv);
19405         return ret_conv;
19406 }
19407
19408 void  __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_free"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_free(uint64_t _res) {
19409         if (!ptr_is_owned(_res)) return;
19410         void* _res_ptr = untag_ptr(_res);
19411         CHECK_ACCESS(_res_ptr);
19412         LDKCResult_GossipTimestampFilterDecodeErrorZ _res_conv = *(LDKCResult_GossipTimestampFilterDecodeErrorZ*)(_res_ptr);
19413         FREE(untag_ptr(_res));
19414         CResult_GossipTimestampFilterDecodeErrorZ_free(_res_conv);
19415 }
19416
19417 static inline uint64_t CResult_GossipTimestampFilterDecodeErrorZ_clone_ptr(LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR arg) {
19418         LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
19419         *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_clone(arg);
19420         return tag_ptr(ret_conv, true);
19421 }
19422 int64_t  __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_clone_ptr"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_clone_ptr(uint64_t arg) {
19423         LDKCResult_GossipTimestampFilterDecodeErrorZ* arg_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)untag_ptr(arg);
19424         int64_t ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_clone_ptr(arg_conv);
19425         return ret_conv;
19426 }
19427
19428 uint64_t  __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_clone"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_clone(uint64_t orig) {
19429         LDKCResult_GossipTimestampFilterDecodeErrorZ* orig_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)untag_ptr(orig);
19430         LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
19431         *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_clone(orig_conv);
19432         return tag_ptr(ret_conv, true);
19433 }
19434
19435 uint64_t  __attribute__((export_name("TS_CResult_InvoiceSignOrCreationErrorZ_ok"))) TS_CResult_InvoiceSignOrCreationErrorZ_ok(uint64_t o) {
19436         LDKInvoice o_conv;
19437         o_conv.inner = untag_ptr(o);
19438         o_conv.is_owned = ptr_is_owned(o);
19439         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19440         o_conv = Invoice_clone(&o_conv);
19441         LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
19442         *ret_conv = CResult_InvoiceSignOrCreationErrorZ_ok(o_conv);
19443         return tag_ptr(ret_conv, true);
19444 }
19445
19446 uint64_t  __attribute__((export_name("TS_CResult_InvoiceSignOrCreationErrorZ_err"))) TS_CResult_InvoiceSignOrCreationErrorZ_err(uint64_t e) {
19447         void* e_ptr = untag_ptr(e);
19448         CHECK_ACCESS(e_ptr);
19449         LDKSignOrCreationError e_conv = *(LDKSignOrCreationError*)(e_ptr);
19450         e_conv = SignOrCreationError_clone((LDKSignOrCreationError*)untag_ptr(e));
19451         LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
19452         *ret_conv = CResult_InvoiceSignOrCreationErrorZ_err(e_conv);
19453         return tag_ptr(ret_conv, true);
19454 }
19455
19456 jboolean  __attribute__((export_name("TS_CResult_InvoiceSignOrCreationErrorZ_is_ok"))) TS_CResult_InvoiceSignOrCreationErrorZ_is_ok(uint64_t o) {
19457         LDKCResult_InvoiceSignOrCreationErrorZ* o_conv = (LDKCResult_InvoiceSignOrCreationErrorZ*)untag_ptr(o);
19458         jboolean ret_conv = CResult_InvoiceSignOrCreationErrorZ_is_ok(o_conv);
19459         return ret_conv;
19460 }
19461
19462 void  __attribute__((export_name("TS_CResult_InvoiceSignOrCreationErrorZ_free"))) TS_CResult_InvoiceSignOrCreationErrorZ_free(uint64_t _res) {
19463         if (!ptr_is_owned(_res)) return;
19464         void* _res_ptr = untag_ptr(_res);
19465         CHECK_ACCESS(_res_ptr);
19466         LDKCResult_InvoiceSignOrCreationErrorZ _res_conv = *(LDKCResult_InvoiceSignOrCreationErrorZ*)(_res_ptr);
19467         FREE(untag_ptr(_res));
19468         CResult_InvoiceSignOrCreationErrorZ_free(_res_conv);
19469 }
19470
19471 static inline uint64_t CResult_InvoiceSignOrCreationErrorZ_clone_ptr(LDKCResult_InvoiceSignOrCreationErrorZ *NONNULL_PTR arg) {
19472         LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
19473         *ret_conv = CResult_InvoiceSignOrCreationErrorZ_clone(arg);
19474         return tag_ptr(ret_conv, true);
19475 }
19476 int64_t  __attribute__((export_name("TS_CResult_InvoiceSignOrCreationErrorZ_clone_ptr"))) TS_CResult_InvoiceSignOrCreationErrorZ_clone_ptr(uint64_t arg) {
19477         LDKCResult_InvoiceSignOrCreationErrorZ* arg_conv = (LDKCResult_InvoiceSignOrCreationErrorZ*)untag_ptr(arg);
19478         int64_t ret_conv = CResult_InvoiceSignOrCreationErrorZ_clone_ptr(arg_conv);
19479         return ret_conv;
19480 }
19481
19482 uint64_t  __attribute__((export_name("TS_CResult_InvoiceSignOrCreationErrorZ_clone"))) TS_CResult_InvoiceSignOrCreationErrorZ_clone(uint64_t orig) {
19483         LDKCResult_InvoiceSignOrCreationErrorZ* orig_conv = (LDKCResult_InvoiceSignOrCreationErrorZ*)untag_ptr(orig);
19484         LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
19485         *ret_conv = CResult_InvoiceSignOrCreationErrorZ_clone(orig_conv);
19486         return tag_ptr(ret_conv, true);
19487 }
19488
19489 uint64_t  __attribute__((export_name("TS_COption_FilterZ_some"))) TS_COption_FilterZ_some(uint64_t o) {
19490         void* o_ptr = untag_ptr(o);
19491         CHECK_ACCESS(o_ptr);
19492         LDKFilter o_conv = *(LDKFilter*)(o_ptr);
19493         if (o_conv.free == LDKFilter_JCalls_free) {
19494                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
19495                 LDKFilter_JCalls_cloned(&o_conv);
19496         }
19497         LDKCOption_FilterZ *ret_copy = MALLOC(sizeof(LDKCOption_FilterZ), "LDKCOption_FilterZ");
19498         *ret_copy = COption_FilterZ_some(o_conv);
19499         uint64_t ret_ref = tag_ptr(ret_copy, true);
19500         return ret_ref;
19501 }
19502
19503 uint64_t  __attribute__((export_name("TS_COption_FilterZ_none"))) TS_COption_FilterZ_none() {
19504         LDKCOption_FilterZ *ret_copy = MALLOC(sizeof(LDKCOption_FilterZ), "LDKCOption_FilterZ");
19505         *ret_copy = COption_FilterZ_none();
19506         uint64_t ret_ref = tag_ptr(ret_copy, true);
19507         return ret_ref;
19508 }
19509
19510 void  __attribute__((export_name("TS_COption_FilterZ_free"))) TS_COption_FilterZ_free(uint64_t _res) {
19511         if (!ptr_is_owned(_res)) return;
19512         void* _res_ptr = untag_ptr(_res);
19513         CHECK_ACCESS(_res_ptr);
19514         LDKCOption_FilterZ _res_conv = *(LDKCOption_FilterZ*)(_res_ptr);
19515         FREE(untag_ptr(_res));
19516         COption_FilterZ_free(_res_conv);
19517 }
19518
19519 uint64_t  __attribute__((export_name("TS_CResult_LockedChannelMonitorNoneZ_ok"))) TS_CResult_LockedChannelMonitorNoneZ_ok(uint64_t o) {
19520         LDKLockedChannelMonitor o_conv;
19521         o_conv.inner = untag_ptr(o);
19522         o_conv.is_owned = ptr_is_owned(o);
19523         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19524         // WARNING: we need a move here but no clone is available for LDKLockedChannelMonitor
19525         
19526         LDKCResult_LockedChannelMonitorNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_LockedChannelMonitorNoneZ), "LDKCResult_LockedChannelMonitorNoneZ");
19527         *ret_conv = CResult_LockedChannelMonitorNoneZ_ok(o_conv);
19528         return tag_ptr(ret_conv, true);
19529 }
19530
19531 uint64_t  __attribute__((export_name("TS_CResult_LockedChannelMonitorNoneZ_err"))) TS_CResult_LockedChannelMonitorNoneZ_err() {
19532         LDKCResult_LockedChannelMonitorNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_LockedChannelMonitorNoneZ), "LDKCResult_LockedChannelMonitorNoneZ");
19533         *ret_conv = CResult_LockedChannelMonitorNoneZ_err();
19534         return tag_ptr(ret_conv, true);
19535 }
19536
19537 jboolean  __attribute__((export_name("TS_CResult_LockedChannelMonitorNoneZ_is_ok"))) TS_CResult_LockedChannelMonitorNoneZ_is_ok(uint64_t o) {
19538         LDKCResult_LockedChannelMonitorNoneZ* o_conv = (LDKCResult_LockedChannelMonitorNoneZ*)untag_ptr(o);
19539         jboolean ret_conv = CResult_LockedChannelMonitorNoneZ_is_ok(o_conv);
19540         return ret_conv;
19541 }
19542
19543 void  __attribute__((export_name("TS_CResult_LockedChannelMonitorNoneZ_free"))) TS_CResult_LockedChannelMonitorNoneZ_free(uint64_t _res) {
19544         if (!ptr_is_owned(_res)) return;
19545         void* _res_ptr = untag_ptr(_res);
19546         CHECK_ACCESS(_res_ptr);
19547         LDKCResult_LockedChannelMonitorNoneZ _res_conv = *(LDKCResult_LockedChannelMonitorNoneZ*)(_res_ptr);
19548         FREE(untag_ptr(_res));
19549         CResult_LockedChannelMonitorNoneZ_free(_res_conv);
19550 }
19551
19552 void  __attribute__((export_name("TS_CVec_OutPointZ_free"))) TS_CVec_OutPointZ_free(uint64_tArray _res) {
19553         LDKCVec_OutPointZ _res_constr;
19554         _res_constr.datalen = _res->arr_len;
19555         if (_res_constr.datalen > 0)
19556                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKOutPoint), "LDKCVec_OutPointZ Elements");
19557         else
19558                 _res_constr.data = NULL;
19559         uint64_t* _res_vals = _res->elems;
19560         for (size_t k = 0; k < _res_constr.datalen; k++) {
19561                 uint64_t _res_conv_10 = _res_vals[k];
19562                 LDKOutPoint _res_conv_10_conv;
19563                 _res_conv_10_conv.inner = untag_ptr(_res_conv_10);
19564                 _res_conv_10_conv.is_owned = ptr_is_owned(_res_conv_10);
19565                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_10_conv);
19566                 _res_constr.data[k] = _res_conv_10_conv;
19567         }
19568         FREE(_res);
19569         CVec_OutPointZ_free(_res_constr);
19570 }
19571
19572 void  __attribute__((export_name("TS_PaymentPurpose_free"))) TS_PaymentPurpose_free(uint64_t this_ptr) {
19573         if (!ptr_is_owned(this_ptr)) return;
19574         void* this_ptr_ptr = untag_ptr(this_ptr);
19575         CHECK_ACCESS(this_ptr_ptr);
19576         LDKPaymentPurpose this_ptr_conv = *(LDKPaymentPurpose*)(this_ptr_ptr);
19577         FREE(untag_ptr(this_ptr));
19578         PaymentPurpose_free(this_ptr_conv);
19579 }
19580
19581 static inline uint64_t PaymentPurpose_clone_ptr(LDKPaymentPurpose *NONNULL_PTR arg) {
19582         LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
19583         *ret_copy = PaymentPurpose_clone(arg);
19584         uint64_t ret_ref = tag_ptr(ret_copy, true);
19585         return ret_ref;
19586 }
19587 int64_t  __attribute__((export_name("TS_PaymentPurpose_clone_ptr"))) TS_PaymentPurpose_clone_ptr(uint64_t arg) {
19588         LDKPaymentPurpose* arg_conv = (LDKPaymentPurpose*)untag_ptr(arg);
19589         int64_t ret_conv = PaymentPurpose_clone_ptr(arg_conv);
19590         return ret_conv;
19591 }
19592
19593 uint64_t  __attribute__((export_name("TS_PaymentPurpose_clone"))) TS_PaymentPurpose_clone(uint64_t orig) {
19594         LDKPaymentPurpose* orig_conv = (LDKPaymentPurpose*)untag_ptr(orig);
19595         LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
19596         *ret_copy = PaymentPurpose_clone(orig_conv);
19597         uint64_t ret_ref = tag_ptr(ret_copy, true);
19598         return ret_ref;
19599 }
19600
19601 uint64_t  __attribute__((export_name("TS_PaymentPurpose_invoice_payment"))) TS_PaymentPurpose_invoice_payment(int8_tArray payment_preimage, int8_tArray payment_secret) {
19602         LDKThirtyTwoBytes payment_preimage_ref;
19603         CHECK(payment_preimage->arr_len == 32);
19604         memcpy(payment_preimage_ref.data, payment_preimage->elems, 32); FREE(payment_preimage);
19605         LDKThirtyTwoBytes payment_secret_ref;
19606         CHECK(payment_secret->arr_len == 32);
19607         memcpy(payment_secret_ref.data, payment_secret->elems, 32); FREE(payment_secret);
19608         LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
19609         *ret_copy = PaymentPurpose_invoice_payment(payment_preimage_ref, payment_secret_ref);
19610         uint64_t ret_ref = tag_ptr(ret_copy, true);
19611         return ret_ref;
19612 }
19613
19614 uint64_t  __attribute__((export_name("TS_PaymentPurpose_spontaneous_payment"))) TS_PaymentPurpose_spontaneous_payment(int8_tArray a) {
19615         LDKThirtyTwoBytes a_ref;
19616         CHECK(a->arr_len == 32);
19617         memcpy(a_ref.data, a->elems, 32); FREE(a);
19618         LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
19619         *ret_copy = PaymentPurpose_spontaneous_payment(a_ref);
19620         uint64_t ret_ref = tag_ptr(ret_copy, true);
19621         return ret_ref;
19622 }
19623
19624 int8_tArray  __attribute__((export_name("TS_PaymentPurpose_write"))) TS_PaymentPurpose_write(uint64_t obj) {
19625         LDKPaymentPurpose* obj_conv = (LDKPaymentPurpose*)untag_ptr(obj);
19626         LDKCVec_u8Z ret_var = PaymentPurpose_write(obj_conv);
19627         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
19628         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
19629         CVec_u8Z_free(ret_var);
19630         return ret_arr;
19631 }
19632
19633 uint64_t  __attribute__((export_name("TS_PaymentPurpose_read"))) TS_PaymentPurpose_read(int8_tArray ser) {
19634         LDKu8slice ser_ref;
19635         ser_ref.datalen = ser->arr_len;
19636         ser_ref.data = ser->elems;
19637         LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
19638         *ret_conv = PaymentPurpose_read(ser_ref);
19639         FREE(ser);
19640         return tag_ptr(ret_conv, true);
19641 }
19642
19643 void  __attribute__((export_name("TS_ClosureReason_free"))) TS_ClosureReason_free(uint64_t this_ptr) {
19644         if (!ptr_is_owned(this_ptr)) return;
19645         void* this_ptr_ptr = untag_ptr(this_ptr);
19646         CHECK_ACCESS(this_ptr_ptr);
19647         LDKClosureReason this_ptr_conv = *(LDKClosureReason*)(this_ptr_ptr);
19648         FREE(untag_ptr(this_ptr));
19649         ClosureReason_free(this_ptr_conv);
19650 }
19651
19652 static inline uint64_t ClosureReason_clone_ptr(LDKClosureReason *NONNULL_PTR arg) {
19653         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
19654         *ret_copy = ClosureReason_clone(arg);
19655         uint64_t ret_ref = tag_ptr(ret_copy, true);
19656         return ret_ref;
19657 }
19658 int64_t  __attribute__((export_name("TS_ClosureReason_clone_ptr"))) TS_ClosureReason_clone_ptr(uint64_t arg) {
19659         LDKClosureReason* arg_conv = (LDKClosureReason*)untag_ptr(arg);
19660         int64_t ret_conv = ClosureReason_clone_ptr(arg_conv);
19661         return ret_conv;
19662 }
19663
19664 uint64_t  __attribute__((export_name("TS_ClosureReason_clone"))) TS_ClosureReason_clone(uint64_t orig) {
19665         LDKClosureReason* orig_conv = (LDKClosureReason*)untag_ptr(orig);
19666         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
19667         *ret_copy = ClosureReason_clone(orig_conv);
19668         uint64_t ret_ref = tag_ptr(ret_copy, true);
19669         return ret_ref;
19670 }
19671
19672 uint64_t  __attribute__((export_name("TS_ClosureReason_counterparty_force_closed"))) TS_ClosureReason_counterparty_force_closed(jstring peer_msg) {
19673         LDKStr peer_msg_conv = str_ref_to_owned_c(peer_msg);
19674         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
19675         *ret_copy = ClosureReason_counterparty_force_closed(peer_msg_conv);
19676         uint64_t ret_ref = tag_ptr(ret_copy, true);
19677         return ret_ref;
19678 }
19679
19680 uint64_t  __attribute__((export_name("TS_ClosureReason_holder_force_closed"))) TS_ClosureReason_holder_force_closed() {
19681         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
19682         *ret_copy = ClosureReason_holder_force_closed();
19683         uint64_t ret_ref = tag_ptr(ret_copy, true);
19684         return ret_ref;
19685 }
19686
19687 uint64_t  __attribute__((export_name("TS_ClosureReason_cooperative_closure"))) TS_ClosureReason_cooperative_closure() {
19688         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
19689         *ret_copy = ClosureReason_cooperative_closure();
19690         uint64_t ret_ref = tag_ptr(ret_copy, true);
19691         return ret_ref;
19692 }
19693
19694 uint64_t  __attribute__((export_name("TS_ClosureReason_commitment_tx_confirmed"))) TS_ClosureReason_commitment_tx_confirmed() {
19695         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
19696         *ret_copy = ClosureReason_commitment_tx_confirmed();
19697         uint64_t ret_ref = tag_ptr(ret_copy, true);
19698         return ret_ref;
19699 }
19700
19701 uint64_t  __attribute__((export_name("TS_ClosureReason_funding_timed_out"))) TS_ClosureReason_funding_timed_out() {
19702         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
19703         *ret_copy = ClosureReason_funding_timed_out();
19704         uint64_t ret_ref = tag_ptr(ret_copy, true);
19705         return ret_ref;
19706 }
19707
19708 uint64_t  __attribute__((export_name("TS_ClosureReason_processing_error"))) TS_ClosureReason_processing_error(jstring err) {
19709         LDKStr err_conv = str_ref_to_owned_c(err);
19710         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
19711         *ret_copy = ClosureReason_processing_error(err_conv);
19712         uint64_t ret_ref = tag_ptr(ret_copy, true);
19713         return ret_ref;
19714 }
19715
19716 uint64_t  __attribute__((export_name("TS_ClosureReason_disconnected_peer"))) TS_ClosureReason_disconnected_peer() {
19717         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
19718         *ret_copy = ClosureReason_disconnected_peer();
19719         uint64_t ret_ref = tag_ptr(ret_copy, true);
19720         return ret_ref;
19721 }
19722
19723 uint64_t  __attribute__((export_name("TS_ClosureReason_outdated_channel_manager"))) TS_ClosureReason_outdated_channel_manager() {
19724         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
19725         *ret_copy = ClosureReason_outdated_channel_manager();
19726         uint64_t ret_ref = tag_ptr(ret_copy, true);
19727         return ret_ref;
19728 }
19729
19730 int8_tArray  __attribute__((export_name("TS_ClosureReason_write"))) TS_ClosureReason_write(uint64_t obj) {
19731         LDKClosureReason* obj_conv = (LDKClosureReason*)untag_ptr(obj);
19732         LDKCVec_u8Z ret_var = ClosureReason_write(obj_conv);
19733         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
19734         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
19735         CVec_u8Z_free(ret_var);
19736         return ret_arr;
19737 }
19738
19739 uint64_t  __attribute__((export_name("TS_ClosureReason_read"))) TS_ClosureReason_read(int8_tArray ser) {
19740         LDKu8slice ser_ref;
19741         ser_ref.datalen = ser->arr_len;
19742         ser_ref.data = ser->elems;
19743         LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
19744         *ret_conv = ClosureReason_read(ser_ref);
19745         FREE(ser);
19746         return tag_ptr(ret_conv, true);
19747 }
19748
19749 void  __attribute__((export_name("TS_HTLCDestination_free"))) TS_HTLCDestination_free(uint64_t this_ptr) {
19750         if (!ptr_is_owned(this_ptr)) return;
19751         void* this_ptr_ptr = untag_ptr(this_ptr);
19752         CHECK_ACCESS(this_ptr_ptr);
19753         LDKHTLCDestination this_ptr_conv = *(LDKHTLCDestination*)(this_ptr_ptr);
19754         FREE(untag_ptr(this_ptr));
19755         HTLCDestination_free(this_ptr_conv);
19756 }
19757
19758 static inline uint64_t HTLCDestination_clone_ptr(LDKHTLCDestination *NONNULL_PTR arg) {
19759         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
19760         *ret_copy = HTLCDestination_clone(arg);
19761         uint64_t ret_ref = tag_ptr(ret_copy, true);
19762         return ret_ref;
19763 }
19764 int64_t  __attribute__((export_name("TS_HTLCDestination_clone_ptr"))) TS_HTLCDestination_clone_ptr(uint64_t arg) {
19765         LDKHTLCDestination* arg_conv = (LDKHTLCDestination*)untag_ptr(arg);
19766         int64_t ret_conv = HTLCDestination_clone_ptr(arg_conv);
19767         return ret_conv;
19768 }
19769
19770 uint64_t  __attribute__((export_name("TS_HTLCDestination_clone"))) TS_HTLCDestination_clone(uint64_t orig) {
19771         LDKHTLCDestination* orig_conv = (LDKHTLCDestination*)untag_ptr(orig);
19772         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
19773         *ret_copy = HTLCDestination_clone(orig_conv);
19774         uint64_t ret_ref = tag_ptr(ret_copy, true);
19775         return ret_ref;
19776 }
19777
19778 uint64_t  __attribute__((export_name("TS_HTLCDestination_next_hop_channel"))) TS_HTLCDestination_next_hop_channel(int8_tArray node_id, int8_tArray channel_id) {
19779         LDKPublicKey node_id_ref;
19780         CHECK(node_id->arr_len == 33);
19781         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
19782         LDKThirtyTwoBytes channel_id_ref;
19783         CHECK(channel_id->arr_len == 32);
19784         memcpy(channel_id_ref.data, channel_id->elems, 32); FREE(channel_id);
19785         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
19786         *ret_copy = HTLCDestination_next_hop_channel(node_id_ref, channel_id_ref);
19787         uint64_t ret_ref = tag_ptr(ret_copy, true);
19788         return ret_ref;
19789 }
19790
19791 uint64_t  __attribute__((export_name("TS_HTLCDestination_unknown_next_hop"))) TS_HTLCDestination_unknown_next_hop(int64_t requested_forward_scid) {
19792         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
19793         *ret_copy = HTLCDestination_unknown_next_hop(requested_forward_scid);
19794         uint64_t ret_ref = tag_ptr(ret_copy, true);
19795         return ret_ref;
19796 }
19797
19798 uint64_t  __attribute__((export_name("TS_HTLCDestination_failed_payment"))) TS_HTLCDestination_failed_payment(int8_tArray payment_hash) {
19799         LDKThirtyTwoBytes payment_hash_ref;
19800         CHECK(payment_hash->arr_len == 32);
19801         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
19802         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
19803         *ret_copy = HTLCDestination_failed_payment(payment_hash_ref);
19804         uint64_t ret_ref = tag_ptr(ret_copy, true);
19805         return ret_ref;
19806 }
19807
19808 int8_tArray  __attribute__((export_name("TS_HTLCDestination_write"))) TS_HTLCDestination_write(uint64_t obj) {
19809         LDKHTLCDestination* obj_conv = (LDKHTLCDestination*)untag_ptr(obj);
19810         LDKCVec_u8Z ret_var = HTLCDestination_write(obj_conv);
19811         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
19812         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
19813         CVec_u8Z_free(ret_var);
19814         return ret_arr;
19815 }
19816
19817 uint64_t  __attribute__((export_name("TS_HTLCDestination_read"))) TS_HTLCDestination_read(int8_tArray ser) {
19818         LDKu8slice ser_ref;
19819         ser_ref.datalen = ser->arr_len;
19820         ser_ref.data = ser->elems;
19821         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ), "LDKCResult_COption_HTLCDestinationZDecodeErrorZ");
19822         *ret_conv = HTLCDestination_read(ser_ref);
19823         FREE(ser);
19824         return tag_ptr(ret_conv, true);
19825 }
19826
19827 void  __attribute__((export_name("TS_Event_free"))) TS_Event_free(uint64_t this_ptr) {
19828         if (!ptr_is_owned(this_ptr)) return;
19829         void* this_ptr_ptr = untag_ptr(this_ptr);
19830         CHECK_ACCESS(this_ptr_ptr);
19831         LDKEvent this_ptr_conv = *(LDKEvent*)(this_ptr_ptr);
19832         FREE(untag_ptr(this_ptr));
19833         Event_free(this_ptr_conv);
19834 }
19835
19836 static inline uint64_t Event_clone_ptr(LDKEvent *NONNULL_PTR arg) {
19837         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
19838         *ret_copy = Event_clone(arg);
19839         uint64_t ret_ref = tag_ptr(ret_copy, true);
19840         return ret_ref;
19841 }
19842 int64_t  __attribute__((export_name("TS_Event_clone_ptr"))) TS_Event_clone_ptr(uint64_t arg) {
19843         LDKEvent* arg_conv = (LDKEvent*)untag_ptr(arg);
19844         int64_t ret_conv = Event_clone_ptr(arg_conv);
19845         return ret_conv;
19846 }
19847
19848 uint64_t  __attribute__((export_name("TS_Event_clone"))) TS_Event_clone(uint64_t orig) {
19849         LDKEvent* orig_conv = (LDKEvent*)untag_ptr(orig);
19850         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
19851         *ret_copy = Event_clone(orig_conv);
19852         uint64_t ret_ref = tag_ptr(ret_copy, true);
19853         return ret_ref;
19854 }
19855
19856 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) {
19857         LDKThirtyTwoBytes temporary_channel_id_ref;
19858         CHECK(temporary_channel_id->arr_len == 32);
19859         memcpy(temporary_channel_id_ref.data, temporary_channel_id->elems, 32); FREE(temporary_channel_id);
19860         LDKPublicKey counterparty_node_id_ref;
19861         CHECK(counterparty_node_id->arr_len == 33);
19862         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
19863         LDKCVec_u8Z output_script_ref;
19864         output_script_ref.datalen = output_script->arr_len;
19865         output_script_ref.data = MALLOC(output_script_ref.datalen, "LDKCVec_u8Z Bytes");
19866         memcpy(output_script_ref.data, output_script->elems, output_script_ref.datalen); FREE(output_script);
19867         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
19868         *ret_copy = Event_funding_generation_ready(temporary_channel_id_ref, counterparty_node_id_ref, channel_value_satoshis, output_script_ref, user_channel_id);
19869         uint64_t ret_ref = tag_ptr(ret_copy, true);
19870         return ret_ref;
19871 }
19872
19873 uint64_t  __attribute__((export_name("TS_Event_payment_received"))) TS_Event_payment_received(int8_tArray payment_hash, int64_t amount_msat, uint64_t purpose) {
19874         LDKThirtyTwoBytes payment_hash_ref;
19875         CHECK(payment_hash->arr_len == 32);
19876         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
19877         void* purpose_ptr = untag_ptr(purpose);
19878         CHECK_ACCESS(purpose_ptr);
19879         LDKPaymentPurpose purpose_conv = *(LDKPaymentPurpose*)(purpose_ptr);
19880         purpose_conv = PaymentPurpose_clone((LDKPaymentPurpose*)untag_ptr(purpose));
19881         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
19882         *ret_copy = Event_payment_received(payment_hash_ref, amount_msat, purpose_conv);
19883         uint64_t ret_ref = tag_ptr(ret_copy, true);
19884         return ret_ref;
19885 }
19886
19887 uint64_t  __attribute__((export_name("TS_Event_payment_claimed"))) TS_Event_payment_claimed(int8_tArray payment_hash, int64_t amount_msat, uint64_t purpose) {
19888         LDKThirtyTwoBytes payment_hash_ref;
19889         CHECK(payment_hash->arr_len == 32);
19890         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
19891         void* purpose_ptr = untag_ptr(purpose);
19892         CHECK_ACCESS(purpose_ptr);
19893         LDKPaymentPurpose purpose_conv = *(LDKPaymentPurpose*)(purpose_ptr);
19894         purpose_conv = PaymentPurpose_clone((LDKPaymentPurpose*)untag_ptr(purpose));
19895         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
19896         *ret_copy = Event_payment_claimed(payment_hash_ref, amount_msat, purpose_conv);
19897         uint64_t ret_ref = tag_ptr(ret_copy, true);
19898         return ret_ref;
19899 }
19900
19901 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) {
19902         LDKThirtyTwoBytes payment_id_ref;
19903         CHECK(payment_id->arr_len == 32);
19904         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
19905         LDKThirtyTwoBytes payment_preimage_ref;
19906         CHECK(payment_preimage->arr_len == 32);
19907         memcpy(payment_preimage_ref.data, payment_preimage->elems, 32); FREE(payment_preimage);
19908         LDKThirtyTwoBytes payment_hash_ref;
19909         CHECK(payment_hash->arr_len == 32);
19910         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
19911         void* fee_paid_msat_ptr = untag_ptr(fee_paid_msat);
19912         CHECK_ACCESS(fee_paid_msat_ptr);
19913         LDKCOption_u64Z fee_paid_msat_conv = *(LDKCOption_u64Z*)(fee_paid_msat_ptr);
19914         fee_paid_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(fee_paid_msat));
19915         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
19916         *ret_copy = Event_payment_sent(payment_id_ref, payment_preimage_ref, payment_hash_ref, fee_paid_msat_conv);
19917         uint64_t ret_ref = tag_ptr(ret_copy, true);
19918         return ret_ref;
19919 }
19920
19921 uint64_t  __attribute__((export_name("TS_Event_payment_failed"))) TS_Event_payment_failed(int8_tArray payment_id, int8_tArray payment_hash) {
19922         LDKThirtyTwoBytes payment_id_ref;
19923         CHECK(payment_id->arr_len == 32);
19924         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
19925         LDKThirtyTwoBytes payment_hash_ref;
19926         CHECK(payment_hash->arr_len == 32);
19927         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
19928         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
19929         *ret_copy = Event_payment_failed(payment_id_ref, payment_hash_ref);
19930         uint64_t ret_ref = tag_ptr(ret_copy, true);
19931         return ret_ref;
19932 }
19933
19934 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) {
19935         LDKThirtyTwoBytes payment_id_ref;
19936         CHECK(payment_id->arr_len == 32);
19937         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
19938         LDKThirtyTwoBytes payment_hash_ref;
19939         CHECK(payment_hash->arr_len == 32);
19940         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
19941         LDKCVec_RouteHopZ path_constr;
19942         path_constr.datalen = path->arr_len;
19943         if (path_constr.datalen > 0)
19944                 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
19945         else
19946                 path_constr.data = NULL;
19947         uint64_t* path_vals = path->elems;
19948         for (size_t k = 0; k < path_constr.datalen; k++) {
19949                 uint64_t path_conv_10 = path_vals[k];
19950                 LDKRouteHop path_conv_10_conv;
19951                 path_conv_10_conv.inner = untag_ptr(path_conv_10);
19952                 path_conv_10_conv.is_owned = ptr_is_owned(path_conv_10);
19953                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
19954                 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
19955                 path_constr.data[k] = path_conv_10_conv;
19956         }
19957         FREE(path);
19958         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
19959         *ret_copy = Event_payment_path_successful(payment_id_ref, payment_hash_ref, path_constr);
19960         uint64_t ret_ref = tag_ptr(ret_copy, true);
19961         return ret_ref;
19962 }
19963
19964 uint64_t  __attribute__((export_name("TS_Event_payment_path_failed"))) TS_Event_payment_path_failed(int8_tArray payment_id, int8_tArray payment_hash, jboolean rejected_by_dest, uint64_t network_update, jboolean all_paths_failed, uint64_tArray path, uint64_t short_channel_id, uint64_t retry) {
19965         LDKThirtyTwoBytes payment_id_ref;
19966         CHECK(payment_id->arr_len == 32);
19967         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
19968         LDKThirtyTwoBytes payment_hash_ref;
19969         CHECK(payment_hash->arr_len == 32);
19970         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
19971         void* network_update_ptr = untag_ptr(network_update);
19972         CHECK_ACCESS(network_update_ptr);
19973         LDKCOption_NetworkUpdateZ network_update_conv = *(LDKCOption_NetworkUpdateZ*)(network_update_ptr);
19974         network_update_conv = COption_NetworkUpdateZ_clone((LDKCOption_NetworkUpdateZ*)untag_ptr(network_update));
19975         LDKCVec_RouteHopZ path_constr;
19976         path_constr.datalen = path->arr_len;
19977         if (path_constr.datalen > 0)
19978                 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
19979         else
19980                 path_constr.data = NULL;
19981         uint64_t* path_vals = path->elems;
19982         for (size_t k = 0; k < path_constr.datalen; k++) {
19983                 uint64_t path_conv_10 = path_vals[k];
19984                 LDKRouteHop path_conv_10_conv;
19985                 path_conv_10_conv.inner = untag_ptr(path_conv_10);
19986                 path_conv_10_conv.is_owned = ptr_is_owned(path_conv_10);
19987                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
19988                 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
19989                 path_constr.data[k] = path_conv_10_conv;
19990         }
19991         FREE(path);
19992         void* short_channel_id_ptr = untag_ptr(short_channel_id);
19993         CHECK_ACCESS(short_channel_id_ptr);
19994         LDKCOption_u64Z short_channel_id_conv = *(LDKCOption_u64Z*)(short_channel_id_ptr);
19995         short_channel_id_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(short_channel_id));
19996         LDKRouteParameters retry_conv;
19997         retry_conv.inner = untag_ptr(retry);
19998         retry_conv.is_owned = ptr_is_owned(retry);
19999         CHECK_INNER_FIELD_ACCESS_OR_NULL(retry_conv);
20000         retry_conv = RouteParameters_clone(&retry_conv);
20001         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
20002         *ret_copy = Event_payment_path_failed(payment_id_ref, payment_hash_ref, rejected_by_dest, network_update_conv, all_paths_failed, path_constr, short_channel_id_conv, retry_conv);
20003         uint64_t ret_ref = tag_ptr(ret_copy, true);
20004         return ret_ref;
20005 }
20006
20007 uint64_t  __attribute__((export_name("TS_Event_probe_successful"))) TS_Event_probe_successful(int8_tArray payment_id, int8_tArray payment_hash, uint64_tArray path) {
20008         LDKThirtyTwoBytes payment_id_ref;
20009         CHECK(payment_id->arr_len == 32);
20010         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
20011         LDKThirtyTwoBytes payment_hash_ref;
20012         CHECK(payment_hash->arr_len == 32);
20013         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
20014         LDKCVec_RouteHopZ path_constr;
20015         path_constr.datalen = path->arr_len;
20016         if (path_constr.datalen > 0)
20017                 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
20018         else
20019                 path_constr.data = NULL;
20020         uint64_t* path_vals = path->elems;
20021         for (size_t k = 0; k < path_constr.datalen; k++) {
20022                 uint64_t path_conv_10 = path_vals[k];
20023                 LDKRouteHop path_conv_10_conv;
20024                 path_conv_10_conv.inner = untag_ptr(path_conv_10);
20025                 path_conv_10_conv.is_owned = ptr_is_owned(path_conv_10);
20026                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
20027                 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
20028                 path_constr.data[k] = path_conv_10_conv;
20029         }
20030         FREE(path);
20031         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
20032         *ret_copy = Event_probe_successful(payment_id_ref, payment_hash_ref, path_constr);
20033         uint64_t ret_ref = tag_ptr(ret_copy, true);
20034         return ret_ref;
20035 }
20036
20037 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) {
20038         LDKThirtyTwoBytes payment_id_ref;
20039         CHECK(payment_id->arr_len == 32);
20040         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
20041         LDKThirtyTwoBytes payment_hash_ref;
20042         CHECK(payment_hash->arr_len == 32);
20043         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
20044         LDKCVec_RouteHopZ path_constr;
20045         path_constr.datalen = path->arr_len;
20046         if (path_constr.datalen > 0)
20047                 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
20048         else
20049                 path_constr.data = NULL;
20050         uint64_t* path_vals = path->elems;
20051         for (size_t k = 0; k < path_constr.datalen; k++) {
20052                 uint64_t path_conv_10 = path_vals[k];
20053                 LDKRouteHop path_conv_10_conv;
20054                 path_conv_10_conv.inner = untag_ptr(path_conv_10);
20055                 path_conv_10_conv.is_owned = ptr_is_owned(path_conv_10);
20056                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
20057                 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
20058                 path_constr.data[k] = path_conv_10_conv;
20059         }
20060         FREE(path);
20061         void* short_channel_id_ptr = untag_ptr(short_channel_id);
20062         CHECK_ACCESS(short_channel_id_ptr);
20063         LDKCOption_u64Z short_channel_id_conv = *(LDKCOption_u64Z*)(short_channel_id_ptr);
20064         short_channel_id_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(short_channel_id));
20065         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
20066         *ret_copy = Event_probe_failed(payment_id_ref, payment_hash_ref, path_constr, short_channel_id_conv);
20067         uint64_t ret_ref = tag_ptr(ret_copy, true);
20068         return ret_ref;
20069 }
20070
20071 uint64_t  __attribute__((export_name("TS_Event_pending_htlcs_forwardable"))) TS_Event_pending_htlcs_forwardable(int64_t time_forwardable) {
20072         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
20073         *ret_copy = Event_pending_htlcs_forwardable(time_forwardable);
20074         uint64_t ret_ref = tag_ptr(ret_copy, true);
20075         return ret_ref;
20076 }
20077
20078 uint64_t  __attribute__((export_name("TS_Event_spendable_outputs"))) TS_Event_spendable_outputs(uint64_tArray outputs) {
20079         LDKCVec_SpendableOutputDescriptorZ outputs_constr;
20080         outputs_constr.datalen = outputs->arr_len;
20081         if (outputs_constr.datalen > 0)
20082                 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
20083         else
20084                 outputs_constr.data = NULL;
20085         uint64_t* outputs_vals = outputs->elems;
20086         for (size_t b = 0; b < outputs_constr.datalen; b++) {
20087                 uint64_t outputs_conv_27 = outputs_vals[b];
20088                 void* outputs_conv_27_ptr = untag_ptr(outputs_conv_27);
20089                 CHECK_ACCESS(outputs_conv_27_ptr);
20090                 LDKSpendableOutputDescriptor outputs_conv_27_conv = *(LDKSpendableOutputDescriptor*)(outputs_conv_27_ptr);
20091                 outputs_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(outputs_conv_27));
20092                 outputs_constr.data[b] = outputs_conv_27_conv;
20093         }
20094         FREE(outputs);
20095         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
20096         *ret_copy = Event_spendable_outputs(outputs_constr);
20097         uint64_t ret_ref = tag_ptr(ret_copy, true);
20098         return ret_ref;
20099 }
20100
20101 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) {
20102         LDKThirtyTwoBytes prev_channel_id_ref;
20103         CHECK(prev_channel_id->arr_len == 32);
20104         memcpy(prev_channel_id_ref.data, prev_channel_id->elems, 32); FREE(prev_channel_id);
20105         LDKThirtyTwoBytes next_channel_id_ref;
20106         CHECK(next_channel_id->arr_len == 32);
20107         memcpy(next_channel_id_ref.data, next_channel_id->elems, 32); FREE(next_channel_id);
20108         void* fee_earned_msat_ptr = untag_ptr(fee_earned_msat);
20109         CHECK_ACCESS(fee_earned_msat_ptr);
20110         LDKCOption_u64Z fee_earned_msat_conv = *(LDKCOption_u64Z*)(fee_earned_msat_ptr);
20111         fee_earned_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(fee_earned_msat));
20112         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
20113         *ret_copy = Event_payment_forwarded(prev_channel_id_ref, next_channel_id_ref, fee_earned_msat_conv, claim_from_onchain_tx);
20114         uint64_t ret_ref = tag_ptr(ret_copy, true);
20115         return ret_ref;
20116 }
20117
20118 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) {
20119         LDKThirtyTwoBytes channel_id_ref;
20120         CHECK(channel_id->arr_len == 32);
20121         memcpy(channel_id_ref.data, channel_id->elems, 32); FREE(channel_id);
20122         void* reason_ptr = untag_ptr(reason);
20123         CHECK_ACCESS(reason_ptr);
20124         LDKClosureReason reason_conv = *(LDKClosureReason*)(reason_ptr);
20125         reason_conv = ClosureReason_clone((LDKClosureReason*)untag_ptr(reason));
20126         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
20127         *ret_copy = Event_channel_closed(channel_id_ref, user_channel_id, reason_conv);
20128         uint64_t ret_ref = tag_ptr(ret_copy, true);
20129         return ret_ref;
20130 }
20131
20132 uint64_t  __attribute__((export_name("TS_Event_discard_funding"))) TS_Event_discard_funding(int8_tArray channel_id, int8_tArray transaction) {
20133         LDKThirtyTwoBytes channel_id_ref;
20134         CHECK(channel_id->arr_len == 32);
20135         memcpy(channel_id_ref.data, channel_id->elems, 32); FREE(channel_id);
20136         LDKTransaction transaction_ref;
20137         transaction_ref.datalen = transaction->arr_len;
20138         transaction_ref.data = MALLOC(transaction_ref.datalen, "LDKTransaction Bytes");
20139         memcpy(transaction_ref.data, transaction->elems, transaction_ref.datalen); FREE(transaction);
20140         transaction_ref.data_is_owned = true;
20141         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
20142         *ret_copy = Event_discard_funding(channel_id_ref, transaction_ref);
20143         uint64_t ret_ref = tag_ptr(ret_copy, true);
20144         return ret_ref;
20145 }
20146
20147 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) {
20148         LDKThirtyTwoBytes temporary_channel_id_ref;
20149         CHECK(temporary_channel_id->arr_len == 32);
20150         memcpy(temporary_channel_id_ref.data, temporary_channel_id->elems, 32); FREE(temporary_channel_id);
20151         LDKPublicKey counterparty_node_id_ref;
20152         CHECK(counterparty_node_id->arr_len == 33);
20153         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
20154         LDKChannelTypeFeatures channel_type_conv;
20155         channel_type_conv.inner = untag_ptr(channel_type);
20156         channel_type_conv.is_owned = ptr_is_owned(channel_type);
20157         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_conv);
20158         channel_type_conv = ChannelTypeFeatures_clone(&channel_type_conv);
20159         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
20160         *ret_copy = Event_open_channel_request(temporary_channel_id_ref, counterparty_node_id_ref, funding_satoshis, push_msat, channel_type_conv);
20161         uint64_t ret_ref = tag_ptr(ret_copy, true);
20162         return ret_ref;
20163 }
20164
20165 uint64_t  __attribute__((export_name("TS_Event_htlchandling_failed"))) TS_Event_htlchandling_failed(int8_tArray prev_channel_id, uint64_t failed_next_destination) {
20166         LDKThirtyTwoBytes prev_channel_id_ref;
20167         CHECK(prev_channel_id->arr_len == 32);
20168         memcpy(prev_channel_id_ref.data, prev_channel_id->elems, 32); FREE(prev_channel_id);
20169         void* failed_next_destination_ptr = untag_ptr(failed_next_destination);
20170         CHECK_ACCESS(failed_next_destination_ptr);
20171         LDKHTLCDestination failed_next_destination_conv = *(LDKHTLCDestination*)(failed_next_destination_ptr);
20172         failed_next_destination_conv = HTLCDestination_clone((LDKHTLCDestination*)untag_ptr(failed_next_destination));
20173         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
20174         *ret_copy = Event_htlchandling_failed(prev_channel_id_ref, failed_next_destination_conv);
20175         uint64_t ret_ref = tag_ptr(ret_copy, true);
20176         return ret_ref;
20177 }
20178
20179 int8_tArray  __attribute__((export_name("TS_Event_write"))) TS_Event_write(uint64_t obj) {
20180         LDKEvent* obj_conv = (LDKEvent*)untag_ptr(obj);
20181         LDKCVec_u8Z ret_var = Event_write(obj_conv);
20182         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
20183         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
20184         CVec_u8Z_free(ret_var);
20185         return ret_arr;
20186 }
20187
20188 uint64_t  __attribute__((export_name("TS_Event_read"))) TS_Event_read(int8_tArray ser) {
20189         LDKu8slice ser_ref;
20190         ser_ref.datalen = ser->arr_len;
20191         ser_ref.data = ser->elems;
20192         LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
20193         *ret_conv = Event_read(ser_ref);
20194         FREE(ser);
20195         return tag_ptr(ret_conv, true);
20196 }
20197
20198 void  __attribute__((export_name("TS_MessageSendEvent_free"))) TS_MessageSendEvent_free(uint64_t this_ptr) {
20199         if (!ptr_is_owned(this_ptr)) return;
20200         void* this_ptr_ptr = untag_ptr(this_ptr);
20201         CHECK_ACCESS(this_ptr_ptr);
20202         LDKMessageSendEvent this_ptr_conv = *(LDKMessageSendEvent*)(this_ptr_ptr);
20203         FREE(untag_ptr(this_ptr));
20204         MessageSendEvent_free(this_ptr_conv);
20205 }
20206
20207 static inline uint64_t MessageSendEvent_clone_ptr(LDKMessageSendEvent *NONNULL_PTR arg) {
20208         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
20209         *ret_copy = MessageSendEvent_clone(arg);
20210         uint64_t ret_ref = tag_ptr(ret_copy, true);
20211         return ret_ref;
20212 }
20213 int64_t  __attribute__((export_name("TS_MessageSendEvent_clone_ptr"))) TS_MessageSendEvent_clone_ptr(uint64_t arg) {
20214         LDKMessageSendEvent* arg_conv = (LDKMessageSendEvent*)untag_ptr(arg);
20215         int64_t ret_conv = MessageSendEvent_clone_ptr(arg_conv);
20216         return ret_conv;
20217 }
20218
20219 uint64_t  __attribute__((export_name("TS_MessageSendEvent_clone"))) TS_MessageSendEvent_clone(uint64_t orig) {
20220         LDKMessageSendEvent* orig_conv = (LDKMessageSendEvent*)untag_ptr(orig);
20221         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
20222         *ret_copy = MessageSendEvent_clone(orig_conv);
20223         uint64_t ret_ref = tag_ptr(ret_copy, true);
20224         return ret_ref;
20225 }
20226
20227 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_accept_channel"))) TS_MessageSendEvent_send_accept_channel(int8_tArray node_id, uint64_t msg) {
20228         LDKPublicKey node_id_ref;
20229         CHECK(node_id->arr_len == 33);
20230         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
20231         LDKAcceptChannel msg_conv;
20232         msg_conv.inner = untag_ptr(msg);
20233         msg_conv.is_owned = ptr_is_owned(msg);
20234         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
20235         msg_conv = AcceptChannel_clone(&msg_conv);
20236         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
20237         *ret_copy = MessageSendEvent_send_accept_channel(node_id_ref, msg_conv);
20238         uint64_t ret_ref = tag_ptr(ret_copy, true);
20239         return ret_ref;
20240 }
20241
20242 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_open_channel"))) TS_MessageSendEvent_send_open_channel(int8_tArray node_id, uint64_t msg) {
20243         LDKPublicKey node_id_ref;
20244         CHECK(node_id->arr_len == 33);
20245         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
20246         LDKOpenChannel msg_conv;
20247         msg_conv.inner = untag_ptr(msg);
20248         msg_conv.is_owned = ptr_is_owned(msg);
20249         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
20250         msg_conv = OpenChannel_clone(&msg_conv);
20251         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
20252         *ret_copy = MessageSendEvent_send_open_channel(node_id_ref, msg_conv);
20253         uint64_t ret_ref = tag_ptr(ret_copy, true);
20254         return ret_ref;
20255 }
20256
20257 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_funding_created"))) TS_MessageSendEvent_send_funding_created(int8_tArray node_id, uint64_t msg) {
20258         LDKPublicKey node_id_ref;
20259         CHECK(node_id->arr_len == 33);
20260         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
20261         LDKFundingCreated msg_conv;
20262         msg_conv.inner = untag_ptr(msg);
20263         msg_conv.is_owned = ptr_is_owned(msg);
20264         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
20265         msg_conv = FundingCreated_clone(&msg_conv);
20266         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
20267         *ret_copy = MessageSendEvent_send_funding_created(node_id_ref, msg_conv);
20268         uint64_t ret_ref = tag_ptr(ret_copy, true);
20269         return ret_ref;
20270 }
20271
20272 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_funding_signed"))) TS_MessageSendEvent_send_funding_signed(int8_tArray node_id, uint64_t msg) {
20273         LDKPublicKey node_id_ref;
20274         CHECK(node_id->arr_len == 33);
20275         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
20276         LDKFundingSigned msg_conv;
20277         msg_conv.inner = untag_ptr(msg);
20278         msg_conv.is_owned = ptr_is_owned(msg);
20279         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
20280         msg_conv = FundingSigned_clone(&msg_conv);
20281         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
20282         *ret_copy = MessageSendEvent_send_funding_signed(node_id_ref, msg_conv);
20283         uint64_t ret_ref = tag_ptr(ret_copy, true);
20284         return ret_ref;
20285 }
20286
20287 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_channel_ready"))) TS_MessageSendEvent_send_channel_ready(int8_tArray node_id, uint64_t msg) {
20288         LDKPublicKey node_id_ref;
20289         CHECK(node_id->arr_len == 33);
20290         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
20291         LDKChannelReady msg_conv;
20292         msg_conv.inner = untag_ptr(msg);
20293         msg_conv.is_owned = ptr_is_owned(msg);
20294         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
20295         msg_conv = ChannelReady_clone(&msg_conv);
20296         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
20297         *ret_copy = MessageSendEvent_send_channel_ready(node_id_ref, msg_conv);
20298         uint64_t ret_ref = tag_ptr(ret_copy, true);
20299         return ret_ref;
20300 }
20301
20302 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_announcement_signatures"))) TS_MessageSendEvent_send_announcement_signatures(int8_tArray node_id, uint64_t msg) {
20303         LDKPublicKey node_id_ref;
20304         CHECK(node_id->arr_len == 33);
20305         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
20306         LDKAnnouncementSignatures msg_conv;
20307         msg_conv.inner = untag_ptr(msg);
20308         msg_conv.is_owned = ptr_is_owned(msg);
20309         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
20310         msg_conv = AnnouncementSignatures_clone(&msg_conv);
20311         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
20312         *ret_copy = MessageSendEvent_send_announcement_signatures(node_id_ref, msg_conv);
20313         uint64_t ret_ref = tag_ptr(ret_copy, true);
20314         return ret_ref;
20315 }
20316
20317 uint64_t  __attribute__((export_name("TS_MessageSendEvent_update_htlcs"))) TS_MessageSendEvent_update_htlcs(int8_tArray node_id, uint64_t updates) {
20318         LDKPublicKey node_id_ref;
20319         CHECK(node_id->arr_len == 33);
20320         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
20321         LDKCommitmentUpdate updates_conv;
20322         updates_conv.inner = untag_ptr(updates);
20323         updates_conv.is_owned = ptr_is_owned(updates);
20324         CHECK_INNER_FIELD_ACCESS_OR_NULL(updates_conv);
20325         updates_conv = CommitmentUpdate_clone(&updates_conv);
20326         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
20327         *ret_copy = MessageSendEvent_update_htlcs(node_id_ref, updates_conv);
20328         uint64_t ret_ref = tag_ptr(ret_copy, true);
20329         return ret_ref;
20330 }
20331
20332 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_revoke_and_ack"))) TS_MessageSendEvent_send_revoke_and_ack(int8_tArray node_id, uint64_t msg) {
20333         LDKPublicKey node_id_ref;
20334         CHECK(node_id->arr_len == 33);
20335         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
20336         LDKRevokeAndACK msg_conv;
20337         msg_conv.inner = untag_ptr(msg);
20338         msg_conv.is_owned = ptr_is_owned(msg);
20339         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
20340         msg_conv = RevokeAndACK_clone(&msg_conv);
20341         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
20342         *ret_copy = MessageSendEvent_send_revoke_and_ack(node_id_ref, msg_conv);
20343         uint64_t ret_ref = tag_ptr(ret_copy, true);
20344         return ret_ref;
20345 }
20346
20347 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_closing_signed"))) TS_MessageSendEvent_send_closing_signed(int8_tArray node_id, uint64_t msg) {
20348         LDKPublicKey node_id_ref;
20349         CHECK(node_id->arr_len == 33);
20350         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
20351         LDKClosingSigned msg_conv;
20352         msg_conv.inner = untag_ptr(msg);
20353         msg_conv.is_owned = ptr_is_owned(msg);
20354         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
20355         msg_conv = ClosingSigned_clone(&msg_conv);
20356         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
20357         *ret_copy = MessageSendEvent_send_closing_signed(node_id_ref, msg_conv);
20358         uint64_t ret_ref = tag_ptr(ret_copy, true);
20359         return ret_ref;
20360 }
20361
20362 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_shutdown"))) TS_MessageSendEvent_send_shutdown(int8_tArray node_id, uint64_t msg) {
20363         LDKPublicKey node_id_ref;
20364         CHECK(node_id->arr_len == 33);
20365         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
20366         LDKShutdown msg_conv;
20367         msg_conv.inner = untag_ptr(msg);
20368         msg_conv.is_owned = ptr_is_owned(msg);
20369         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
20370         msg_conv = Shutdown_clone(&msg_conv);
20371         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
20372         *ret_copy = MessageSendEvent_send_shutdown(node_id_ref, msg_conv);
20373         uint64_t ret_ref = tag_ptr(ret_copy, true);
20374         return ret_ref;
20375 }
20376
20377 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_channel_reestablish"))) TS_MessageSendEvent_send_channel_reestablish(int8_tArray node_id, uint64_t msg) {
20378         LDKPublicKey node_id_ref;
20379         CHECK(node_id->arr_len == 33);
20380         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
20381         LDKChannelReestablish msg_conv;
20382         msg_conv.inner = untag_ptr(msg);
20383         msg_conv.is_owned = ptr_is_owned(msg);
20384         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
20385         msg_conv = ChannelReestablish_clone(&msg_conv);
20386         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
20387         *ret_copy = MessageSendEvent_send_channel_reestablish(node_id_ref, msg_conv);
20388         uint64_t ret_ref = tag_ptr(ret_copy, true);
20389         return ret_ref;
20390 }
20391
20392 uint64_t  __attribute__((export_name("TS_MessageSendEvent_broadcast_channel_announcement"))) TS_MessageSendEvent_broadcast_channel_announcement(uint64_t msg, uint64_t update_msg) {
20393         LDKChannelAnnouncement msg_conv;
20394         msg_conv.inner = untag_ptr(msg);
20395         msg_conv.is_owned = ptr_is_owned(msg);
20396         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
20397         msg_conv = ChannelAnnouncement_clone(&msg_conv);
20398         LDKChannelUpdate update_msg_conv;
20399         update_msg_conv.inner = untag_ptr(update_msg);
20400         update_msg_conv.is_owned = ptr_is_owned(update_msg);
20401         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_msg_conv);
20402         update_msg_conv = ChannelUpdate_clone(&update_msg_conv);
20403         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
20404         *ret_copy = MessageSendEvent_broadcast_channel_announcement(msg_conv, update_msg_conv);
20405         uint64_t ret_ref = tag_ptr(ret_copy, true);
20406         return ret_ref;
20407 }
20408
20409 uint64_t  __attribute__((export_name("TS_MessageSendEvent_broadcast_node_announcement"))) TS_MessageSendEvent_broadcast_node_announcement(uint64_t msg) {
20410         LDKNodeAnnouncement msg_conv;
20411         msg_conv.inner = untag_ptr(msg);
20412         msg_conv.is_owned = ptr_is_owned(msg);
20413         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
20414         msg_conv = NodeAnnouncement_clone(&msg_conv);
20415         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
20416         *ret_copy = MessageSendEvent_broadcast_node_announcement(msg_conv);
20417         uint64_t ret_ref = tag_ptr(ret_copy, true);
20418         return ret_ref;
20419 }
20420
20421 uint64_t  __attribute__((export_name("TS_MessageSendEvent_broadcast_channel_update"))) TS_MessageSendEvent_broadcast_channel_update(uint64_t msg) {
20422         LDKChannelUpdate msg_conv;
20423         msg_conv.inner = untag_ptr(msg);
20424         msg_conv.is_owned = ptr_is_owned(msg);
20425         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
20426         msg_conv = ChannelUpdate_clone(&msg_conv);
20427         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
20428         *ret_copy = MessageSendEvent_broadcast_channel_update(msg_conv);
20429         uint64_t ret_ref = tag_ptr(ret_copy, true);
20430         return ret_ref;
20431 }
20432
20433 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_channel_update"))) TS_MessageSendEvent_send_channel_update(int8_tArray node_id, uint64_t msg) {
20434         LDKPublicKey node_id_ref;
20435         CHECK(node_id->arr_len == 33);
20436         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
20437         LDKChannelUpdate msg_conv;
20438         msg_conv.inner = untag_ptr(msg);
20439         msg_conv.is_owned = ptr_is_owned(msg);
20440         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
20441         msg_conv = ChannelUpdate_clone(&msg_conv);
20442         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
20443         *ret_copy = MessageSendEvent_send_channel_update(node_id_ref, msg_conv);
20444         uint64_t ret_ref = tag_ptr(ret_copy, true);
20445         return ret_ref;
20446 }
20447
20448 uint64_t  __attribute__((export_name("TS_MessageSendEvent_handle_error"))) TS_MessageSendEvent_handle_error(int8_tArray node_id, uint64_t action) {
20449         LDKPublicKey node_id_ref;
20450         CHECK(node_id->arr_len == 33);
20451         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
20452         void* action_ptr = untag_ptr(action);
20453         CHECK_ACCESS(action_ptr);
20454         LDKErrorAction action_conv = *(LDKErrorAction*)(action_ptr);
20455         action_conv = ErrorAction_clone((LDKErrorAction*)untag_ptr(action));
20456         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
20457         *ret_copy = MessageSendEvent_handle_error(node_id_ref, action_conv);
20458         uint64_t ret_ref = tag_ptr(ret_copy, true);
20459         return ret_ref;
20460 }
20461
20462 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_channel_range_query"))) TS_MessageSendEvent_send_channel_range_query(int8_tArray node_id, uint64_t msg) {
20463         LDKPublicKey node_id_ref;
20464         CHECK(node_id->arr_len == 33);
20465         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
20466         LDKQueryChannelRange msg_conv;
20467         msg_conv.inner = untag_ptr(msg);
20468         msg_conv.is_owned = ptr_is_owned(msg);
20469         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
20470         msg_conv = QueryChannelRange_clone(&msg_conv);
20471         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
20472         *ret_copy = MessageSendEvent_send_channel_range_query(node_id_ref, msg_conv);
20473         uint64_t ret_ref = tag_ptr(ret_copy, true);
20474         return ret_ref;
20475 }
20476
20477 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_short_ids_query"))) TS_MessageSendEvent_send_short_ids_query(int8_tArray node_id, uint64_t msg) {
20478         LDKPublicKey node_id_ref;
20479         CHECK(node_id->arr_len == 33);
20480         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
20481         LDKQueryShortChannelIds msg_conv;
20482         msg_conv.inner = untag_ptr(msg);
20483         msg_conv.is_owned = ptr_is_owned(msg);
20484         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
20485         msg_conv = QueryShortChannelIds_clone(&msg_conv);
20486         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
20487         *ret_copy = MessageSendEvent_send_short_ids_query(node_id_ref, msg_conv);
20488         uint64_t ret_ref = tag_ptr(ret_copy, true);
20489         return ret_ref;
20490 }
20491
20492 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_reply_channel_range"))) TS_MessageSendEvent_send_reply_channel_range(int8_tArray node_id, uint64_t msg) {
20493         LDKPublicKey node_id_ref;
20494         CHECK(node_id->arr_len == 33);
20495         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
20496         LDKReplyChannelRange msg_conv;
20497         msg_conv.inner = untag_ptr(msg);
20498         msg_conv.is_owned = ptr_is_owned(msg);
20499         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
20500         msg_conv = ReplyChannelRange_clone(&msg_conv);
20501         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
20502         *ret_copy = MessageSendEvent_send_reply_channel_range(node_id_ref, msg_conv);
20503         uint64_t ret_ref = tag_ptr(ret_copy, true);
20504         return ret_ref;
20505 }
20506
20507 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_gossip_timestamp_filter"))) TS_MessageSendEvent_send_gossip_timestamp_filter(int8_tArray node_id, uint64_t msg) {
20508         LDKPublicKey node_id_ref;
20509         CHECK(node_id->arr_len == 33);
20510         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
20511         LDKGossipTimestampFilter msg_conv;
20512         msg_conv.inner = untag_ptr(msg);
20513         msg_conv.is_owned = ptr_is_owned(msg);
20514         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
20515         msg_conv = GossipTimestampFilter_clone(&msg_conv);
20516         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
20517         *ret_copy = MessageSendEvent_send_gossip_timestamp_filter(node_id_ref, msg_conv);
20518         uint64_t ret_ref = tag_ptr(ret_copy, true);
20519         return ret_ref;
20520 }
20521
20522 void  __attribute__((export_name("TS_MessageSendEventsProvider_free"))) TS_MessageSendEventsProvider_free(uint64_t this_ptr) {
20523         if (!ptr_is_owned(this_ptr)) return;
20524         void* this_ptr_ptr = untag_ptr(this_ptr);
20525         CHECK_ACCESS(this_ptr_ptr);
20526         LDKMessageSendEventsProvider this_ptr_conv = *(LDKMessageSendEventsProvider*)(this_ptr_ptr);
20527         FREE(untag_ptr(this_ptr));
20528         MessageSendEventsProvider_free(this_ptr_conv);
20529 }
20530
20531 void  __attribute__((export_name("TS_EventsProvider_free"))) TS_EventsProvider_free(uint64_t this_ptr) {
20532         if (!ptr_is_owned(this_ptr)) return;
20533         void* this_ptr_ptr = untag_ptr(this_ptr);
20534         CHECK_ACCESS(this_ptr_ptr);
20535         LDKEventsProvider this_ptr_conv = *(LDKEventsProvider*)(this_ptr_ptr);
20536         FREE(untag_ptr(this_ptr));
20537         EventsProvider_free(this_ptr_conv);
20538 }
20539
20540 void  __attribute__((export_name("TS_EventHandler_free"))) TS_EventHandler_free(uint64_t this_ptr) {
20541         if (!ptr_is_owned(this_ptr)) return;
20542         void* this_ptr_ptr = untag_ptr(this_ptr);
20543         CHECK_ACCESS(this_ptr_ptr);
20544         LDKEventHandler this_ptr_conv = *(LDKEventHandler*)(this_ptr_ptr);
20545         FREE(untag_ptr(this_ptr));
20546         EventHandler_free(this_ptr_conv);
20547 }
20548
20549 void  __attribute__((export_name("TS_APIError_free"))) TS_APIError_free(uint64_t this_ptr) {
20550         if (!ptr_is_owned(this_ptr)) return;
20551         void* this_ptr_ptr = untag_ptr(this_ptr);
20552         CHECK_ACCESS(this_ptr_ptr);
20553         LDKAPIError this_ptr_conv = *(LDKAPIError*)(this_ptr_ptr);
20554         FREE(untag_ptr(this_ptr));
20555         APIError_free(this_ptr_conv);
20556 }
20557
20558 static inline uint64_t APIError_clone_ptr(LDKAPIError *NONNULL_PTR arg) {
20559         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
20560         *ret_copy = APIError_clone(arg);
20561         uint64_t ret_ref = tag_ptr(ret_copy, true);
20562         return ret_ref;
20563 }
20564 int64_t  __attribute__((export_name("TS_APIError_clone_ptr"))) TS_APIError_clone_ptr(uint64_t arg) {
20565         LDKAPIError* arg_conv = (LDKAPIError*)untag_ptr(arg);
20566         int64_t ret_conv = APIError_clone_ptr(arg_conv);
20567         return ret_conv;
20568 }
20569
20570 uint64_t  __attribute__((export_name("TS_APIError_clone"))) TS_APIError_clone(uint64_t orig) {
20571         LDKAPIError* orig_conv = (LDKAPIError*)untag_ptr(orig);
20572         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
20573         *ret_copy = APIError_clone(orig_conv);
20574         uint64_t ret_ref = tag_ptr(ret_copy, true);
20575         return ret_ref;
20576 }
20577
20578 uint64_t  __attribute__((export_name("TS_APIError_apimisuse_error"))) TS_APIError_apimisuse_error(jstring err) {
20579         LDKStr err_conv = str_ref_to_owned_c(err);
20580         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
20581         *ret_copy = APIError_apimisuse_error(err_conv);
20582         uint64_t ret_ref = tag_ptr(ret_copy, true);
20583         return ret_ref;
20584 }
20585
20586 uint64_t  __attribute__((export_name("TS_APIError_fee_rate_too_high"))) TS_APIError_fee_rate_too_high(jstring err, int32_t feerate) {
20587         LDKStr err_conv = str_ref_to_owned_c(err);
20588         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
20589         *ret_copy = APIError_fee_rate_too_high(err_conv, feerate);
20590         uint64_t ret_ref = tag_ptr(ret_copy, true);
20591         return ret_ref;
20592 }
20593
20594 uint64_t  __attribute__((export_name("TS_APIError_route_error"))) TS_APIError_route_error(jstring err) {
20595         LDKStr err_conv = str_ref_to_owned_c(err);
20596         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
20597         *ret_copy = APIError_route_error(err_conv);
20598         uint64_t ret_ref = tag_ptr(ret_copy, true);
20599         return ret_ref;
20600 }
20601
20602 uint64_t  __attribute__((export_name("TS_APIError_channel_unavailable"))) TS_APIError_channel_unavailable(jstring err) {
20603         LDKStr err_conv = str_ref_to_owned_c(err);
20604         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
20605         *ret_copy = APIError_channel_unavailable(err_conv);
20606         uint64_t ret_ref = tag_ptr(ret_copy, true);
20607         return ret_ref;
20608 }
20609
20610 uint64_t  __attribute__((export_name("TS_APIError_monitor_update_failed"))) TS_APIError_monitor_update_failed() {
20611         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
20612         *ret_copy = APIError_monitor_update_failed();
20613         uint64_t ret_ref = tag_ptr(ret_copy, true);
20614         return ret_ref;
20615 }
20616
20617 uint64_t  __attribute__((export_name("TS_APIError_incompatible_shutdown_script"))) TS_APIError_incompatible_shutdown_script(uint64_t script) {
20618         LDKShutdownScript script_conv;
20619         script_conv.inner = untag_ptr(script);
20620         script_conv.is_owned = ptr_is_owned(script);
20621         CHECK_INNER_FIELD_ACCESS_OR_NULL(script_conv);
20622         script_conv = ShutdownScript_clone(&script_conv);
20623         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
20624         *ret_copy = APIError_incompatible_shutdown_script(script_conv);
20625         uint64_t ret_ref = tag_ptr(ret_copy, true);
20626         return ret_ref;
20627 }
20628
20629 void  __attribute__((export_name("TS_BigSize_free"))) TS_BigSize_free(uint64_t this_obj) {
20630         LDKBigSize this_obj_conv;
20631         this_obj_conv.inner = untag_ptr(this_obj);
20632         this_obj_conv.is_owned = ptr_is_owned(this_obj);
20633         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
20634         BigSize_free(this_obj_conv);
20635 }
20636
20637 int64_t  __attribute__((export_name("TS_BigSize_get_a"))) TS_BigSize_get_a(uint64_t this_ptr) {
20638         LDKBigSize this_ptr_conv;
20639         this_ptr_conv.inner = untag_ptr(this_ptr);
20640         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
20641         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20642         this_ptr_conv.is_owned = false;
20643         int64_t ret_conv = BigSize_get_a(&this_ptr_conv);
20644         return ret_conv;
20645 }
20646
20647 void  __attribute__((export_name("TS_BigSize_set_a"))) TS_BigSize_set_a(uint64_t this_ptr, int64_t val) {
20648         LDKBigSize this_ptr_conv;
20649         this_ptr_conv.inner = untag_ptr(this_ptr);
20650         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
20651         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20652         this_ptr_conv.is_owned = false;
20653         BigSize_set_a(&this_ptr_conv, val);
20654 }
20655
20656 uint64_t  __attribute__((export_name("TS_BigSize_new"))) TS_BigSize_new(int64_t a_arg) {
20657         LDKBigSize ret_var = BigSize_new(a_arg);
20658         uint64_t ret_ref = 0;
20659         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
20660         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
20661         return ret_ref;
20662 }
20663
20664 void  __attribute__((export_name("TS_Hostname_free"))) TS_Hostname_free(uint64_t this_obj) {
20665         LDKHostname this_obj_conv;
20666         this_obj_conv.inner = untag_ptr(this_obj);
20667         this_obj_conv.is_owned = ptr_is_owned(this_obj);
20668         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
20669         Hostname_free(this_obj_conv);
20670 }
20671
20672 static inline uint64_t Hostname_clone_ptr(LDKHostname *NONNULL_PTR arg) {
20673         LDKHostname ret_var = Hostname_clone(arg);
20674         uint64_t ret_ref = 0;
20675         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
20676         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
20677         return ret_ref;
20678 }
20679 int64_t  __attribute__((export_name("TS_Hostname_clone_ptr"))) TS_Hostname_clone_ptr(uint64_t arg) {
20680         LDKHostname arg_conv;
20681         arg_conv.inner = untag_ptr(arg);
20682         arg_conv.is_owned = ptr_is_owned(arg);
20683         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
20684         arg_conv.is_owned = false;
20685         int64_t ret_conv = Hostname_clone_ptr(&arg_conv);
20686         return ret_conv;
20687 }
20688
20689 uint64_t  __attribute__((export_name("TS_Hostname_clone"))) TS_Hostname_clone(uint64_t orig) {
20690         LDKHostname orig_conv;
20691         orig_conv.inner = untag_ptr(orig);
20692         orig_conv.is_owned = ptr_is_owned(orig);
20693         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
20694         orig_conv.is_owned = false;
20695         LDKHostname ret_var = Hostname_clone(&orig_conv);
20696         uint64_t ret_ref = 0;
20697         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
20698         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
20699         return ret_ref;
20700 }
20701
20702 int8_t  __attribute__((export_name("TS_Hostname_len"))) TS_Hostname_len(uint64_t this_arg) {
20703         LDKHostname this_arg_conv;
20704         this_arg_conv.inner = untag_ptr(this_arg);
20705         this_arg_conv.is_owned = ptr_is_owned(this_arg);
20706         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
20707         this_arg_conv.is_owned = false;
20708         int8_t ret_conv = Hostname_len(&this_arg_conv);
20709         return ret_conv;
20710 }
20711
20712 uint64_t  __attribute__((export_name("TS_sign"))) TS_sign(int8_tArray msg, int8_tArray sk) {
20713         LDKu8slice msg_ref;
20714         msg_ref.datalen = msg->arr_len;
20715         msg_ref.data = msg->elems;
20716         unsigned char sk_arr[32];
20717         CHECK(sk->arr_len == 32);
20718         memcpy(sk_arr, sk->elems, 32); FREE(sk);
20719         unsigned char (*sk_ref)[32] = &sk_arr;
20720         LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
20721         *ret_conv = sign(msg_ref, sk_ref);
20722         FREE(msg);
20723         return tag_ptr(ret_conv, true);
20724 }
20725
20726 uint64_t  __attribute__((export_name("TS_recover_pk"))) TS_recover_pk(int8_tArray msg, jstring sig) {
20727         LDKu8slice msg_ref;
20728         msg_ref.datalen = msg->arr_len;
20729         msg_ref.data = msg->elems;
20730         LDKStr sig_conv = str_ref_to_owned_c(sig);
20731         LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
20732         *ret_conv = recover_pk(msg_ref, sig_conv);
20733         FREE(msg);
20734         return tag_ptr(ret_conv, true);
20735 }
20736
20737 jboolean  __attribute__((export_name("TS_verify"))) TS_verify(int8_tArray msg, jstring sig, int8_tArray pk) {
20738         LDKu8slice msg_ref;
20739         msg_ref.datalen = msg->arr_len;
20740         msg_ref.data = msg->elems;
20741         LDKStr sig_conv = str_ref_to_owned_c(sig);
20742         LDKPublicKey pk_ref;
20743         CHECK(pk->arr_len == 33);
20744         memcpy(pk_ref.compressed_form, pk->elems, 33); FREE(pk);
20745         jboolean ret_conv = verify(msg_ref, sig_conv, pk_ref);
20746         FREE(msg);
20747         return ret_conv;
20748 }
20749
20750 int8_tArray  __attribute__((export_name("TS_construct_invoice_preimage"))) TS_construct_invoice_preimage(int8_tArray hrp_bytes, ptrArray data_without_signature) {
20751         LDKu8slice hrp_bytes_ref;
20752         hrp_bytes_ref.datalen = hrp_bytes->arr_len;
20753         hrp_bytes_ref.data = hrp_bytes->elems;
20754         LDKCVec_u5Z data_without_signature_constr;
20755         data_without_signature_constr.datalen = data_without_signature->arr_len;
20756         if (data_without_signature_constr.datalen > 0)
20757                 data_without_signature_constr.data = MALLOC(data_without_signature_constr.datalen * sizeof(LDKu5), "LDKCVec_u5Z Elements");
20758         else
20759                 data_without_signature_constr.data = NULL;
20760         int8_t* data_without_signature_vals = (void*) data_without_signature->elems;
20761         for (size_t h = 0; h < data_without_signature_constr.datalen; h++) {
20762                 int8_t data_without_signature_conv_7 = data_without_signature_vals[h];
20763                 
20764                 data_without_signature_constr.data[h] = (LDKu5){ ._0 = data_without_signature_conv_7 };
20765         }
20766         FREE(data_without_signature);
20767         LDKCVec_u8Z ret_var = construct_invoice_preimage(hrp_bytes_ref, data_without_signature_constr);
20768         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
20769         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
20770         CVec_u8Z_free(ret_var);
20771         FREE(hrp_bytes);
20772         return ret_arr;
20773 }
20774
20775 void  __attribute__((export_name("TS_Persister_free"))) TS_Persister_free(uint64_t this_ptr) {
20776         if (!ptr_is_owned(this_ptr)) return;
20777         void* this_ptr_ptr = untag_ptr(this_ptr);
20778         CHECK_ACCESS(this_ptr_ptr);
20779         LDKPersister this_ptr_conv = *(LDKPersister*)(this_ptr_ptr);
20780         FREE(untag_ptr(this_ptr));
20781         Persister_free(this_ptr_conv);
20782 }
20783
20784 uint32_t  __attribute__((export_name("TS_Level_clone"))) TS_Level_clone(uint64_t orig) {
20785         LDKLevel* orig_conv = (LDKLevel*)untag_ptr(orig);
20786         uint32_t ret_conv = LDKLevel_to_js(Level_clone(orig_conv));
20787         return ret_conv;
20788 }
20789
20790 uint32_t  __attribute__((export_name("TS_Level_gossip"))) TS_Level_gossip() {
20791         uint32_t ret_conv = LDKLevel_to_js(Level_gossip());
20792         return ret_conv;
20793 }
20794
20795 uint32_t  __attribute__((export_name("TS_Level_trace"))) TS_Level_trace() {
20796         uint32_t ret_conv = LDKLevel_to_js(Level_trace());
20797         return ret_conv;
20798 }
20799
20800 uint32_t  __attribute__((export_name("TS_Level_debug"))) TS_Level_debug() {
20801         uint32_t ret_conv = LDKLevel_to_js(Level_debug());
20802         return ret_conv;
20803 }
20804
20805 uint32_t  __attribute__((export_name("TS_Level_info"))) TS_Level_info() {
20806         uint32_t ret_conv = LDKLevel_to_js(Level_info());
20807         return ret_conv;
20808 }
20809
20810 uint32_t  __attribute__((export_name("TS_Level_warn"))) TS_Level_warn() {
20811         uint32_t ret_conv = LDKLevel_to_js(Level_warn());
20812         return ret_conv;
20813 }
20814
20815 uint32_t  __attribute__((export_name("TS_Level_error"))) TS_Level_error() {
20816         uint32_t ret_conv = LDKLevel_to_js(Level_error());
20817         return ret_conv;
20818 }
20819
20820 jboolean  __attribute__((export_name("TS_Level_eq"))) TS_Level_eq(uint64_t a, uint64_t b) {
20821         LDKLevel* a_conv = (LDKLevel*)untag_ptr(a);
20822         LDKLevel* b_conv = (LDKLevel*)untag_ptr(b);
20823         jboolean ret_conv = Level_eq(a_conv, b_conv);
20824         return ret_conv;
20825 }
20826
20827 int64_t  __attribute__((export_name("TS_Level_hash"))) TS_Level_hash(uint64_t o) {
20828         LDKLevel* o_conv = (LDKLevel*)untag_ptr(o);
20829         int64_t ret_conv = Level_hash(o_conv);
20830         return ret_conv;
20831 }
20832
20833 uint32_t  __attribute__((export_name("TS_Level_max"))) TS_Level_max() {
20834         uint32_t ret_conv = LDKLevel_to_js(Level_max());
20835         return ret_conv;
20836 }
20837
20838 void  __attribute__((export_name("TS_Record_free"))) TS_Record_free(uint64_t this_obj) {
20839         LDKRecord this_obj_conv;
20840         this_obj_conv.inner = untag_ptr(this_obj);
20841         this_obj_conv.is_owned = ptr_is_owned(this_obj);
20842         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
20843         Record_free(this_obj_conv);
20844 }
20845
20846 uint32_t  __attribute__((export_name("TS_Record_get_level"))) TS_Record_get_level(uint64_t this_ptr) {
20847         LDKRecord this_ptr_conv;
20848         this_ptr_conv.inner = untag_ptr(this_ptr);
20849         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
20850         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20851         this_ptr_conv.is_owned = false;
20852         uint32_t ret_conv = LDKLevel_to_js(Record_get_level(&this_ptr_conv));
20853         return ret_conv;
20854 }
20855
20856 void  __attribute__((export_name("TS_Record_set_level"))) TS_Record_set_level(uint64_t this_ptr, uint32_t val) {
20857         LDKRecord this_ptr_conv;
20858         this_ptr_conv.inner = untag_ptr(this_ptr);
20859         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
20860         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20861         this_ptr_conv.is_owned = false;
20862         LDKLevel val_conv = LDKLevel_from_js(val);
20863         Record_set_level(&this_ptr_conv, val_conv);
20864 }
20865
20866 jstring  __attribute__((export_name("TS_Record_get_args"))) TS_Record_get_args(uint64_t this_ptr) {
20867         LDKRecord this_ptr_conv;
20868         this_ptr_conv.inner = untag_ptr(this_ptr);
20869         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
20870         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20871         this_ptr_conv.is_owned = false;
20872         LDKStr ret_str = Record_get_args(&this_ptr_conv);
20873         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
20874         Str_free(ret_str);
20875         return ret_conv;
20876 }
20877
20878 void  __attribute__((export_name("TS_Record_set_args"))) TS_Record_set_args(uint64_t this_ptr, jstring val) {
20879         LDKRecord this_ptr_conv;
20880         this_ptr_conv.inner = untag_ptr(this_ptr);
20881         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
20882         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20883         this_ptr_conv.is_owned = false;
20884         LDKStr val_conv = str_ref_to_owned_c(val);
20885         Record_set_args(&this_ptr_conv, val_conv);
20886 }
20887
20888 jstring  __attribute__((export_name("TS_Record_get_module_path"))) TS_Record_get_module_path(uint64_t this_ptr) {
20889         LDKRecord this_ptr_conv;
20890         this_ptr_conv.inner = untag_ptr(this_ptr);
20891         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
20892         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20893         this_ptr_conv.is_owned = false;
20894         LDKStr ret_str = Record_get_module_path(&this_ptr_conv);
20895         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
20896         Str_free(ret_str);
20897         return ret_conv;
20898 }
20899
20900 void  __attribute__((export_name("TS_Record_set_module_path"))) TS_Record_set_module_path(uint64_t this_ptr, jstring val) {
20901         LDKRecord this_ptr_conv;
20902         this_ptr_conv.inner = untag_ptr(this_ptr);
20903         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
20904         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20905         this_ptr_conv.is_owned = false;
20906         LDKStr val_conv = str_ref_to_owned_c(val);
20907         Record_set_module_path(&this_ptr_conv, val_conv);
20908 }
20909
20910 jstring  __attribute__((export_name("TS_Record_get_file"))) TS_Record_get_file(uint64_t this_ptr) {
20911         LDKRecord this_ptr_conv;
20912         this_ptr_conv.inner = untag_ptr(this_ptr);
20913         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
20914         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20915         this_ptr_conv.is_owned = false;
20916         LDKStr ret_str = Record_get_file(&this_ptr_conv);
20917         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
20918         Str_free(ret_str);
20919         return ret_conv;
20920 }
20921
20922 void  __attribute__((export_name("TS_Record_set_file"))) TS_Record_set_file(uint64_t this_ptr, jstring val) {
20923         LDKRecord this_ptr_conv;
20924         this_ptr_conv.inner = untag_ptr(this_ptr);
20925         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
20926         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20927         this_ptr_conv.is_owned = false;
20928         LDKStr val_conv = str_ref_to_owned_c(val);
20929         Record_set_file(&this_ptr_conv, val_conv);
20930 }
20931
20932 int32_t  __attribute__((export_name("TS_Record_get_line"))) TS_Record_get_line(uint64_t this_ptr) {
20933         LDKRecord this_ptr_conv;
20934         this_ptr_conv.inner = untag_ptr(this_ptr);
20935         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
20936         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20937         this_ptr_conv.is_owned = false;
20938         int32_t ret_conv = Record_get_line(&this_ptr_conv);
20939         return ret_conv;
20940 }
20941
20942 void  __attribute__((export_name("TS_Record_set_line"))) TS_Record_set_line(uint64_t this_ptr, int32_t val) {
20943         LDKRecord this_ptr_conv;
20944         this_ptr_conv.inner = untag_ptr(this_ptr);
20945         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
20946         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20947         this_ptr_conv.is_owned = false;
20948         Record_set_line(&this_ptr_conv, val);
20949 }
20950
20951 static inline uint64_t Record_clone_ptr(LDKRecord *NONNULL_PTR arg) {
20952         LDKRecord ret_var = Record_clone(arg);
20953         uint64_t ret_ref = 0;
20954         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
20955         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
20956         return ret_ref;
20957 }
20958 int64_t  __attribute__((export_name("TS_Record_clone_ptr"))) TS_Record_clone_ptr(uint64_t arg) {
20959         LDKRecord arg_conv;
20960         arg_conv.inner = untag_ptr(arg);
20961         arg_conv.is_owned = ptr_is_owned(arg);
20962         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
20963         arg_conv.is_owned = false;
20964         int64_t ret_conv = Record_clone_ptr(&arg_conv);
20965         return ret_conv;
20966 }
20967
20968 uint64_t  __attribute__((export_name("TS_Record_clone"))) TS_Record_clone(uint64_t orig) {
20969         LDKRecord orig_conv;
20970         orig_conv.inner = untag_ptr(orig);
20971         orig_conv.is_owned = ptr_is_owned(orig);
20972         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
20973         orig_conv.is_owned = false;
20974         LDKRecord ret_var = Record_clone(&orig_conv);
20975         uint64_t ret_ref = 0;
20976         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
20977         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
20978         return ret_ref;
20979 }
20980
20981 void  __attribute__((export_name("TS_Logger_free"))) TS_Logger_free(uint64_t this_ptr) {
20982         if (!ptr_is_owned(this_ptr)) return;
20983         void* this_ptr_ptr = untag_ptr(this_ptr);
20984         CHECK_ACCESS(this_ptr_ptr);
20985         LDKLogger this_ptr_conv = *(LDKLogger*)(this_ptr_ptr);
20986         FREE(untag_ptr(this_ptr));
20987         Logger_free(this_ptr_conv);
20988 }
20989
20990 void  __attribute__((export_name("TS_ChannelHandshakeConfig_free"))) TS_ChannelHandshakeConfig_free(uint64_t this_obj) {
20991         LDKChannelHandshakeConfig this_obj_conv;
20992         this_obj_conv.inner = untag_ptr(this_obj);
20993         this_obj_conv.is_owned = ptr_is_owned(this_obj);
20994         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
20995         ChannelHandshakeConfig_free(this_obj_conv);
20996 }
20997
20998 int32_t  __attribute__((export_name("TS_ChannelHandshakeConfig_get_minimum_depth"))) TS_ChannelHandshakeConfig_get_minimum_depth(uint64_t this_ptr) {
20999         LDKChannelHandshakeConfig this_ptr_conv;
21000         this_ptr_conv.inner = untag_ptr(this_ptr);
21001         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
21002         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21003         this_ptr_conv.is_owned = false;
21004         int32_t ret_conv = ChannelHandshakeConfig_get_minimum_depth(&this_ptr_conv);
21005         return ret_conv;
21006 }
21007
21008 void  __attribute__((export_name("TS_ChannelHandshakeConfig_set_minimum_depth"))) TS_ChannelHandshakeConfig_set_minimum_depth(uint64_t this_ptr, int32_t val) {
21009         LDKChannelHandshakeConfig this_ptr_conv;
21010         this_ptr_conv.inner = untag_ptr(this_ptr);
21011         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
21012         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21013         this_ptr_conv.is_owned = false;
21014         ChannelHandshakeConfig_set_minimum_depth(&this_ptr_conv, val);
21015 }
21016
21017 int16_t  __attribute__((export_name("TS_ChannelHandshakeConfig_get_our_to_self_delay"))) TS_ChannelHandshakeConfig_get_our_to_self_delay(uint64_t this_ptr) {
21018         LDKChannelHandshakeConfig this_ptr_conv;
21019         this_ptr_conv.inner = untag_ptr(this_ptr);
21020         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
21021         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21022         this_ptr_conv.is_owned = false;
21023         int16_t ret_conv = ChannelHandshakeConfig_get_our_to_self_delay(&this_ptr_conv);
21024         return ret_conv;
21025 }
21026
21027 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) {
21028         LDKChannelHandshakeConfig this_ptr_conv;
21029         this_ptr_conv.inner = untag_ptr(this_ptr);
21030         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
21031         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21032         this_ptr_conv.is_owned = false;
21033         ChannelHandshakeConfig_set_our_to_self_delay(&this_ptr_conv, val);
21034 }
21035
21036 int64_t  __attribute__((export_name("TS_ChannelHandshakeConfig_get_our_htlc_minimum_msat"))) TS_ChannelHandshakeConfig_get_our_htlc_minimum_msat(uint64_t this_ptr) {
21037         LDKChannelHandshakeConfig this_ptr_conv;
21038         this_ptr_conv.inner = untag_ptr(this_ptr);
21039         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
21040         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21041         this_ptr_conv.is_owned = false;
21042         int64_t ret_conv = ChannelHandshakeConfig_get_our_htlc_minimum_msat(&this_ptr_conv);
21043         return ret_conv;
21044 }
21045
21046 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) {
21047         LDKChannelHandshakeConfig this_ptr_conv;
21048         this_ptr_conv.inner = untag_ptr(this_ptr);
21049         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
21050         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21051         this_ptr_conv.is_owned = false;
21052         ChannelHandshakeConfig_set_our_htlc_minimum_msat(&this_ptr_conv, val);
21053 }
21054
21055 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) {
21056         LDKChannelHandshakeConfig this_ptr_conv;
21057         this_ptr_conv.inner = untag_ptr(this_ptr);
21058         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
21059         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21060         this_ptr_conv.is_owned = false;
21061         int8_t ret_conv = ChannelHandshakeConfig_get_max_inbound_htlc_value_in_flight_percent_of_channel(&this_ptr_conv);
21062         return ret_conv;
21063 }
21064
21065 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) {
21066         LDKChannelHandshakeConfig this_ptr_conv;
21067         this_ptr_conv.inner = untag_ptr(this_ptr);
21068         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
21069         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21070         this_ptr_conv.is_owned = false;
21071         ChannelHandshakeConfig_set_max_inbound_htlc_value_in_flight_percent_of_channel(&this_ptr_conv, val);
21072 }
21073
21074 jboolean  __attribute__((export_name("TS_ChannelHandshakeConfig_get_negotiate_scid_privacy"))) TS_ChannelHandshakeConfig_get_negotiate_scid_privacy(uint64_t this_ptr) {
21075         LDKChannelHandshakeConfig this_ptr_conv;
21076         this_ptr_conv.inner = untag_ptr(this_ptr);
21077         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
21078         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21079         this_ptr_conv.is_owned = false;
21080         jboolean ret_conv = ChannelHandshakeConfig_get_negotiate_scid_privacy(&this_ptr_conv);
21081         return ret_conv;
21082 }
21083
21084 void  __attribute__((export_name("TS_ChannelHandshakeConfig_set_negotiate_scid_privacy"))) TS_ChannelHandshakeConfig_set_negotiate_scid_privacy(uint64_t this_ptr, jboolean val) {
21085         LDKChannelHandshakeConfig this_ptr_conv;
21086         this_ptr_conv.inner = untag_ptr(this_ptr);
21087         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
21088         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21089         this_ptr_conv.is_owned = false;
21090         ChannelHandshakeConfig_set_negotiate_scid_privacy(&this_ptr_conv, val);
21091 }
21092
21093 jboolean  __attribute__((export_name("TS_ChannelHandshakeConfig_get_announced_channel"))) TS_ChannelHandshakeConfig_get_announced_channel(uint64_t this_ptr) {
21094         LDKChannelHandshakeConfig this_ptr_conv;
21095         this_ptr_conv.inner = untag_ptr(this_ptr);
21096         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
21097         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21098         this_ptr_conv.is_owned = false;
21099         jboolean ret_conv = ChannelHandshakeConfig_get_announced_channel(&this_ptr_conv);
21100         return ret_conv;
21101 }
21102
21103 void  __attribute__((export_name("TS_ChannelHandshakeConfig_set_announced_channel"))) TS_ChannelHandshakeConfig_set_announced_channel(uint64_t this_ptr, jboolean val) {
21104         LDKChannelHandshakeConfig this_ptr_conv;
21105         this_ptr_conv.inner = untag_ptr(this_ptr);
21106         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
21107         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21108         this_ptr_conv.is_owned = false;
21109         ChannelHandshakeConfig_set_announced_channel(&this_ptr_conv, val);
21110 }
21111
21112 jboolean  __attribute__((export_name("TS_ChannelHandshakeConfig_get_commit_upfront_shutdown_pubkey"))) TS_ChannelHandshakeConfig_get_commit_upfront_shutdown_pubkey(uint64_t this_ptr) {
21113         LDKChannelHandshakeConfig this_ptr_conv;
21114         this_ptr_conv.inner = untag_ptr(this_ptr);
21115         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
21116         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21117         this_ptr_conv.is_owned = false;
21118         jboolean ret_conv = ChannelHandshakeConfig_get_commit_upfront_shutdown_pubkey(&this_ptr_conv);
21119         return ret_conv;
21120 }
21121
21122 void  __attribute__((export_name("TS_ChannelHandshakeConfig_set_commit_upfront_shutdown_pubkey"))) TS_ChannelHandshakeConfig_set_commit_upfront_shutdown_pubkey(uint64_t this_ptr, jboolean val) {
21123         LDKChannelHandshakeConfig this_ptr_conv;
21124         this_ptr_conv.inner = untag_ptr(this_ptr);
21125         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
21126         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21127         this_ptr_conv.is_owned = false;
21128         ChannelHandshakeConfig_set_commit_upfront_shutdown_pubkey(&this_ptr_conv, val);
21129 }
21130
21131 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) {
21132         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);
21133         uint64_t ret_ref = 0;
21134         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21135         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
21136         return ret_ref;
21137 }
21138
21139 static inline uint64_t ChannelHandshakeConfig_clone_ptr(LDKChannelHandshakeConfig *NONNULL_PTR arg) {
21140         LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_clone(arg);
21141         uint64_t ret_ref = 0;
21142         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21143         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
21144         return ret_ref;
21145 }
21146 int64_t  __attribute__((export_name("TS_ChannelHandshakeConfig_clone_ptr"))) TS_ChannelHandshakeConfig_clone_ptr(uint64_t arg) {
21147         LDKChannelHandshakeConfig arg_conv;
21148         arg_conv.inner = untag_ptr(arg);
21149         arg_conv.is_owned = ptr_is_owned(arg);
21150         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
21151         arg_conv.is_owned = false;
21152         int64_t ret_conv = ChannelHandshakeConfig_clone_ptr(&arg_conv);
21153         return ret_conv;
21154 }
21155
21156 uint64_t  __attribute__((export_name("TS_ChannelHandshakeConfig_clone"))) TS_ChannelHandshakeConfig_clone(uint64_t orig) {
21157         LDKChannelHandshakeConfig orig_conv;
21158         orig_conv.inner = untag_ptr(orig);
21159         orig_conv.is_owned = ptr_is_owned(orig);
21160         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
21161         orig_conv.is_owned = false;
21162         LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_clone(&orig_conv);
21163         uint64_t ret_ref = 0;
21164         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21165         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
21166         return ret_ref;
21167 }
21168
21169 uint64_t  __attribute__((export_name("TS_ChannelHandshakeConfig_default"))) TS_ChannelHandshakeConfig_default() {
21170         LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_default();
21171         uint64_t ret_ref = 0;
21172         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21173         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
21174         return ret_ref;
21175 }
21176
21177 void  __attribute__((export_name("TS_ChannelHandshakeLimits_free"))) TS_ChannelHandshakeLimits_free(uint64_t this_obj) {
21178         LDKChannelHandshakeLimits this_obj_conv;
21179         this_obj_conv.inner = untag_ptr(this_obj);
21180         this_obj_conv.is_owned = ptr_is_owned(this_obj);
21181         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
21182         ChannelHandshakeLimits_free(this_obj_conv);
21183 }
21184
21185 int64_t  __attribute__((export_name("TS_ChannelHandshakeLimits_get_min_funding_satoshis"))) TS_ChannelHandshakeLimits_get_min_funding_satoshis(uint64_t this_ptr) {
21186         LDKChannelHandshakeLimits this_ptr_conv;
21187         this_ptr_conv.inner = untag_ptr(this_ptr);
21188         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
21189         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21190         this_ptr_conv.is_owned = false;
21191         int64_t ret_conv = ChannelHandshakeLimits_get_min_funding_satoshis(&this_ptr_conv);
21192         return ret_conv;
21193 }
21194
21195 void  __attribute__((export_name("TS_ChannelHandshakeLimits_set_min_funding_satoshis"))) TS_ChannelHandshakeLimits_set_min_funding_satoshis(uint64_t this_ptr, int64_t val) {
21196         LDKChannelHandshakeLimits this_ptr_conv;
21197         this_ptr_conv.inner = untag_ptr(this_ptr);
21198         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
21199         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21200         this_ptr_conv.is_owned = false;
21201         ChannelHandshakeLimits_set_min_funding_satoshis(&this_ptr_conv, val);
21202 }
21203
21204 int64_t  __attribute__((export_name("TS_ChannelHandshakeLimits_get_max_funding_satoshis"))) TS_ChannelHandshakeLimits_get_max_funding_satoshis(uint64_t this_ptr) {
21205         LDKChannelHandshakeLimits this_ptr_conv;
21206         this_ptr_conv.inner = untag_ptr(this_ptr);
21207         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
21208         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21209         this_ptr_conv.is_owned = false;
21210         int64_t ret_conv = ChannelHandshakeLimits_get_max_funding_satoshis(&this_ptr_conv);
21211         return ret_conv;
21212 }
21213
21214 void  __attribute__((export_name("TS_ChannelHandshakeLimits_set_max_funding_satoshis"))) TS_ChannelHandshakeLimits_set_max_funding_satoshis(uint64_t this_ptr, int64_t val) {
21215         LDKChannelHandshakeLimits this_ptr_conv;
21216         this_ptr_conv.inner = untag_ptr(this_ptr);
21217         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
21218         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21219         this_ptr_conv.is_owned = false;
21220         ChannelHandshakeLimits_set_max_funding_satoshis(&this_ptr_conv, val);
21221 }
21222
21223 int64_t  __attribute__((export_name("TS_ChannelHandshakeLimits_get_max_htlc_minimum_msat"))) TS_ChannelHandshakeLimits_get_max_htlc_minimum_msat(uint64_t this_ptr) {
21224         LDKChannelHandshakeLimits this_ptr_conv;
21225         this_ptr_conv.inner = untag_ptr(this_ptr);
21226         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
21227         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21228         this_ptr_conv.is_owned = false;
21229         int64_t ret_conv = ChannelHandshakeLimits_get_max_htlc_minimum_msat(&this_ptr_conv);
21230         return ret_conv;
21231 }
21232
21233 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) {
21234         LDKChannelHandshakeLimits this_ptr_conv;
21235         this_ptr_conv.inner = untag_ptr(this_ptr);
21236         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
21237         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21238         this_ptr_conv.is_owned = false;
21239         ChannelHandshakeLimits_set_max_htlc_minimum_msat(&this_ptr_conv, val);
21240 }
21241
21242 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) {
21243         LDKChannelHandshakeLimits this_ptr_conv;
21244         this_ptr_conv.inner = untag_ptr(this_ptr);
21245         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
21246         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21247         this_ptr_conv.is_owned = false;
21248         int64_t ret_conv = ChannelHandshakeLimits_get_min_max_htlc_value_in_flight_msat(&this_ptr_conv);
21249         return ret_conv;
21250 }
21251
21252 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) {
21253         LDKChannelHandshakeLimits this_ptr_conv;
21254         this_ptr_conv.inner = untag_ptr(this_ptr);
21255         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
21256         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21257         this_ptr_conv.is_owned = false;
21258         ChannelHandshakeLimits_set_min_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
21259 }
21260
21261 int64_t  __attribute__((export_name("TS_ChannelHandshakeLimits_get_max_channel_reserve_satoshis"))) TS_ChannelHandshakeLimits_get_max_channel_reserve_satoshis(uint64_t this_ptr) {
21262         LDKChannelHandshakeLimits this_ptr_conv;
21263         this_ptr_conv.inner = untag_ptr(this_ptr);
21264         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
21265         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21266         this_ptr_conv.is_owned = false;
21267         int64_t ret_conv = ChannelHandshakeLimits_get_max_channel_reserve_satoshis(&this_ptr_conv);
21268         return ret_conv;
21269 }
21270
21271 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) {
21272         LDKChannelHandshakeLimits this_ptr_conv;
21273         this_ptr_conv.inner = untag_ptr(this_ptr);
21274         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
21275         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21276         this_ptr_conv.is_owned = false;
21277         ChannelHandshakeLimits_set_max_channel_reserve_satoshis(&this_ptr_conv, val);
21278 }
21279
21280 int16_t  __attribute__((export_name("TS_ChannelHandshakeLimits_get_min_max_accepted_htlcs"))) TS_ChannelHandshakeLimits_get_min_max_accepted_htlcs(uint64_t this_ptr) {
21281         LDKChannelHandshakeLimits this_ptr_conv;
21282         this_ptr_conv.inner = untag_ptr(this_ptr);
21283         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
21284         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21285         this_ptr_conv.is_owned = false;
21286         int16_t ret_conv = ChannelHandshakeLimits_get_min_max_accepted_htlcs(&this_ptr_conv);
21287         return ret_conv;
21288 }
21289
21290 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) {
21291         LDKChannelHandshakeLimits this_ptr_conv;
21292         this_ptr_conv.inner = untag_ptr(this_ptr);
21293         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
21294         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21295         this_ptr_conv.is_owned = false;
21296         ChannelHandshakeLimits_set_min_max_accepted_htlcs(&this_ptr_conv, val);
21297 }
21298
21299 int32_t  __attribute__((export_name("TS_ChannelHandshakeLimits_get_max_minimum_depth"))) TS_ChannelHandshakeLimits_get_max_minimum_depth(uint64_t this_ptr) {
21300         LDKChannelHandshakeLimits this_ptr_conv;
21301         this_ptr_conv.inner = untag_ptr(this_ptr);
21302         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
21303         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21304         this_ptr_conv.is_owned = false;
21305         int32_t ret_conv = ChannelHandshakeLimits_get_max_minimum_depth(&this_ptr_conv);
21306         return ret_conv;
21307 }
21308
21309 void  __attribute__((export_name("TS_ChannelHandshakeLimits_set_max_minimum_depth"))) TS_ChannelHandshakeLimits_set_max_minimum_depth(uint64_t this_ptr, int32_t val) {
21310         LDKChannelHandshakeLimits this_ptr_conv;
21311         this_ptr_conv.inner = untag_ptr(this_ptr);
21312         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
21313         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21314         this_ptr_conv.is_owned = false;
21315         ChannelHandshakeLimits_set_max_minimum_depth(&this_ptr_conv, val);
21316 }
21317
21318 jboolean  __attribute__((export_name("TS_ChannelHandshakeLimits_get_trust_own_funding_0conf"))) TS_ChannelHandshakeLimits_get_trust_own_funding_0conf(uint64_t this_ptr) {
21319         LDKChannelHandshakeLimits this_ptr_conv;
21320         this_ptr_conv.inner = untag_ptr(this_ptr);
21321         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
21322         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21323         this_ptr_conv.is_owned = false;
21324         jboolean ret_conv = ChannelHandshakeLimits_get_trust_own_funding_0conf(&this_ptr_conv);
21325         return ret_conv;
21326 }
21327
21328 void  __attribute__((export_name("TS_ChannelHandshakeLimits_set_trust_own_funding_0conf"))) TS_ChannelHandshakeLimits_set_trust_own_funding_0conf(uint64_t this_ptr, jboolean val) {
21329         LDKChannelHandshakeLimits this_ptr_conv;
21330         this_ptr_conv.inner = untag_ptr(this_ptr);
21331         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
21332         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21333         this_ptr_conv.is_owned = false;
21334         ChannelHandshakeLimits_set_trust_own_funding_0conf(&this_ptr_conv, val);
21335 }
21336
21337 jboolean  __attribute__((export_name("TS_ChannelHandshakeLimits_get_force_announced_channel_preference"))) TS_ChannelHandshakeLimits_get_force_announced_channel_preference(uint64_t this_ptr) {
21338         LDKChannelHandshakeLimits this_ptr_conv;
21339         this_ptr_conv.inner = untag_ptr(this_ptr);
21340         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
21341         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21342         this_ptr_conv.is_owned = false;
21343         jboolean ret_conv = ChannelHandshakeLimits_get_force_announced_channel_preference(&this_ptr_conv);
21344         return ret_conv;
21345 }
21346
21347 void  __attribute__((export_name("TS_ChannelHandshakeLimits_set_force_announced_channel_preference"))) TS_ChannelHandshakeLimits_set_force_announced_channel_preference(uint64_t this_ptr, jboolean val) {
21348         LDKChannelHandshakeLimits this_ptr_conv;
21349         this_ptr_conv.inner = untag_ptr(this_ptr);
21350         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
21351         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21352         this_ptr_conv.is_owned = false;
21353         ChannelHandshakeLimits_set_force_announced_channel_preference(&this_ptr_conv, val);
21354 }
21355
21356 int16_t  __attribute__((export_name("TS_ChannelHandshakeLimits_get_their_to_self_delay"))) TS_ChannelHandshakeLimits_get_their_to_self_delay(uint64_t this_ptr) {
21357         LDKChannelHandshakeLimits this_ptr_conv;
21358         this_ptr_conv.inner = untag_ptr(this_ptr);
21359         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
21360         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21361         this_ptr_conv.is_owned = false;
21362         int16_t ret_conv = ChannelHandshakeLimits_get_their_to_self_delay(&this_ptr_conv);
21363         return ret_conv;
21364 }
21365
21366 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) {
21367         LDKChannelHandshakeLimits this_ptr_conv;
21368         this_ptr_conv.inner = untag_ptr(this_ptr);
21369         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
21370         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21371         this_ptr_conv.is_owned = false;
21372         ChannelHandshakeLimits_set_their_to_self_delay(&this_ptr_conv, val);
21373 }
21374
21375 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) {
21376         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);
21377         uint64_t ret_ref = 0;
21378         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21379         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
21380         return ret_ref;
21381 }
21382
21383 static inline uint64_t ChannelHandshakeLimits_clone_ptr(LDKChannelHandshakeLimits *NONNULL_PTR arg) {
21384         LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_clone(arg);
21385         uint64_t ret_ref = 0;
21386         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21387         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
21388         return ret_ref;
21389 }
21390 int64_t  __attribute__((export_name("TS_ChannelHandshakeLimits_clone_ptr"))) TS_ChannelHandshakeLimits_clone_ptr(uint64_t arg) {
21391         LDKChannelHandshakeLimits arg_conv;
21392         arg_conv.inner = untag_ptr(arg);
21393         arg_conv.is_owned = ptr_is_owned(arg);
21394         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
21395         arg_conv.is_owned = false;
21396         int64_t ret_conv = ChannelHandshakeLimits_clone_ptr(&arg_conv);
21397         return ret_conv;
21398 }
21399
21400 uint64_t  __attribute__((export_name("TS_ChannelHandshakeLimits_clone"))) TS_ChannelHandshakeLimits_clone(uint64_t orig) {
21401         LDKChannelHandshakeLimits orig_conv;
21402         orig_conv.inner = untag_ptr(orig);
21403         orig_conv.is_owned = ptr_is_owned(orig);
21404         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
21405         orig_conv.is_owned = false;
21406         LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_clone(&orig_conv);
21407         uint64_t ret_ref = 0;
21408         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21409         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
21410         return ret_ref;
21411 }
21412
21413 uint64_t  __attribute__((export_name("TS_ChannelHandshakeLimits_default"))) TS_ChannelHandshakeLimits_default() {
21414         LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_default();
21415         uint64_t ret_ref = 0;
21416         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21417         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
21418         return ret_ref;
21419 }
21420
21421 void  __attribute__((export_name("TS_ChannelConfig_free"))) TS_ChannelConfig_free(uint64_t this_obj) {
21422         LDKChannelConfig this_obj_conv;
21423         this_obj_conv.inner = untag_ptr(this_obj);
21424         this_obj_conv.is_owned = ptr_is_owned(this_obj);
21425         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
21426         ChannelConfig_free(this_obj_conv);
21427 }
21428
21429 int32_t  __attribute__((export_name("TS_ChannelConfig_get_forwarding_fee_proportional_millionths"))) TS_ChannelConfig_get_forwarding_fee_proportional_millionths(uint64_t this_ptr) {
21430         LDKChannelConfig this_ptr_conv;
21431         this_ptr_conv.inner = untag_ptr(this_ptr);
21432         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
21433         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21434         this_ptr_conv.is_owned = false;
21435         int32_t ret_conv = ChannelConfig_get_forwarding_fee_proportional_millionths(&this_ptr_conv);
21436         return ret_conv;
21437 }
21438
21439 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) {
21440         LDKChannelConfig this_ptr_conv;
21441         this_ptr_conv.inner = untag_ptr(this_ptr);
21442         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
21443         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21444         this_ptr_conv.is_owned = false;
21445         ChannelConfig_set_forwarding_fee_proportional_millionths(&this_ptr_conv, val);
21446 }
21447
21448 int32_t  __attribute__((export_name("TS_ChannelConfig_get_forwarding_fee_base_msat"))) TS_ChannelConfig_get_forwarding_fee_base_msat(uint64_t this_ptr) {
21449         LDKChannelConfig this_ptr_conv;
21450         this_ptr_conv.inner = untag_ptr(this_ptr);
21451         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
21452         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21453         this_ptr_conv.is_owned = false;
21454         int32_t ret_conv = ChannelConfig_get_forwarding_fee_base_msat(&this_ptr_conv);
21455         return ret_conv;
21456 }
21457
21458 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) {
21459         LDKChannelConfig this_ptr_conv;
21460         this_ptr_conv.inner = untag_ptr(this_ptr);
21461         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
21462         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21463         this_ptr_conv.is_owned = false;
21464         ChannelConfig_set_forwarding_fee_base_msat(&this_ptr_conv, val);
21465 }
21466
21467 int16_t  __attribute__((export_name("TS_ChannelConfig_get_cltv_expiry_delta"))) TS_ChannelConfig_get_cltv_expiry_delta(uint64_t this_ptr) {
21468         LDKChannelConfig this_ptr_conv;
21469         this_ptr_conv.inner = untag_ptr(this_ptr);
21470         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
21471         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21472         this_ptr_conv.is_owned = false;
21473         int16_t ret_conv = ChannelConfig_get_cltv_expiry_delta(&this_ptr_conv);
21474         return ret_conv;
21475 }
21476
21477 void  __attribute__((export_name("TS_ChannelConfig_set_cltv_expiry_delta"))) TS_ChannelConfig_set_cltv_expiry_delta(uint64_t this_ptr, int16_t val) {
21478         LDKChannelConfig this_ptr_conv;
21479         this_ptr_conv.inner = untag_ptr(this_ptr);
21480         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
21481         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21482         this_ptr_conv.is_owned = false;
21483         ChannelConfig_set_cltv_expiry_delta(&this_ptr_conv, val);
21484 }
21485
21486 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) {
21487         LDKChannelConfig this_ptr_conv;
21488         this_ptr_conv.inner = untag_ptr(this_ptr);
21489         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
21490         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21491         this_ptr_conv.is_owned = false;
21492         int64_t ret_conv = ChannelConfig_get_max_dust_htlc_exposure_msat(&this_ptr_conv);
21493         return ret_conv;
21494 }
21495
21496 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) {
21497         LDKChannelConfig this_ptr_conv;
21498         this_ptr_conv.inner = untag_ptr(this_ptr);
21499         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
21500         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21501         this_ptr_conv.is_owned = false;
21502         ChannelConfig_set_max_dust_htlc_exposure_msat(&this_ptr_conv, val);
21503 }
21504
21505 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) {
21506         LDKChannelConfig this_ptr_conv;
21507         this_ptr_conv.inner = untag_ptr(this_ptr);
21508         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
21509         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21510         this_ptr_conv.is_owned = false;
21511         int64_t ret_conv = ChannelConfig_get_force_close_avoidance_max_fee_satoshis(&this_ptr_conv);
21512         return ret_conv;
21513 }
21514
21515 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) {
21516         LDKChannelConfig this_ptr_conv;
21517         this_ptr_conv.inner = untag_ptr(this_ptr);
21518         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
21519         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21520         this_ptr_conv.is_owned = false;
21521         ChannelConfig_set_force_close_avoidance_max_fee_satoshis(&this_ptr_conv, val);
21522 }
21523
21524 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) {
21525         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);
21526         uint64_t ret_ref = 0;
21527         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21528         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
21529         return ret_ref;
21530 }
21531
21532 static inline uint64_t ChannelConfig_clone_ptr(LDKChannelConfig *NONNULL_PTR arg) {
21533         LDKChannelConfig ret_var = ChannelConfig_clone(arg);
21534         uint64_t ret_ref = 0;
21535         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21536         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
21537         return ret_ref;
21538 }
21539 int64_t  __attribute__((export_name("TS_ChannelConfig_clone_ptr"))) TS_ChannelConfig_clone_ptr(uint64_t arg) {
21540         LDKChannelConfig arg_conv;
21541         arg_conv.inner = untag_ptr(arg);
21542         arg_conv.is_owned = ptr_is_owned(arg);
21543         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
21544         arg_conv.is_owned = false;
21545         int64_t ret_conv = ChannelConfig_clone_ptr(&arg_conv);
21546         return ret_conv;
21547 }
21548
21549 uint64_t  __attribute__((export_name("TS_ChannelConfig_clone"))) TS_ChannelConfig_clone(uint64_t orig) {
21550         LDKChannelConfig orig_conv;
21551         orig_conv.inner = untag_ptr(orig);
21552         orig_conv.is_owned = ptr_is_owned(orig);
21553         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
21554         orig_conv.is_owned = false;
21555         LDKChannelConfig ret_var = ChannelConfig_clone(&orig_conv);
21556         uint64_t ret_ref = 0;
21557         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21558         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
21559         return ret_ref;
21560 }
21561
21562 uint64_t  __attribute__((export_name("TS_ChannelConfig_default"))) TS_ChannelConfig_default() {
21563         LDKChannelConfig ret_var = ChannelConfig_default();
21564         uint64_t ret_ref = 0;
21565         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21566         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
21567         return ret_ref;
21568 }
21569
21570 int8_tArray  __attribute__((export_name("TS_ChannelConfig_write"))) TS_ChannelConfig_write(uint64_t obj) {
21571         LDKChannelConfig obj_conv;
21572         obj_conv.inner = untag_ptr(obj);
21573         obj_conv.is_owned = ptr_is_owned(obj);
21574         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
21575         obj_conv.is_owned = false;
21576         LDKCVec_u8Z ret_var = ChannelConfig_write(&obj_conv);
21577         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
21578         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
21579         CVec_u8Z_free(ret_var);
21580         return ret_arr;
21581 }
21582
21583 uint64_t  __attribute__((export_name("TS_ChannelConfig_read"))) TS_ChannelConfig_read(int8_tArray ser) {
21584         LDKu8slice ser_ref;
21585         ser_ref.datalen = ser->arr_len;
21586         ser_ref.data = ser->elems;
21587         LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
21588         *ret_conv = ChannelConfig_read(ser_ref);
21589         FREE(ser);
21590         return tag_ptr(ret_conv, true);
21591 }
21592
21593 void  __attribute__((export_name("TS_UserConfig_free"))) TS_UserConfig_free(uint64_t this_obj) {
21594         LDKUserConfig this_obj_conv;
21595         this_obj_conv.inner = untag_ptr(this_obj);
21596         this_obj_conv.is_owned = ptr_is_owned(this_obj);
21597         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
21598         UserConfig_free(this_obj_conv);
21599 }
21600
21601 uint64_t  __attribute__((export_name("TS_UserConfig_get_channel_handshake_config"))) TS_UserConfig_get_channel_handshake_config(uint64_t this_ptr) {
21602         LDKUserConfig this_ptr_conv;
21603         this_ptr_conv.inner = untag_ptr(this_ptr);
21604         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
21605         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21606         this_ptr_conv.is_owned = false;
21607         LDKChannelHandshakeConfig ret_var = UserConfig_get_channel_handshake_config(&this_ptr_conv);
21608         uint64_t ret_ref = 0;
21609         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21610         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
21611         return ret_ref;
21612 }
21613
21614 void  __attribute__((export_name("TS_UserConfig_set_channel_handshake_config"))) TS_UserConfig_set_channel_handshake_config(uint64_t this_ptr, uint64_t val) {
21615         LDKUserConfig this_ptr_conv;
21616         this_ptr_conv.inner = untag_ptr(this_ptr);
21617         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
21618         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21619         this_ptr_conv.is_owned = false;
21620         LDKChannelHandshakeConfig val_conv;
21621         val_conv.inner = untag_ptr(val);
21622         val_conv.is_owned = ptr_is_owned(val);
21623         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
21624         val_conv = ChannelHandshakeConfig_clone(&val_conv);
21625         UserConfig_set_channel_handshake_config(&this_ptr_conv, val_conv);
21626 }
21627
21628 uint64_t  __attribute__((export_name("TS_UserConfig_get_channel_handshake_limits"))) TS_UserConfig_get_channel_handshake_limits(uint64_t this_ptr) {
21629         LDKUserConfig this_ptr_conv;
21630         this_ptr_conv.inner = untag_ptr(this_ptr);
21631         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
21632         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21633         this_ptr_conv.is_owned = false;
21634         LDKChannelHandshakeLimits ret_var = UserConfig_get_channel_handshake_limits(&this_ptr_conv);
21635         uint64_t ret_ref = 0;
21636         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21637         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
21638         return ret_ref;
21639 }
21640
21641 void  __attribute__((export_name("TS_UserConfig_set_channel_handshake_limits"))) TS_UserConfig_set_channel_handshake_limits(uint64_t this_ptr, uint64_t val) {
21642         LDKUserConfig this_ptr_conv;
21643         this_ptr_conv.inner = untag_ptr(this_ptr);
21644         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
21645         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21646         this_ptr_conv.is_owned = false;
21647         LDKChannelHandshakeLimits val_conv;
21648         val_conv.inner = untag_ptr(val);
21649         val_conv.is_owned = ptr_is_owned(val);
21650         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
21651         val_conv = ChannelHandshakeLimits_clone(&val_conv);
21652         UserConfig_set_channel_handshake_limits(&this_ptr_conv, val_conv);
21653 }
21654
21655 uint64_t  __attribute__((export_name("TS_UserConfig_get_channel_config"))) TS_UserConfig_get_channel_config(uint64_t this_ptr) {
21656         LDKUserConfig this_ptr_conv;
21657         this_ptr_conv.inner = untag_ptr(this_ptr);
21658         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
21659         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21660         this_ptr_conv.is_owned = false;
21661         LDKChannelConfig ret_var = UserConfig_get_channel_config(&this_ptr_conv);
21662         uint64_t ret_ref = 0;
21663         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21664         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
21665         return ret_ref;
21666 }
21667
21668 void  __attribute__((export_name("TS_UserConfig_set_channel_config"))) TS_UserConfig_set_channel_config(uint64_t this_ptr, uint64_t val) {
21669         LDKUserConfig this_ptr_conv;
21670         this_ptr_conv.inner = untag_ptr(this_ptr);
21671         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
21672         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21673         this_ptr_conv.is_owned = false;
21674         LDKChannelConfig val_conv;
21675         val_conv.inner = untag_ptr(val);
21676         val_conv.is_owned = ptr_is_owned(val);
21677         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
21678         val_conv = ChannelConfig_clone(&val_conv);
21679         UserConfig_set_channel_config(&this_ptr_conv, val_conv);
21680 }
21681
21682 jboolean  __attribute__((export_name("TS_UserConfig_get_accept_forwards_to_priv_channels"))) TS_UserConfig_get_accept_forwards_to_priv_channels(uint64_t this_ptr) {
21683         LDKUserConfig this_ptr_conv;
21684         this_ptr_conv.inner = untag_ptr(this_ptr);
21685         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
21686         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21687         this_ptr_conv.is_owned = false;
21688         jboolean ret_conv = UserConfig_get_accept_forwards_to_priv_channels(&this_ptr_conv);
21689         return ret_conv;
21690 }
21691
21692 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) {
21693         LDKUserConfig this_ptr_conv;
21694         this_ptr_conv.inner = untag_ptr(this_ptr);
21695         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
21696         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21697         this_ptr_conv.is_owned = false;
21698         UserConfig_set_accept_forwards_to_priv_channels(&this_ptr_conv, val);
21699 }
21700
21701 jboolean  __attribute__((export_name("TS_UserConfig_get_accept_inbound_channels"))) TS_UserConfig_get_accept_inbound_channels(uint64_t this_ptr) {
21702         LDKUserConfig this_ptr_conv;
21703         this_ptr_conv.inner = untag_ptr(this_ptr);
21704         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
21705         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21706         this_ptr_conv.is_owned = false;
21707         jboolean ret_conv = UserConfig_get_accept_inbound_channels(&this_ptr_conv);
21708         return ret_conv;
21709 }
21710
21711 void  __attribute__((export_name("TS_UserConfig_set_accept_inbound_channels"))) TS_UserConfig_set_accept_inbound_channels(uint64_t this_ptr, jboolean val) {
21712         LDKUserConfig this_ptr_conv;
21713         this_ptr_conv.inner = untag_ptr(this_ptr);
21714         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
21715         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21716         this_ptr_conv.is_owned = false;
21717         UserConfig_set_accept_inbound_channels(&this_ptr_conv, val);
21718 }
21719
21720 jboolean  __attribute__((export_name("TS_UserConfig_get_manually_accept_inbound_channels"))) TS_UserConfig_get_manually_accept_inbound_channels(uint64_t this_ptr) {
21721         LDKUserConfig this_ptr_conv;
21722         this_ptr_conv.inner = untag_ptr(this_ptr);
21723         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
21724         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21725         this_ptr_conv.is_owned = false;
21726         jboolean ret_conv = UserConfig_get_manually_accept_inbound_channels(&this_ptr_conv);
21727         return ret_conv;
21728 }
21729
21730 void  __attribute__((export_name("TS_UserConfig_set_manually_accept_inbound_channels"))) TS_UserConfig_set_manually_accept_inbound_channels(uint64_t this_ptr, jboolean val) {
21731         LDKUserConfig this_ptr_conv;
21732         this_ptr_conv.inner = untag_ptr(this_ptr);
21733         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
21734         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21735         this_ptr_conv.is_owned = false;
21736         UserConfig_set_manually_accept_inbound_channels(&this_ptr_conv, val);
21737 }
21738
21739 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) {
21740         LDKChannelHandshakeConfig channel_handshake_config_arg_conv;
21741         channel_handshake_config_arg_conv.inner = untag_ptr(channel_handshake_config_arg);
21742         channel_handshake_config_arg_conv.is_owned = ptr_is_owned(channel_handshake_config_arg);
21743         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_handshake_config_arg_conv);
21744         channel_handshake_config_arg_conv = ChannelHandshakeConfig_clone(&channel_handshake_config_arg_conv);
21745         LDKChannelHandshakeLimits channel_handshake_limits_arg_conv;
21746         channel_handshake_limits_arg_conv.inner = untag_ptr(channel_handshake_limits_arg);
21747         channel_handshake_limits_arg_conv.is_owned = ptr_is_owned(channel_handshake_limits_arg);
21748         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_handshake_limits_arg_conv);
21749         channel_handshake_limits_arg_conv = ChannelHandshakeLimits_clone(&channel_handshake_limits_arg_conv);
21750         LDKChannelConfig channel_config_arg_conv;
21751         channel_config_arg_conv.inner = untag_ptr(channel_config_arg);
21752         channel_config_arg_conv.is_owned = ptr_is_owned(channel_config_arg);
21753         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_config_arg_conv);
21754         channel_config_arg_conv = ChannelConfig_clone(&channel_config_arg_conv);
21755         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);
21756         uint64_t ret_ref = 0;
21757         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21758         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
21759         return ret_ref;
21760 }
21761
21762 static inline uint64_t UserConfig_clone_ptr(LDKUserConfig *NONNULL_PTR arg) {
21763         LDKUserConfig ret_var = UserConfig_clone(arg);
21764         uint64_t ret_ref = 0;
21765         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21766         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
21767         return ret_ref;
21768 }
21769 int64_t  __attribute__((export_name("TS_UserConfig_clone_ptr"))) TS_UserConfig_clone_ptr(uint64_t arg) {
21770         LDKUserConfig arg_conv;
21771         arg_conv.inner = untag_ptr(arg);
21772         arg_conv.is_owned = ptr_is_owned(arg);
21773         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
21774         arg_conv.is_owned = false;
21775         int64_t ret_conv = UserConfig_clone_ptr(&arg_conv);
21776         return ret_conv;
21777 }
21778
21779 uint64_t  __attribute__((export_name("TS_UserConfig_clone"))) TS_UserConfig_clone(uint64_t orig) {
21780         LDKUserConfig orig_conv;
21781         orig_conv.inner = untag_ptr(orig);
21782         orig_conv.is_owned = ptr_is_owned(orig);
21783         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
21784         orig_conv.is_owned = false;
21785         LDKUserConfig ret_var = UserConfig_clone(&orig_conv);
21786         uint64_t ret_ref = 0;
21787         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21788         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
21789         return ret_ref;
21790 }
21791
21792 uint64_t  __attribute__((export_name("TS_UserConfig_default"))) TS_UserConfig_default() {
21793         LDKUserConfig ret_var = UserConfig_default();
21794         uint64_t ret_ref = 0;
21795         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21796         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
21797         return ret_ref;
21798 }
21799
21800 void  __attribute__((export_name("TS_BestBlock_free"))) TS_BestBlock_free(uint64_t this_obj) {
21801         LDKBestBlock this_obj_conv;
21802         this_obj_conv.inner = untag_ptr(this_obj);
21803         this_obj_conv.is_owned = ptr_is_owned(this_obj);
21804         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
21805         BestBlock_free(this_obj_conv);
21806 }
21807
21808 static inline uint64_t BestBlock_clone_ptr(LDKBestBlock *NONNULL_PTR arg) {
21809         LDKBestBlock ret_var = BestBlock_clone(arg);
21810         uint64_t ret_ref = 0;
21811         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21812         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
21813         return ret_ref;
21814 }
21815 int64_t  __attribute__((export_name("TS_BestBlock_clone_ptr"))) TS_BestBlock_clone_ptr(uint64_t arg) {
21816         LDKBestBlock arg_conv;
21817         arg_conv.inner = untag_ptr(arg);
21818         arg_conv.is_owned = ptr_is_owned(arg);
21819         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
21820         arg_conv.is_owned = false;
21821         int64_t ret_conv = BestBlock_clone_ptr(&arg_conv);
21822         return ret_conv;
21823 }
21824
21825 uint64_t  __attribute__((export_name("TS_BestBlock_clone"))) TS_BestBlock_clone(uint64_t orig) {
21826         LDKBestBlock orig_conv;
21827         orig_conv.inner = untag_ptr(orig);
21828         orig_conv.is_owned = ptr_is_owned(orig);
21829         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
21830         orig_conv.is_owned = false;
21831         LDKBestBlock ret_var = BestBlock_clone(&orig_conv);
21832         uint64_t ret_ref = 0;
21833         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21834         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
21835         return ret_ref;
21836 }
21837
21838 uint64_t  __attribute__((export_name("TS_BestBlock_from_genesis"))) TS_BestBlock_from_genesis(uint32_t network) {
21839         LDKNetwork network_conv = LDKNetwork_from_js(network);
21840         LDKBestBlock ret_var = BestBlock_from_genesis(network_conv);
21841         uint64_t ret_ref = 0;
21842         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21843         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
21844         return ret_ref;
21845 }
21846
21847 uint64_t  __attribute__((export_name("TS_BestBlock_new"))) TS_BestBlock_new(int8_tArray block_hash, int32_t height) {
21848         LDKThirtyTwoBytes block_hash_ref;
21849         CHECK(block_hash->arr_len == 32);
21850         memcpy(block_hash_ref.data, block_hash->elems, 32); FREE(block_hash);
21851         LDKBestBlock ret_var = BestBlock_new(block_hash_ref, height);
21852         uint64_t ret_ref = 0;
21853         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21854         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
21855         return ret_ref;
21856 }
21857
21858 int8_tArray  __attribute__((export_name("TS_BestBlock_block_hash"))) TS_BestBlock_block_hash(uint64_t this_arg) {
21859         LDKBestBlock this_arg_conv;
21860         this_arg_conv.inner = untag_ptr(this_arg);
21861         this_arg_conv.is_owned = ptr_is_owned(this_arg);
21862         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
21863         this_arg_conv.is_owned = false;
21864         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
21865         memcpy(ret_arr->elems, BestBlock_block_hash(&this_arg_conv).data, 32);
21866         return ret_arr;
21867 }
21868
21869 int32_t  __attribute__((export_name("TS_BestBlock_height"))) TS_BestBlock_height(uint64_t this_arg) {
21870         LDKBestBlock this_arg_conv;
21871         this_arg_conv.inner = untag_ptr(this_arg);
21872         this_arg_conv.is_owned = ptr_is_owned(this_arg);
21873         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
21874         this_arg_conv.is_owned = false;
21875         int32_t ret_conv = BestBlock_height(&this_arg_conv);
21876         return ret_conv;
21877 }
21878
21879 uint32_t  __attribute__((export_name("TS_AccessError_clone"))) TS_AccessError_clone(uint64_t orig) {
21880         LDKAccessError* orig_conv = (LDKAccessError*)untag_ptr(orig);
21881         uint32_t ret_conv = LDKAccessError_to_js(AccessError_clone(orig_conv));
21882         return ret_conv;
21883 }
21884
21885 uint32_t  __attribute__((export_name("TS_AccessError_unknown_chain"))) TS_AccessError_unknown_chain() {
21886         uint32_t ret_conv = LDKAccessError_to_js(AccessError_unknown_chain());
21887         return ret_conv;
21888 }
21889
21890 uint32_t  __attribute__((export_name("TS_AccessError_unknown_tx"))) TS_AccessError_unknown_tx() {
21891         uint32_t ret_conv = LDKAccessError_to_js(AccessError_unknown_tx());
21892         return ret_conv;
21893 }
21894
21895 void  __attribute__((export_name("TS_Access_free"))) TS_Access_free(uint64_t this_ptr) {
21896         if (!ptr_is_owned(this_ptr)) return;
21897         void* this_ptr_ptr = untag_ptr(this_ptr);
21898         CHECK_ACCESS(this_ptr_ptr);
21899         LDKAccess this_ptr_conv = *(LDKAccess*)(this_ptr_ptr);
21900         FREE(untag_ptr(this_ptr));
21901         Access_free(this_ptr_conv);
21902 }
21903
21904 void  __attribute__((export_name("TS_Listen_free"))) TS_Listen_free(uint64_t this_ptr) {
21905         if (!ptr_is_owned(this_ptr)) return;
21906         void* this_ptr_ptr = untag_ptr(this_ptr);
21907         CHECK_ACCESS(this_ptr_ptr);
21908         LDKListen this_ptr_conv = *(LDKListen*)(this_ptr_ptr);
21909         FREE(untag_ptr(this_ptr));
21910         Listen_free(this_ptr_conv);
21911 }
21912
21913 void  __attribute__((export_name("TS_Confirm_free"))) TS_Confirm_free(uint64_t this_ptr) {
21914         if (!ptr_is_owned(this_ptr)) return;
21915         void* this_ptr_ptr = untag_ptr(this_ptr);
21916         CHECK_ACCESS(this_ptr_ptr);
21917         LDKConfirm this_ptr_conv = *(LDKConfirm*)(this_ptr_ptr);
21918         FREE(untag_ptr(this_ptr));
21919         Confirm_free(this_ptr_conv);
21920 }
21921
21922 uint32_t  __attribute__((export_name("TS_ChannelMonitorUpdateErr_clone"))) TS_ChannelMonitorUpdateErr_clone(uint64_t orig) {
21923         LDKChannelMonitorUpdateErr* orig_conv = (LDKChannelMonitorUpdateErr*)untag_ptr(orig);
21924         uint32_t ret_conv = LDKChannelMonitorUpdateErr_to_js(ChannelMonitorUpdateErr_clone(orig_conv));
21925         return ret_conv;
21926 }
21927
21928 uint32_t  __attribute__((export_name("TS_ChannelMonitorUpdateErr_temporary_failure"))) TS_ChannelMonitorUpdateErr_temporary_failure() {
21929         uint32_t ret_conv = LDKChannelMonitorUpdateErr_to_js(ChannelMonitorUpdateErr_temporary_failure());
21930         return ret_conv;
21931 }
21932
21933 uint32_t  __attribute__((export_name("TS_ChannelMonitorUpdateErr_permanent_failure"))) TS_ChannelMonitorUpdateErr_permanent_failure() {
21934         uint32_t ret_conv = LDKChannelMonitorUpdateErr_to_js(ChannelMonitorUpdateErr_permanent_failure());
21935         return ret_conv;
21936 }
21937
21938 void  __attribute__((export_name("TS_Watch_free"))) TS_Watch_free(uint64_t this_ptr) {
21939         if (!ptr_is_owned(this_ptr)) return;
21940         void* this_ptr_ptr = untag_ptr(this_ptr);
21941         CHECK_ACCESS(this_ptr_ptr);
21942         LDKWatch this_ptr_conv = *(LDKWatch*)(this_ptr_ptr);
21943         FREE(untag_ptr(this_ptr));
21944         Watch_free(this_ptr_conv);
21945 }
21946
21947 void  __attribute__((export_name("TS_Filter_free"))) TS_Filter_free(uint64_t this_ptr) {
21948         if (!ptr_is_owned(this_ptr)) return;
21949         void* this_ptr_ptr = untag_ptr(this_ptr);
21950         CHECK_ACCESS(this_ptr_ptr);
21951         LDKFilter this_ptr_conv = *(LDKFilter*)(this_ptr_ptr);
21952         FREE(untag_ptr(this_ptr));
21953         Filter_free(this_ptr_conv);
21954 }
21955
21956 void  __attribute__((export_name("TS_WatchedOutput_free"))) TS_WatchedOutput_free(uint64_t this_obj) {
21957         LDKWatchedOutput this_obj_conv;
21958         this_obj_conv.inner = untag_ptr(this_obj);
21959         this_obj_conv.is_owned = ptr_is_owned(this_obj);
21960         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
21961         WatchedOutput_free(this_obj_conv);
21962 }
21963
21964 int8_tArray  __attribute__((export_name("TS_WatchedOutput_get_block_hash"))) TS_WatchedOutput_get_block_hash(uint64_t this_ptr) {
21965         LDKWatchedOutput this_ptr_conv;
21966         this_ptr_conv.inner = untag_ptr(this_ptr);
21967         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
21968         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21969         this_ptr_conv.is_owned = false;
21970         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
21971         memcpy(ret_arr->elems, WatchedOutput_get_block_hash(&this_ptr_conv).data, 32);
21972         return ret_arr;
21973 }
21974
21975 void  __attribute__((export_name("TS_WatchedOutput_set_block_hash"))) TS_WatchedOutput_set_block_hash(uint64_t this_ptr, int8_tArray val) {
21976         LDKWatchedOutput this_ptr_conv;
21977         this_ptr_conv.inner = untag_ptr(this_ptr);
21978         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
21979         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21980         this_ptr_conv.is_owned = false;
21981         LDKThirtyTwoBytes val_ref;
21982         CHECK(val->arr_len == 32);
21983         memcpy(val_ref.data, val->elems, 32); FREE(val);
21984         WatchedOutput_set_block_hash(&this_ptr_conv, val_ref);
21985 }
21986
21987 uint64_t  __attribute__((export_name("TS_WatchedOutput_get_outpoint"))) TS_WatchedOutput_get_outpoint(uint64_t this_ptr) {
21988         LDKWatchedOutput this_ptr_conv;
21989         this_ptr_conv.inner = untag_ptr(this_ptr);
21990         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
21991         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21992         this_ptr_conv.is_owned = false;
21993         LDKOutPoint ret_var = WatchedOutput_get_outpoint(&this_ptr_conv);
21994         uint64_t ret_ref = 0;
21995         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21996         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
21997         return ret_ref;
21998 }
21999
22000 void  __attribute__((export_name("TS_WatchedOutput_set_outpoint"))) TS_WatchedOutput_set_outpoint(uint64_t this_ptr, uint64_t val) {
22001         LDKWatchedOutput this_ptr_conv;
22002         this_ptr_conv.inner = untag_ptr(this_ptr);
22003         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22004         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22005         this_ptr_conv.is_owned = false;
22006         LDKOutPoint val_conv;
22007         val_conv.inner = untag_ptr(val);
22008         val_conv.is_owned = ptr_is_owned(val);
22009         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
22010         val_conv = OutPoint_clone(&val_conv);
22011         WatchedOutput_set_outpoint(&this_ptr_conv, val_conv);
22012 }
22013
22014 int8_tArray  __attribute__((export_name("TS_WatchedOutput_get_script_pubkey"))) TS_WatchedOutput_get_script_pubkey(uint64_t this_ptr) {
22015         LDKWatchedOutput this_ptr_conv;
22016         this_ptr_conv.inner = untag_ptr(this_ptr);
22017         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22018         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22019         this_ptr_conv.is_owned = false;
22020         LDKu8slice ret_var = WatchedOutput_get_script_pubkey(&this_ptr_conv);
22021         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
22022         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
22023         return ret_arr;
22024 }
22025
22026 void  __attribute__((export_name("TS_WatchedOutput_set_script_pubkey"))) TS_WatchedOutput_set_script_pubkey(uint64_t this_ptr, int8_tArray val) {
22027         LDKWatchedOutput this_ptr_conv;
22028         this_ptr_conv.inner = untag_ptr(this_ptr);
22029         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22030         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22031         this_ptr_conv.is_owned = false;
22032         LDKCVec_u8Z val_ref;
22033         val_ref.datalen = val->arr_len;
22034         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
22035         memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
22036         WatchedOutput_set_script_pubkey(&this_ptr_conv, val_ref);
22037 }
22038
22039 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) {
22040         LDKThirtyTwoBytes block_hash_arg_ref;
22041         CHECK(block_hash_arg->arr_len == 32);
22042         memcpy(block_hash_arg_ref.data, block_hash_arg->elems, 32); FREE(block_hash_arg);
22043         LDKOutPoint outpoint_arg_conv;
22044         outpoint_arg_conv.inner = untag_ptr(outpoint_arg);
22045         outpoint_arg_conv.is_owned = ptr_is_owned(outpoint_arg);
22046         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
22047         outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
22048         LDKCVec_u8Z script_pubkey_arg_ref;
22049         script_pubkey_arg_ref.datalen = script_pubkey_arg->arr_len;
22050         script_pubkey_arg_ref.data = MALLOC(script_pubkey_arg_ref.datalen, "LDKCVec_u8Z Bytes");
22051         memcpy(script_pubkey_arg_ref.data, script_pubkey_arg->elems, script_pubkey_arg_ref.datalen); FREE(script_pubkey_arg);
22052         LDKWatchedOutput ret_var = WatchedOutput_new(block_hash_arg_ref, outpoint_arg_conv, script_pubkey_arg_ref);
22053         uint64_t ret_ref = 0;
22054         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22055         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
22056         return ret_ref;
22057 }
22058
22059 static inline uint64_t WatchedOutput_clone_ptr(LDKWatchedOutput *NONNULL_PTR arg) {
22060         LDKWatchedOutput ret_var = WatchedOutput_clone(arg);
22061         uint64_t ret_ref = 0;
22062         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22063         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
22064         return ret_ref;
22065 }
22066 int64_t  __attribute__((export_name("TS_WatchedOutput_clone_ptr"))) TS_WatchedOutput_clone_ptr(uint64_t arg) {
22067         LDKWatchedOutput arg_conv;
22068         arg_conv.inner = untag_ptr(arg);
22069         arg_conv.is_owned = ptr_is_owned(arg);
22070         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
22071         arg_conv.is_owned = false;
22072         int64_t ret_conv = WatchedOutput_clone_ptr(&arg_conv);
22073         return ret_conv;
22074 }
22075
22076 uint64_t  __attribute__((export_name("TS_WatchedOutput_clone"))) TS_WatchedOutput_clone(uint64_t orig) {
22077         LDKWatchedOutput orig_conv;
22078         orig_conv.inner = untag_ptr(orig);
22079         orig_conv.is_owned = ptr_is_owned(orig);
22080         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
22081         orig_conv.is_owned = false;
22082         LDKWatchedOutput ret_var = WatchedOutput_clone(&orig_conv);
22083         uint64_t ret_ref = 0;
22084         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22085         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
22086         return ret_ref;
22087 }
22088
22089 int64_t  __attribute__((export_name("TS_WatchedOutput_hash"))) TS_WatchedOutput_hash(uint64_t o) {
22090         LDKWatchedOutput o_conv;
22091         o_conv.inner = untag_ptr(o);
22092         o_conv.is_owned = ptr_is_owned(o);
22093         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22094         o_conv.is_owned = false;
22095         int64_t ret_conv = WatchedOutput_hash(&o_conv);
22096         return ret_conv;
22097 }
22098
22099 void  __attribute__((export_name("TS_BroadcasterInterface_free"))) TS_BroadcasterInterface_free(uint64_t this_ptr) {
22100         if (!ptr_is_owned(this_ptr)) return;
22101         void* this_ptr_ptr = untag_ptr(this_ptr);
22102         CHECK_ACCESS(this_ptr_ptr);
22103         LDKBroadcasterInterface this_ptr_conv = *(LDKBroadcasterInterface*)(this_ptr_ptr);
22104         FREE(untag_ptr(this_ptr));
22105         BroadcasterInterface_free(this_ptr_conv);
22106 }
22107
22108 uint32_t  __attribute__((export_name("TS_ConfirmationTarget_clone"))) TS_ConfirmationTarget_clone(uint64_t orig) {
22109         LDKConfirmationTarget* orig_conv = (LDKConfirmationTarget*)untag_ptr(orig);
22110         uint32_t ret_conv = LDKConfirmationTarget_to_js(ConfirmationTarget_clone(orig_conv));
22111         return ret_conv;
22112 }
22113
22114 uint32_t  __attribute__((export_name("TS_ConfirmationTarget_background"))) TS_ConfirmationTarget_background() {
22115         uint32_t ret_conv = LDKConfirmationTarget_to_js(ConfirmationTarget_background());
22116         return ret_conv;
22117 }
22118
22119 uint32_t  __attribute__((export_name("TS_ConfirmationTarget_normal"))) TS_ConfirmationTarget_normal() {
22120         uint32_t ret_conv = LDKConfirmationTarget_to_js(ConfirmationTarget_normal());
22121         return ret_conv;
22122 }
22123
22124 uint32_t  __attribute__((export_name("TS_ConfirmationTarget_high_priority"))) TS_ConfirmationTarget_high_priority() {
22125         uint32_t ret_conv = LDKConfirmationTarget_to_js(ConfirmationTarget_high_priority());
22126         return ret_conv;
22127 }
22128
22129 jboolean  __attribute__((export_name("TS_ConfirmationTarget_eq"))) TS_ConfirmationTarget_eq(uint64_t a, uint64_t b) {
22130         LDKConfirmationTarget* a_conv = (LDKConfirmationTarget*)untag_ptr(a);
22131         LDKConfirmationTarget* b_conv = (LDKConfirmationTarget*)untag_ptr(b);
22132         jboolean ret_conv = ConfirmationTarget_eq(a_conv, b_conv);
22133         return ret_conv;
22134 }
22135
22136 void  __attribute__((export_name("TS_FeeEstimator_free"))) TS_FeeEstimator_free(uint64_t this_ptr) {
22137         if (!ptr_is_owned(this_ptr)) return;
22138         void* this_ptr_ptr = untag_ptr(this_ptr);
22139         CHECK_ACCESS(this_ptr_ptr);
22140         LDKFeeEstimator this_ptr_conv = *(LDKFeeEstimator*)(this_ptr_ptr);
22141         FREE(untag_ptr(this_ptr));
22142         FeeEstimator_free(this_ptr_conv);
22143 }
22144
22145 void  __attribute__((export_name("TS_MonitorUpdateId_free"))) TS_MonitorUpdateId_free(uint64_t this_obj) {
22146         LDKMonitorUpdateId this_obj_conv;
22147         this_obj_conv.inner = untag_ptr(this_obj);
22148         this_obj_conv.is_owned = ptr_is_owned(this_obj);
22149         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
22150         MonitorUpdateId_free(this_obj_conv);
22151 }
22152
22153 static inline uint64_t MonitorUpdateId_clone_ptr(LDKMonitorUpdateId *NONNULL_PTR arg) {
22154         LDKMonitorUpdateId ret_var = MonitorUpdateId_clone(arg);
22155         uint64_t ret_ref = 0;
22156         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22157         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
22158         return ret_ref;
22159 }
22160 int64_t  __attribute__((export_name("TS_MonitorUpdateId_clone_ptr"))) TS_MonitorUpdateId_clone_ptr(uint64_t arg) {
22161         LDKMonitorUpdateId arg_conv;
22162         arg_conv.inner = untag_ptr(arg);
22163         arg_conv.is_owned = ptr_is_owned(arg);
22164         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
22165         arg_conv.is_owned = false;
22166         int64_t ret_conv = MonitorUpdateId_clone_ptr(&arg_conv);
22167         return ret_conv;
22168 }
22169
22170 uint64_t  __attribute__((export_name("TS_MonitorUpdateId_clone"))) TS_MonitorUpdateId_clone(uint64_t orig) {
22171         LDKMonitorUpdateId orig_conv;
22172         orig_conv.inner = untag_ptr(orig);
22173         orig_conv.is_owned = ptr_is_owned(orig);
22174         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
22175         orig_conv.is_owned = false;
22176         LDKMonitorUpdateId ret_var = MonitorUpdateId_clone(&orig_conv);
22177         uint64_t ret_ref = 0;
22178         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22179         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
22180         return ret_ref;
22181 }
22182
22183 int64_t  __attribute__((export_name("TS_MonitorUpdateId_hash"))) TS_MonitorUpdateId_hash(uint64_t o) {
22184         LDKMonitorUpdateId o_conv;
22185         o_conv.inner = untag_ptr(o);
22186         o_conv.is_owned = ptr_is_owned(o);
22187         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22188         o_conv.is_owned = false;
22189         int64_t ret_conv = MonitorUpdateId_hash(&o_conv);
22190         return ret_conv;
22191 }
22192
22193 jboolean  __attribute__((export_name("TS_MonitorUpdateId_eq"))) TS_MonitorUpdateId_eq(uint64_t a, uint64_t b) {
22194         LDKMonitorUpdateId a_conv;
22195         a_conv.inner = untag_ptr(a);
22196         a_conv.is_owned = ptr_is_owned(a);
22197         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
22198         a_conv.is_owned = false;
22199         LDKMonitorUpdateId b_conv;
22200         b_conv.inner = untag_ptr(b);
22201         b_conv.is_owned = ptr_is_owned(b);
22202         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
22203         b_conv.is_owned = false;
22204         jboolean ret_conv = MonitorUpdateId_eq(&a_conv, &b_conv);
22205         return ret_conv;
22206 }
22207
22208 void  __attribute__((export_name("TS_Persist_free"))) TS_Persist_free(uint64_t this_ptr) {
22209         if (!ptr_is_owned(this_ptr)) return;
22210         void* this_ptr_ptr = untag_ptr(this_ptr);
22211         CHECK_ACCESS(this_ptr_ptr);
22212         LDKPersist this_ptr_conv = *(LDKPersist*)(this_ptr_ptr);
22213         FREE(untag_ptr(this_ptr));
22214         Persist_free(this_ptr_conv);
22215 }
22216
22217 void  __attribute__((export_name("TS_LockedChannelMonitor_free"))) TS_LockedChannelMonitor_free(uint64_t this_obj) {
22218         LDKLockedChannelMonitor this_obj_conv;
22219         this_obj_conv.inner = untag_ptr(this_obj);
22220         this_obj_conv.is_owned = ptr_is_owned(this_obj);
22221         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
22222         LockedChannelMonitor_free(this_obj_conv);
22223 }
22224
22225 void  __attribute__((export_name("TS_ChainMonitor_free"))) TS_ChainMonitor_free(uint64_t this_obj) {
22226         LDKChainMonitor this_obj_conv;
22227         this_obj_conv.inner = untag_ptr(this_obj);
22228         this_obj_conv.is_owned = ptr_is_owned(this_obj);
22229         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
22230         ChainMonitor_free(this_obj_conv);
22231 }
22232
22233 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) {
22234         void* chain_source_ptr = untag_ptr(chain_source);
22235         CHECK_ACCESS(chain_source_ptr);
22236         LDKCOption_FilterZ chain_source_conv = *(LDKCOption_FilterZ*)(chain_source_ptr);
22237         // WARNING: we may need a move here but no clone is available for LDKCOption_FilterZ
22238         if (chain_source_conv.tag == LDKCOption_FilterZ_Some) {
22239                 // Manually implement clone for Java trait instances
22240                 if (chain_source_conv.some.free == LDKFilter_JCalls_free) {
22241                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
22242                         LDKFilter_JCalls_cloned(&chain_source_conv.some);
22243                 }
22244         }
22245         void* broadcaster_ptr = untag_ptr(broadcaster);
22246         CHECK_ACCESS(broadcaster_ptr);
22247         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
22248         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
22249                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
22250                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
22251         }
22252         void* logger_ptr = untag_ptr(logger);
22253         CHECK_ACCESS(logger_ptr);
22254         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
22255         if (logger_conv.free == LDKLogger_JCalls_free) {
22256                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
22257                 LDKLogger_JCalls_cloned(&logger_conv);
22258         }
22259         void* feeest_ptr = untag_ptr(feeest);
22260         CHECK_ACCESS(feeest_ptr);
22261         LDKFeeEstimator feeest_conv = *(LDKFeeEstimator*)(feeest_ptr);
22262         if (feeest_conv.free == LDKFeeEstimator_JCalls_free) {
22263                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
22264                 LDKFeeEstimator_JCalls_cloned(&feeest_conv);
22265         }
22266         void* persister_ptr = untag_ptr(persister);
22267         CHECK_ACCESS(persister_ptr);
22268         LDKPersist persister_conv = *(LDKPersist*)(persister_ptr);
22269         if (persister_conv.free == LDKPersist_JCalls_free) {
22270                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
22271                 LDKPersist_JCalls_cloned(&persister_conv);
22272         }
22273         LDKChainMonitor ret_var = ChainMonitor_new(chain_source_conv, broadcaster_conv, logger_conv, feeest_conv, persister_conv);
22274         uint64_t ret_ref = 0;
22275         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22276         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
22277         return ret_ref;
22278 }
22279
22280 uint64_tArray  __attribute__((export_name("TS_ChainMonitor_get_claimable_balances"))) TS_ChainMonitor_get_claimable_balances(uint64_t this_arg, uint64_tArray ignored_channels) {
22281         LDKChainMonitor this_arg_conv;
22282         this_arg_conv.inner = untag_ptr(this_arg);
22283         this_arg_conv.is_owned = ptr_is_owned(this_arg);
22284         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
22285         this_arg_conv.is_owned = false;
22286         LDKCVec_ChannelDetailsZ ignored_channels_constr;
22287         ignored_channels_constr.datalen = ignored_channels->arr_len;
22288         if (ignored_channels_constr.datalen > 0)
22289                 ignored_channels_constr.data = MALLOC(ignored_channels_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
22290         else
22291                 ignored_channels_constr.data = NULL;
22292         uint64_t* ignored_channels_vals = ignored_channels->elems;
22293         for (size_t q = 0; q < ignored_channels_constr.datalen; q++) {
22294                 uint64_t ignored_channels_conv_16 = ignored_channels_vals[q];
22295                 LDKChannelDetails ignored_channels_conv_16_conv;
22296                 ignored_channels_conv_16_conv.inner = untag_ptr(ignored_channels_conv_16);
22297                 ignored_channels_conv_16_conv.is_owned = ptr_is_owned(ignored_channels_conv_16);
22298                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ignored_channels_conv_16_conv);
22299                 ignored_channels_conv_16_conv = ChannelDetails_clone(&ignored_channels_conv_16_conv);
22300                 ignored_channels_constr.data[q] = ignored_channels_conv_16_conv;
22301         }
22302         FREE(ignored_channels);
22303         LDKCVec_BalanceZ ret_var = ChainMonitor_get_claimable_balances(&this_arg_conv, ignored_channels_constr);
22304         uint64_tArray ret_arr = NULL;
22305         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
22306         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
22307         for (size_t j = 0; j < ret_var.datalen; j++) {
22308                 LDKBalance *ret_conv_9_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
22309                 *ret_conv_9_copy = ret_var.data[j];
22310                 uint64_t ret_conv_9_ref = tag_ptr(ret_conv_9_copy, true);
22311                 ret_arr_ptr[j] = ret_conv_9_ref;
22312         }
22313         
22314         FREE(ret_var.data);
22315         return ret_arr;
22316 }
22317
22318 uint64_t  __attribute__((export_name("TS_ChainMonitor_get_monitor"))) TS_ChainMonitor_get_monitor(uint64_t this_arg, uint64_t funding_txo) {
22319         LDKChainMonitor this_arg_conv;
22320         this_arg_conv.inner = untag_ptr(this_arg);
22321         this_arg_conv.is_owned = ptr_is_owned(this_arg);
22322         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
22323         this_arg_conv.is_owned = false;
22324         LDKOutPoint funding_txo_conv;
22325         funding_txo_conv.inner = untag_ptr(funding_txo);
22326         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
22327         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
22328         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
22329         LDKCResult_LockedChannelMonitorNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_LockedChannelMonitorNoneZ), "LDKCResult_LockedChannelMonitorNoneZ");
22330         *ret_conv = ChainMonitor_get_monitor(&this_arg_conv, funding_txo_conv);
22331         return tag_ptr(ret_conv, true);
22332 }
22333
22334 uint64_tArray  __attribute__((export_name("TS_ChainMonitor_list_monitors"))) TS_ChainMonitor_list_monitors(uint64_t this_arg) {
22335         LDKChainMonitor this_arg_conv;
22336         this_arg_conv.inner = untag_ptr(this_arg);
22337         this_arg_conv.is_owned = ptr_is_owned(this_arg);
22338         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
22339         this_arg_conv.is_owned = false;
22340         LDKCVec_OutPointZ ret_var = ChainMonitor_list_monitors(&this_arg_conv);
22341         uint64_tArray ret_arr = NULL;
22342         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
22343         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
22344         for (size_t k = 0; k < ret_var.datalen; k++) {
22345                 LDKOutPoint ret_conv_10_var = ret_var.data[k];
22346                 uint64_t ret_conv_10_ref = 0;
22347                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_10_var);
22348                 ret_conv_10_ref = tag_ptr(ret_conv_10_var.inner, ret_conv_10_var.is_owned);
22349                 ret_arr_ptr[k] = ret_conv_10_ref;
22350         }
22351         
22352         FREE(ret_var.data);
22353         return ret_arr;
22354 }
22355
22356 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) {
22357         LDKChainMonitor this_arg_conv;
22358         this_arg_conv.inner = untag_ptr(this_arg);
22359         this_arg_conv.is_owned = ptr_is_owned(this_arg);
22360         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
22361         this_arg_conv.is_owned = false;
22362         LDKOutPoint funding_txo_conv;
22363         funding_txo_conv.inner = untag_ptr(funding_txo);
22364         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
22365         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
22366         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
22367         LDKMonitorUpdateId completed_update_id_conv;
22368         completed_update_id_conv.inner = untag_ptr(completed_update_id);
22369         completed_update_id_conv.is_owned = ptr_is_owned(completed_update_id);
22370         CHECK_INNER_FIELD_ACCESS_OR_NULL(completed_update_id_conv);
22371         completed_update_id_conv = MonitorUpdateId_clone(&completed_update_id_conv);
22372         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
22373         *ret_conv = ChainMonitor_channel_monitor_updated(&this_arg_conv, funding_txo_conv, completed_update_id_conv);
22374         return tag_ptr(ret_conv, true);
22375 }
22376
22377 uint64_t  __attribute__((export_name("TS_ChainMonitor_as_Listen"))) TS_ChainMonitor_as_Listen(uint64_t this_arg) {
22378         LDKChainMonitor this_arg_conv;
22379         this_arg_conv.inner = untag_ptr(this_arg);
22380         this_arg_conv.is_owned = ptr_is_owned(this_arg);
22381         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
22382         this_arg_conv.is_owned = false;
22383         LDKListen* ret_ret = MALLOC(sizeof(LDKListen), "LDKListen");
22384         *ret_ret = ChainMonitor_as_Listen(&this_arg_conv);
22385         return tag_ptr(ret_ret, true);
22386 }
22387
22388 uint64_t  __attribute__((export_name("TS_ChainMonitor_as_Confirm"))) TS_ChainMonitor_as_Confirm(uint64_t this_arg) {
22389         LDKChainMonitor this_arg_conv;
22390         this_arg_conv.inner = untag_ptr(this_arg);
22391         this_arg_conv.is_owned = ptr_is_owned(this_arg);
22392         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
22393         this_arg_conv.is_owned = false;
22394         LDKConfirm* ret_ret = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
22395         *ret_ret = ChainMonitor_as_Confirm(&this_arg_conv);
22396         return tag_ptr(ret_ret, true);
22397 }
22398
22399 uint64_t  __attribute__((export_name("TS_ChainMonitor_as_Watch"))) TS_ChainMonitor_as_Watch(uint64_t this_arg) {
22400         LDKChainMonitor this_arg_conv;
22401         this_arg_conv.inner = untag_ptr(this_arg);
22402         this_arg_conv.is_owned = ptr_is_owned(this_arg);
22403         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
22404         this_arg_conv.is_owned = false;
22405         LDKWatch* ret_ret = MALLOC(sizeof(LDKWatch), "LDKWatch");
22406         *ret_ret = ChainMonitor_as_Watch(&this_arg_conv);
22407         return tag_ptr(ret_ret, true);
22408 }
22409
22410 uint64_t  __attribute__((export_name("TS_ChainMonitor_as_EventsProvider"))) TS_ChainMonitor_as_EventsProvider(uint64_t this_arg) {
22411         LDKChainMonitor this_arg_conv;
22412         this_arg_conv.inner = untag_ptr(this_arg);
22413         this_arg_conv.is_owned = ptr_is_owned(this_arg);
22414         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
22415         this_arg_conv.is_owned = false;
22416         LDKEventsProvider* ret_ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
22417         *ret_ret = ChainMonitor_as_EventsProvider(&this_arg_conv);
22418         return tag_ptr(ret_ret, true);
22419 }
22420
22421 void  __attribute__((export_name("TS_ChannelMonitorUpdate_free"))) TS_ChannelMonitorUpdate_free(uint64_t this_obj) {
22422         LDKChannelMonitorUpdate this_obj_conv;
22423         this_obj_conv.inner = untag_ptr(this_obj);
22424         this_obj_conv.is_owned = ptr_is_owned(this_obj);
22425         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
22426         ChannelMonitorUpdate_free(this_obj_conv);
22427 }
22428
22429 int64_t  __attribute__((export_name("TS_ChannelMonitorUpdate_get_update_id"))) TS_ChannelMonitorUpdate_get_update_id(uint64_t this_ptr) {
22430         LDKChannelMonitorUpdate this_ptr_conv;
22431         this_ptr_conv.inner = untag_ptr(this_ptr);
22432         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22433         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22434         this_ptr_conv.is_owned = false;
22435         int64_t ret_conv = ChannelMonitorUpdate_get_update_id(&this_ptr_conv);
22436         return ret_conv;
22437 }
22438
22439 void  __attribute__((export_name("TS_ChannelMonitorUpdate_set_update_id"))) TS_ChannelMonitorUpdate_set_update_id(uint64_t this_ptr, int64_t val) {
22440         LDKChannelMonitorUpdate this_ptr_conv;
22441         this_ptr_conv.inner = untag_ptr(this_ptr);
22442         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22443         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22444         this_ptr_conv.is_owned = false;
22445         ChannelMonitorUpdate_set_update_id(&this_ptr_conv, val);
22446 }
22447
22448 static inline uint64_t ChannelMonitorUpdate_clone_ptr(LDKChannelMonitorUpdate *NONNULL_PTR arg) {
22449         LDKChannelMonitorUpdate ret_var = ChannelMonitorUpdate_clone(arg);
22450         uint64_t ret_ref = 0;
22451         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22452         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
22453         return ret_ref;
22454 }
22455 int64_t  __attribute__((export_name("TS_ChannelMonitorUpdate_clone_ptr"))) TS_ChannelMonitorUpdate_clone_ptr(uint64_t arg) {
22456         LDKChannelMonitorUpdate arg_conv;
22457         arg_conv.inner = untag_ptr(arg);
22458         arg_conv.is_owned = ptr_is_owned(arg);
22459         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
22460         arg_conv.is_owned = false;
22461         int64_t ret_conv = ChannelMonitorUpdate_clone_ptr(&arg_conv);
22462         return ret_conv;
22463 }
22464
22465 uint64_t  __attribute__((export_name("TS_ChannelMonitorUpdate_clone"))) TS_ChannelMonitorUpdate_clone(uint64_t orig) {
22466         LDKChannelMonitorUpdate orig_conv;
22467         orig_conv.inner = untag_ptr(orig);
22468         orig_conv.is_owned = ptr_is_owned(orig);
22469         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
22470         orig_conv.is_owned = false;
22471         LDKChannelMonitorUpdate ret_var = ChannelMonitorUpdate_clone(&orig_conv);
22472         uint64_t ret_ref = 0;
22473         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22474         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
22475         return ret_ref;
22476 }
22477
22478 int8_tArray  __attribute__((export_name("TS_ChannelMonitorUpdate_write"))) TS_ChannelMonitorUpdate_write(uint64_t obj) {
22479         LDKChannelMonitorUpdate obj_conv;
22480         obj_conv.inner = untag_ptr(obj);
22481         obj_conv.is_owned = ptr_is_owned(obj);
22482         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
22483         obj_conv.is_owned = false;
22484         LDKCVec_u8Z ret_var = ChannelMonitorUpdate_write(&obj_conv);
22485         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
22486         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
22487         CVec_u8Z_free(ret_var);
22488         return ret_arr;
22489 }
22490
22491 uint64_t  __attribute__((export_name("TS_ChannelMonitorUpdate_read"))) TS_ChannelMonitorUpdate_read(int8_tArray ser) {
22492         LDKu8slice ser_ref;
22493         ser_ref.datalen = ser->arr_len;
22494         ser_ref.data = ser->elems;
22495         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
22496         *ret_conv = ChannelMonitorUpdate_read(ser_ref);
22497         FREE(ser);
22498         return tag_ptr(ret_conv, true);
22499 }
22500
22501 void  __attribute__((export_name("TS_MonitorEvent_free"))) TS_MonitorEvent_free(uint64_t this_ptr) {
22502         if (!ptr_is_owned(this_ptr)) return;
22503         void* this_ptr_ptr = untag_ptr(this_ptr);
22504         CHECK_ACCESS(this_ptr_ptr);
22505         LDKMonitorEvent this_ptr_conv = *(LDKMonitorEvent*)(this_ptr_ptr);
22506         FREE(untag_ptr(this_ptr));
22507         MonitorEvent_free(this_ptr_conv);
22508 }
22509
22510 static inline uint64_t MonitorEvent_clone_ptr(LDKMonitorEvent *NONNULL_PTR arg) {
22511         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
22512         *ret_copy = MonitorEvent_clone(arg);
22513         uint64_t ret_ref = tag_ptr(ret_copy, true);
22514         return ret_ref;
22515 }
22516 int64_t  __attribute__((export_name("TS_MonitorEvent_clone_ptr"))) TS_MonitorEvent_clone_ptr(uint64_t arg) {
22517         LDKMonitorEvent* arg_conv = (LDKMonitorEvent*)untag_ptr(arg);
22518         int64_t ret_conv = MonitorEvent_clone_ptr(arg_conv);
22519         return ret_conv;
22520 }
22521
22522 uint64_t  __attribute__((export_name("TS_MonitorEvent_clone"))) TS_MonitorEvent_clone(uint64_t orig) {
22523         LDKMonitorEvent* orig_conv = (LDKMonitorEvent*)untag_ptr(orig);
22524         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
22525         *ret_copy = MonitorEvent_clone(orig_conv);
22526         uint64_t ret_ref = tag_ptr(ret_copy, true);
22527         return ret_ref;
22528 }
22529
22530 uint64_t  __attribute__((export_name("TS_MonitorEvent_htlcevent"))) TS_MonitorEvent_htlcevent(uint64_t a) {
22531         LDKHTLCUpdate a_conv;
22532         a_conv.inner = untag_ptr(a);
22533         a_conv.is_owned = ptr_is_owned(a);
22534         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
22535         a_conv = HTLCUpdate_clone(&a_conv);
22536         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
22537         *ret_copy = MonitorEvent_htlcevent(a_conv);
22538         uint64_t ret_ref = tag_ptr(ret_copy, true);
22539         return ret_ref;
22540 }
22541
22542 uint64_t  __attribute__((export_name("TS_MonitorEvent_commitment_tx_confirmed"))) TS_MonitorEvent_commitment_tx_confirmed(uint64_t a) {
22543         LDKOutPoint a_conv;
22544         a_conv.inner = untag_ptr(a);
22545         a_conv.is_owned = ptr_is_owned(a);
22546         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
22547         a_conv = OutPoint_clone(&a_conv);
22548         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
22549         *ret_copy = MonitorEvent_commitment_tx_confirmed(a_conv);
22550         uint64_t ret_ref = tag_ptr(ret_copy, true);
22551         return ret_ref;
22552 }
22553
22554 uint64_t  __attribute__((export_name("TS_MonitorEvent_update_completed"))) TS_MonitorEvent_update_completed(uint64_t funding_txo, int64_t monitor_update_id) {
22555         LDKOutPoint funding_txo_conv;
22556         funding_txo_conv.inner = untag_ptr(funding_txo);
22557         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
22558         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
22559         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
22560         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
22561         *ret_copy = MonitorEvent_update_completed(funding_txo_conv, monitor_update_id);
22562         uint64_t ret_ref = tag_ptr(ret_copy, true);
22563         return ret_ref;
22564 }
22565
22566 uint64_t  __attribute__((export_name("TS_MonitorEvent_update_failed"))) TS_MonitorEvent_update_failed(uint64_t a) {
22567         LDKOutPoint a_conv;
22568         a_conv.inner = untag_ptr(a);
22569         a_conv.is_owned = ptr_is_owned(a);
22570         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
22571         a_conv = OutPoint_clone(&a_conv);
22572         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
22573         *ret_copy = MonitorEvent_update_failed(a_conv);
22574         uint64_t ret_ref = tag_ptr(ret_copy, true);
22575         return ret_ref;
22576 }
22577
22578 int8_tArray  __attribute__((export_name("TS_MonitorEvent_write"))) TS_MonitorEvent_write(uint64_t obj) {
22579         LDKMonitorEvent* obj_conv = (LDKMonitorEvent*)untag_ptr(obj);
22580         LDKCVec_u8Z ret_var = MonitorEvent_write(obj_conv);
22581         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
22582         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
22583         CVec_u8Z_free(ret_var);
22584         return ret_arr;
22585 }
22586
22587 uint64_t  __attribute__((export_name("TS_MonitorEvent_read"))) TS_MonitorEvent_read(int8_tArray ser) {
22588         LDKu8slice ser_ref;
22589         ser_ref.datalen = ser->arr_len;
22590         ser_ref.data = ser->elems;
22591         LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
22592         *ret_conv = MonitorEvent_read(ser_ref);
22593         FREE(ser);
22594         return tag_ptr(ret_conv, true);
22595 }
22596
22597 void  __attribute__((export_name("TS_HTLCUpdate_free"))) TS_HTLCUpdate_free(uint64_t this_obj) {
22598         LDKHTLCUpdate this_obj_conv;
22599         this_obj_conv.inner = untag_ptr(this_obj);
22600         this_obj_conv.is_owned = ptr_is_owned(this_obj);
22601         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
22602         HTLCUpdate_free(this_obj_conv);
22603 }
22604
22605 static inline uint64_t HTLCUpdate_clone_ptr(LDKHTLCUpdate *NONNULL_PTR arg) {
22606         LDKHTLCUpdate ret_var = HTLCUpdate_clone(arg);
22607         uint64_t ret_ref = 0;
22608         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22609         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
22610         return ret_ref;
22611 }
22612 int64_t  __attribute__((export_name("TS_HTLCUpdate_clone_ptr"))) TS_HTLCUpdate_clone_ptr(uint64_t arg) {
22613         LDKHTLCUpdate arg_conv;
22614         arg_conv.inner = untag_ptr(arg);
22615         arg_conv.is_owned = ptr_is_owned(arg);
22616         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
22617         arg_conv.is_owned = false;
22618         int64_t ret_conv = HTLCUpdate_clone_ptr(&arg_conv);
22619         return ret_conv;
22620 }
22621
22622 uint64_t  __attribute__((export_name("TS_HTLCUpdate_clone"))) TS_HTLCUpdate_clone(uint64_t orig) {
22623         LDKHTLCUpdate orig_conv;
22624         orig_conv.inner = untag_ptr(orig);
22625         orig_conv.is_owned = ptr_is_owned(orig);
22626         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
22627         orig_conv.is_owned = false;
22628         LDKHTLCUpdate ret_var = HTLCUpdate_clone(&orig_conv);
22629         uint64_t ret_ref = 0;
22630         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22631         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
22632         return ret_ref;
22633 }
22634
22635 int8_tArray  __attribute__((export_name("TS_HTLCUpdate_write"))) TS_HTLCUpdate_write(uint64_t obj) {
22636         LDKHTLCUpdate obj_conv;
22637         obj_conv.inner = untag_ptr(obj);
22638         obj_conv.is_owned = ptr_is_owned(obj);
22639         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
22640         obj_conv.is_owned = false;
22641         LDKCVec_u8Z ret_var = HTLCUpdate_write(&obj_conv);
22642         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
22643         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
22644         CVec_u8Z_free(ret_var);
22645         return ret_arr;
22646 }
22647
22648 uint64_t  __attribute__((export_name("TS_HTLCUpdate_read"))) TS_HTLCUpdate_read(int8_tArray ser) {
22649         LDKu8slice ser_ref;
22650         ser_ref.datalen = ser->arr_len;
22651         ser_ref.data = ser->elems;
22652         LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
22653         *ret_conv = HTLCUpdate_read(ser_ref);
22654         FREE(ser);
22655         return tag_ptr(ret_conv, true);
22656 }
22657
22658 void  __attribute__((export_name("TS_Balance_free"))) TS_Balance_free(uint64_t this_ptr) {
22659         if (!ptr_is_owned(this_ptr)) return;
22660         void* this_ptr_ptr = untag_ptr(this_ptr);
22661         CHECK_ACCESS(this_ptr_ptr);
22662         LDKBalance this_ptr_conv = *(LDKBalance*)(this_ptr_ptr);
22663         FREE(untag_ptr(this_ptr));
22664         Balance_free(this_ptr_conv);
22665 }
22666
22667 static inline uint64_t Balance_clone_ptr(LDKBalance *NONNULL_PTR arg) {
22668         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
22669         *ret_copy = Balance_clone(arg);
22670         uint64_t ret_ref = tag_ptr(ret_copy, true);
22671         return ret_ref;
22672 }
22673 int64_t  __attribute__((export_name("TS_Balance_clone_ptr"))) TS_Balance_clone_ptr(uint64_t arg) {
22674         LDKBalance* arg_conv = (LDKBalance*)untag_ptr(arg);
22675         int64_t ret_conv = Balance_clone_ptr(arg_conv);
22676         return ret_conv;
22677 }
22678
22679 uint64_t  __attribute__((export_name("TS_Balance_clone"))) TS_Balance_clone(uint64_t orig) {
22680         LDKBalance* orig_conv = (LDKBalance*)untag_ptr(orig);
22681         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
22682         *ret_copy = Balance_clone(orig_conv);
22683         uint64_t ret_ref = tag_ptr(ret_copy, true);
22684         return ret_ref;
22685 }
22686
22687 uint64_t  __attribute__((export_name("TS_Balance_claimable_on_channel_close"))) TS_Balance_claimable_on_channel_close(int64_t claimable_amount_satoshis) {
22688         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
22689         *ret_copy = Balance_claimable_on_channel_close(claimable_amount_satoshis);
22690         uint64_t ret_ref = tag_ptr(ret_copy, true);
22691         return ret_ref;
22692 }
22693
22694 uint64_t  __attribute__((export_name("TS_Balance_claimable_awaiting_confirmations"))) TS_Balance_claimable_awaiting_confirmations(int64_t claimable_amount_satoshis, int32_t confirmation_height) {
22695         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
22696         *ret_copy = Balance_claimable_awaiting_confirmations(claimable_amount_satoshis, confirmation_height);
22697         uint64_t ret_ref = tag_ptr(ret_copy, true);
22698         return ret_ref;
22699 }
22700
22701 uint64_t  __attribute__((export_name("TS_Balance_contentious_claimable"))) TS_Balance_contentious_claimable(int64_t claimable_amount_satoshis, int32_t timeout_height) {
22702         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
22703         *ret_copy = Balance_contentious_claimable(claimable_amount_satoshis, timeout_height);
22704         uint64_t ret_ref = tag_ptr(ret_copy, true);
22705         return ret_ref;
22706 }
22707
22708 uint64_t  __attribute__((export_name("TS_Balance_maybe_claimable_htlcawaiting_timeout"))) TS_Balance_maybe_claimable_htlcawaiting_timeout(int64_t claimable_amount_satoshis, int32_t claimable_height) {
22709         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
22710         *ret_copy = Balance_maybe_claimable_htlcawaiting_timeout(claimable_amount_satoshis, claimable_height);
22711         uint64_t ret_ref = tag_ptr(ret_copy, true);
22712         return ret_ref;
22713 }
22714
22715 jboolean  __attribute__((export_name("TS_Balance_eq"))) TS_Balance_eq(uint64_t a, uint64_t b) {
22716         LDKBalance* a_conv = (LDKBalance*)untag_ptr(a);
22717         LDKBalance* b_conv = (LDKBalance*)untag_ptr(b);
22718         jboolean ret_conv = Balance_eq(a_conv, b_conv);
22719         return ret_conv;
22720 }
22721
22722 void  __attribute__((export_name("TS_ChannelMonitor_free"))) TS_ChannelMonitor_free(uint64_t this_obj) {
22723         LDKChannelMonitor this_obj_conv;
22724         this_obj_conv.inner = untag_ptr(this_obj);
22725         this_obj_conv.is_owned = ptr_is_owned(this_obj);
22726         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
22727         ChannelMonitor_free(this_obj_conv);
22728 }
22729
22730 static inline uint64_t ChannelMonitor_clone_ptr(LDKChannelMonitor *NONNULL_PTR arg) {
22731         LDKChannelMonitor ret_var = ChannelMonitor_clone(arg);
22732         uint64_t ret_ref = 0;
22733         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22734         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
22735         return ret_ref;
22736 }
22737 int64_t  __attribute__((export_name("TS_ChannelMonitor_clone_ptr"))) TS_ChannelMonitor_clone_ptr(uint64_t arg) {
22738         LDKChannelMonitor arg_conv;
22739         arg_conv.inner = untag_ptr(arg);
22740         arg_conv.is_owned = ptr_is_owned(arg);
22741         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
22742         arg_conv.is_owned = false;
22743         int64_t ret_conv = ChannelMonitor_clone_ptr(&arg_conv);
22744         return ret_conv;
22745 }
22746
22747 uint64_t  __attribute__((export_name("TS_ChannelMonitor_clone"))) TS_ChannelMonitor_clone(uint64_t orig) {
22748         LDKChannelMonitor orig_conv;
22749         orig_conv.inner = untag_ptr(orig);
22750         orig_conv.is_owned = ptr_is_owned(orig);
22751         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
22752         orig_conv.is_owned = false;
22753         LDKChannelMonitor ret_var = ChannelMonitor_clone(&orig_conv);
22754         uint64_t ret_ref = 0;
22755         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22756         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
22757         return ret_ref;
22758 }
22759
22760 int8_tArray  __attribute__((export_name("TS_ChannelMonitor_write"))) TS_ChannelMonitor_write(uint64_t obj) {
22761         LDKChannelMonitor obj_conv;
22762         obj_conv.inner = untag_ptr(obj);
22763         obj_conv.is_owned = ptr_is_owned(obj);
22764         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
22765         obj_conv.is_owned = false;
22766         LDKCVec_u8Z ret_var = ChannelMonitor_write(&obj_conv);
22767         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
22768         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
22769         CVec_u8Z_free(ret_var);
22770         return ret_arr;
22771 }
22772
22773 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) {
22774         LDKChannelMonitor this_arg_conv;
22775         this_arg_conv.inner = untag_ptr(this_arg);
22776         this_arg_conv.is_owned = ptr_is_owned(this_arg);
22777         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
22778         this_arg_conv.is_owned = false;
22779         LDKChannelMonitorUpdate updates_conv;
22780         updates_conv.inner = untag_ptr(updates);
22781         updates_conv.is_owned = ptr_is_owned(updates);
22782         CHECK_INNER_FIELD_ACCESS_OR_NULL(updates_conv);
22783         updates_conv.is_owned = false;
22784         void* broadcaster_ptr = untag_ptr(broadcaster);
22785         if (ptr_is_owned(broadcaster)) { CHECK_ACCESS(broadcaster_ptr); }
22786         LDKBroadcasterInterface* broadcaster_conv = (LDKBroadcasterInterface*)broadcaster_ptr;
22787         void* fee_estimator_ptr = untag_ptr(fee_estimator);
22788         CHECK_ACCESS(fee_estimator_ptr);
22789         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
22790         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
22791                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
22792                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
22793         }
22794         void* logger_ptr = untag_ptr(logger);
22795         if (ptr_is_owned(logger)) { CHECK_ACCESS(logger_ptr); }
22796         LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
22797         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
22798         *ret_conv = ChannelMonitor_update_monitor(&this_arg_conv, &updates_conv, broadcaster_conv, fee_estimator_conv, logger_conv);
22799         return tag_ptr(ret_conv, true);
22800 }
22801
22802 int64_t  __attribute__((export_name("TS_ChannelMonitor_get_latest_update_id"))) TS_ChannelMonitor_get_latest_update_id(uint64_t this_arg) {
22803         LDKChannelMonitor this_arg_conv;
22804         this_arg_conv.inner = untag_ptr(this_arg);
22805         this_arg_conv.is_owned = ptr_is_owned(this_arg);
22806         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
22807         this_arg_conv.is_owned = false;
22808         int64_t ret_conv = ChannelMonitor_get_latest_update_id(&this_arg_conv);
22809         return ret_conv;
22810 }
22811
22812 uint64_t  __attribute__((export_name("TS_ChannelMonitor_get_funding_txo"))) TS_ChannelMonitor_get_funding_txo(uint64_t this_arg) {
22813         LDKChannelMonitor this_arg_conv;
22814         this_arg_conv.inner = untag_ptr(this_arg);
22815         this_arg_conv.is_owned = ptr_is_owned(this_arg);
22816         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
22817         this_arg_conv.is_owned = false;
22818         LDKC2Tuple_OutPointScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
22819         *ret_conv = ChannelMonitor_get_funding_txo(&this_arg_conv);
22820         return tag_ptr(ret_conv, true);
22821 }
22822
22823 uint64_tArray  __attribute__((export_name("TS_ChannelMonitor_get_outputs_to_watch"))) TS_ChannelMonitor_get_outputs_to_watch(uint64_t this_arg) {
22824         LDKChannelMonitor this_arg_conv;
22825         this_arg_conv.inner = untag_ptr(this_arg);
22826         this_arg_conv.is_owned = ptr_is_owned(this_arg);
22827         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
22828         this_arg_conv.is_owned = false;
22829         LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ ret_var = ChannelMonitor_get_outputs_to_watch(&this_arg_conv);
22830         uint64_tArray ret_arr = NULL;
22831         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
22832         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
22833         for (size_t o = 0; o < ret_var.datalen; o++) {
22834                 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_conv_40_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
22835                 *ret_conv_40_conv = ret_var.data[o];
22836                 ret_arr_ptr[o] = tag_ptr(ret_conv_40_conv, true);
22837         }
22838         
22839         FREE(ret_var.data);
22840         return ret_arr;
22841 }
22842
22843 void  __attribute__((export_name("TS_ChannelMonitor_load_outputs_to_watch"))) TS_ChannelMonitor_load_outputs_to_watch(uint64_t this_arg, uint64_t filter) {
22844         LDKChannelMonitor this_arg_conv;
22845         this_arg_conv.inner = untag_ptr(this_arg);
22846         this_arg_conv.is_owned = ptr_is_owned(this_arg);
22847         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
22848         this_arg_conv.is_owned = false;
22849         void* filter_ptr = untag_ptr(filter);
22850         if (ptr_is_owned(filter)) { CHECK_ACCESS(filter_ptr); }
22851         LDKFilter* filter_conv = (LDKFilter*)filter_ptr;
22852         ChannelMonitor_load_outputs_to_watch(&this_arg_conv, filter_conv);
22853 }
22854
22855 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) {
22856         LDKChannelMonitor this_arg_conv;
22857         this_arg_conv.inner = untag_ptr(this_arg);
22858         this_arg_conv.is_owned = ptr_is_owned(this_arg);
22859         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
22860         this_arg_conv.is_owned = false;
22861         LDKCVec_MonitorEventZ ret_var = ChannelMonitor_get_and_clear_pending_monitor_events(&this_arg_conv);
22862         uint64_tArray ret_arr = NULL;
22863         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
22864         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
22865         for (size_t o = 0; o < ret_var.datalen; o++) {
22866                 LDKMonitorEvent *ret_conv_14_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
22867                 *ret_conv_14_copy = ret_var.data[o];
22868                 uint64_t ret_conv_14_ref = tag_ptr(ret_conv_14_copy, true);
22869                 ret_arr_ptr[o] = ret_conv_14_ref;
22870         }
22871         
22872         FREE(ret_var.data);
22873         return ret_arr;
22874 }
22875
22876 uint64_tArray  __attribute__((export_name("TS_ChannelMonitor_get_and_clear_pending_events"))) TS_ChannelMonitor_get_and_clear_pending_events(uint64_t this_arg) {
22877         LDKChannelMonitor this_arg_conv;
22878         this_arg_conv.inner = untag_ptr(this_arg);
22879         this_arg_conv.is_owned = ptr_is_owned(this_arg);
22880         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
22881         this_arg_conv.is_owned = false;
22882         LDKCVec_EventZ ret_var = ChannelMonitor_get_and_clear_pending_events(&this_arg_conv);
22883         uint64_tArray ret_arr = NULL;
22884         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
22885         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
22886         for (size_t h = 0; h < ret_var.datalen; h++) {
22887                 LDKEvent *ret_conv_7_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
22888                 *ret_conv_7_copy = ret_var.data[h];
22889                 uint64_t ret_conv_7_ref = tag_ptr(ret_conv_7_copy, true);
22890                 ret_arr_ptr[h] = ret_conv_7_ref;
22891         }
22892         
22893         FREE(ret_var.data);
22894         return ret_arr;
22895 }
22896
22897 int8_tArray  __attribute__((export_name("TS_ChannelMonitor_get_counterparty_node_id"))) TS_ChannelMonitor_get_counterparty_node_id(uint64_t this_arg) {
22898         LDKChannelMonitor this_arg_conv;
22899         this_arg_conv.inner = untag_ptr(this_arg);
22900         this_arg_conv.is_owned = ptr_is_owned(this_arg);
22901         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
22902         this_arg_conv.is_owned = false;
22903         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
22904         memcpy(ret_arr->elems, ChannelMonitor_get_counterparty_node_id(&this_arg_conv).compressed_form, 33);
22905         return ret_arr;
22906 }
22907
22908 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) {
22909         LDKChannelMonitor this_arg_conv;
22910         this_arg_conv.inner = untag_ptr(this_arg);
22911         this_arg_conv.is_owned = ptr_is_owned(this_arg);
22912         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
22913         this_arg_conv.is_owned = false;
22914         void* logger_ptr = untag_ptr(logger);
22915         if (ptr_is_owned(logger)) { CHECK_ACCESS(logger_ptr); }
22916         LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
22917         LDKCVec_TransactionZ ret_var = ChannelMonitor_get_latest_holder_commitment_txn(&this_arg_conv, logger_conv);
22918         ptrArray ret_arr = NULL;
22919         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
22920         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
22921         for (size_t m = 0; m < ret_var.datalen; m++) {
22922                 LDKTransaction ret_conv_12_var = ret_var.data[m];
22923                 int8_tArray ret_conv_12_arr = init_int8_tArray(ret_conv_12_var.datalen, __LINE__);
22924                 memcpy(ret_conv_12_arr->elems, ret_conv_12_var.data, ret_conv_12_var.datalen);
22925                 Transaction_free(ret_conv_12_var);
22926                 ret_arr_ptr[m] = ret_conv_12_arr;
22927         }
22928         
22929         FREE(ret_var.data);
22930         return ret_arr;
22931 }
22932
22933 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) {
22934         LDKChannelMonitor this_arg_conv;
22935         this_arg_conv.inner = untag_ptr(this_arg);
22936         this_arg_conv.is_owned = ptr_is_owned(this_arg);
22937         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
22938         this_arg_conv.is_owned = false;
22939         unsigned char header_arr[80];
22940         CHECK(header->arr_len == 80);
22941         memcpy(header_arr, header->elems, 80); FREE(header);
22942         unsigned char (*header_ref)[80] = &header_arr;
22943         LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
22944         txdata_constr.datalen = txdata->arr_len;
22945         if (txdata_constr.datalen > 0)
22946                 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
22947         else
22948                 txdata_constr.data = NULL;
22949         uint64_t* txdata_vals = txdata->elems;
22950         for (size_t c = 0; c < txdata_constr.datalen; c++) {
22951                 uint64_t txdata_conv_28 = txdata_vals[c];
22952                 void* txdata_conv_28_ptr = untag_ptr(txdata_conv_28);
22953                 CHECK_ACCESS(txdata_conv_28_ptr);
22954                 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
22955                 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)untag_ptr(txdata_conv_28));
22956                 txdata_constr.data[c] = txdata_conv_28_conv;
22957         }
22958         FREE(txdata);
22959         void* broadcaster_ptr = untag_ptr(broadcaster);
22960         CHECK_ACCESS(broadcaster_ptr);
22961         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
22962         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
22963                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
22964                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
22965         }
22966         void* fee_estimator_ptr = untag_ptr(fee_estimator);
22967         CHECK_ACCESS(fee_estimator_ptr);
22968         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
22969         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
22970                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
22971                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
22972         }
22973         void* logger_ptr = untag_ptr(logger);
22974         CHECK_ACCESS(logger_ptr);
22975         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
22976         if (logger_conv.free == LDKLogger_JCalls_free) {
22977                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
22978                 LDKLogger_JCalls_cloned(&logger_conv);
22979         }
22980         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);
22981         uint64_tArray ret_arr = NULL;
22982         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
22983         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
22984         for (size_t n = 0; n < ret_var.datalen; n++) {
22985                 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv_39_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
22986                 *ret_conv_39_conv = ret_var.data[n];
22987                 ret_arr_ptr[n] = tag_ptr(ret_conv_39_conv, true);
22988         }
22989         
22990         FREE(ret_var.data);
22991         return ret_arr;
22992 }
22993
22994 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) {
22995         LDKChannelMonitor this_arg_conv;
22996         this_arg_conv.inner = untag_ptr(this_arg);
22997         this_arg_conv.is_owned = ptr_is_owned(this_arg);
22998         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
22999         this_arg_conv.is_owned = false;
23000         unsigned char header_arr[80];
23001         CHECK(header->arr_len == 80);
23002         memcpy(header_arr, header->elems, 80); FREE(header);
23003         unsigned char (*header_ref)[80] = &header_arr;
23004         void* broadcaster_ptr = untag_ptr(broadcaster);
23005         CHECK_ACCESS(broadcaster_ptr);
23006         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
23007         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
23008                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
23009                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
23010         }
23011         void* fee_estimator_ptr = untag_ptr(fee_estimator);
23012         CHECK_ACCESS(fee_estimator_ptr);
23013         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
23014         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
23015                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
23016                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
23017         }
23018         void* logger_ptr = untag_ptr(logger);
23019         CHECK_ACCESS(logger_ptr);
23020         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
23021         if (logger_conv.free == LDKLogger_JCalls_free) {
23022                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
23023                 LDKLogger_JCalls_cloned(&logger_conv);
23024         }
23025         ChannelMonitor_block_disconnected(&this_arg_conv, header_ref, height, broadcaster_conv, fee_estimator_conv, logger_conv);
23026 }
23027
23028 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) {
23029         LDKChannelMonitor this_arg_conv;
23030         this_arg_conv.inner = untag_ptr(this_arg);
23031         this_arg_conv.is_owned = ptr_is_owned(this_arg);
23032         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
23033         this_arg_conv.is_owned = false;
23034         unsigned char header_arr[80];
23035         CHECK(header->arr_len == 80);
23036         memcpy(header_arr, header->elems, 80); FREE(header);
23037         unsigned char (*header_ref)[80] = &header_arr;
23038         LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
23039         txdata_constr.datalen = txdata->arr_len;
23040         if (txdata_constr.datalen > 0)
23041                 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
23042         else
23043                 txdata_constr.data = NULL;
23044         uint64_t* txdata_vals = txdata->elems;
23045         for (size_t c = 0; c < txdata_constr.datalen; c++) {
23046                 uint64_t txdata_conv_28 = txdata_vals[c];
23047                 void* txdata_conv_28_ptr = untag_ptr(txdata_conv_28);
23048                 CHECK_ACCESS(txdata_conv_28_ptr);
23049                 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
23050                 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)untag_ptr(txdata_conv_28));
23051                 txdata_constr.data[c] = txdata_conv_28_conv;
23052         }
23053         FREE(txdata);
23054         void* broadcaster_ptr = untag_ptr(broadcaster);
23055         CHECK_ACCESS(broadcaster_ptr);
23056         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
23057         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
23058                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
23059                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
23060         }
23061         void* fee_estimator_ptr = untag_ptr(fee_estimator);
23062         CHECK_ACCESS(fee_estimator_ptr);
23063         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
23064         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
23065                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
23066                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
23067         }
23068         void* logger_ptr = untag_ptr(logger);
23069         CHECK_ACCESS(logger_ptr);
23070         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
23071         if (logger_conv.free == LDKLogger_JCalls_free) {
23072                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
23073                 LDKLogger_JCalls_cloned(&logger_conv);
23074         }
23075         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);
23076         uint64_tArray ret_arr = NULL;
23077         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
23078         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
23079         for (size_t n = 0; n < ret_var.datalen; n++) {
23080                 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv_39_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
23081                 *ret_conv_39_conv = ret_var.data[n];
23082                 ret_arr_ptr[n] = tag_ptr(ret_conv_39_conv, true);
23083         }
23084         
23085         FREE(ret_var.data);
23086         return ret_arr;
23087 }
23088
23089 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) {
23090         LDKChannelMonitor this_arg_conv;
23091         this_arg_conv.inner = untag_ptr(this_arg);
23092         this_arg_conv.is_owned = ptr_is_owned(this_arg);
23093         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
23094         this_arg_conv.is_owned = false;
23095         unsigned char txid_arr[32];
23096         CHECK(txid->arr_len == 32);
23097         memcpy(txid_arr, txid->elems, 32); FREE(txid);
23098         unsigned char (*txid_ref)[32] = &txid_arr;
23099         void* broadcaster_ptr = untag_ptr(broadcaster);
23100         CHECK_ACCESS(broadcaster_ptr);
23101         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
23102         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
23103                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
23104                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
23105         }
23106         void* fee_estimator_ptr = untag_ptr(fee_estimator);
23107         CHECK_ACCESS(fee_estimator_ptr);
23108         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
23109         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
23110                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
23111                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
23112         }
23113         void* logger_ptr = untag_ptr(logger);
23114         CHECK_ACCESS(logger_ptr);
23115         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
23116         if (logger_conv.free == LDKLogger_JCalls_free) {
23117                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
23118                 LDKLogger_JCalls_cloned(&logger_conv);
23119         }
23120         ChannelMonitor_transaction_unconfirmed(&this_arg_conv, txid_ref, broadcaster_conv, fee_estimator_conv, logger_conv);
23121 }
23122
23123 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) {
23124         LDKChannelMonitor this_arg_conv;
23125         this_arg_conv.inner = untag_ptr(this_arg);
23126         this_arg_conv.is_owned = ptr_is_owned(this_arg);
23127         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
23128         this_arg_conv.is_owned = false;
23129         unsigned char header_arr[80];
23130         CHECK(header->arr_len == 80);
23131         memcpy(header_arr, header->elems, 80); FREE(header);
23132         unsigned char (*header_ref)[80] = &header_arr;
23133         void* broadcaster_ptr = untag_ptr(broadcaster);
23134         CHECK_ACCESS(broadcaster_ptr);
23135         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
23136         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
23137                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
23138                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
23139         }
23140         void* fee_estimator_ptr = untag_ptr(fee_estimator);
23141         CHECK_ACCESS(fee_estimator_ptr);
23142         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
23143         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
23144                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
23145                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
23146         }
23147         void* logger_ptr = untag_ptr(logger);
23148         CHECK_ACCESS(logger_ptr);
23149         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
23150         if (logger_conv.free == LDKLogger_JCalls_free) {
23151                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
23152                 LDKLogger_JCalls_cloned(&logger_conv);
23153         }
23154         LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ ret_var = ChannelMonitor_best_block_updated(&this_arg_conv, header_ref, height, broadcaster_conv, fee_estimator_conv, logger_conv);
23155         uint64_tArray ret_arr = NULL;
23156         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
23157         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
23158         for (size_t n = 0; n < ret_var.datalen; n++) {
23159                 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv_39_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
23160                 *ret_conv_39_conv = ret_var.data[n];
23161                 ret_arr_ptr[n] = tag_ptr(ret_conv_39_conv, true);
23162         }
23163         
23164         FREE(ret_var.data);
23165         return ret_arr;
23166 }
23167
23168 ptrArray  __attribute__((export_name("TS_ChannelMonitor_get_relevant_txids"))) TS_ChannelMonitor_get_relevant_txids(uint64_t this_arg) {
23169         LDKChannelMonitor this_arg_conv;
23170         this_arg_conv.inner = untag_ptr(this_arg);
23171         this_arg_conv.is_owned = ptr_is_owned(this_arg);
23172         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
23173         this_arg_conv.is_owned = false;
23174         LDKCVec_TxidZ ret_var = ChannelMonitor_get_relevant_txids(&this_arg_conv);
23175         ptrArray ret_arr = NULL;
23176         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
23177         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
23178         for (size_t m = 0; m < ret_var.datalen; m++) {
23179                 int8_tArray ret_conv_12_arr = init_int8_tArray(32, __LINE__);
23180                 memcpy(ret_conv_12_arr->elems, ret_var.data[m].data, 32);
23181                 ret_arr_ptr[m] = ret_conv_12_arr;
23182         }
23183         
23184         FREE(ret_var.data);
23185         return ret_arr;
23186 }
23187
23188 uint64_t  __attribute__((export_name("TS_ChannelMonitor_current_best_block"))) TS_ChannelMonitor_current_best_block(uint64_t this_arg) {
23189         LDKChannelMonitor this_arg_conv;
23190         this_arg_conv.inner = untag_ptr(this_arg);
23191         this_arg_conv.is_owned = ptr_is_owned(this_arg);
23192         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
23193         this_arg_conv.is_owned = false;
23194         LDKBestBlock ret_var = ChannelMonitor_current_best_block(&this_arg_conv);
23195         uint64_t ret_ref = 0;
23196         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23197         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
23198         return ret_ref;
23199 }
23200
23201 uint64_tArray  __attribute__((export_name("TS_ChannelMonitor_get_claimable_balances"))) TS_ChannelMonitor_get_claimable_balances(uint64_t this_arg) {
23202         LDKChannelMonitor this_arg_conv;
23203         this_arg_conv.inner = untag_ptr(this_arg);
23204         this_arg_conv.is_owned = ptr_is_owned(this_arg);
23205         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
23206         this_arg_conv.is_owned = false;
23207         LDKCVec_BalanceZ ret_var = ChannelMonitor_get_claimable_balances(&this_arg_conv);
23208         uint64_tArray ret_arr = NULL;
23209         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
23210         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
23211         for (size_t j = 0; j < ret_var.datalen; j++) {
23212                 LDKBalance *ret_conv_9_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
23213                 *ret_conv_9_copy = ret_var.data[j];
23214                 uint64_t ret_conv_9_ref = tag_ptr(ret_conv_9_copy, true);
23215                 ret_arr_ptr[j] = ret_conv_9_ref;
23216         }
23217         
23218         FREE(ret_var.data);
23219         return ret_arr;
23220 }
23221
23222 uint64_t  __attribute__((export_name("TS_C2Tuple_BlockHashChannelMonitorZ_read"))) TS_C2Tuple_BlockHashChannelMonitorZ_read(int8_tArray ser, uint64_t arg) {
23223         LDKu8slice ser_ref;
23224         ser_ref.datalen = ser->arr_len;
23225         ser_ref.data = ser->elems;
23226         void* arg_ptr = untag_ptr(arg);
23227         if (ptr_is_owned(arg)) { CHECK_ACCESS(arg_ptr); }
23228         LDKKeysInterface* arg_conv = (LDKKeysInterface*)arg_ptr;
23229         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
23230         *ret_conv = C2Tuple_BlockHashChannelMonitorZ_read(ser_ref, arg_conv);
23231         FREE(ser);
23232         return tag_ptr(ret_conv, true);
23233 }
23234
23235 void  __attribute__((export_name("TS_OutPoint_free"))) TS_OutPoint_free(uint64_t this_obj) {
23236         LDKOutPoint this_obj_conv;
23237         this_obj_conv.inner = untag_ptr(this_obj);
23238         this_obj_conv.is_owned = ptr_is_owned(this_obj);
23239         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
23240         OutPoint_free(this_obj_conv);
23241 }
23242
23243 int8_tArray  __attribute__((export_name("TS_OutPoint_get_txid"))) TS_OutPoint_get_txid(uint64_t this_ptr) {
23244         LDKOutPoint this_ptr_conv;
23245         this_ptr_conv.inner = untag_ptr(this_ptr);
23246         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23247         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23248         this_ptr_conv.is_owned = false;
23249         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
23250         memcpy(ret_arr->elems, *OutPoint_get_txid(&this_ptr_conv), 32);
23251         return ret_arr;
23252 }
23253
23254 void  __attribute__((export_name("TS_OutPoint_set_txid"))) TS_OutPoint_set_txid(uint64_t this_ptr, int8_tArray val) {
23255         LDKOutPoint this_ptr_conv;
23256         this_ptr_conv.inner = untag_ptr(this_ptr);
23257         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23258         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23259         this_ptr_conv.is_owned = false;
23260         LDKThirtyTwoBytes val_ref;
23261         CHECK(val->arr_len == 32);
23262         memcpy(val_ref.data, val->elems, 32); FREE(val);
23263         OutPoint_set_txid(&this_ptr_conv, val_ref);
23264 }
23265
23266 int16_t  __attribute__((export_name("TS_OutPoint_get_index"))) TS_OutPoint_get_index(uint64_t this_ptr) {
23267         LDKOutPoint this_ptr_conv;
23268         this_ptr_conv.inner = untag_ptr(this_ptr);
23269         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23270         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23271         this_ptr_conv.is_owned = false;
23272         int16_t ret_conv = OutPoint_get_index(&this_ptr_conv);
23273         return ret_conv;
23274 }
23275
23276 void  __attribute__((export_name("TS_OutPoint_set_index"))) TS_OutPoint_set_index(uint64_t this_ptr, int16_t val) {
23277         LDKOutPoint this_ptr_conv;
23278         this_ptr_conv.inner = untag_ptr(this_ptr);
23279         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23280         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23281         this_ptr_conv.is_owned = false;
23282         OutPoint_set_index(&this_ptr_conv, val);
23283 }
23284
23285 uint64_t  __attribute__((export_name("TS_OutPoint_new"))) TS_OutPoint_new(int8_tArray txid_arg, int16_t index_arg) {
23286         LDKThirtyTwoBytes txid_arg_ref;
23287         CHECK(txid_arg->arr_len == 32);
23288         memcpy(txid_arg_ref.data, txid_arg->elems, 32); FREE(txid_arg);
23289         LDKOutPoint ret_var = OutPoint_new(txid_arg_ref, index_arg);
23290         uint64_t ret_ref = 0;
23291         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23292         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
23293         return ret_ref;
23294 }
23295
23296 static inline uint64_t OutPoint_clone_ptr(LDKOutPoint *NONNULL_PTR arg) {
23297         LDKOutPoint ret_var = OutPoint_clone(arg);
23298         uint64_t ret_ref = 0;
23299         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23300         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
23301         return ret_ref;
23302 }
23303 int64_t  __attribute__((export_name("TS_OutPoint_clone_ptr"))) TS_OutPoint_clone_ptr(uint64_t arg) {
23304         LDKOutPoint arg_conv;
23305         arg_conv.inner = untag_ptr(arg);
23306         arg_conv.is_owned = ptr_is_owned(arg);
23307         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
23308         arg_conv.is_owned = false;
23309         int64_t ret_conv = OutPoint_clone_ptr(&arg_conv);
23310         return ret_conv;
23311 }
23312
23313 uint64_t  __attribute__((export_name("TS_OutPoint_clone"))) TS_OutPoint_clone(uint64_t orig) {
23314         LDKOutPoint orig_conv;
23315         orig_conv.inner = untag_ptr(orig);
23316         orig_conv.is_owned = ptr_is_owned(orig);
23317         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
23318         orig_conv.is_owned = false;
23319         LDKOutPoint ret_var = OutPoint_clone(&orig_conv);
23320         uint64_t ret_ref = 0;
23321         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23322         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
23323         return ret_ref;
23324 }
23325
23326 jboolean  __attribute__((export_name("TS_OutPoint_eq"))) TS_OutPoint_eq(uint64_t a, uint64_t b) {
23327         LDKOutPoint a_conv;
23328         a_conv.inner = untag_ptr(a);
23329         a_conv.is_owned = ptr_is_owned(a);
23330         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
23331         a_conv.is_owned = false;
23332         LDKOutPoint b_conv;
23333         b_conv.inner = untag_ptr(b);
23334         b_conv.is_owned = ptr_is_owned(b);
23335         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
23336         b_conv.is_owned = false;
23337         jboolean ret_conv = OutPoint_eq(&a_conv, &b_conv);
23338         return ret_conv;
23339 }
23340
23341 int64_t  __attribute__((export_name("TS_OutPoint_hash"))) TS_OutPoint_hash(uint64_t o) {
23342         LDKOutPoint o_conv;
23343         o_conv.inner = untag_ptr(o);
23344         o_conv.is_owned = ptr_is_owned(o);
23345         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23346         o_conv.is_owned = false;
23347         int64_t ret_conv = OutPoint_hash(&o_conv);
23348         return ret_conv;
23349 }
23350
23351 int8_tArray  __attribute__((export_name("TS_OutPoint_to_channel_id"))) TS_OutPoint_to_channel_id(uint64_t this_arg) {
23352         LDKOutPoint this_arg_conv;
23353         this_arg_conv.inner = untag_ptr(this_arg);
23354         this_arg_conv.is_owned = ptr_is_owned(this_arg);
23355         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
23356         this_arg_conv.is_owned = false;
23357         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
23358         memcpy(ret_arr->elems, OutPoint_to_channel_id(&this_arg_conv).data, 32);
23359         return ret_arr;
23360 }
23361
23362 int8_tArray  __attribute__((export_name("TS_OutPoint_write"))) TS_OutPoint_write(uint64_t obj) {
23363         LDKOutPoint obj_conv;
23364         obj_conv.inner = untag_ptr(obj);
23365         obj_conv.is_owned = ptr_is_owned(obj);
23366         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
23367         obj_conv.is_owned = false;
23368         LDKCVec_u8Z ret_var = OutPoint_write(&obj_conv);
23369         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
23370         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
23371         CVec_u8Z_free(ret_var);
23372         return ret_arr;
23373 }
23374
23375 uint64_t  __attribute__((export_name("TS_OutPoint_read"))) TS_OutPoint_read(int8_tArray ser) {
23376         LDKu8slice ser_ref;
23377         ser_ref.datalen = ser->arr_len;
23378         ser_ref.data = ser->elems;
23379         LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
23380         *ret_conv = OutPoint_read(ser_ref);
23381         FREE(ser);
23382         return tag_ptr(ret_conv, true);
23383 }
23384
23385 void  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_free"))) TS_DelayedPaymentOutputDescriptor_free(uint64_t this_obj) {
23386         LDKDelayedPaymentOutputDescriptor this_obj_conv;
23387         this_obj_conv.inner = untag_ptr(this_obj);
23388         this_obj_conv.is_owned = ptr_is_owned(this_obj);
23389         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
23390         DelayedPaymentOutputDescriptor_free(this_obj_conv);
23391 }
23392
23393 uint64_t  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_get_outpoint"))) TS_DelayedPaymentOutputDescriptor_get_outpoint(uint64_t this_ptr) {
23394         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
23395         this_ptr_conv.inner = untag_ptr(this_ptr);
23396         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23397         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23398         this_ptr_conv.is_owned = false;
23399         LDKOutPoint ret_var = DelayedPaymentOutputDescriptor_get_outpoint(&this_ptr_conv);
23400         uint64_t ret_ref = 0;
23401         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23402         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
23403         return ret_ref;
23404 }
23405
23406 void  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_set_outpoint"))) TS_DelayedPaymentOutputDescriptor_set_outpoint(uint64_t this_ptr, uint64_t val) {
23407         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
23408         this_ptr_conv.inner = untag_ptr(this_ptr);
23409         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23410         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23411         this_ptr_conv.is_owned = false;
23412         LDKOutPoint val_conv;
23413         val_conv.inner = untag_ptr(val);
23414         val_conv.is_owned = ptr_is_owned(val);
23415         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
23416         val_conv = OutPoint_clone(&val_conv);
23417         DelayedPaymentOutputDescriptor_set_outpoint(&this_ptr_conv, val_conv);
23418 }
23419
23420 int8_tArray  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_get_per_commitment_point"))) TS_DelayedPaymentOutputDescriptor_get_per_commitment_point(uint64_t this_ptr) {
23421         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
23422         this_ptr_conv.inner = untag_ptr(this_ptr);
23423         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23424         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23425         this_ptr_conv.is_owned = false;
23426         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
23427         memcpy(ret_arr->elems, DelayedPaymentOutputDescriptor_get_per_commitment_point(&this_ptr_conv).compressed_form, 33);
23428         return ret_arr;
23429 }
23430
23431 void  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_set_per_commitment_point"))) TS_DelayedPaymentOutputDescriptor_set_per_commitment_point(uint64_t this_ptr, int8_tArray val) {
23432         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
23433         this_ptr_conv.inner = untag_ptr(this_ptr);
23434         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23435         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23436         this_ptr_conv.is_owned = false;
23437         LDKPublicKey val_ref;
23438         CHECK(val->arr_len == 33);
23439         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
23440         DelayedPaymentOutputDescriptor_set_per_commitment_point(&this_ptr_conv, val_ref);
23441 }
23442
23443 int16_t  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_get_to_self_delay"))) TS_DelayedPaymentOutputDescriptor_get_to_self_delay(uint64_t this_ptr) {
23444         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
23445         this_ptr_conv.inner = untag_ptr(this_ptr);
23446         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23447         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23448         this_ptr_conv.is_owned = false;
23449         int16_t ret_conv = DelayedPaymentOutputDescriptor_get_to_self_delay(&this_ptr_conv);
23450         return ret_conv;
23451 }
23452
23453 void  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_set_to_self_delay"))) TS_DelayedPaymentOutputDescriptor_set_to_self_delay(uint64_t this_ptr, int16_t val) {
23454         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
23455         this_ptr_conv.inner = untag_ptr(this_ptr);
23456         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23457         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23458         this_ptr_conv.is_owned = false;
23459         DelayedPaymentOutputDescriptor_set_to_self_delay(&this_ptr_conv, val);
23460 }
23461
23462 uint64_t  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_get_output"))) TS_DelayedPaymentOutputDescriptor_get_output(uint64_t this_ptr) {
23463         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
23464         this_ptr_conv.inner = untag_ptr(this_ptr);
23465         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23466         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23467         this_ptr_conv.is_owned = false;
23468         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
23469         *ret_ref = DelayedPaymentOutputDescriptor_get_output(&this_ptr_conv);
23470         return tag_ptr(ret_ref, true);
23471 }
23472
23473 void  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_set_output"))) TS_DelayedPaymentOutputDescriptor_set_output(uint64_t this_ptr, uint64_t val) {
23474         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
23475         this_ptr_conv.inner = untag_ptr(this_ptr);
23476         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23477         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23478         this_ptr_conv.is_owned = false;
23479         void* val_ptr = untag_ptr(val);
23480         CHECK_ACCESS(val_ptr);
23481         LDKTxOut val_conv = *(LDKTxOut*)(val_ptr);
23482         val_conv = TxOut_clone((LDKTxOut*)untag_ptr(val));
23483         DelayedPaymentOutputDescriptor_set_output(&this_ptr_conv, val_conv);
23484 }
23485
23486 int8_tArray  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_get_revocation_pubkey"))) TS_DelayedPaymentOutputDescriptor_get_revocation_pubkey(uint64_t this_ptr) {
23487         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
23488         this_ptr_conv.inner = untag_ptr(this_ptr);
23489         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23490         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23491         this_ptr_conv.is_owned = false;
23492         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
23493         memcpy(ret_arr->elems, DelayedPaymentOutputDescriptor_get_revocation_pubkey(&this_ptr_conv).compressed_form, 33);
23494         return ret_arr;
23495 }
23496
23497 void  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_set_revocation_pubkey"))) TS_DelayedPaymentOutputDescriptor_set_revocation_pubkey(uint64_t this_ptr, int8_tArray val) {
23498         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
23499         this_ptr_conv.inner = untag_ptr(this_ptr);
23500         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23501         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23502         this_ptr_conv.is_owned = false;
23503         LDKPublicKey val_ref;
23504         CHECK(val->arr_len == 33);
23505         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
23506         DelayedPaymentOutputDescriptor_set_revocation_pubkey(&this_ptr_conv, val_ref);
23507 }
23508
23509 int8_tArray  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_get_channel_keys_id"))) TS_DelayedPaymentOutputDescriptor_get_channel_keys_id(uint64_t this_ptr) {
23510         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
23511         this_ptr_conv.inner = untag_ptr(this_ptr);
23512         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23513         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23514         this_ptr_conv.is_owned = false;
23515         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
23516         memcpy(ret_arr->elems, *DelayedPaymentOutputDescriptor_get_channel_keys_id(&this_ptr_conv), 32);
23517         return ret_arr;
23518 }
23519
23520 void  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_set_channel_keys_id"))) TS_DelayedPaymentOutputDescriptor_set_channel_keys_id(uint64_t this_ptr, int8_tArray val) {
23521         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
23522         this_ptr_conv.inner = untag_ptr(this_ptr);
23523         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23524         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23525         this_ptr_conv.is_owned = false;
23526         LDKThirtyTwoBytes val_ref;
23527         CHECK(val->arr_len == 32);
23528         memcpy(val_ref.data, val->elems, 32); FREE(val);
23529         DelayedPaymentOutputDescriptor_set_channel_keys_id(&this_ptr_conv, val_ref);
23530 }
23531
23532 int64_t  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_get_channel_value_satoshis"))) TS_DelayedPaymentOutputDescriptor_get_channel_value_satoshis(uint64_t this_ptr) {
23533         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
23534         this_ptr_conv.inner = untag_ptr(this_ptr);
23535         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23536         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23537         this_ptr_conv.is_owned = false;
23538         int64_t ret_conv = DelayedPaymentOutputDescriptor_get_channel_value_satoshis(&this_ptr_conv);
23539         return ret_conv;
23540 }
23541
23542 void  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_set_channel_value_satoshis"))) TS_DelayedPaymentOutputDescriptor_set_channel_value_satoshis(uint64_t this_ptr, int64_t val) {
23543         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
23544         this_ptr_conv.inner = untag_ptr(this_ptr);
23545         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23546         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23547         this_ptr_conv.is_owned = false;
23548         DelayedPaymentOutputDescriptor_set_channel_value_satoshis(&this_ptr_conv, val);
23549 }
23550
23551 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) {
23552         LDKOutPoint outpoint_arg_conv;
23553         outpoint_arg_conv.inner = untag_ptr(outpoint_arg);
23554         outpoint_arg_conv.is_owned = ptr_is_owned(outpoint_arg);
23555         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
23556         outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
23557         LDKPublicKey per_commitment_point_arg_ref;
23558         CHECK(per_commitment_point_arg->arr_len == 33);
23559         memcpy(per_commitment_point_arg_ref.compressed_form, per_commitment_point_arg->elems, 33); FREE(per_commitment_point_arg);
23560         void* output_arg_ptr = untag_ptr(output_arg);
23561         CHECK_ACCESS(output_arg_ptr);
23562         LDKTxOut output_arg_conv = *(LDKTxOut*)(output_arg_ptr);
23563         output_arg_conv = TxOut_clone((LDKTxOut*)untag_ptr(output_arg));
23564         LDKPublicKey revocation_pubkey_arg_ref;
23565         CHECK(revocation_pubkey_arg->arr_len == 33);
23566         memcpy(revocation_pubkey_arg_ref.compressed_form, revocation_pubkey_arg->elems, 33); FREE(revocation_pubkey_arg);
23567         LDKThirtyTwoBytes channel_keys_id_arg_ref;
23568         CHECK(channel_keys_id_arg->arr_len == 32);
23569         memcpy(channel_keys_id_arg_ref.data, channel_keys_id_arg->elems, 32); FREE(channel_keys_id_arg);
23570         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);
23571         uint64_t ret_ref = 0;
23572         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23573         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
23574         return ret_ref;
23575 }
23576
23577 static inline uint64_t DelayedPaymentOutputDescriptor_clone_ptr(LDKDelayedPaymentOutputDescriptor *NONNULL_PTR arg) {
23578         LDKDelayedPaymentOutputDescriptor ret_var = DelayedPaymentOutputDescriptor_clone(arg);
23579         uint64_t ret_ref = 0;
23580         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23581         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
23582         return ret_ref;
23583 }
23584 int64_t  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_clone_ptr"))) TS_DelayedPaymentOutputDescriptor_clone_ptr(uint64_t arg) {
23585         LDKDelayedPaymentOutputDescriptor arg_conv;
23586         arg_conv.inner = untag_ptr(arg);
23587         arg_conv.is_owned = ptr_is_owned(arg);
23588         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
23589         arg_conv.is_owned = false;
23590         int64_t ret_conv = DelayedPaymentOutputDescriptor_clone_ptr(&arg_conv);
23591         return ret_conv;
23592 }
23593
23594 uint64_t  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_clone"))) TS_DelayedPaymentOutputDescriptor_clone(uint64_t orig) {
23595         LDKDelayedPaymentOutputDescriptor orig_conv;
23596         orig_conv.inner = untag_ptr(orig);
23597         orig_conv.is_owned = ptr_is_owned(orig);
23598         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
23599         orig_conv.is_owned = false;
23600         LDKDelayedPaymentOutputDescriptor ret_var = DelayedPaymentOutputDescriptor_clone(&orig_conv);
23601         uint64_t ret_ref = 0;
23602         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23603         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
23604         return ret_ref;
23605 }
23606
23607 int8_tArray  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_write"))) TS_DelayedPaymentOutputDescriptor_write(uint64_t obj) {
23608         LDKDelayedPaymentOutputDescriptor obj_conv;
23609         obj_conv.inner = untag_ptr(obj);
23610         obj_conv.is_owned = ptr_is_owned(obj);
23611         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
23612         obj_conv.is_owned = false;
23613         LDKCVec_u8Z ret_var = DelayedPaymentOutputDescriptor_write(&obj_conv);
23614         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
23615         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
23616         CVec_u8Z_free(ret_var);
23617         return ret_arr;
23618 }
23619
23620 uint64_t  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_read"))) TS_DelayedPaymentOutputDescriptor_read(int8_tArray ser) {
23621         LDKu8slice ser_ref;
23622         ser_ref.datalen = ser->arr_len;
23623         ser_ref.data = ser->elems;
23624         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
23625         *ret_conv = DelayedPaymentOutputDescriptor_read(ser_ref);
23626         FREE(ser);
23627         return tag_ptr(ret_conv, true);
23628 }
23629
23630 void  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_free"))) TS_StaticPaymentOutputDescriptor_free(uint64_t this_obj) {
23631         LDKStaticPaymentOutputDescriptor this_obj_conv;
23632         this_obj_conv.inner = untag_ptr(this_obj);
23633         this_obj_conv.is_owned = ptr_is_owned(this_obj);
23634         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
23635         StaticPaymentOutputDescriptor_free(this_obj_conv);
23636 }
23637
23638 uint64_t  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_get_outpoint"))) TS_StaticPaymentOutputDescriptor_get_outpoint(uint64_t this_ptr) {
23639         LDKStaticPaymentOutputDescriptor this_ptr_conv;
23640         this_ptr_conv.inner = untag_ptr(this_ptr);
23641         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23642         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23643         this_ptr_conv.is_owned = false;
23644         LDKOutPoint ret_var = StaticPaymentOutputDescriptor_get_outpoint(&this_ptr_conv);
23645         uint64_t ret_ref = 0;
23646         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23647         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
23648         return ret_ref;
23649 }
23650
23651 void  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_set_outpoint"))) TS_StaticPaymentOutputDescriptor_set_outpoint(uint64_t this_ptr, uint64_t val) {
23652         LDKStaticPaymentOutputDescriptor this_ptr_conv;
23653         this_ptr_conv.inner = untag_ptr(this_ptr);
23654         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23655         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23656         this_ptr_conv.is_owned = false;
23657         LDKOutPoint val_conv;
23658         val_conv.inner = untag_ptr(val);
23659         val_conv.is_owned = ptr_is_owned(val);
23660         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
23661         val_conv = OutPoint_clone(&val_conv);
23662         StaticPaymentOutputDescriptor_set_outpoint(&this_ptr_conv, val_conv);
23663 }
23664
23665 uint64_t  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_get_output"))) TS_StaticPaymentOutputDescriptor_get_output(uint64_t this_ptr) {
23666         LDKStaticPaymentOutputDescriptor this_ptr_conv;
23667         this_ptr_conv.inner = untag_ptr(this_ptr);
23668         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23669         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23670         this_ptr_conv.is_owned = false;
23671         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
23672         *ret_ref = StaticPaymentOutputDescriptor_get_output(&this_ptr_conv);
23673         return tag_ptr(ret_ref, true);
23674 }
23675
23676 void  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_set_output"))) TS_StaticPaymentOutputDescriptor_set_output(uint64_t this_ptr, uint64_t val) {
23677         LDKStaticPaymentOutputDescriptor this_ptr_conv;
23678         this_ptr_conv.inner = untag_ptr(this_ptr);
23679         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23680         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23681         this_ptr_conv.is_owned = false;
23682         void* val_ptr = untag_ptr(val);
23683         CHECK_ACCESS(val_ptr);
23684         LDKTxOut val_conv = *(LDKTxOut*)(val_ptr);
23685         val_conv = TxOut_clone((LDKTxOut*)untag_ptr(val));
23686         StaticPaymentOutputDescriptor_set_output(&this_ptr_conv, val_conv);
23687 }
23688
23689 int8_tArray  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_get_channel_keys_id"))) TS_StaticPaymentOutputDescriptor_get_channel_keys_id(uint64_t this_ptr) {
23690         LDKStaticPaymentOutputDescriptor this_ptr_conv;
23691         this_ptr_conv.inner = untag_ptr(this_ptr);
23692         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23693         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23694         this_ptr_conv.is_owned = false;
23695         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
23696         memcpy(ret_arr->elems, *StaticPaymentOutputDescriptor_get_channel_keys_id(&this_ptr_conv), 32);
23697         return ret_arr;
23698 }
23699
23700 void  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_set_channel_keys_id"))) TS_StaticPaymentOutputDescriptor_set_channel_keys_id(uint64_t this_ptr, int8_tArray val) {
23701         LDKStaticPaymentOutputDescriptor this_ptr_conv;
23702         this_ptr_conv.inner = untag_ptr(this_ptr);
23703         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23704         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23705         this_ptr_conv.is_owned = false;
23706         LDKThirtyTwoBytes val_ref;
23707         CHECK(val->arr_len == 32);
23708         memcpy(val_ref.data, val->elems, 32); FREE(val);
23709         StaticPaymentOutputDescriptor_set_channel_keys_id(&this_ptr_conv, val_ref);
23710 }
23711
23712 int64_t  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_get_channel_value_satoshis"))) TS_StaticPaymentOutputDescriptor_get_channel_value_satoshis(uint64_t this_ptr) {
23713         LDKStaticPaymentOutputDescriptor this_ptr_conv;
23714         this_ptr_conv.inner = untag_ptr(this_ptr);
23715         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23716         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23717         this_ptr_conv.is_owned = false;
23718         int64_t ret_conv = StaticPaymentOutputDescriptor_get_channel_value_satoshis(&this_ptr_conv);
23719         return ret_conv;
23720 }
23721
23722 void  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_set_channel_value_satoshis"))) TS_StaticPaymentOutputDescriptor_set_channel_value_satoshis(uint64_t this_ptr, int64_t val) {
23723         LDKStaticPaymentOutputDescriptor this_ptr_conv;
23724         this_ptr_conv.inner = untag_ptr(this_ptr);
23725         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23726         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23727         this_ptr_conv.is_owned = false;
23728         StaticPaymentOutputDescriptor_set_channel_value_satoshis(&this_ptr_conv, val);
23729 }
23730
23731 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) {
23732         LDKOutPoint outpoint_arg_conv;
23733         outpoint_arg_conv.inner = untag_ptr(outpoint_arg);
23734         outpoint_arg_conv.is_owned = ptr_is_owned(outpoint_arg);
23735         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
23736         outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
23737         void* output_arg_ptr = untag_ptr(output_arg);
23738         CHECK_ACCESS(output_arg_ptr);
23739         LDKTxOut output_arg_conv = *(LDKTxOut*)(output_arg_ptr);
23740         output_arg_conv = TxOut_clone((LDKTxOut*)untag_ptr(output_arg));
23741         LDKThirtyTwoBytes channel_keys_id_arg_ref;
23742         CHECK(channel_keys_id_arg->arr_len == 32);
23743         memcpy(channel_keys_id_arg_ref.data, channel_keys_id_arg->elems, 32); FREE(channel_keys_id_arg);
23744         LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_new(outpoint_arg_conv, output_arg_conv, channel_keys_id_arg_ref, channel_value_satoshis_arg);
23745         uint64_t ret_ref = 0;
23746         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23747         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
23748         return ret_ref;
23749 }
23750
23751 static inline uint64_t StaticPaymentOutputDescriptor_clone_ptr(LDKStaticPaymentOutputDescriptor *NONNULL_PTR arg) {
23752         LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_clone(arg);
23753         uint64_t ret_ref = 0;
23754         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23755         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
23756         return ret_ref;
23757 }
23758 int64_t  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_clone_ptr"))) TS_StaticPaymentOutputDescriptor_clone_ptr(uint64_t arg) {
23759         LDKStaticPaymentOutputDescriptor arg_conv;
23760         arg_conv.inner = untag_ptr(arg);
23761         arg_conv.is_owned = ptr_is_owned(arg);
23762         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
23763         arg_conv.is_owned = false;
23764         int64_t ret_conv = StaticPaymentOutputDescriptor_clone_ptr(&arg_conv);
23765         return ret_conv;
23766 }
23767
23768 uint64_t  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_clone"))) TS_StaticPaymentOutputDescriptor_clone(uint64_t orig) {
23769         LDKStaticPaymentOutputDescriptor orig_conv;
23770         orig_conv.inner = untag_ptr(orig);
23771         orig_conv.is_owned = ptr_is_owned(orig);
23772         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
23773         orig_conv.is_owned = false;
23774         LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_clone(&orig_conv);
23775         uint64_t ret_ref = 0;
23776         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23777         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
23778         return ret_ref;
23779 }
23780
23781 int8_tArray  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_write"))) TS_StaticPaymentOutputDescriptor_write(uint64_t obj) {
23782         LDKStaticPaymentOutputDescriptor obj_conv;
23783         obj_conv.inner = untag_ptr(obj);
23784         obj_conv.is_owned = ptr_is_owned(obj);
23785         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
23786         obj_conv.is_owned = false;
23787         LDKCVec_u8Z ret_var = StaticPaymentOutputDescriptor_write(&obj_conv);
23788         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
23789         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
23790         CVec_u8Z_free(ret_var);
23791         return ret_arr;
23792 }
23793
23794 uint64_t  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_read"))) TS_StaticPaymentOutputDescriptor_read(int8_tArray ser) {
23795         LDKu8slice ser_ref;
23796         ser_ref.datalen = ser->arr_len;
23797         ser_ref.data = ser->elems;
23798         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
23799         *ret_conv = StaticPaymentOutputDescriptor_read(ser_ref);
23800         FREE(ser);
23801         return tag_ptr(ret_conv, true);
23802 }
23803
23804 void  __attribute__((export_name("TS_SpendableOutputDescriptor_free"))) TS_SpendableOutputDescriptor_free(uint64_t this_ptr) {
23805         if (!ptr_is_owned(this_ptr)) return;
23806         void* this_ptr_ptr = untag_ptr(this_ptr);
23807         CHECK_ACCESS(this_ptr_ptr);
23808         LDKSpendableOutputDescriptor this_ptr_conv = *(LDKSpendableOutputDescriptor*)(this_ptr_ptr);
23809         FREE(untag_ptr(this_ptr));
23810         SpendableOutputDescriptor_free(this_ptr_conv);
23811 }
23812
23813 static inline uint64_t SpendableOutputDescriptor_clone_ptr(LDKSpendableOutputDescriptor *NONNULL_PTR arg) {
23814         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
23815         *ret_copy = SpendableOutputDescriptor_clone(arg);
23816         uint64_t ret_ref = tag_ptr(ret_copy, true);
23817         return ret_ref;
23818 }
23819 int64_t  __attribute__((export_name("TS_SpendableOutputDescriptor_clone_ptr"))) TS_SpendableOutputDescriptor_clone_ptr(uint64_t arg) {
23820         LDKSpendableOutputDescriptor* arg_conv = (LDKSpendableOutputDescriptor*)untag_ptr(arg);
23821         int64_t ret_conv = SpendableOutputDescriptor_clone_ptr(arg_conv);
23822         return ret_conv;
23823 }
23824
23825 uint64_t  __attribute__((export_name("TS_SpendableOutputDescriptor_clone"))) TS_SpendableOutputDescriptor_clone(uint64_t orig) {
23826         LDKSpendableOutputDescriptor* orig_conv = (LDKSpendableOutputDescriptor*)untag_ptr(orig);
23827         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
23828         *ret_copy = SpendableOutputDescriptor_clone(orig_conv);
23829         uint64_t ret_ref = tag_ptr(ret_copy, true);
23830         return ret_ref;
23831 }
23832
23833 uint64_t  __attribute__((export_name("TS_SpendableOutputDescriptor_static_output"))) TS_SpendableOutputDescriptor_static_output(uint64_t outpoint, uint64_t output) {
23834         LDKOutPoint outpoint_conv;
23835         outpoint_conv.inner = untag_ptr(outpoint);
23836         outpoint_conv.is_owned = ptr_is_owned(outpoint);
23837         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_conv);
23838         outpoint_conv = OutPoint_clone(&outpoint_conv);
23839         void* output_ptr = untag_ptr(output);
23840         CHECK_ACCESS(output_ptr);
23841         LDKTxOut output_conv = *(LDKTxOut*)(output_ptr);
23842         output_conv = TxOut_clone((LDKTxOut*)untag_ptr(output));
23843         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
23844         *ret_copy = SpendableOutputDescriptor_static_output(outpoint_conv, output_conv);
23845         uint64_t ret_ref = tag_ptr(ret_copy, true);
23846         return ret_ref;
23847 }
23848
23849 uint64_t  __attribute__((export_name("TS_SpendableOutputDescriptor_delayed_payment_output"))) TS_SpendableOutputDescriptor_delayed_payment_output(uint64_t a) {
23850         LDKDelayedPaymentOutputDescriptor a_conv;
23851         a_conv.inner = untag_ptr(a);
23852         a_conv.is_owned = ptr_is_owned(a);
23853         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
23854         a_conv = DelayedPaymentOutputDescriptor_clone(&a_conv);
23855         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
23856         *ret_copy = SpendableOutputDescriptor_delayed_payment_output(a_conv);
23857         uint64_t ret_ref = tag_ptr(ret_copy, true);
23858         return ret_ref;
23859 }
23860
23861 uint64_t  __attribute__((export_name("TS_SpendableOutputDescriptor_static_payment_output"))) TS_SpendableOutputDescriptor_static_payment_output(uint64_t a) {
23862         LDKStaticPaymentOutputDescriptor a_conv;
23863         a_conv.inner = untag_ptr(a);
23864         a_conv.is_owned = ptr_is_owned(a);
23865         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
23866         a_conv = StaticPaymentOutputDescriptor_clone(&a_conv);
23867         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
23868         *ret_copy = SpendableOutputDescriptor_static_payment_output(a_conv);
23869         uint64_t ret_ref = tag_ptr(ret_copy, true);
23870         return ret_ref;
23871 }
23872
23873 int8_tArray  __attribute__((export_name("TS_SpendableOutputDescriptor_write"))) TS_SpendableOutputDescriptor_write(uint64_t obj) {
23874         LDKSpendableOutputDescriptor* obj_conv = (LDKSpendableOutputDescriptor*)untag_ptr(obj);
23875         LDKCVec_u8Z ret_var = SpendableOutputDescriptor_write(obj_conv);
23876         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
23877         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
23878         CVec_u8Z_free(ret_var);
23879         return ret_arr;
23880 }
23881
23882 uint64_t  __attribute__((export_name("TS_SpendableOutputDescriptor_read"))) TS_SpendableOutputDescriptor_read(int8_tArray ser) {
23883         LDKu8slice ser_ref;
23884         ser_ref.datalen = ser->arr_len;
23885         ser_ref.data = ser->elems;
23886         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
23887         *ret_conv = SpendableOutputDescriptor_read(ser_ref);
23888         FREE(ser);
23889         return tag_ptr(ret_conv, true);
23890 }
23891
23892 void  __attribute__((export_name("TS_BaseSign_free"))) TS_BaseSign_free(uint64_t this_ptr) {
23893         if (!ptr_is_owned(this_ptr)) return;
23894         void* this_ptr_ptr = untag_ptr(this_ptr);
23895         CHECK_ACCESS(this_ptr_ptr);
23896         LDKBaseSign this_ptr_conv = *(LDKBaseSign*)(this_ptr_ptr);
23897         FREE(untag_ptr(this_ptr));
23898         BaseSign_free(this_ptr_conv);
23899 }
23900
23901 static inline uint64_t Sign_clone_ptr(LDKSign *NONNULL_PTR arg) {
23902         LDKSign* ret_ret = MALLOC(sizeof(LDKSign), "LDKSign");
23903         *ret_ret = Sign_clone(arg);
23904         return tag_ptr(ret_ret, true);
23905 }
23906 int64_t  __attribute__((export_name("TS_Sign_clone_ptr"))) TS_Sign_clone_ptr(uint64_t arg) {
23907         void* arg_ptr = untag_ptr(arg);
23908         if (ptr_is_owned(arg)) { CHECK_ACCESS(arg_ptr); }
23909         LDKSign* arg_conv = (LDKSign*)arg_ptr;
23910         int64_t ret_conv = Sign_clone_ptr(arg_conv);
23911         return ret_conv;
23912 }
23913
23914 uint64_t  __attribute__((export_name("TS_Sign_clone"))) TS_Sign_clone(uint64_t orig) {
23915         void* orig_ptr = untag_ptr(orig);
23916         if (ptr_is_owned(orig)) { CHECK_ACCESS(orig_ptr); }
23917         LDKSign* orig_conv = (LDKSign*)orig_ptr;
23918         LDKSign* ret_ret = MALLOC(sizeof(LDKSign), "LDKSign");
23919         *ret_ret = Sign_clone(orig_conv);
23920         return tag_ptr(ret_ret, true);
23921 }
23922
23923 void  __attribute__((export_name("TS_Sign_free"))) TS_Sign_free(uint64_t this_ptr) {
23924         if (!ptr_is_owned(this_ptr)) return;
23925         void* this_ptr_ptr = untag_ptr(this_ptr);
23926         CHECK_ACCESS(this_ptr_ptr);
23927         LDKSign this_ptr_conv = *(LDKSign*)(this_ptr_ptr);
23928         FREE(untag_ptr(this_ptr));
23929         Sign_free(this_ptr_conv);
23930 }
23931
23932 uint32_t  __attribute__((export_name("TS_Recipient_clone"))) TS_Recipient_clone(uint64_t orig) {
23933         LDKRecipient* orig_conv = (LDKRecipient*)untag_ptr(orig);
23934         uint32_t ret_conv = LDKRecipient_to_js(Recipient_clone(orig_conv));
23935         return ret_conv;
23936 }
23937
23938 uint32_t  __attribute__((export_name("TS_Recipient_node"))) TS_Recipient_node() {
23939         uint32_t ret_conv = LDKRecipient_to_js(Recipient_node());
23940         return ret_conv;
23941 }
23942
23943 uint32_t  __attribute__((export_name("TS_Recipient_phantom_node"))) TS_Recipient_phantom_node() {
23944         uint32_t ret_conv = LDKRecipient_to_js(Recipient_phantom_node());
23945         return ret_conv;
23946 }
23947
23948 void  __attribute__((export_name("TS_KeysInterface_free"))) TS_KeysInterface_free(uint64_t this_ptr) {
23949         if (!ptr_is_owned(this_ptr)) return;
23950         void* this_ptr_ptr = untag_ptr(this_ptr);
23951         CHECK_ACCESS(this_ptr_ptr);
23952         LDKKeysInterface this_ptr_conv = *(LDKKeysInterface*)(this_ptr_ptr);
23953         FREE(untag_ptr(this_ptr));
23954         KeysInterface_free(this_ptr_conv);
23955 }
23956
23957 void  __attribute__((export_name("TS_InMemorySigner_free"))) TS_InMemorySigner_free(uint64_t this_obj) {
23958         LDKInMemorySigner this_obj_conv;
23959         this_obj_conv.inner = untag_ptr(this_obj);
23960         this_obj_conv.is_owned = ptr_is_owned(this_obj);
23961         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
23962         InMemorySigner_free(this_obj_conv);
23963 }
23964
23965 int8_tArray  __attribute__((export_name("TS_InMemorySigner_get_funding_key"))) TS_InMemorySigner_get_funding_key(uint64_t this_ptr) {
23966         LDKInMemorySigner this_ptr_conv;
23967         this_ptr_conv.inner = untag_ptr(this_ptr);
23968         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23969         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23970         this_ptr_conv.is_owned = false;
23971         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
23972         memcpy(ret_arr->elems, *InMemorySigner_get_funding_key(&this_ptr_conv), 32);
23973         return ret_arr;
23974 }
23975
23976 void  __attribute__((export_name("TS_InMemorySigner_set_funding_key"))) TS_InMemorySigner_set_funding_key(uint64_t this_ptr, int8_tArray val) {
23977         LDKInMemorySigner this_ptr_conv;
23978         this_ptr_conv.inner = untag_ptr(this_ptr);
23979         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23980         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23981         this_ptr_conv.is_owned = false;
23982         LDKSecretKey val_ref;
23983         CHECK(val->arr_len == 32);
23984         memcpy(val_ref.bytes, val->elems, 32); FREE(val);
23985         InMemorySigner_set_funding_key(&this_ptr_conv, val_ref);
23986 }
23987
23988 int8_tArray  __attribute__((export_name("TS_InMemorySigner_get_revocation_base_key"))) TS_InMemorySigner_get_revocation_base_key(uint64_t this_ptr) {
23989         LDKInMemorySigner this_ptr_conv;
23990         this_ptr_conv.inner = untag_ptr(this_ptr);
23991         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23992         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23993         this_ptr_conv.is_owned = false;
23994         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
23995         memcpy(ret_arr->elems, *InMemorySigner_get_revocation_base_key(&this_ptr_conv), 32);
23996         return ret_arr;
23997 }
23998
23999 void  __attribute__((export_name("TS_InMemorySigner_set_revocation_base_key"))) TS_InMemorySigner_set_revocation_base_key(uint64_t this_ptr, int8_tArray val) {
24000         LDKInMemorySigner this_ptr_conv;
24001         this_ptr_conv.inner = untag_ptr(this_ptr);
24002         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24003         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24004         this_ptr_conv.is_owned = false;
24005         LDKSecretKey val_ref;
24006         CHECK(val->arr_len == 32);
24007         memcpy(val_ref.bytes, val->elems, 32); FREE(val);
24008         InMemorySigner_set_revocation_base_key(&this_ptr_conv, val_ref);
24009 }
24010
24011 int8_tArray  __attribute__((export_name("TS_InMemorySigner_get_payment_key"))) TS_InMemorySigner_get_payment_key(uint64_t this_ptr) {
24012         LDKInMemorySigner this_ptr_conv;
24013         this_ptr_conv.inner = untag_ptr(this_ptr);
24014         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24015         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24016         this_ptr_conv.is_owned = false;
24017         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
24018         memcpy(ret_arr->elems, *InMemorySigner_get_payment_key(&this_ptr_conv), 32);
24019         return ret_arr;
24020 }
24021
24022 void  __attribute__((export_name("TS_InMemorySigner_set_payment_key"))) TS_InMemorySigner_set_payment_key(uint64_t this_ptr, int8_tArray val) {
24023         LDKInMemorySigner this_ptr_conv;
24024         this_ptr_conv.inner = untag_ptr(this_ptr);
24025         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24026         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24027         this_ptr_conv.is_owned = false;
24028         LDKSecretKey val_ref;
24029         CHECK(val->arr_len == 32);
24030         memcpy(val_ref.bytes, val->elems, 32); FREE(val);
24031         InMemorySigner_set_payment_key(&this_ptr_conv, val_ref);
24032 }
24033
24034 int8_tArray  __attribute__((export_name("TS_InMemorySigner_get_delayed_payment_base_key"))) TS_InMemorySigner_get_delayed_payment_base_key(uint64_t this_ptr) {
24035         LDKInMemorySigner this_ptr_conv;
24036         this_ptr_conv.inner = untag_ptr(this_ptr);
24037         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24038         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24039         this_ptr_conv.is_owned = false;
24040         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
24041         memcpy(ret_arr->elems, *InMemorySigner_get_delayed_payment_base_key(&this_ptr_conv), 32);
24042         return ret_arr;
24043 }
24044
24045 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) {
24046         LDKInMemorySigner this_ptr_conv;
24047         this_ptr_conv.inner = untag_ptr(this_ptr);
24048         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24049         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24050         this_ptr_conv.is_owned = false;
24051         LDKSecretKey val_ref;
24052         CHECK(val->arr_len == 32);
24053         memcpy(val_ref.bytes, val->elems, 32); FREE(val);
24054         InMemorySigner_set_delayed_payment_base_key(&this_ptr_conv, val_ref);
24055 }
24056
24057 int8_tArray  __attribute__((export_name("TS_InMemorySigner_get_htlc_base_key"))) TS_InMemorySigner_get_htlc_base_key(uint64_t this_ptr) {
24058         LDKInMemorySigner this_ptr_conv;
24059         this_ptr_conv.inner = untag_ptr(this_ptr);
24060         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24061         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24062         this_ptr_conv.is_owned = false;
24063         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
24064         memcpy(ret_arr->elems, *InMemorySigner_get_htlc_base_key(&this_ptr_conv), 32);
24065         return ret_arr;
24066 }
24067
24068 void  __attribute__((export_name("TS_InMemorySigner_set_htlc_base_key"))) TS_InMemorySigner_set_htlc_base_key(uint64_t this_ptr, int8_tArray val) {
24069         LDKInMemorySigner this_ptr_conv;
24070         this_ptr_conv.inner = untag_ptr(this_ptr);
24071         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24072         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24073         this_ptr_conv.is_owned = false;
24074         LDKSecretKey val_ref;
24075         CHECK(val->arr_len == 32);
24076         memcpy(val_ref.bytes, val->elems, 32); FREE(val);
24077         InMemorySigner_set_htlc_base_key(&this_ptr_conv, val_ref);
24078 }
24079
24080 int8_tArray  __attribute__((export_name("TS_InMemorySigner_get_commitment_seed"))) TS_InMemorySigner_get_commitment_seed(uint64_t this_ptr) {
24081         LDKInMemorySigner this_ptr_conv;
24082         this_ptr_conv.inner = untag_ptr(this_ptr);
24083         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24084         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24085         this_ptr_conv.is_owned = false;
24086         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
24087         memcpy(ret_arr->elems, *InMemorySigner_get_commitment_seed(&this_ptr_conv), 32);
24088         return ret_arr;
24089 }
24090
24091 void  __attribute__((export_name("TS_InMemorySigner_set_commitment_seed"))) TS_InMemorySigner_set_commitment_seed(uint64_t this_ptr, int8_tArray val) {
24092         LDKInMemorySigner this_ptr_conv;
24093         this_ptr_conv.inner = untag_ptr(this_ptr);
24094         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24095         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24096         this_ptr_conv.is_owned = false;
24097         LDKThirtyTwoBytes val_ref;
24098         CHECK(val->arr_len == 32);
24099         memcpy(val_ref.data, val->elems, 32); FREE(val);
24100         InMemorySigner_set_commitment_seed(&this_ptr_conv, val_ref);
24101 }
24102
24103 static inline uint64_t InMemorySigner_clone_ptr(LDKInMemorySigner *NONNULL_PTR arg) {
24104         LDKInMemorySigner ret_var = InMemorySigner_clone(arg);
24105         uint64_t ret_ref = 0;
24106         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24107         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24108         return ret_ref;
24109 }
24110 int64_t  __attribute__((export_name("TS_InMemorySigner_clone_ptr"))) TS_InMemorySigner_clone_ptr(uint64_t arg) {
24111         LDKInMemorySigner arg_conv;
24112         arg_conv.inner = untag_ptr(arg);
24113         arg_conv.is_owned = ptr_is_owned(arg);
24114         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
24115         arg_conv.is_owned = false;
24116         int64_t ret_conv = InMemorySigner_clone_ptr(&arg_conv);
24117         return ret_conv;
24118 }
24119
24120 uint64_t  __attribute__((export_name("TS_InMemorySigner_clone"))) TS_InMemorySigner_clone(uint64_t orig) {
24121         LDKInMemorySigner orig_conv;
24122         orig_conv.inner = untag_ptr(orig);
24123         orig_conv.is_owned = ptr_is_owned(orig);
24124         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
24125         orig_conv.is_owned = false;
24126         LDKInMemorySigner ret_var = InMemorySigner_clone(&orig_conv);
24127         uint64_t ret_ref = 0;
24128         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24129         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24130         return ret_ref;
24131 }
24132
24133 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) {
24134         LDKSecretKey node_secret_ref;
24135         CHECK(node_secret->arr_len == 32);
24136         memcpy(node_secret_ref.bytes, node_secret->elems, 32); FREE(node_secret);
24137         LDKSecretKey funding_key_ref;
24138         CHECK(funding_key->arr_len == 32);
24139         memcpy(funding_key_ref.bytes, funding_key->elems, 32); FREE(funding_key);
24140         LDKSecretKey revocation_base_key_ref;
24141         CHECK(revocation_base_key->arr_len == 32);
24142         memcpy(revocation_base_key_ref.bytes, revocation_base_key->elems, 32); FREE(revocation_base_key);
24143         LDKSecretKey payment_key_ref;
24144         CHECK(payment_key->arr_len == 32);
24145         memcpy(payment_key_ref.bytes, payment_key->elems, 32); FREE(payment_key);
24146         LDKSecretKey delayed_payment_base_key_ref;
24147         CHECK(delayed_payment_base_key->arr_len == 32);
24148         memcpy(delayed_payment_base_key_ref.bytes, delayed_payment_base_key->elems, 32); FREE(delayed_payment_base_key);
24149         LDKSecretKey htlc_base_key_ref;
24150         CHECK(htlc_base_key->arr_len == 32);
24151         memcpy(htlc_base_key_ref.bytes, htlc_base_key->elems, 32); FREE(htlc_base_key);
24152         LDKThirtyTwoBytes commitment_seed_ref;
24153         CHECK(commitment_seed->arr_len == 32);
24154         memcpy(commitment_seed_ref.data, commitment_seed->elems, 32); FREE(commitment_seed);
24155         LDKThirtyTwoBytes channel_keys_id_ref;
24156         CHECK(channel_keys_id->arr_len == 32);
24157         memcpy(channel_keys_id_ref.data, channel_keys_id->elems, 32); FREE(channel_keys_id);
24158         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);
24159         uint64_t ret_ref = 0;
24160         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24161         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24162         return ret_ref;
24163 }
24164
24165 uint64_t  __attribute__((export_name("TS_InMemorySigner_counterparty_pubkeys"))) TS_InMemorySigner_counterparty_pubkeys(uint64_t this_arg) {
24166         LDKInMemorySigner this_arg_conv;
24167         this_arg_conv.inner = untag_ptr(this_arg);
24168         this_arg_conv.is_owned = ptr_is_owned(this_arg);
24169         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24170         this_arg_conv.is_owned = false;
24171         LDKChannelPublicKeys ret_var = InMemorySigner_counterparty_pubkeys(&this_arg_conv);
24172         uint64_t ret_ref = 0;
24173         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24174         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24175         return ret_ref;
24176 }
24177
24178 int16_t  __attribute__((export_name("TS_InMemorySigner_counterparty_selected_contest_delay"))) TS_InMemorySigner_counterparty_selected_contest_delay(uint64_t this_arg) {
24179         LDKInMemorySigner this_arg_conv;
24180         this_arg_conv.inner = untag_ptr(this_arg);
24181         this_arg_conv.is_owned = ptr_is_owned(this_arg);
24182         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24183         this_arg_conv.is_owned = false;
24184         int16_t ret_conv = InMemorySigner_counterparty_selected_contest_delay(&this_arg_conv);
24185         return ret_conv;
24186 }
24187
24188 int16_t  __attribute__((export_name("TS_InMemorySigner_holder_selected_contest_delay"))) TS_InMemorySigner_holder_selected_contest_delay(uint64_t this_arg) {
24189         LDKInMemorySigner this_arg_conv;
24190         this_arg_conv.inner = untag_ptr(this_arg);
24191         this_arg_conv.is_owned = ptr_is_owned(this_arg);
24192         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24193         this_arg_conv.is_owned = false;
24194         int16_t ret_conv = InMemorySigner_holder_selected_contest_delay(&this_arg_conv);
24195         return ret_conv;
24196 }
24197
24198 jboolean  __attribute__((export_name("TS_InMemorySigner_is_outbound"))) TS_InMemorySigner_is_outbound(uint64_t this_arg) {
24199         LDKInMemorySigner 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         jboolean ret_conv = InMemorySigner_is_outbound(&this_arg_conv);
24205         return ret_conv;
24206 }
24207
24208 uint64_t  __attribute__((export_name("TS_InMemorySigner_funding_outpoint"))) TS_InMemorySigner_funding_outpoint(uint64_t this_arg) {
24209         LDKInMemorySigner this_arg_conv;
24210         this_arg_conv.inner = untag_ptr(this_arg);
24211         this_arg_conv.is_owned = ptr_is_owned(this_arg);
24212         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24213         this_arg_conv.is_owned = false;
24214         LDKOutPoint ret_var = InMemorySigner_funding_outpoint(&this_arg_conv);
24215         uint64_t ret_ref = 0;
24216         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24217         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24218         return ret_ref;
24219 }
24220
24221 uint64_t  __attribute__((export_name("TS_InMemorySigner_get_channel_parameters"))) TS_InMemorySigner_get_channel_parameters(uint64_t this_arg) {
24222         LDKInMemorySigner this_arg_conv;
24223         this_arg_conv.inner = untag_ptr(this_arg);
24224         this_arg_conv.is_owned = ptr_is_owned(this_arg);
24225         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24226         this_arg_conv.is_owned = false;
24227         LDKChannelTransactionParameters ret_var = InMemorySigner_get_channel_parameters(&this_arg_conv);
24228         uint64_t ret_ref = 0;
24229         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24230         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24231         return ret_ref;
24232 }
24233
24234 jboolean  __attribute__((export_name("TS_InMemorySigner_opt_anchors"))) TS_InMemorySigner_opt_anchors(uint64_t this_arg) {
24235         LDKInMemorySigner this_arg_conv;
24236         this_arg_conv.inner = untag_ptr(this_arg);
24237         this_arg_conv.is_owned = ptr_is_owned(this_arg);
24238         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24239         this_arg_conv.is_owned = false;
24240         jboolean ret_conv = InMemorySigner_opt_anchors(&this_arg_conv);
24241         return ret_conv;
24242 }
24243
24244 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) {
24245         LDKInMemorySigner this_arg_conv;
24246         this_arg_conv.inner = untag_ptr(this_arg);
24247         this_arg_conv.is_owned = ptr_is_owned(this_arg);
24248         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24249         this_arg_conv.is_owned = false;
24250         LDKTransaction spend_tx_ref;
24251         spend_tx_ref.datalen = spend_tx->arr_len;
24252         spend_tx_ref.data = MALLOC(spend_tx_ref.datalen, "LDKTransaction Bytes");
24253         memcpy(spend_tx_ref.data, spend_tx->elems, spend_tx_ref.datalen); FREE(spend_tx);
24254         spend_tx_ref.data_is_owned = true;
24255         LDKStaticPaymentOutputDescriptor descriptor_conv;
24256         descriptor_conv.inner = untag_ptr(descriptor);
24257         descriptor_conv.is_owned = ptr_is_owned(descriptor);
24258         CHECK_INNER_FIELD_ACCESS_OR_NULL(descriptor_conv);
24259         descriptor_conv.is_owned = false;
24260         LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
24261         *ret_conv = InMemorySigner_sign_counterparty_payment_input(&this_arg_conv, spend_tx_ref, input_idx, &descriptor_conv);
24262         return tag_ptr(ret_conv, true);
24263 }
24264
24265 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) {
24266         LDKInMemorySigner this_arg_conv;
24267         this_arg_conv.inner = untag_ptr(this_arg);
24268         this_arg_conv.is_owned = ptr_is_owned(this_arg);
24269         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24270         this_arg_conv.is_owned = false;
24271         LDKTransaction spend_tx_ref;
24272         spend_tx_ref.datalen = spend_tx->arr_len;
24273         spend_tx_ref.data = MALLOC(spend_tx_ref.datalen, "LDKTransaction Bytes");
24274         memcpy(spend_tx_ref.data, spend_tx->elems, spend_tx_ref.datalen); FREE(spend_tx);
24275         spend_tx_ref.data_is_owned = true;
24276         LDKDelayedPaymentOutputDescriptor descriptor_conv;
24277         descriptor_conv.inner = untag_ptr(descriptor);
24278         descriptor_conv.is_owned = ptr_is_owned(descriptor);
24279         CHECK_INNER_FIELD_ACCESS_OR_NULL(descriptor_conv);
24280         descriptor_conv.is_owned = false;
24281         LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
24282         *ret_conv = InMemorySigner_sign_dynamic_p2wsh_input(&this_arg_conv, spend_tx_ref, input_idx, &descriptor_conv);
24283         return tag_ptr(ret_conv, true);
24284 }
24285
24286 uint64_t  __attribute__((export_name("TS_InMemorySigner_as_BaseSign"))) TS_InMemorySigner_as_BaseSign(uint64_t this_arg) {
24287         LDKInMemorySigner this_arg_conv;
24288         this_arg_conv.inner = untag_ptr(this_arg);
24289         this_arg_conv.is_owned = ptr_is_owned(this_arg);
24290         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24291         this_arg_conv.is_owned = false;
24292         LDKBaseSign* ret_ret = MALLOC(sizeof(LDKBaseSign), "LDKBaseSign");
24293         *ret_ret = InMemorySigner_as_BaseSign(&this_arg_conv);
24294         return tag_ptr(ret_ret, true);
24295 }
24296
24297 uint64_t  __attribute__((export_name("TS_InMemorySigner_as_Sign"))) TS_InMemorySigner_as_Sign(uint64_t this_arg) {
24298         LDKInMemorySigner this_arg_conv;
24299         this_arg_conv.inner = untag_ptr(this_arg);
24300         this_arg_conv.is_owned = ptr_is_owned(this_arg);
24301         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24302         this_arg_conv.is_owned = false;
24303         LDKSign* ret_ret = MALLOC(sizeof(LDKSign), "LDKSign");
24304         *ret_ret = InMemorySigner_as_Sign(&this_arg_conv);
24305         return tag_ptr(ret_ret, true);
24306 }
24307
24308 int8_tArray  __attribute__((export_name("TS_InMemorySigner_write"))) TS_InMemorySigner_write(uint64_t obj) {
24309         LDKInMemorySigner obj_conv;
24310         obj_conv.inner = untag_ptr(obj);
24311         obj_conv.is_owned = ptr_is_owned(obj);
24312         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
24313         obj_conv.is_owned = false;
24314         LDKCVec_u8Z ret_var = InMemorySigner_write(&obj_conv);
24315         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
24316         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
24317         CVec_u8Z_free(ret_var);
24318         return ret_arr;
24319 }
24320
24321 uint64_t  __attribute__((export_name("TS_InMemorySigner_read"))) TS_InMemorySigner_read(int8_tArray ser, int8_tArray arg) {
24322         LDKu8slice ser_ref;
24323         ser_ref.datalen = ser->arr_len;
24324         ser_ref.data = ser->elems;
24325         LDKSecretKey arg_ref;
24326         CHECK(arg->arr_len == 32);
24327         memcpy(arg_ref.bytes, arg->elems, 32); FREE(arg);
24328         LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
24329         *ret_conv = InMemorySigner_read(ser_ref, arg_ref);
24330         FREE(ser);
24331         return tag_ptr(ret_conv, true);
24332 }
24333
24334 void  __attribute__((export_name("TS_KeysManager_free"))) TS_KeysManager_free(uint64_t this_obj) {
24335         LDKKeysManager this_obj_conv;
24336         this_obj_conv.inner = untag_ptr(this_obj);
24337         this_obj_conv.is_owned = ptr_is_owned(this_obj);
24338         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
24339         KeysManager_free(this_obj_conv);
24340 }
24341
24342 uint64_t  __attribute__((export_name("TS_KeysManager_new"))) TS_KeysManager_new(int8_tArray seed, int64_t starting_time_secs, int32_t starting_time_nanos) {
24343         unsigned char seed_arr[32];
24344         CHECK(seed->arr_len == 32);
24345         memcpy(seed_arr, seed->elems, 32); FREE(seed);
24346         unsigned char (*seed_ref)[32] = &seed_arr;
24347         LDKKeysManager ret_var = KeysManager_new(seed_ref, starting_time_secs, starting_time_nanos);
24348         uint64_t ret_ref = 0;
24349         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24350         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24351         return ret_ref;
24352 }
24353
24354 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) {
24355         LDKKeysManager 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 params_arr[32];
24361         CHECK(params->arr_len == 32);
24362         memcpy(params_arr, params->elems, 32); FREE(params);
24363         unsigned char (*params_ref)[32] = &params_arr;
24364         LDKInMemorySigner ret_var = KeysManager_derive_channel_keys(&this_arg_conv, channel_value_satoshis, params_ref);
24365         uint64_t ret_ref = 0;
24366         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24367         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24368         return ret_ref;
24369 }
24370
24371 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) {
24372         LDKKeysManager this_arg_conv;
24373         this_arg_conv.inner = untag_ptr(this_arg);
24374         this_arg_conv.is_owned = ptr_is_owned(this_arg);
24375         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24376         this_arg_conv.is_owned = false;
24377         LDKCVec_SpendableOutputDescriptorZ descriptors_constr;
24378         descriptors_constr.datalen = descriptors->arr_len;
24379         if (descriptors_constr.datalen > 0)
24380                 descriptors_constr.data = MALLOC(descriptors_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
24381         else
24382                 descriptors_constr.data = NULL;
24383         uint64_t* descriptors_vals = descriptors->elems;
24384         for (size_t b = 0; b < descriptors_constr.datalen; b++) {
24385                 uint64_t descriptors_conv_27 = descriptors_vals[b];
24386                 void* descriptors_conv_27_ptr = untag_ptr(descriptors_conv_27);
24387                 CHECK_ACCESS(descriptors_conv_27_ptr);
24388                 LDKSpendableOutputDescriptor descriptors_conv_27_conv = *(LDKSpendableOutputDescriptor*)(descriptors_conv_27_ptr);
24389                 descriptors_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(descriptors_conv_27));
24390                 descriptors_constr.data[b] = descriptors_conv_27_conv;
24391         }
24392         FREE(descriptors);
24393         LDKCVec_TxOutZ outputs_constr;
24394         outputs_constr.datalen = outputs->arr_len;
24395         if (outputs_constr.datalen > 0)
24396                 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
24397         else
24398                 outputs_constr.data = NULL;
24399         uint64_t* outputs_vals = outputs->elems;
24400         for (size_t h = 0; h < outputs_constr.datalen; h++) {
24401                 uint64_t outputs_conv_7 = outputs_vals[h];
24402                 void* outputs_conv_7_ptr = untag_ptr(outputs_conv_7);
24403                 CHECK_ACCESS(outputs_conv_7_ptr);
24404                 LDKTxOut outputs_conv_7_conv = *(LDKTxOut*)(outputs_conv_7_ptr);
24405                 outputs_conv_7_conv = TxOut_clone((LDKTxOut*)untag_ptr(outputs_conv_7));
24406                 outputs_constr.data[h] = outputs_conv_7_conv;
24407         }
24408         FREE(outputs);
24409         LDKCVec_u8Z change_destination_script_ref;
24410         change_destination_script_ref.datalen = change_destination_script->arr_len;
24411         change_destination_script_ref.data = MALLOC(change_destination_script_ref.datalen, "LDKCVec_u8Z Bytes");
24412         memcpy(change_destination_script_ref.data, change_destination_script->elems, change_destination_script_ref.datalen); FREE(change_destination_script);
24413         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
24414         *ret_conv = KeysManager_spend_spendable_outputs(&this_arg_conv, descriptors_constr, outputs_constr, change_destination_script_ref, feerate_sat_per_1000_weight);
24415         return tag_ptr(ret_conv, true);
24416 }
24417
24418 uint64_t  __attribute__((export_name("TS_KeysManager_as_KeysInterface"))) TS_KeysManager_as_KeysInterface(uint64_t this_arg) {
24419         LDKKeysManager this_arg_conv;
24420         this_arg_conv.inner = untag_ptr(this_arg);
24421         this_arg_conv.is_owned = ptr_is_owned(this_arg);
24422         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24423         this_arg_conv.is_owned = false;
24424         LDKKeysInterface* ret_ret = MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface");
24425         *ret_ret = KeysManager_as_KeysInterface(&this_arg_conv);
24426         return tag_ptr(ret_ret, true);
24427 }
24428
24429 void  __attribute__((export_name("TS_PhantomKeysManager_free"))) TS_PhantomKeysManager_free(uint64_t this_obj) {
24430         LDKPhantomKeysManager this_obj_conv;
24431         this_obj_conv.inner = untag_ptr(this_obj);
24432         this_obj_conv.is_owned = ptr_is_owned(this_obj);
24433         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
24434         PhantomKeysManager_free(this_obj_conv);
24435 }
24436
24437 uint64_t  __attribute__((export_name("TS_PhantomKeysManager_as_KeysInterface"))) TS_PhantomKeysManager_as_KeysInterface(uint64_t this_arg) {
24438         LDKPhantomKeysManager this_arg_conv;
24439         this_arg_conv.inner = untag_ptr(this_arg);
24440         this_arg_conv.is_owned = ptr_is_owned(this_arg);
24441         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24442         this_arg_conv.is_owned = false;
24443         LDKKeysInterface* ret_ret = MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface");
24444         *ret_ret = PhantomKeysManager_as_KeysInterface(&this_arg_conv);
24445         return tag_ptr(ret_ret, true);
24446 }
24447
24448 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) {
24449         unsigned char seed_arr[32];
24450         CHECK(seed->arr_len == 32);
24451         memcpy(seed_arr, seed->elems, 32); FREE(seed);
24452         unsigned char (*seed_ref)[32] = &seed_arr;
24453         unsigned char cross_node_seed_arr[32];
24454         CHECK(cross_node_seed->arr_len == 32);
24455         memcpy(cross_node_seed_arr, cross_node_seed->elems, 32); FREE(cross_node_seed);
24456         unsigned char (*cross_node_seed_ref)[32] = &cross_node_seed_arr;
24457         LDKPhantomKeysManager ret_var = PhantomKeysManager_new(seed_ref, starting_time_secs, starting_time_nanos, cross_node_seed_ref);
24458         uint64_t ret_ref = 0;
24459         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24460         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24461         return ret_ref;
24462 }
24463
24464 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) {
24465         LDKPhantomKeysManager this_arg_conv;
24466         this_arg_conv.inner = untag_ptr(this_arg);
24467         this_arg_conv.is_owned = ptr_is_owned(this_arg);
24468         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24469         this_arg_conv.is_owned = false;
24470         LDKCVec_SpendableOutputDescriptorZ descriptors_constr;
24471         descriptors_constr.datalen = descriptors->arr_len;
24472         if (descriptors_constr.datalen > 0)
24473                 descriptors_constr.data = MALLOC(descriptors_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
24474         else
24475                 descriptors_constr.data = NULL;
24476         uint64_t* descriptors_vals = descriptors->elems;
24477         for (size_t b = 0; b < descriptors_constr.datalen; b++) {
24478                 uint64_t descriptors_conv_27 = descriptors_vals[b];
24479                 void* descriptors_conv_27_ptr = untag_ptr(descriptors_conv_27);
24480                 CHECK_ACCESS(descriptors_conv_27_ptr);
24481                 LDKSpendableOutputDescriptor descriptors_conv_27_conv = *(LDKSpendableOutputDescriptor*)(descriptors_conv_27_ptr);
24482                 descriptors_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(descriptors_conv_27));
24483                 descriptors_constr.data[b] = descriptors_conv_27_conv;
24484         }
24485         FREE(descriptors);
24486         LDKCVec_TxOutZ outputs_constr;
24487         outputs_constr.datalen = outputs->arr_len;
24488         if (outputs_constr.datalen > 0)
24489                 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
24490         else
24491                 outputs_constr.data = NULL;
24492         uint64_t* outputs_vals = outputs->elems;
24493         for (size_t h = 0; h < outputs_constr.datalen; h++) {
24494                 uint64_t outputs_conv_7 = outputs_vals[h];
24495                 void* outputs_conv_7_ptr = untag_ptr(outputs_conv_7);
24496                 CHECK_ACCESS(outputs_conv_7_ptr);
24497                 LDKTxOut outputs_conv_7_conv = *(LDKTxOut*)(outputs_conv_7_ptr);
24498                 outputs_conv_7_conv = TxOut_clone((LDKTxOut*)untag_ptr(outputs_conv_7));
24499                 outputs_constr.data[h] = outputs_conv_7_conv;
24500         }
24501         FREE(outputs);
24502         LDKCVec_u8Z change_destination_script_ref;
24503         change_destination_script_ref.datalen = change_destination_script->arr_len;
24504         change_destination_script_ref.data = MALLOC(change_destination_script_ref.datalen, "LDKCVec_u8Z Bytes");
24505         memcpy(change_destination_script_ref.data, change_destination_script->elems, change_destination_script_ref.datalen); FREE(change_destination_script);
24506         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
24507         *ret_conv = PhantomKeysManager_spend_spendable_outputs(&this_arg_conv, descriptors_constr, outputs_constr, change_destination_script_ref, feerate_sat_per_1000_weight);
24508         return tag_ptr(ret_conv, true);
24509 }
24510
24511 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) {
24512         LDKPhantomKeysManager this_arg_conv;
24513         this_arg_conv.inner = untag_ptr(this_arg);
24514         this_arg_conv.is_owned = ptr_is_owned(this_arg);
24515         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24516         this_arg_conv.is_owned = false;
24517         unsigned char params_arr[32];
24518         CHECK(params->arr_len == 32);
24519         memcpy(params_arr, params->elems, 32); FREE(params);
24520         unsigned char (*params_ref)[32] = &params_arr;
24521         LDKInMemorySigner ret_var = PhantomKeysManager_derive_channel_keys(&this_arg_conv, channel_value_satoshis, params_ref);
24522         uint64_t ret_ref = 0;
24523         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24524         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24525         return ret_ref;
24526 }
24527
24528 void  __attribute__((export_name("TS_ChannelManager_free"))) TS_ChannelManager_free(uint64_t this_obj) {
24529         LDKChannelManager this_obj_conv;
24530         this_obj_conv.inner = untag_ptr(this_obj);
24531         this_obj_conv.is_owned = ptr_is_owned(this_obj);
24532         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
24533         ChannelManager_free(this_obj_conv);
24534 }
24535
24536 void  __attribute__((export_name("TS_ChainParameters_free"))) TS_ChainParameters_free(uint64_t this_obj) {
24537         LDKChainParameters this_obj_conv;
24538         this_obj_conv.inner = untag_ptr(this_obj);
24539         this_obj_conv.is_owned = ptr_is_owned(this_obj);
24540         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
24541         ChainParameters_free(this_obj_conv);
24542 }
24543
24544 uint32_t  __attribute__((export_name("TS_ChainParameters_get_network"))) TS_ChainParameters_get_network(uint64_t this_ptr) {
24545         LDKChainParameters this_ptr_conv;
24546         this_ptr_conv.inner = untag_ptr(this_ptr);
24547         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24548         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24549         this_ptr_conv.is_owned = false;
24550         uint32_t ret_conv = LDKNetwork_to_js(ChainParameters_get_network(&this_ptr_conv));
24551         return ret_conv;
24552 }
24553
24554 void  __attribute__((export_name("TS_ChainParameters_set_network"))) TS_ChainParameters_set_network(uint64_t this_ptr, uint32_t val) {
24555         LDKChainParameters this_ptr_conv;
24556         this_ptr_conv.inner = untag_ptr(this_ptr);
24557         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24558         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24559         this_ptr_conv.is_owned = false;
24560         LDKNetwork val_conv = LDKNetwork_from_js(val);
24561         ChainParameters_set_network(&this_ptr_conv, val_conv);
24562 }
24563
24564 uint64_t  __attribute__((export_name("TS_ChainParameters_get_best_block"))) TS_ChainParameters_get_best_block(uint64_t this_ptr) {
24565         LDKChainParameters this_ptr_conv;
24566         this_ptr_conv.inner = untag_ptr(this_ptr);
24567         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24568         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24569         this_ptr_conv.is_owned = false;
24570         LDKBestBlock ret_var = ChainParameters_get_best_block(&this_ptr_conv);
24571         uint64_t ret_ref = 0;
24572         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24573         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24574         return ret_ref;
24575 }
24576
24577 void  __attribute__((export_name("TS_ChainParameters_set_best_block"))) TS_ChainParameters_set_best_block(uint64_t this_ptr, uint64_t val) {
24578         LDKChainParameters this_ptr_conv;
24579         this_ptr_conv.inner = untag_ptr(this_ptr);
24580         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24581         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24582         this_ptr_conv.is_owned = false;
24583         LDKBestBlock val_conv;
24584         val_conv.inner = untag_ptr(val);
24585         val_conv.is_owned = ptr_is_owned(val);
24586         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
24587         val_conv = BestBlock_clone(&val_conv);
24588         ChainParameters_set_best_block(&this_ptr_conv, val_conv);
24589 }
24590
24591 uint64_t  __attribute__((export_name("TS_ChainParameters_new"))) TS_ChainParameters_new(uint32_t network_arg, uint64_t best_block_arg) {
24592         LDKNetwork network_arg_conv = LDKNetwork_from_js(network_arg);
24593         LDKBestBlock best_block_arg_conv;
24594         best_block_arg_conv.inner = untag_ptr(best_block_arg);
24595         best_block_arg_conv.is_owned = ptr_is_owned(best_block_arg);
24596         CHECK_INNER_FIELD_ACCESS_OR_NULL(best_block_arg_conv);
24597         best_block_arg_conv = BestBlock_clone(&best_block_arg_conv);
24598         LDKChainParameters ret_var = ChainParameters_new(network_arg_conv, best_block_arg_conv);
24599         uint64_t ret_ref = 0;
24600         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24601         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24602         return ret_ref;
24603 }
24604
24605 static inline uint64_t ChainParameters_clone_ptr(LDKChainParameters *NONNULL_PTR arg) {
24606         LDKChainParameters ret_var = ChainParameters_clone(arg);
24607         uint64_t ret_ref = 0;
24608         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24609         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24610         return ret_ref;
24611 }
24612 int64_t  __attribute__((export_name("TS_ChainParameters_clone_ptr"))) TS_ChainParameters_clone_ptr(uint64_t arg) {
24613         LDKChainParameters arg_conv;
24614         arg_conv.inner = untag_ptr(arg);
24615         arg_conv.is_owned = ptr_is_owned(arg);
24616         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
24617         arg_conv.is_owned = false;
24618         int64_t ret_conv = ChainParameters_clone_ptr(&arg_conv);
24619         return ret_conv;
24620 }
24621
24622 uint64_t  __attribute__((export_name("TS_ChainParameters_clone"))) TS_ChainParameters_clone(uint64_t orig) {
24623         LDKChainParameters orig_conv;
24624         orig_conv.inner = untag_ptr(orig);
24625         orig_conv.is_owned = ptr_is_owned(orig);
24626         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
24627         orig_conv.is_owned = false;
24628         LDKChainParameters ret_var = ChainParameters_clone(&orig_conv);
24629         uint64_t ret_ref = 0;
24630         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24631         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24632         return ret_ref;
24633 }
24634
24635 void  __attribute__((export_name("TS_CounterpartyForwardingInfo_free"))) TS_CounterpartyForwardingInfo_free(uint64_t this_obj) {
24636         LDKCounterpartyForwardingInfo this_obj_conv;
24637         this_obj_conv.inner = untag_ptr(this_obj);
24638         this_obj_conv.is_owned = ptr_is_owned(this_obj);
24639         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
24640         CounterpartyForwardingInfo_free(this_obj_conv);
24641 }
24642
24643 int32_t  __attribute__((export_name("TS_CounterpartyForwardingInfo_get_fee_base_msat"))) TS_CounterpartyForwardingInfo_get_fee_base_msat(uint64_t this_ptr) {
24644         LDKCounterpartyForwardingInfo this_ptr_conv;
24645         this_ptr_conv.inner = untag_ptr(this_ptr);
24646         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24647         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24648         this_ptr_conv.is_owned = false;
24649         int32_t ret_conv = CounterpartyForwardingInfo_get_fee_base_msat(&this_ptr_conv);
24650         return ret_conv;
24651 }
24652
24653 void  __attribute__((export_name("TS_CounterpartyForwardingInfo_set_fee_base_msat"))) TS_CounterpartyForwardingInfo_set_fee_base_msat(uint64_t this_ptr, int32_t val) {
24654         LDKCounterpartyForwardingInfo this_ptr_conv;
24655         this_ptr_conv.inner = untag_ptr(this_ptr);
24656         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24657         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24658         this_ptr_conv.is_owned = false;
24659         CounterpartyForwardingInfo_set_fee_base_msat(&this_ptr_conv, val);
24660 }
24661
24662 int32_t  __attribute__((export_name("TS_CounterpartyForwardingInfo_get_fee_proportional_millionths"))) TS_CounterpartyForwardingInfo_get_fee_proportional_millionths(uint64_t this_ptr) {
24663         LDKCounterpartyForwardingInfo this_ptr_conv;
24664         this_ptr_conv.inner = untag_ptr(this_ptr);
24665         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24666         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24667         this_ptr_conv.is_owned = false;
24668         int32_t ret_conv = CounterpartyForwardingInfo_get_fee_proportional_millionths(&this_ptr_conv);
24669         return ret_conv;
24670 }
24671
24672 void  __attribute__((export_name("TS_CounterpartyForwardingInfo_set_fee_proportional_millionths"))) TS_CounterpartyForwardingInfo_set_fee_proportional_millionths(uint64_t this_ptr, int32_t val) {
24673         LDKCounterpartyForwardingInfo this_ptr_conv;
24674         this_ptr_conv.inner = untag_ptr(this_ptr);
24675         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24676         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24677         this_ptr_conv.is_owned = false;
24678         CounterpartyForwardingInfo_set_fee_proportional_millionths(&this_ptr_conv, val);
24679 }
24680
24681 int16_t  __attribute__((export_name("TS_CounterpartyForwardingInfo_get_cltv_expiry_delta"))) TS_CounterpartyForwardingInfo_get_cltv_expiry_delta(uint64_t this_ptr) {
24682         LDKCounterpartyForwardingInfo this_ptr_conv;
24683         this_ptr_conv.inner = untag_ptr(this_ptr);
24684         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24685         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24686         this_ptr_conv.is_owned = false;
24687         int16_t ret_conv = CounterpartyForwardingInfo_get_cltv_expiry_delta(&this_ptr_conv);
24688         return ret_conv;
24689 }
24690
24691 void  __attribute__((export_name("TS_CounterpartyForwardingInfo_set_cltv_expiry_delta"))) TS_CounterpartyForwardingInfo_set_cltv_expiry_delta(uint64_t this_ptr, int16_t val) {
24692         LDKCounterpartyForwardingInfo this_ptr_conv;
24693         this_ptr_conv.inner = untag_ptr(this_ptr);
24694         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24695         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24696         this_ptr_conv.is_owned = false;
24697         CounterpartyForwardingInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
24698 }
24699
24700 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) {
24701         LDKCounterpartyForwardingInfo ret_var = CounterpartyForwardingInfo_new(fee_base_msat_arg, fee_proportional_millionths_arg, cltv_expiry_delta_arg);
24702         uint64_t ret_ref = 0;
24703         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24704         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24705         return ret_ref;
24706 }
24707
24708 static inline uint64_t CounterpartyForwardingInfo_clone_ptr(LDKCounterpartyForwardingInfo *NONNULL_PTR arg) {
24709         LDKCounterpartyForwardingInfo ret_var = CounterpartyForwardingInfo_clone(arg);
24710         uint64_t ret_ref = 0;
24711         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24712         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24713         return ret_ref;
24714 }
24715 int64_t  __attribute__((export_name("TS_CounterpartyForwardingInfo_clone_ptr"))) TS_CounterpartyForwardingInfo_clone_ptr(uint64_t arg) {
24716         LDKCounterpartyForwardingInfo arg_conv;
24717         arg_conv.inner = untag_ptr(arg);
24718         arg_conv.is_owned = ptr_is_owned(arg);
24719         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
24720         arg_conv.is_owned = false;
24721         int64_t ret_conv = CounterpartyForwardingInfo_clone_ptr(&arg_conv);
24722         return ret_conv;
24723 }
24724
24725 uint64_t  __attribute__((export_name("TS_CounterpartyForwardingInfo_clone"))) TS_CounterpartyForwardingInfo_clone(uint64_t orig) {
24726         LDKCounterpartyForwardingInfo orig_conv;
24727         orig_conv.inner = untag_ptr(orig);
24728         orig_conv.is_owned = ptr_is_owned(orig);
24729         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
24730         orig_conv.is_owned = false;
24731         LDKCounterpartyForwardingInfo ret_var = CounterpartyForwardingInfo_clone(&orig_conv);
24732         uint64_t ret_ref = 0;
24733         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24734         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24735         return ret_ref;
24736 }
24737
24738 void  __attribute__((export_name("TS_ChannelCounterparty_free"))) TS_ChannelCounterparty_free(uint64_t this_obj) {
24739         LDKChannelCounterparty this_obj_conv;
24740         this_obj_conv.inner = untag_ptr(this_obj);
24741         this_obj_conv.is_owned = ptr_is_owned(this_obj);
24742         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
24743         ChannelCounterparty_free(this_obj_conv);
24744 }
24745
24746 int8_tArray  __attribute__((export_name("TS_ChannelCounterparty_get_node_id"))) TS_ChannelCounterparty_get_node_id(uint64_t this_ptr) {
24747         LDKChannelCounterparty this_ptr_conv;
24748         this_ptr_conv.inner = untag_ptr(this_ptr);
24749         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24750         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24751         this_ptr_conv.is_owned = false;
24752         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
24753         memcpy(ret_arr->elems, ChannelCounterparty_get_node_id(&this_ptr_conv).compressed_form, 33);
24754         return ret_arr;
24755 }
24756
24757 void  __attribute__((export_name("TS_ChannelCounterparty_set_node_id"))) TS_ChannelCounterparty_set_node_id(uint64_t this_ptr, int8_tArray val) {
24758         LDKChannelCounterparty this_ptr_conv;
24759         this_ptr_conv.inner = untag_ptr(this_ptr);
24760         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24761         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24762         this_ptr_conv.is_owned = false;
24763         LDKPublicKey val_ref;
24764         CHECK(val->arr_len == 33);
24765         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
24766         ChannelCounterparty_set_node_id(&this_ptr_conv, val_ref);
24767 }
24768
24769 uint64_t  __attribute__((export_name("TS_ChannelCounterparty_get_features"))) TS_ChannelCounterparty_get_features(uint64_t this_ptr) {
24770         LDKChannelCounterparty this_ptr_conv;
24771         this_ptr_conv.inner = untag_ptr(this_ptr);
24772         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24773         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24774         this_ptr_conv.is_owned = false;
24775         LDKInitFeatures ret_var = ChannelCounterparty_get_features(&this_ptr_conv);
24776         uint64_t ret_ref = 0;
24777         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24778         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24779         return ret_ref;
24780 }
24781
24782 void  __attribute__((export_name("TS_ChannelCounterparty_set_features"))) TS_ChannelCounterparty_set_features(uint64_t this_ptr, uint64_t val) {
24783         LDKChannelCounterparty this_ptr_conv;
24784         this_ptr_conv.inner = untag_ptr(this_ptr);
24785         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24786         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24787         this_ptr_conv.is_owned = false;
24788         LDKInitFeatures val_conv;
24789         val_conv.inner = untag_ptr(val);
24790         val_conv.is_owned = ptr_is_owned(val);
24791         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
24792         val_conv = InitFeatures_clone(&val_conv);
24793         ChannelCounterparty_set_features(&this_ptr_conv, val_conv);
24794 }
24795
24796 int64_t  __attribute__((export_name("TS_ChannelCounterparty_get_unspendable_punishment_reserve"))) TS_ChannelCounterparty_get_unspendable_punishment_reserve(uint64_t this_ptr) {
24797         LDKChannelCounterparty this_ptr_conv;
24798         this_ptr_conv.inner = untag_ptr(this_ptr);
24799         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24800         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24801         this_ptr_conv.is_owned = false;
24802         int64_t ret_conv = ChannelCounterparty_get_unspendable_punishment_reserve(&this_ptr_conv);
24803         return ret_conv;
24804 }
24805
24806 void  __attribute__((export_name("TS_ChannelCounterparty_set_unspendable_punishment_reserve"))) TS_ChannelCounterparty_set_unspendable_punishment_reserve(uint64_t this_ptr, int64_t val) {
24807         LDKChannelCounterparty this_ptr_conv;
24808         this_ptr_conv.inner = untag_ptr(this_ptr);
24809         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24810         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24811         this_ptr_conv.is_owned = false;
24812         ChannelCounterparty_set_unspendable_punishment_reserve(&this_ptr_conv, val);
24813 }
24814
24815 uint64_t  __attribute__((export_name("TS_ChannelCounterparty_get_forwarding_info"))) TS_ChannelCounterparty_get_forwarding_info(uint64_t this_ptr) {
24816         LDKChannelCounterparty this_ptr_conv;
24817         this_ptr_conv.inner = untag_ptr(this_ptr);
24818         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24819         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24820         this_ptr_conv.is_owned = false;
24821         LDKCounterpartyForwardingInfo ret_var = ChannelCounterparty_get_forwarding_info(&this_ptr_conv);
24822         uint64_t ret_ref = 0;
24823         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24824         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24825         return ret_ref;
24826 }
24827
24828 void  __attribute__((export_name("TS_ChannelCounterparty_set_forwarding_info"))) TS_ChannelCounterparty_set_forwarding_info(uint64_t this_ptr, uint64_t val) {
24829         LDKChannelCounterparty this_ptr_conv;
24830         this_ptr_conv.inner = untag_ptr(this_ptr);
24831         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24832         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24833         this_ptr_conv.is_owned = false;
24834         LDKCounterpartyForwardingInfo val_conv;
24835         val_conv.inner = untag_ptr(val);
24836         val_conv.is_owned = ptr_is_owned(val);
24837         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
24838         val_conv = CounterpartyForwardingInfo_clone(&val_conv);
24839         ChannelCounterparty_set_forwarding_info(&this_ptr_conv, val_conv);
24840 }
24841
24842 uint64_t  __attribute__((export_name("TS_ChannelCounterparty_get_outbound_htlc_minimum_msat"))) TS_ChannelCounterparty_get_outbound_htlc_minimum_msat(uint64_t this_ptr) {
24843         LDKChannelCounterparty this_ptr_conv;
24844         this_ptr_conv.inner = untag_ptr(this_ptr);
24845         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24846         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24847         this_ptr_conv.is_owned = false;
24848         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
24849         *ret_copy = ChannelCounterparty_get_outbound_htlc_minimum_msat(&this_ptr_conv);
24850         uint64_t ret_ref = tag_ptr(ret_copy, true);
24851         return ret_ref;
24852 }
24853
24854 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) {
24855         LDKChannelCounterparty this_ptr_conv;
24856         this_ptr_conv.inner = untag_ptr(this_ptr);
24857         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24858         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24859         this_ptr_conv.is_owned = false;
24860         void* val_ptr = untag_ptr(val);
24861         CHECK_ACCESS(val_ptr);
24862         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
24863         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
24864         ChannelCounterparty_set_outbound_htlc_minimum_msat(&this_ptr_conv, val_conv);
24865 }
24866
24867 uint64_t  __attribute__((export_name("TS_ChannelCounterparty_get_outbound_htlc_maximum_msat"))) TS_ChannelCounterparty_get_outbound_htlc_maximum_msat(uint64_t this_ptr) {
24868         LDKChannelCounterparty this_ptr_conv;
24869         this_ptr_conv.inner = untag_ptr(this_ptr);
24870         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24871         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24872         this_ptr_conv.is_owned = false;
24873         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
24874         *ret_copy = ChannelCounterparty_get_outbound_htlc_maximum_msat(&this_ptr_conv);
24875         uint64_t ret_ref = tag_ptr(ret_copy, true);
24876         return ret_ref;
24877 }
24878
24879 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) {
24880         LDKChannelCounterparty this_ptr_conv;
24881         this_ptr_conv.inner = untag_ptr(this_ptr);
24882         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24883         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24884         this_ptr_conv.is_owned = false;
24885         void* val_ptr = untag_ptr(val);
24886         CHECK_ACCESS(val_ptr);
24887         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
24888         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
24889         ChannelCounterparty_set_outbound_htlc_maximum_msat(&this_ptr_conv, val_conv);
24890 }
24891
24892 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) {
24893         LDKPublicKey node_id_arg_ref;
24894         CHECK(node_id_arg->arr_len == 33);
24895         memcpy(node_id_arg_ref.compressed_form, node_id_arg->elems, 33); FREE(node_id_arg);
24896         LDKInitFeatures features_arg_conv;
24897         features_arg_conv.inner = untag_ptr(features_arg);
24898         features_arg_conv.is_owned = ptr_is_owned(features_arg);
24899         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
24900         features_arg_conv = InitFeatures_clone(&features_arg_conv);
24901         LDKCounterpartyForwardingInfo forwarding_info_arg_conv;
24902         forwarding_info_arg_conv.inner = untag_ptr(forwarding_info_arg);
24903         forwarding_info_arg_conv.is_owned = ptr_is_owned(forwarding_info_arg);
24904         CHECK_INNER_FIELD_ACCESS_OR_NULL(forwarding_info_arg_conv);
24905         forwarding_info_arg_conv = CounterpartyForwardingInfo_clone(&forwarding_info_arg_conv);
24906         void* outbound_htlc_minimum_msat_arg_ptr = untag_ptr(outbound_htlc_minimum_msat_arg);
24907         CHECK_ACCESS(outbound_htlc_minimum_msat_arg_ptr);
24908         LDKCOption_u64Z outbound_htlc_minimum_msat_arg_conv = *(LDKCOption_u64Z*)(outbound_htlc_minimum_msat_arg_ptr);
24909         outbound_htlc_minimum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(outbound_htlc_minimum_msat_arg));
24910         void* outbound_htlc_maximum_msat_arg_ptr = untag_ptr(outbound_htlc_maximum_msat_arg);
24911         CHECK_ACCESS(outbound_htlc_maximum_msat_arg_ptr);
24912         LDKCOption_u64Z outbound_htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(outbound_htlc_maximum_msat_arg_ptr);
24913         outbound_htlc_maximum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(outbound_htlc_maximum_msat_arg));
24914         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);
24915         uint64_t ret_ref = 0;
24916         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24917         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24918         return ret_ref;
24919 }
24920
24921 static inline uint64_t ChannelCounterparty_clone_ptr(LDKChannelCounterparty *NONNULL_PTR arg) {
24922         LDKChannelCounterparty ret_var = ChannelCounterparty_clone(arg);
24923         uint64_t ret_ref = 0;
24924         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24925         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24926         return ret_ref;
24927 }
24928 int64_t  __attribute__((export_name("TS_ChannelCounterparty_clone_ptr"))) TS_ChannelCounterparty_clone_ptr(uint64_t arg) {
24929         LDKChannelCounterparty arg_conv;
24930         arg_conv.inner = untag_ptr(arg);
24931         arg_conv.is_owned = ptr_is_owned(arg);
24932         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
24933         arg_conv.is_owned = false;
24934         int64_t ret_conv = ChannelCounterparty_clone_ptr(&arg_conv);
24935         return ret_conv;
24936 }
24937
24938 uint64_t  __attribute__((export_name("TS_ChannelCounterparty_clone"))) TS_ChannelCounterparty_clone(uint64_t orig) {
24939         LDKChannelCounterparty orig_conv;
24940         orig_conv.inner = untag_ptr(orig);
24941         orig_conv.is_owned = ptr_is_owned(orig);
24942         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
24943         orig_conv.is_owned = false;
24944         LDKChannelCounterparty ret_var = ChannelCounterparty_clone(&orig_conv);
24945         uint64_t ret_ref = 0;
24946         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24947         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24948         return ret_ref;
24949 }
24950
24951 void  __attribute__((export_name("TS_ChannelDetails_free"))) TS_ChannelDetails_free(uint64_t this_obj) {
24952         LDKChannelDetails this_obj_conv;
24953         this_obj_conv.inner = untag_ptr(this_obj);
24954         this_obj_conv.is_owned = ptr_is_owned(this_obj);
24955         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
24956         ChannelDetails_free(this_obj_conv);
24957 }
24958
24959 int8_tArray  __attribute__((export_name("TS_ChannelDetails_get_channel_id"))) TS_ChannelDetails_get_channel_id(uint64_t this_ptr) {
24960         LDKChannelDetails this_ptr_conv;
24961         this_ptr_conv.inner = untag_ptr(this_ptr);
24962         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24963         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24964         this_ptr_conv.is_owned = false;
24965         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
24966         memcpy(ret_arr->elems, *ChannelDetails_get_channel_id(&this_ptr_conv), 32);
24967         return ret_arr;
24968 }
24969
24970 void  __attribute__((export_name("TS_ChannelDetails_set_channel_id"))) TS_ChannelDetails_set_channel_id(uint64_t this_ptr, int8_tArray val) {
24971         LDKChannelDetails this_ptr_conv;
24972         this_ptr_conv.inner = untag_ptr(this_ptr);
24973         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24974         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24975         this_ptr_conv.is_owned = false;
24976         LDKThirtyTwoBytes val_ref;
24977         CHECK(val->arr_len == 32);
24978         memcpy(val_ref.data, val->elems, 32); FREE(val);
24979         ChannelDetails_set_channel_id(&this_ptr_conv, val_ref);
24980 }
24981
24982 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_counterparty"))) TS_ChannelDetails_get_counterparty(uint64_t this_ptr) {
24983         LDKChannelDetails this_ptr_conv;
24984         this_ptr_conv.inner = untag_ptr(this_ptr);
24985         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24986         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24987         this_ptr_conv.is_owned = false;
24988         LDKChannelCounterparty ret_var = ChannelDetails_get_counterparty(&this_ptr_conv);
24989         uint64_t ret_ref = 0;
24990         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24991         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24992         return ret_ref;
24993 }
24994
24995 void  __attribute__((export_name("TS_ChannelDetails_set_counterparty"))) TS_ChannelDetails_set_counterparty(uint64_t this_ptr, uint64_t val) {
24996         LDKChannelDetails this_ptr_conv;
24997         this_ptr_conv.inner = untag_ptr(this_ptr);
24998         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24999         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25000         this_ptr_conv.is_owned = false;
25001         LDKChannelCounterparty val_conv;
25002         val_conv.inner = untag_ptr(val);
25003         val_conv.is_owned = ptr_is_owned(val);
25004         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
25005         val_conv = ChannelCounterparty_clone(&val_conv);
25006         ChannelDetails_set_counterparty(&this_ptr_conv, val_conv);
25007 }
25008
25009 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_funding_txo"))) TS_ChannelDetails_get_funding_txo(uint64_t this_ptr) {
25010         LDKChannelDetails this_ptr_conv;
25011         this_ptr_conv.inner = untag_ptr(this_ptr);
25012         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25013         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25014         this_ptr_conv.is_owned = false;
25015         LDKOutPoint ret_var = ChannelDetails_get_funding_txo(&this_ptr_conv);
25016         uint64_t ret_ref = 0;
25017         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25018         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
25019         return ret_ref;
25020 }
25021
25022 void  __attribute__((export_name("TS_ChannelDetails_set_funding_txo"))) TS_ChannelDetails_set_funding_txo(uint64_t this_ptr, uint64_t val) {
25023         LDKChannelDetails this_ptr_conv;
25024         this_ptr_conv.inner = untag_ptr(this_ptr);
25025         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25026         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25027         this_ptr_conv.is_owned = false;
25028         LDKOutPoint val_conv;
25029         val_conv.inner = untag_ptr(val);
25030         val_conv.is_owned = ptr_is_owned(val);
25031         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
25032         val_conv = OutPoint_clone(&val_conv);
25033         ChannelDetails_set_funding_txo(&this_ptr_conv, val_conv);
25034 }
25035
25036 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_channel_type"))) TS_ChannelDetails_get_channel_type(uint64_t this_ptr) {
25037         LDKChannelDetails this_ptr_conv;
25038         this_ptr_conv.inner = untag_ptr(this_ptr);
25039         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25040         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25041         this_ptr_conv.is_owned = false;
25042         LDKChannelTypeFeatures ret_var = ChannelDetails_get_channel_type(&this_ptr_conv);
25043         uint64_t ret_ref = 0;
25044         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25045         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
25046         return ret_ref;
25047 }
25048
25049 void  __attribute__((export_name("TS_ChannelDetails_set_channel_type"))) TS_ChannelDetails_set_channel_type(uint64_t this_ptr, uint64_t val) {
25050         LDKChannelDetails this_ptr_conv;
25051         this_ptr_conv.inner = untag_ptr(this_ptr);
25052         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25053         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25054         this_ptr_conv.is_owned = false;
25055         LDKChannelTypeFeatures val_conv;
25056         val_conv.inner = untag_ptr(val);
25057         val_conv.is_owned = ptr_is_owned(val);
25058         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
25059         val_conv = ChannelTypeFeatures_clone(&val_conv);
25060         ChannelDetails_set_channel_type(&this_ptr_conv, val_conv);
25061 }
25062
25063 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_short_channel_id"))) TS_ChannelDetails_get_short_channel_id(uint64_t this_ptr) {
25064         LDKChannelDetails this_ptr_conv;
25065         this_ptr_conv.inner = untag_ptr(this_ptr);
25066         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25067         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25068         this_ptr_conv.is_owned = false;
25069         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
25070         *ret_copy = ChannelDetails_get_short_channel_id(&this_ptr_conv);
25071         uint64_t ret_ref = tag_ptr(ret_copy, true);
25072         return ret_ref;
25073 }
25074
25075 void  __attribute__((export_name("TS_ChannelDetails_set_short_channel_id"))) TS_ChannelDetails_set_short_channel_id(uint64_t this_ptr, uint64_t val) {
25076         LDKChannelDetails this_ptr_conv;
25077         this_ptr_conv.inner = untag_ptr(this_ptr);
25078         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25079         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25080         this_ptr_conv.is_owned = false;
25081         void* val_ptr = untag_ptr(val);
25082         CHECK_ACCESS(val_ptr);
25083         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
25084         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
25085         ChannelDetails_set_short_channel_id(&this_ptr_conv, val_conv);
25086 }
25087
25088 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_outbound_scid_alias"))) TS_ChannelDetails_get_outbound_scid_alias(uint64_t this_ptr) {
25089         LDKChannelDetails this_ptr_conv;
25090         this_ptr_conv.inner = untag_ptr(this_ptr);
25091         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25092         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25093         this_ptr_conv.is_owned = false;
25094         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
25095         *ret_copy = ChannelDetails_get_outbound_scid_alias(&this_ptr_conv);
25096         uint64_t ret_ref = tag_ptr(ret_copy, true);
25097         return ret_ref;
25098 }
25099
25100 void  __attribute__((export_name("TS_ChannelDetails_set_outbound_scid_alias"))) TS_ChannelDetails_set_outbound_scid_alias(uint64_t this_ptr, uint64_t val) {
25101         LDKChannelDetails this_ptr_conv;
25102         this_ptr_conv.inner = untag_ptr(this_ptr);
25103         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25104         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25105         this_ptr_conv.is_owned = false;
25106         void* val_ptr = untag_ptr(val);
25107         CHECK_ACCESS(val_ptr);
25108         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
25109         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
25110         ChannelDetails_set_outbound_scid_alias(&this_ptr_conv, val_conv);
25111 }
25112
25113 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_inbound_scid_alias"))) TS_ChannelDetails_get_inbound_scid_alias(uint64_t this_ptr) {
25114         LDKChannelDetails this_ptr_conv;
25115         this_ptr_conv.inner = untag_ptr(this_ptr);
25116         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25117         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25118         this_ptr_conv.is_owned = false;
25119         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
25120         *ret_copy = ChannelDetails_get_inbound_scid_alias(&this_ptr_conv);
25121         uint64_t ret_ref = tag_ptr(ret_copy, true);
25122         return ret_ref;
25123 }
25124
25125 void  __attribute__((export_name("TS_ChannelDetails_set_inbound_scid_alias"))) TS_ChannelDetails_set_inbound_scid_alias(uint64_t this_ptr, uint64_t val) {
25126         LDKChannelDetails this_ptr_conv;
25127         this_ptr_conv.inner = untag_ptr(this_ptr);
25128         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25129         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25130         this_ptr_conv.is_owned = false;
25131         void* val_ptr = untag_ptr(val);
25132         CHECK_ACCESS(val_ptr);
25133         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
25134         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
25135         ChannelDetails_set_inbound_scid_alias(&this_ptr_conv, val_conv);
25136 }
25137
25138 int64_t  __attribute__((export_name("TS_ChannelDetails_get_channel_value_satoshis"))) TS_ChannelDetails_get_channel_value_satoshis(uint64_t this_ptr) {
25139         LDKChannelDetails this_ptr_conv;
25140         this_ptr_conv.inner = untag_ptr(this_ptr);
25141         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25142         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25143         this_ptr_conv.is_owned = false;
25144         int64_t ret_conv = ChannelDetails_get_channel_value_satoshis(&this_ptr_conv);
25145         return ret_conv;
25146 }
25147
25148 void  __attribute__((export_name("TS_ChannelDetails_set_channel_value_satoshis"))) TS_ChannelDetails_set_channel_value_satoshis(uint64_t this_ptr, int64_t val) {
25149         LDKChannelDetails this_ptr_conv;
25150         this_ptr_conv.inner = untag_ptr(this_ptr);
25151         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25152         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25153         this_ptr_conv.is_owned = false;
25154         ChannelDetails_set_channel_value_satoshis(&this_ptr_conv, val);
25155 }
25156
25157 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_unspendable_punishment_reserve"))) TS_ChannelDetails_get_unspendable_punishment_reserve(uint64_t this_ptr) {
25158         LDKChannelDetails this_ptr_conv;
25159         this_ptr_conv.inner = untag_ptr(this_ptr);
25160         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25161         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25162         this_ptr_conv.is_owned = false;
25163         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
25164         *ret_copy = ChannelDetails_get_unspendable_punishment_reserve(&this_ptr_conv);
25165         uint64_t ret_ref = tag_ptr(ret_copy, true);
25166         return ret_ref;
25167 }
25168
25169 void  __attribute__((export_name("TS_ChannelDetails_set_unspendable_punishment_reserve"))) TS_ChannelDetails_set_unspendable_punishment_reserve(uint64_t this_ptr, uint64_t val) {
25170         LDKChannelDetails this_ptr_conv;
25171         this_ptr_conv.inner = untag_ptr(this_ptr);
25172         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25173         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25174         this_ptr_conv.is_owned = false;
25175         void* val_ptr = untag_ptr(val);
25176         CHECK_ACCESS(val_ptr);
25177         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
25178         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
25179         ChannelDetails_set_unspendable_punishment_reserve(&this_ptr_conv, val_conv);
25180 }
25181
25182 int64_t  __attribute__((export_name("TS_ChannelDetails_get_user_channel_id"))) TS_ChannelDetails_get_user_channel_id(uint64_t this_ptr) {
25183         LDKChannelDetails this_ptr_conv;
25184         this_ptr_conv.inner = untag_ptr(this_ptr);
25185         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25186         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25187         this_ptr_conv.is_owned = false;
25188         int64_t ret_conv = ChannelDetails_get_user_channel_id(&this_ptr_conv);
25189         return ret_conv;
25190 }
25191
25192 void  __attribute__((export_name("TS_ChannelDetails_set_user_channel_id"))) TS_ChannelDetails_set_user_channel_id(uint64_t this_ptr, int64_t val) {
25193         LDKChannelDetails this_ptr_conv;
25194         this_ptr_conv.inner = untag_ptr(this_ptr);
25195         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25196         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25197         this_ptr_conv.is_owned = false;
25198         ChannelDetails_set_user_channel_id(&this_ptr_conv, val);
25199 }
25200
25201 int64_t  __attribute__((export_name("TS_ChannelDetails_get_balance_msat"))) TS_ChannelDetails_get_balance_msat(uint64_t this_ptr) {
25202         LDKChannelDetails this_ptr_conv;
25203         this_ptr_conv.inner = untag_ptr(this_ptr);
25204         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25205         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25206         this_ptr_conv.is_owned = false;
25207         int64_t ret_conv = ChannelDetails_get_balance_msat(&this_ptr_conv);
25208         return ret_conv;
25209 }
25210
25211 void  __attribute__((export_name("TS_ChannelDetails_set_balance_msat"))) TS_ChannelDetails_set_balance_msat(uint64_t this_ptr, int64_t val) {
25212         LDKChannelDetails this_ptr_conv;
25213         this_ptr_conv.inner = untag_ptr(this_ptr);
25214         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25215         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25216         this_ptr_conv.is_owned = false;
25217         ChannelDetails_set_balance_msat(&this_ptr_conv, val);
25218 }
25219
25220 int64_t  __attribute__((export_name("TS_ChannelDetails_get_outbound_capacity_msat"))) TS_ChannelDetails_get_outbound_capacity_msat(uint64_t this_ptr) {
25221         LDKChannelDetails this_ptr_conv;
25222         this_ptr_conv.inner = untag_ptr(this_ptr);
25223         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25224         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25225         this_ptr_conv.is_owned = false;
25226         int64_t ret_conv = ChannelDetails_get_outbound_capacity_msat(&this_ptr_conv);
25227         return ret_conv;
25228 }
25229
25230 void  __attribute__((export_name("TS_ChannelDetails_set_outbound_capacity_msat"))) TS_ChannelDetails_set_outbound_capacity_msat(uint64_t this_ptr, int64_t val) {
25231         LDKChannelDetails 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         ChannelDetails_set_outbound_capacity_msat(&this_ptr_conv, val);
25237 }
25238
25239 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) {
25240         LDKChannelDetails this_ptr_conv;
25241         this_ptr_conv.inner = untag_ptr(this_ptr);
25242         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25243         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25244         this_ptr_conv.is_owned = false;
25245         int64_t ret_conv = ChannelDetails_get_next_outbound_htlc_limit_msat(&this_ptr_conv);
25246         return ret_conv;
25247 }
25248
25249 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) {
25250         LDKChannelDetails this_ptr_conv;
25251         this_ptr_conv.inner = untag_ptr(this_ptr);
25252         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25253         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25254         this_ptr_conv.is_owned = false;
25255         ChannelDetails_set_next_outbound_htlc_limit_msat(&this_ptr_conv, val);
25256 }
25257
25258 int64_t  __attribute__((export_name("TS_ChannelDetails_get_inbound_capacity_msat"))) TS_ChannelDetails_get_inbound_capacity_msat(uint64_t this_ptr) {
25259         LDKChannelDetails this_ptr_conv;
25260         this_ptr_conv.inner = untag_ptr(this_ptr);
25261         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25262         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25263         this_ptr_conv.is_owned = false;
25264         int64_t ret_conv = ChannelDetails_get_inbound_capacity_msat(&this_ptr_conv);
25265         return ret_conv;
25266 }
25267
25268 void  __attribute__((export_name("TS_ChannelDetails_set_inbound_capacity_msat"))) TS_ChannelDetails_set_inbound_capacity_msat(uint64_t this_ptr, int64_t val) {
25269         LDKChannelDetails this_ptr_conv;
25270         this_ptr_conv.inner = untag_ptr(this_ptr);
25271         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25272         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25273         this_ptr_conv.is_owned = false;
25274         ChannelDetails_set_inbound_capacity_msat(&this_ptr_conv, val);
25275 }
25276
25277 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_confirmations_required"))) TS_ChannelDetails_get_confirmations_required(uint64_t this_ptr) {
25278         LDKChannelDetails this_ptr_conv;
25279         this_ptr_conv.inner = untag_ptr(this_ptr);
25280         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25281         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25282         this_ptr_conv.is_owned = false;
25283         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
25284         *ret_copy = ChannelDetails_get_confirmations_required(&this_ptr_conv);
25285         uint64_t ret_ref = tag_ptr(ret_copy, true);
25286         return ret_ref;
25287 }
25288
25289 void  __attribute__((export_name("TS_ChannelDetails_set_confirmations_required"))) TS_ChannelDetails_set_confirmations_required(uint64_t this_ptr, uint64_t val) {
25290         LDKChannelDetails this_ptr_conv;
25291         this_ptr_conv.inner = untag_ptr(this_ptr);
25292         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25293         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25294         this_ptr_conv.is_owned = false;
25295         void* val_ptr = untag_ptr(val);
25296         CHECK_ACCESS(val_ptr);
25297         LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
25298         val_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(val));
25299         ChannelDetails_set_confirmations_required(&this_ptr_conv, val_conv);
25300 }
25301
25302 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_force_close_spend_delay"))) TS_ChannelDetails_get_force_close_spend_delay(uint64_t this_ptr) {
25303         LDKChannelDetails this_ptr_conv;
25304         this_ptr_conv.inner = untag_ptr(this_ptr);
25305         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25306         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25307         this_ptr_conv.is_owned = false;
25308         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
25309         *ret_copy = ChannelDetails_get_force_close_spend_delay(&this_ptr_conv);
25310         uint64_t ret_ref = tag_ptr(ret_copy, true);
25311         return ret_ref;
25312 }
25313
25314 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) {
25315         LDKChannelDetails this_ptr_conv;
25316         this_ptr_conv.inner = untag_ptr(this_ptr);
25317         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25318         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25319         this_ptr_conv.is_owned = false;
25320         void* val_ptr = untag_ptr(val);
25321         CHECK_ACCESS(val_ptr);
25322         LDKCOption_u16Z val_conv = *(LDKCOption_u16Z*)(val_ptr);
25323         val_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(val));
25324         ChannelDetails_set_force_close_spend_delay(&this_ptr_conv, val_conv);
25325 }
25326
25327 jboolean  __attribute__((export_name("TS_ChannelDetails_get_is_outbound"))) TS_ChannelDetails_get_is_outbound(uint64_t this_ptr) {
25328         LDKChannelDetails this_ptr_conv;
25329         this_ptr_conv.inner = untag_ptr(this_ptr);
25330         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25331         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25332         this_ptr_conv.is_owned = false;
25333         jboolean ret_conv = ChannelDetails_get_is_outbound(&this_ptr_conv);
25334         return ret_conv;
25335 }
25336
25337 void  __attribute__((export_name("TS_ChannelDetails_set_is_outbound"))) TS_ChannelDetails_set_is_outbound(uint64_t this_ptr, jboolean val) {
25338         LDKChannelDetails this_ptr_conv;
25339         this_ptr_conv.inner = untag_ptr(this_ptr);
25340         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25341         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25342         this_ptr_conv.is_owned = false;
25343         ChannelDetails_set_is_outbound(&this_ptr_conv, val);
25344 }
25345
25346 jboolean  __attribute__((export_name("TS_ChannelDetails_get_is_channel_ready"))) TS_ChannelDetails_get_is_channel_ready(uint64_t this_ptr) {
25347         LDKChannelDetails this_ptr_conv;
25348         this_ptr_conv.inner = untag_ptr(this_ptr);
25349         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25350         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25351         this_ptr_conv.is_owned = false;
25352         jboolean ret_conv = ChannelDetails_get_is_channel_ready(&this_ptr_conv);
25353         return ret_conv;
25354 }
25355
25356 void  __attribute__((export_name("TS_ChannelDetails_set_is_channel_ready"))) TS_ChannelDetails_set_is_channel_ready(uint64_t this_ptr, jboolean val) {
25357         LDKChannelDetails 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         ChannelDetails_set_is_channel_ready(&this_ptr_conv, val);
25363 }
25364
25365 jboolean  __attribute__((export_name("TS_ChannelDetails_get_is_usable"))) TS_ChannelDetails_get_is_usable(uint64_t this_ptr) {
25366         LDKChannelDetails this_ptr_conv;
25367         this_ptr_conv.inner = untag_ptr(this_ptr);
25368         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25369         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25370         this_ptr_conv.is_owned = false;
25371         jboolean ret_conv = ChannelDetails_get_is_usable(&this_ptr_conv);
25372         return ret_conv;
25373 }
25374
25375 void  __attribute__((export_name("TS_ChannelDetails_set_is_usable"))) TS_ChannelDetails_set_is_usable(uint64_t this_ptr, jboolean val) {
25376         LDKChannelDetails this_ptr_conv;
25377         this_ptr_conv.inner = untag_ptr(this_ptr);
25378         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25379         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25380         this_ptr_conv.is_owned = false;
25381         ChannelDetails_set_is_usable(&this_ptr_conv, val);
25382 }
25383
25384 jboolean  __attribute__((export_name("TS_ChannelDetails_get_is_public"))) TS_ChannelDetails_get_is_public(uint64_t this_ptr) {
25385         LDKChannelDetails this_ptr_conv;
25386         this_ptr_conv.inner = untag_ptr(this_ptr);
25387         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25388         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25389         this_ptr_conv.is_owned = false;
25390         jboolean ret_conv = ChannelDetails_get_is_public(&this_ptr_conv);
25391         return ret_conv;
25392 }
25393
25394 void  __attribute__((export_name("TS_ChannelDetails_set_is_public"))) TS_ChannelDetails_set_is_public(uint64_t this_ptr, jboolean val) {
25395         LDKChannelDetails this_ptr_conv;
25396         this_ptr_conv.inner = untag_ptr(this_ptr);
25397         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25398         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25399         this_ptr_conv.is_owned = false;
25400         ChannelDetails_set_is_public(&this_ptr_conv, val);
25401 }
25402
25403 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_inbound_htlc_minimum_msat"))) TS_ChannelDetails_get_inbound_htlc_minimum_msat(uint64_t this_ptr) {
25404         LDKChannelDetails this_ptr_conv;
25405         this_ptr_conv.inner = untag_ptr(this_ptr);
25406         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25407         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25408         this_ptr_conv.is_owned = false;
25409         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
25410         *ret_copy = ChannelDetails_get_inbound_htlc_minimum_msat(&this_ptr_conv);
25411         uint64_t ret_ref = tag_ptr(ret_copy, true);
25412         return ret_ref;
25413 }
25414
25415 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) {
25416         LDKChannelDetails this_ptr_conv;
25417         this_ptr_conv.inner = untag_ptr(this_ptr);
25418         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25419         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25420         this_ptr_conv.is_owned = false;
25421         void* val_ptr = untag_ptr(val);
25422         CHECK_ACCESS(val_ptr);
25423         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
25424         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
25425         ChannelDetails_set_inbound_htlc_minimum_msat(&this_ptr_conv, val_conv);
25426 }
25427
25428 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_inbound_htlc_maximum_msat"))) TS_ChannelDetails_get_inbound_htlc_maximum_msat(uint64_t this_ptr) {
25429         LDKChannelDetails this_ptr_conv;
25430         this_ptr_conv.inner = untag_ptr(this_ptr);
25431         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25432         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25433         this_ptr_conv.is_owned = false;
25434         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
25435         *ret_copy = ChannelDetails_get_inbound_htlc_maximum_msat(&this_ptr_conv);
25436         uint64_t ret_ref = tag_ptr(ret_copy, true);
25437         return ret_ref;
25438 }
25439
25440 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) {
25441         LDKChannelDetails this_ptr_conv;
25442         this_ptr_conv.inner = untag_ptr(this_ptr);
25443         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25444         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25445         this_ptr_conv.is_owned = false;
25446         void* val_ptr = untag_ptr(val);
25447         CHECK_ACCESS(val_ptr);
25448         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
25449         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
25450         ChannelDetails_set_inbound_htlc_maximum_msat(&this_ptr_conv, val_conv);
25451 }
25452
25453 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_config"))) TS_ChannelDetails_get_config(uint64_t this_ptr) {
25454         LDKChannelDetails this_ptr_conv;
25455         this_ptr_conv.inner = untag_ptr(this_ptr);
25456         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25457         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25458         this_ptr_conv.is_owned = false;
25459         LDKChannelConfig ret_var = ChannelDetails_get_config(&this_ptr_conv);
25460         uint64_t ret_ref = 0;
25461         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25462         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
25463         return ret_ref;
25464 }
25465
25466 void  __attribute__((export_name("TS_ChannelDetails_set_config"))) TS_ChannelDetails_set_config(uint64_t this_ptr, uint64_t val) {
25467         LDKChannelDetails this_ptr_conv;
25468         this_ptr_conv.inner = untag_ptr(this_ptr);
25469         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25470         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25471         this_ptr_conv.is_owned = false;
25472         LDKChannelConfig val_conv;
25473         val_conv.inner = untag_ptr(val);
25474         val_conv.is_owned = ptr_is_owned(val);
25475         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
25476         val_conv = ChannelConfig_clone(&val_conv);
25477         ChannelDetails_set_config(&this_ptr_conv, val_conv);
25478 }
25479
25480 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) {
25481         LDKThirtyTwoBytes channel_id_arg_ref;
25482         CHECK(channel_id_arg->arr_len == 32);
25483         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
25484         LDKChannelCounterparty counterparty_arg_conv;
25485         counterparty_arg_conv.inner = untag_ptr(counterparty_arg);
25486         counterparty_arg_conv.is_owned = ptr_is_owned(counterparty_arg);
25487         CHECK_INNER_FIELD_ACCESS_OR_NULL(counterparty_arg_conv);
25488         counterparty_arg_conv = ChannelCounterparty_clone(&counterparty_arg_conv);
25489         LDKOutPoint funding_txo_arg_conv;
25490         funding_txo_arg_conv.inner = untag_ptr(funding_txo_arg);
25491         funding_txo_arg_conv.is_owned = ptr_is_owned(funding_txo_arg);
25492         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_arg_conv);
25493         funding_txo_arg_conv = OutPoint_clone(&funding_txo_arg_conv);
25494         LDKChannelTypeFeatures channel_type_arg_conv;
25495         channel_type_arg_conv.inner = untag_ptr(channel_type_arg);
25496         channel_type_arg_conv.is_owned = ptr_is_owned(channel_type_arg);
25497         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_arg_conv);
25498         channel_type_arg_conv = ChannelTypeFeatures_clone(&channel_type_arg_conv);
25499         void* short_channel_id_arg_ptr = untag_ptr(short_channel_id_arg);
25500         CHECK_ACCESS(short_channel_id_arg_ptr);
25501         LDKCOption_u64Z short_channel_id_arg_conv = *(LDKCOption_u64Z*)(short_channel_id_arg_ptr);
25502         short_channel_id_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(short_channel_id_arg));
25503         void* outbound_scid_alias_arg_ptr = untag_ptr(outbound_scid_alias_arg);
25504         CHECK_ACCESS(outbound_scid_alias_arg_ptr);
25505         LDKCOption_u64Z outbound_scid_alias_arg_conv = *(LDKCOption_u64Z*)(outbound_scid_alias_arg_ptr);
25506         outbound_scid_alias_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(outbound_scid_alias_arg));
25507         void* inbound_scid_alias_arg_ptr = untag_ptr(inbound_scid_alias_arg);
25508         CHECK_ACCESS(inbound_scid_alias_arg_ptr);
25509         LDKCOption_u64Z inbound_scid_alias_arg_conv = *(LDKCOption_u64Z*)(inbound_scid_alias_arg_ptr);
25510         inbound_scid_alias_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(inbound_scid_alias_arg));
25511         void* unspendable_punishment_reserve_arg_ptr = untag_ptr(unspendable_punishment_reserve_arg);
25512         CHECK_ACCESS(unspendable_punishment_reserve_arg_ptr);
25513         LDKCOption_u64Z unspendable_punishment_reserve_arg_conv = *(LDKCOption_u64Z*)(unspendable_punishment_reserve_arg_ptr);
25514         void* confirmations_required_arg_ptr = untag_ptr(confirmations_required_arg);
25515         CHECK_ACCESS(confirmations_required_arg_ptr);
25516         LDKCOption_u32Z confirmations_required_arg_conv = *(LDKCOption_u32Z*)(confirmations_required_arg_ptr);
25517         confirmations_required_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(confirmations_required_arg));
25518         void* force_close_spend_delay_arg_ptr = untag_ptr(force_close_spend_delay_arg);
25519         CHECK_ACCESS(force_close_spend_delay_arg_ptr);
25520         LDKCOption_u16Z force_close_spend_delay_arg_conv = *(LDKCOption_u16Z*)(force_close_spend_delay_arg_ptr);
25521         force_close_spend_delay_arg_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(force_close_spend_delay_arg));
25522         void* inbound_htlc_minimum_msat_arg_ptr = untag_ptr(inbound_htlc_minimum_msat_arg);
25523         CHECK_ACCESS(inbound_htlc_minimum_msat_arg_ptr);
25524         LDKCOption_u64Z inbound_htlc_minimum_msat_arg_conv = *(LDKCOption_u64Z*)(inbound_htlc_minimum_msat_arg_ptr);
25525         inbound_htlc_minimum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(inbound_htlc_minimum_msat_arg));
25526         void* inbound_htlc_maximum_msat_arg_ptr = untag_ptr(inbound_htlc_maximum_msat_arg);
25527         CHECK_ACCESS(inbound_htlc_maximum_msat_arg_ptr);
25528         LDKCOption_u64Z inbound_htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(inbound_htlc_maximum_msat_arg_ptr);
25529         inbound_htlc_maximum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(inbound_htlc_maximum_msat_arg));
25530         LDKChannelConfig config_arg_conv;
25531         config_arg_conv.inner = untag_ptr(config_arg);
25532         config_arg_conv.is_owned = ptr_is_owned(config_arg);
25533         CHECK_INNER_FIELD_ACCESS_OR_NULL(config_arg_conv);
25534         config_arg_conv = ChannelConfig_clone(&config_arg_conv);
25535         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);
25536         uint64_t ret_ref = 0;
25537         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25538         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
25539         return ret_ref;
25540 }
25541
25542 static inline uint64_t ChannelDetails_clone_ptr(LDKChannelDetails *NONNULL_PTR arg) {
25543         LDKChannelDetails ret_var = ChannelDetails_clone(arg);
25544         uint64_t ret_ref = 0;
25545         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25546         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
25547         return ret_ref;
25548 }
25549 int64_t  __attribute__((export_name("TS_ChannelDetails_clone_ptr"))) TS_ChannelDetails_clone_ptr(uint64_t arg) {
25550         LDKChannelDetails arg_conv;
25551         arg_conv.inner = untag_ptr(arg);
25552         arg_conv.is_owned = ptr_is_owned(arg);
25553         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
25554         arg_conv.is_owned = false;
25555         int64_t ret_conv = ChannelDetails_clone_ptr(&arg_conv);
25556         return ret_conv;
25557 }
25558
25559 uint64_t  __attribute__((export_name("TS_ChannelDetails_clone"))) TS_ChannelDetails_clone(uint64_t orig) {
25560         LDKChannelDetails orig_conv;
25561         orig_conv.inner = untag_ptr(orig);
25562         orig_conv.is_owned = ptr_is_owned(orig);
25563         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
25564         orig_conv.is_owned = false;
25565         LDKChannelDetails ret_var = ChannelDetails_clone(&orig_conv);
25566         uint64_t ret_ref = 0;
25567         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25568         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
25569         return ret_ref;
25570 }
25571
25572 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_inbound_payment_scid"))) TS_ChannelDetails_get_inbound_payment_scid(uint64_t this_arg) {
25573         LDKChannelDetails this_arg_conv;
25574         this_arg_conv.inner = untag_ptr(this_arg);
25575         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25576         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25577         this_arg_conv.is_owned = false;
25578         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
25579         *ret_copy = ChannelDetails_get_inbound_payment_scid(&this_arg_conv);
25580         uint64_t ret_ref = tag_ptr(ret_copy, true);
25581         return ret_ref;
25582 }
25583
25584 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_outbound_payment_scid"))) TS_ChannelDetails_get_outbound_payment_scid(uint64_t this_arg) {
25585         LDKChannelDetails this_arg_conv;
25586         this_arg_conv.inner = untag_ptr(this_arg);
25587         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25588         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25589         this_arg_conv.is_owned = false;
25590         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
25591         *ret_copy = ChannelDetails_get_outbound_payment_scid(&this_arg_conv);
25592         uint64_t ret_ref = tag_ptr(ret_copy, true);
25593         return ret_ref;
25594 }
25595
25596 void  __attribute__((export_name("TS_PaymentSendFailure_free"))) TS_PaymentSendFailure_free(uint64_t this_ptr) {
25597         if (!ptr_is_owned(this_ptr)) return;
25598         void* this_ptr_ptr = untag_ptr(this_ptr);
25599         CHECK_ACCESS(this_ptr_ptr);
25600         LDKPaymentSendFailure this_ptr_conv = *(LDKPaymentSendFailure*)(this_ptr_ptr);
25601         FREE(untag_ptr(this_ptr));
25602         PaymentSendFailure_free(this_ptr_conv);
25603 }
25604
25605 static inline uint64_t PaymentSendFailure_clone_ptr(LDKPaymentSendFailure *NONNULL_PTR arg) {
25606         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
25607         *ret_copy = PaymentSendFailure_clone(arg);
25608         uint64_t ret_ref = tag_ptr(ret_copy, true);
25609         return ret_ref;
25610 }
25611 int64_t  __attribute__((export_name("TS_PaymentSendFailure_clone_ptr"))) TS_PaymentSendFailure_clone_ptr(uint64_t arg) {
25612         LDKPaymentSendFailure* arg_conv = (LDKPaymentSendFailure*)untag_ptr(arg);
25613         int64_t ret_conv = PaymentSendFailure_clone_ptr(arg_conv);
25614         return ret_conv;
25615 }
25616
25617 uint64_t  __attribute__((export_name("TS_PaymentSendFailure_clone"))) TS_PaymentSendFailure_clone(uint64_t orig) {
25618         LDKPaymentSendFailure* orig_conv = (LDKPaymentSendFailure*)untag_ptr(orig);
25619         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
25620         *ret_copy = PaymentSendFailure_clone(orig_conv);
25621         uint64_t ret_ref = tag_ptr(ret_copy, true);
25622         return ret_ref;
25623 }
25624
25625 uint64_t  __attribute__((export_name("TS_PaymentSendFailure_parameter_error"))) TS_PaymentSendFailure_parameter_error(uint64_t a) {
25626         void* a_ptr = untag_ptr(a);
25627         CHECK_ACCESS(a_ptr);
25628         LDKAPIError a_conv = *(LDKAPIError*)(a_ptr);
25629         a_conv = APIError_clone((LDKAPIError*)untag_ptr(a));
25630         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
25631         *ret_copy = PaymentSendFailure_parameter_error(a_conv);
25632         uint64_t ret_ref = tag_ptr(ret_copy, true);
25633         return ret_ref;
25634 }
25635
25636 uint64_t  __attribute__((export_name("TS_PaymentSendFailure_path_parameter_error"))) TS_PaymentSendFailure_path_parameter_error(uint64_tArray a) {
25637         LDKCVec_CResult_NoneAPIErrorZZ a_constr;
25638         a_constr.datalen = a->arr_len;
25639         if (a_constr.datalen > 0)
25640                 a_constr.data = MALLOC(a_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
25641         else
25642                 a_constr.data = NULL;
25643         uint64_t* a_vals = a->elems;
25644         for (size_t w = 0; w < a_constr.datalen; w++) {
25645                 uint64_t a_conv_22 = a_vals[w];
25646                 void* a_conv_22_ptr = untag_ptr(a_conv_22);
25647                 CHECK_ACCESS(a_conv_22_ptr);
25648                 LDKCResult_NoneAPIErrorZ a_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(a_conv_22_ptr);
25649                 a_conv_22_conv = CResult_NoneAPIErrorZ_clone((LDKCResult_NoneAPIErrorZ*)untag_ptr(a_conv_22));
25650                 a_constr.data[w] = a_conv_22_conv;
25651         }
25652         FREE(a);
25653         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
25654         *ret_copy = PaymentSendFailure_path_parameter_error(a_constr);
25655         uint64_t ret_ref = tag_ptr(ret_copy, true);
25656         return ret_ref;
25657 }
25658
25659 uint64_t  __attribute__((export_name("TS_PaymentSendFailure_all_failed_retry_safe"))) TS_PaymentSendFailure_all_failed_retry_safe(uint64_tArray a) {
25660         LDKCVec_APIErrorZ a_constr;
25661         a_constr.datalen = a->arr_len;
25662         if (a_constr.datalen > 0)
25663                 a_constr.data = MALLOC(a_constr.datalen * sizeof(LDKAPIError), "LDKCVec_APIErrorZ Elements");
25664         else
25665                 a_constr.data = NULL;
25666         uint64_t* a_vals = a->elems;
25667         for (size_t k = 0; k < a_constr.datalen; k++) {
25668                 uint64_t a_conv_10 = a_vals[k];
25669                 void* a_conv_10_ptr = untag_ptr(a_conv_10);
25670                 CHECK_ACCESS(a_conv_10_ptr);
25671                 LDKAPIError a_conv_10_conv = *(LDKAPIError*)(a_conv_10_ptr);
25672                 a_conv_10_conv = APIError_clone((LDKAPIError*)untag_ptr(a_conv_10));
25673                 a_constr.data[k] = a_conv_10_conv;
25674         }
25675         FREE(a);
25676         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
25677         *ret_copy = PaymentSendFailure_all_failed_retry_safe(a_constr);
25678         uint64_t ret_ref = tag_ptr(ret_copy, true);
25679         return ret_ref;
25680 }
25681
25682 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) {
25683         LDKCVec_CResult_NoneAPIErrorZZ results_constr;
25684         results_constr.datalen = results->arr_len;
25685         if (results_constr.datalen > 0)
25686                 results_constr.data = MALLOC(results_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
25687         else
25688                 results_constr.data = NULL;
25689         uint64_t* results_vals = results->elems;
25690         for (size_t w = 0; w < results_constr.datalen; w++) {
25691                 uint64_t results_conv_22 = results_vals[w];
25692                 void* results_conv_22_ptr = untag_ptr(results_conv_22);
25693                 CHECK_ACCESS(results_conv_22_ptr);
25694                 LDKCResult_NoneAPIErrorZ results_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(results_conv_22_ptr);
25695                 results_constr.data[w] = results_conv_22_conv;
25696         }
25697         FREE(results);
25698         LDKRouteParameters failed_paths_retry_conv;
25699         failed_paths_retry_conv.inner = untag_ptr(failed_paths_retry);
25700         failed_paths_retry_conv.is_owned = ptr_is_owned(failed_paths_retry);
25701         CHECK_INNER_FIELD_ACCESS_OR_NULL(failed_paths_retry_conv);
25702         failed_paths_retry_conv = RouteParameters_clone(&failed_paths_retry_conv);
25703         LDKThirtyTwoBytes payment_id_ref;
25704         CHECK(payment_id->arr_len == 32);
25705         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
25706         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
25707         *ret_copy = PaymentSendFailure_partial_failure(results_constr, failed_paths_retry_conv, payment_id_ref);
25708         uint64_t ret_ref = tag_ptr(ret_copy, true);
25709         return ret_ref;
25710 }
25711
25712 void  __attribute__((export_name("TS_PhantomRouteHints_free"))) TS_PhantomRouteHints_free(uint64_t this_obj) {
25713         LDKPhantomRouteHints this_obj_conv;
25714         this_obj_conv.inner = untag_ptr(this_obj);
25715         this_obj_conv.is_owned = ptr_is_owned(this_obj);
25716         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
25717         PhantomRouteHints_free(this_obj_conv);
25718 }
25719
25720 uint64_tArray  __attribute__((export_name("TS_PhantomRouteHints_get_channels"))) TS_PhantomRouteHints_get_channels(uint64_t this_ptr) {
25721         LDKPhantomRouteHints this_ptr_conv;
25722         this_ptr_conv.inner = untag_ptr(this_ptr);
25723         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25724         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25725         this_ptr_conv.is_owned = false;
25726         LDKCVec_ChannelDetailsZ ret_var = PhantomRouteHints_get_channels(&this_ptr_conv);
25727         uint64_tArray ret_arr = NULL;
25728         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
25729         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
25730         for (size_t q = 0; q < ret_var.datalen; q++) {
25731                 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
25732                 uint64_t ret_conv_16_ref = 0;
25733                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
25734                 ret_conv_16_ref = tag_ptr(ret_conv_16_var.inner, ret_conv_16_var.is_owned);
25735                 ret_arr_ptr[q] = ret_conv_16_ref;
25736         }
25737         
25738         FREE(ret_var.data);
25739         return ret_arr;
25740 }
25741
25742 void  __attribute__((export_name("TS_PhantomRouteHints_set_channels"))) TS_PhantomRouteHints_set_channels(uint64_t this_ptr, uint64_tArray val) {
25743         LDKPhantomRouteHints this_ptr_conv;
25744         this_ptr_conv.inner = untag_ptr(this_ptr);
25745         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25746         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25747         this_ptr_conv.is_owned = false;
25748         LDKCVec_ChannelDetailsZ val_constr;
25749         val_constr.datalen = val->arr_len;
25750         if (val_constr.datalen > 0)
25751                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
25752         else
25753                 val_constr.data = NULL;
25754         uint64_t* val_vals = val->elems;
25755         for (size_t q = 0; q < val_constr.datalen; q++) {
25756                 uint64_t val_conv_16 = val_vals[q];
25757                 LDKChannelDetails val_conv_16_conv;
25758                 val_conv_16_conv.inner = untag_ptr(val_conv_16);
25759                 val_conv_16_conv.is_owned = ptr_is_owned(val_conv_16);
25760                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_16_conv);
25761                 val_conv_16_conv = ChannelDetails_clone(&val_conv_16_conv);
25762                 val_constr.data[q] = val_conv_16_conv;
25763         }
25764         FREE(val);
25765         PhantomRouteHints_set_channels(&this_ptr_conv, val_constr);
25766 }
25767
25768 int64_t  __attribute__((export_name("TS_PhantomRouteHints_get_phantom_scid"))) TS_PhantomRouteHints_get_phantom_scid(uint64_t this_ptr) {
25769         LDKPhantomRouteHints this_ptr_conv;
25770         this_ptr_conv.inner = untag_ptr(this_ptr);
25771         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25772         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25773         this_ptr_conv.is_owned = false;
25774         int64_t ret_conv = PhantomRouteHints_get_phantom_scid(&this_ptr_conv);
25775         return ret_conv;
25776 }
25777
25778 void  __attribute__((export_name("TS_PhantomRouteHints_set_phantom_scid"))) TS_PhantomRouteHints_set_phantom_scid(uint64_t this_ptr, int64_t val) {
25779         LDKPhantomRouteHints this_ptr_conv;
25780         this_ptr_conv.inner = untag_ptr(this_ptr);
25781         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25782         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25783         this_ptr_conv.is_owned = false;
25784         PhantomRouteHints_set_phantom_scid(&this_ptr_conv, val);
25785 }
25786
25787 int8_tArray  __attribute__((export_name("TS_PhantomRouteHints_get_real_node_pubkey"))) TS_PhantomRouteHints_get_real_node_pubkey(uint64_t this_ptr) {
25788         LDKPhantomRouteHints this_ptr_conv;
25789         this_ptr_conv.inner = untag_ptr(this_ptr);
25790         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25791         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25792         this_ptr_conv.is_owned = false;
25793         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
25794         memcpy(ret_arr->elems, PhantomRouteHints_get_real_node_pubkey(&this_ptr_conv).compressed_form, 33);
25795         return ret_arr;
25796 }
25797
25798 void  __attribute__((export_name("TS_PhantomRouteHints_set_real_node_pubkey"))) TS_PhantomRouteHints_set_real_node_pubkey(uint64_t this_ptr, int8_tArray val) {
25799         LDKPhantomRouteHints this_ptr_conv;
25800         this_ptr_conv.inner = untag_ptr(this_ptr);
25801         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25802         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25803         this_ptr_conv.is_owned = false;
25804         LDKPublicKey val_ref;
25805         CHECK(val->arr_len == 33);
25806         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
25807         PhantomRouteHints_set_real_node_pubkey(&this_ptr_conv, val_ref);
25808 }
25809
25810 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) {
25811         LDKCVec_ChannelDetailsZ channels_arg_constr;
25812         channels_arg_constr.datalen = channels_arg->arr_len;
25813         if (channels_arg_constr.datalen > 0)
25814                 channels_arg_constr.data = MALLOC(channels_arg_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
25815         else
25816                 channels_arg_constr.data = NULL;
25817         uint64_t* channels_arg_vals = channels_arg->elems;
25818         for (size_t q = 0; q < channels_arg_constr.datalen; q++) {
25819                 uint64_t channels_arg_conv_16 = channels_arg_vals[q];
25820                 LDKChannelDetails channels_arg_conv_16_conv;
25821                 channels_arg_conv_16_conv.inner = untag_ptr(channels_arg_conv_16);
25822                 channels_arg_conv_16_conv.is_owned = ptr_is_owned(channels_arg_conv_16);
25823                 CHECK_INNER_FIELD_ACCESS_OR_NULL(channels_arg_conv_16_conv);
25824                 channels_arg_conv_16_conv = ChannelDetails_clone(&channels_arg_conv_16_conv);
25825                 channels_arg_constr.data[q] = channels_arg_conv_16_conv;
25826         }
25827         FREE(channels_arg);
25828         LDKPublicKey real_node_pubkey_arg_ref;
25829         CHECK(real_node_pubkey_arg->arr_len == 33);
25830         memcpy(real_node_pubkey_arg_ref.compressed_form, real_node_pubkey_arg->elems, 33); FREE(real_node_pubkey_arg);
25831         LDKPhantomRouteHints ret_var = PhantomRouteHints_new(channels_arg_constr, phantom_scid_arg, real_node_pubkey_arg_ref);
25832         uint64_t ret_ref = 0;
25833         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25834         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
25835         return ret_ref;
25836 }
25837
25838 static inline uint64_t PhantomRouteHints_clone_ptr(LDKPhantomRouteHints *NONNULL_PTR arg) {
25839         LDKPhantomRouteHints ret_var = PhantomRouteHints_clone(arg);
25840         uint64_t ret_ref = 0;
25841         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25842         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
25843         return ret_ref;
25844 }
25845 int64_t  __attribute__((export_name("TS_PhantomRouteHints_clone_ptr"))) TS_PhantomRouteHints_clone_ptr(uint64_t arg) {
25846         LDKPhantomRouteHints arg_conv;
25847         arg_conv.inner = untag_ptr(arg);
25848         arg_conv.is_owned = ptr_is_owned(arg);
25849         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
25850         arg_conv.is_owned = false;
25851         int64_t ret_conv = PhantomRouteHints_clone_ptr(&arg_conv);
25852         return ret_conv;
25853 }
25854
25855 uint64_t  __attribute__((export_name("TS_PhantomRouteHints_clone"))) TS_PhantomRouteHints_clone(uint64_t orig) {
25856         LDKPhantomRouteHints orig_conv;
25857         orig_conv.inner = untag_ptr(orig);
25858         orig_conv.is_owned = ptr_is_owned(orig);
25859         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
25860         orig_conv.is_owned = false;
25861         LDKPhantomRouteHints ret_var = PhantomRouteHints_clone(&orig_conv);
25862         uint64_t ret_ref = 0;
25863         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25864         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
25865         return ret_ref;
25866 }
25867
25868 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) {
25869         void* fee_est_ptr = untag_ptr(fee_est);
25870         CHECK_ACCESS(fee_est_ptr);
25871         LDKFeeEstimator fee_est_conv = *(LDKFeeEstimator*)(fee_est_ptr);
25872         if (fee_est_conv.free == LDKFeeEstimator_JCalls_free) {
25873                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25874                 LDKFeeEstimator_JCalls_cloned(&fee_est_conv);
25875         }
25876         void* chain_monitor_ptr = untag_ptr(chain_monitor);
25877         CHECK_ACCESS(chain_monitor_ptr);
25878         LDKWatch chain_monitor_conv = *(LDKWatch*)(chain_monitor_ptr);
25879         if (chain_monitor_conv.free == LDKWatch_JCalls_free) {
25880                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25881                 LDKWatch_JCalls_cloned(&chain_monitor_conv);
25882         }
25883         void* tx_broadcaster_ptr = untag_ptr(tx_broadcaster);
25884         CHECK_ACCESS(tx_broadcaster_ptr);
25885         LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)(tx_broadcaster_ptr);
25886         if (tx_broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
25887                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25888                 LDKBroadcasterInterface_JCalls_cloned(&tx_broadcaster_conv);
25889         }
25890         void* logger_ptr = untag_ptr(logger);
25891         CHECK_ACCESS(logger_ptr);
25892         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
25893         if (logger_conv.free == LDKLogger_JCalls_free) {
25894                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25895                 LDKLogger_JCalls_cloned(&logger_conv);
25896         }
25897         void* keys_manager_ptr = untag_ptr(keys_manager);
25898         CHECK_ACCESS(keys_manager_ptr);
25899         LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr);
25900         if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
25901                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25902                 LDKKeysInterface_JCalls_cloned(&keys_manager_conv);
25903         }
25904         LDKUserConfig config_conv;
25905         config_conv.inner = untag_ptr(config);
25906         config_conv.is_owned = ptr_is_owned(config);
25907         CHECK_INNER_FIELD_ACCESS_OR_NULL(config_conv);
25908         config_conv = UserConfig_clone(&config_conv);
25909         LDKChainParameters params_conv;
25910         params_conv.inner = untag_ptr(params);
25911         params_conv.is_owned = ptr_is_owned(params);
25912         CHECK_INNER_FIELD_ACCESS_OR_NULL(params_conv);
25913         params_conv = ChainParameters_clone(&params_conv);
25914         LDKChannelManager ret_var = ChannelManager_new(fee_est_conv, chain_monitor_conv, tx_broadcaster_conv, logger_conv, keys_manager_conv, config_conv, params_conv);
25915         uint64_t ret_ref = 0;
25916         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25917         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
25918         return ret_ref;
25919 }
25920
25921 uint64_t  __attribute__((export_name("TS_ChannelManager_get_current_default_configuration"))) TS_ChannelManager_get_current_default_configuration(uint64_t this_arg) {
25922         LDKChannelManager this_arg_conv;
25923         this_arg_conv.inner = untag_ptr(this_arg);
25924         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25925         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25926         this_arg_conv.is_owned = false;
25927         LDKUserConfig ret_var = ChannelManager_get_current_default_configuration(&this_arg_conv);
25928         uint64_t ret_ref = 0;
25929         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25930         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
25931         return ret_ref;
25932 }
25933
25934 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) {
25935         LDKChannelManager this_arg_conv;
25936         this_arg_conv.inner = untag_ptr(this_arg);
25937         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25938         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25939         this_arg_conv.is_owned = false;
25940         LDKPublicKey their_network_key_ref;
25941         CHECK(their_network_key->arr_len == 33);
25942         memcpy(their_network_key_ref.compressed_form, their_network_key->elems, 33); FREE(their_network_key);
25943         LDKUserConfig override_config_conv;
25944         override_config_conv.inner = untag_ptr(override_config);
25945         override_config_conv.is_owned = ptr_is_owned(override_config);
25946         CHECK_INNER_FIELD_ACCESS_OR_NULL(override_config_conv);
25947         override_config_conv = UserConfig_clone(&override_config_conv);
25948         LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
25949         *ret_conv = ChannelManager_create_channel(&this_arg_conv, their_network_key_ref, channel_value_satoshis, push_msat, user_channel_id, override_config_conv);
25950         return tag_ptr(ret_conv, true);
25951 }
25952
25953 uint64_tArray  __attribute__((export_name("TS_ChannelManager_list_channels"))) TS_ChannelManager_list_channels(uint64_t this_arg) {
25954         LDKChannelManager this_arg_conv;
25955         this_arg_conv.inner = untag_ptr(this_arg);
25956         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25957         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25958         this_arg_conv.is_owned = false;
25959         LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_channels(&this_arg_conv);
25960         uint64_tArray ret_arr = NULL;
25961         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
25962         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
25963         for (size_t q = 0; q < ret_var.datalen; q++) {
25964                 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
25965                 uint64_t ret_conv_16_ref = 0;
25966                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
25967                 ret_conv_16_ref = tag_ptr(ret_conv_16_var.inner, ret_conv_16_var.is_owned);
25968                 ret_arr_ptr[q] = ret_conv_16_ref;
25969         }
25970         
25971         FREE(ret_var.data);
25972         return ret_arr;
25973 }
25974
25975 uint64_tArray  __attribute__((export_name("TS_ChannelManager_list_usable_channels"))) TS_ChannelManager_list_usable_channels(uint64_t this_arg) {
25976         LDKChannelManager this_arg_conv;
25977         this_arg_conv.inner = untag_ptr(this_arg);
25978         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25979         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25980         this_arg_conv.is_owned = false;
25981         LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_usable_channels(&this_arg_conv);
25982         uint64_tArray ret_arr = NULL;
25983         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
25984         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
25985         for (size_t q = 0; q < ret_var.datalen; q++) {
25986                 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
25987                 uint64_t ret_conv_16_ref = 0;
25988                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
25989                 ret_conv_16_ref = tag_ptr(ret_conv_16_var.inner, ret_conv_16_var.is_owned);
25990                 ret_arr_ptr[q] = ret_conv_16_ref;
25991         }
25992         
25993         FREE(ret_var.data);
25994         return ret_arr;
25995 }
25996
25997 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) {
25998         LDKChannelManager this_arg_conv;
25999         this_arg_conv.inner = untag_ptr(this_arg);
26000         this_arg_conv.is_owned = ptr_is_owned(this_arg);
26001         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26002         this_arg_conv.is_owned = false;
26003         unsigned char channel_id_arr[32];
26004         CHECK(channel_id->arr_len == 32);
26005         memcpy(channel_id_arr, channel_id->elems, 32); FREE(channel_id);
26006         unsigned char (*channel_id_ref)[32] = &channel_id_arr;
26007         LDKPublicKey counterparty_node_id_ref;
26008         CHECK(counterparty_node_id->arr_len == 33);
26009         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
26010         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
26011         *ret_conv = ChannelManager_close_channel(&this_arg_conv, channel_id_ref, counterparty_node_id_ref);
26012         return tag_ptr(ret_conv, true);
26013 }
26014
26015 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) {
26016         LDKChannelManager this_arg_conv;
26017         this_arg_conv.inner = untag_ptr(this_arg);
26018         this_arg_conv.is_owned = ptr_is_owned(this_arg);
26019         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26020         this_arg_conv.is_owned = false;
26021         unsigned char channel_id_arr[32];
26022         CHECK(channel_id->arr_len == 32);
26023         memcpy(channel_id_arr, channel_id->elems, 32); FREE(channel_id);
26024         unsigned char (*channel_id_ref)[32] = &channel_id_arr;
26025         LDKPublicKey counterparty_node_id_ref;
26026         CHECK(counterparty_node_id->arr_len == 33);
26027         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
26028         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
26029         *ret_conv = ChannelManager_close_channel_with_target_feerate(&this_arg_conv, channel_id_ref, counterparty_node_id_ref, target_feerate_sats_per_1000_weight);
26030         return tag_ptr(ret_conv, true);
26031 }
26032
26033 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) {
26034         LDKChannelManager this_arg_conv;
26035         this_arg_conv.inner = untag_ptr(this_arg);
26036         this_arg_conv.is_owned = ptr_is_owned(this_arg);
26037         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26038         this_arg_conv.is_owned = false;
26039         unsigned char channel_id_arr[32];
26040         CHECK(channel_id->arr_len == 32);
26041         memcpy(channel_id_arr, channel_id->elems, 32); FREE(channel_id);
26042         unsigned char (*channel_id_ref)[32] = &channel_id_arr;
26043         LDKPublicKey counterparty_node_id_ref;
26044         CHECK(counterparty_node_id->arr_len == 33);
26045         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
26046         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
26047         *ret_conv = ChannelManager_force_close_broadcasting_latest_txn(&this_arg_conv, channel_id_ref, counterparty_node_id_ref);
26048         return tag_ptr(ret_conv, true);
26049 }
26050
26051 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) {
26052         LDKChannelManager this_arg_conv;
26053         this_arg_conv.inner = untag_ptr(this_arg);
26054         this_arg_conv.is_owned = ptr_is_owned(this_arg);
26055         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26056         this_arg_conv.is_owned = false;
26057         unsigned char channel_id_arr[32];
26058         CHECK(channel_id->arr_len == 32);
26059         memcpy(channel_id_arr, channel_id->elems, 32); FREE(channel_id);
26060         unsigned char (*channel_id_ref)[32] = &channel_id_arr;
26061         LDKPublicKey counterparty_node_id_ref;
26062         CHECK(counterparty_node_id->arr_len == 33);
26063         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
26064         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
26065         *ret_conv = ChannelManager_force_close_without_broadcasting_txn(&this_arg_conv, channel_id_ref, counterparty_node_id_ref);
26066         return tag_ptr(ret_conv, true);
26067 }
26068
26069 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) {
26070         LDKChannelManager this_arg_conv;
26071         this_arg_conv.inner = untag_ptr(this_arg);
26072         this_arg_conv.is_owned = ptr_is_owned(this_arg);
26073         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26074         this_arg_conv.is_owned = false;
26075         ChannelManager_force_close_all_channels_broadcasting_latest_txn(&this_arg_conv);
26076 }
26077
26078 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) {
26079         LDKChannelManager this_arg_conv;
26080         this_arg_conv.inner = untag_ptr(this_arg);
26081         this_arg_conv.is_owned = ptr_is_owned(this_arg);
26082         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26083         this_arg_conv.is_owned = false;
26084         ChannelManager_force_close_all_channels_without_broadcasting_txn(&this_arg_conv);
26085 }
26086
26087 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) {
26088         LDKChannelManager this_arg_conv;
26089         this_arg_conv.inner = untag_ptr(this_arg);
26090         this_arg_conv.is_owned = ptr_is_owned(this_arg);
26091         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26092         this_arg_conv.is_owned = false;
26093         LDKRoute route_conv;
26094         route_conv.inner = untag_ptr(route);
26095         route_conv.is_owned = ptr_is_owned(route);
26096         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
26097         route_conv.is_owned = false;
26098         LDKThirtyTwoBytes payment_hash_ref;
26099         CHECK(payment_hash->arr_len == 32);
26100         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
26101         LDKThirtyTwoBytes payment_secret_ref;
26102         CHECK(payment_secret->arr_len == 32);
26103         memcpy(payment_secret_ref.data, payment_secret->elems, 32); FREE(payment_secret);
26104         LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
26105         *ret_conv = ChannelManager_send_payment(&this_arg_conv, &route_conv, payment_hash_ref, payment_secret_ref);
26106         return tag_ptr(ret_conv, true);
26107 }
26108
26109 uint64_t  __attribute__((export_name("TS_ChannelManager_retry_payment"))) TS_ChannelManager_retry_payment(uint64_t this_arg, uint64_t route, int8_tArray payment_id) {
26110         LDKChannelManager this_arg_conv;
26111         this_arg_conv.inner = untag_ptr(this_arg);
26112         this_arg_conv.is_owned = ptr_is_owned(this_arg);
26113         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26114         this_arg_conv.is_owned = false;
26115         LDKRoute route_conv;
26116         route_conv.inner = untag_ptr(route);
26117         route_conv.is_owned = ptr_is_owned(route);
26118         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
26119         route_conv.is_owned = false;
26120         LDKThirtyTwoBytes payment_id_ref;
26121         CHECK(payment_id->arr_len == 32);
26122         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
26123         LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
26124         *ret_conv = ChannelManager_retry_payment(&this_arg_conv, &route_conv, payment_id_ref);
26125         return tag_ptr(ret_conv, true);
26126 }
26127
26128 void  __attribute__((export_name("TS_ChannelManager_abandon_payment"))) TS_ChannelManager_abandon_payment(uint64_t this_arg, int8_tArray payment_id) {
26129         LDKChannelManager this_arg_conv;
26130         this_arg_conv.inner = untag_ptr(this_arg);
26131         this_arg_conv.is_owned = ptr_is_owned(this_arg);
26132         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26133         this_arg_conv.is_owned = false;
26134         LDKThirtyTwoBytes payment_id_ref;
26135         CHECK(payment_id->arr_len == 32);
26136         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
26137         ChannelManager_abandon_payment(&this_arg_conv, payment_id_ref);
26138 }
26139
26140 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) {
26141         LDKChannelManager this_arg_conv;
26142         this_arg_conv.inner = untag_ptr(this_arg);
26143         this_arg_conv.is_owned = ptr_is_owned(this_arg);
26144         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26145         this_arg_conv.is_owned = false;
26146         LDKRoute route_conv;
26147         route_conv.inner = untag_ptr(route);
26148         route_conv.is_owned = ptr_is_owned(route);
26149         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
26150         route_conv.is_owned = false;
26151         LDKThirtyTwoBytes payment_preimage_ref;
26152         CHECK(payment_preimage->arr_len == 32);
26153         memcpy(payment_preimage_ref.data, payment_preimage->elems, 32); FREE(payment_preimage);
26154         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
26155         *ret_conv = ChannelManager_send_spontaneous_payment(&this_arg_conv, &route_conv, payment_preimage_ref);
26156         return tag_ptr(ret_conv, true);
26157 }
26158
26159 uint64_t  __attribute__((export_name("TS_ChannelManager_send_probe"))) TS_ChannelManager_send_probe(uint64_t this_arg, uint64_tArray hops) {
26160         LDKChannelManager this_arg_conv;
26161         this_arg_conv.inner = untag_ptr(this_arg);
26162         this_arg_conv.is_owned = ptr_is_owned(this_arg);
26163         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26164         this_arg_conv.is_owned = false;
26165         LDKCVec_RouteHopZ hops_constr;
26166         hops_constr.datalen = hops->arr_len;
26167         if (hops_constr.datalen > 0)
26168                 hops_constr.data = MALLOC(hops_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
26169         else
26170                 hops_constr.data = NULL;
26171         uint64_t* hops_vals = hops->elems;
26172         for (size_t k = 0; k < hops_constr.datalen; k++) {
26173                 uint64_t hops_conv_10 = hops_vals[k];
26174                 LDKRouteHop hops_conv_10_conv;
26175                 hops_conv_10_conv.inner = untag_ptr(hops_conv_10);
26176                 hops_conv_10_conv.is_owned = ptr_is_owned(hops_conv_10);
26177                 CHECK_INNER_FIELD_ACCESS_OR_NULL(hops_conv_10_conv);
26178                 hops_conv_10_conv = RouteHop_clone(&hops_conv_10_conv);
26179                 hops_constr.data[k] = hops_conv_10_conv;
26180         }
26181         FREE(hops);
26182         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
26183         *ret_conv = ChannelManager_send_probe(&this_arg_conv, hops_constr);
26184         return tag_ptr(ret_conv, true);
26185 }
26186
26187 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) {
26188         LDKChannelManager this_arg_conv;
26189         this_arg_conv.inner = untag_ptr(this_arg);
26190         this_arg_conv.is_owned = ptr_is_owned(this_arg);
26191         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26192         this_arg_conv.is_owned = false;
26193         unsigned char temporary_channel_id_arr[32];
26194         CHECK(temporary_channel_id->arr_len == 32);
26195         memcpy(temporary_channel_id_arr, temporary_channel_id->elems, 32); FREE(temporary_channel_id);
26196         unsigned char (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr;
26197         LDKPublicKey counterparty_node_id_ref;
26198         CHECK(counterparty_node_id->arr_len == 33);
26199         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
26200         LDKTransaction funding_transaction_ref;
26201         funding_transaction_ref.datalen = funding_transaction->arr_len;
26202         funding_transaction_ref.data = MALLOC(funding_transaction_ref.datalen, "LDKTransaction Bytes");
26203         memcpy(funding_transaction_ref.data, funding_transaction->elems, funding_transaction_ref.datalen); FREE(funding_transaction);
26204         funding_transaction_ref.data_is_owned = true;
26205         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
26206         *ret_conv = ChannelManager_funding_transaction_generated(&this_arg_conv, temporary_channel_id_ref, counterparty_node_id_ref, funding_transaction_ref);
26207         return tag_ptr(ret_conv, true);
26208 }
26209
26210 void  __attribute__((export_name("TS_ChannelManager_broadcast_node_announcement"))) TS_ChannelManager_broadcast_node_announcement(uint64_t this_arg, int8_tArray rgb, int8_tArray alias, uint64_tArray addresses) {
26211         LDKChannelManager this_arg_conv;
26212         this_arg_conv.inner = untag_ptr(this_arg);
26213         this_arg_conv.is_owned = ptr_is_owned(this_arg);
26214         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26215         this_arg_conv.is_owned = false;
26216         LDKThreeBytes rgb_ref;
26217         CHECK(rgb->arr_len == 3);
26218         memcpy(rgb_ref.data, rgb->elems, 3); FREE(rgb);
26219         LDKThirtyTwoBytes alias_ref;
26220         CHECK(alias->arr_len == 32);
26221         memcpy(alias_ref.data, alias->elems, 32); FREE(alias);
26222         LDKCVec_NetAddressZ addresses_constr;
26223         addresses_constr.datalen = addresses->arr_len;
26224         if (addresses_constr.datalen > 0)
26225                 addresses_constr.data = MALLOC(addresses_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
26226         else
26227                 addresses_constr.data = NULL;
26228         uint64_t* addresses_vals = addresses->elems;
26229         for (size_t m = 0; m < addresses_constr.datalen; m++) {
26230                 uint64_t addresses_conv_12 = addresses_vals[m];
26231                 void* addresses_conv_12_ptr = untag_ptr(addresses_conv_12);
26232                 CHECK_ACCESS(addresses_conv_12_ptr);
26233                 LDKNetAddress addresses_conv_12_conv = *(LDKNetAddress*)(addresses_conv_12_ptr);
26234                 addresses_constr.data[m] = addresses_conv_12_conv;
26235         }
26236         FREE(addresses);
26237         ChannelManager_broadcast_node_announcement(&this_arg_conv, rgb_ref, alias_ref, addresses_constr);
26238 }
26239
26240 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) {
26241         LDKChannelManager this_arg_conv;
26242         this_arg_conv.inner = untag_ptr(this_arg);
26243         this_arg_conv.is_owned = ptr_is_owned(this_arg);
26244         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26245         this_arg_conv.is_owned = false;
26246         LDKPublicKey counterparty_node_id_ref;
26247         CHECK(counterparty_node_id->arr_len == 33);
26248         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
26249         LDKCVec_ThirtyTwoBytesZ channel_ids_constr;
26250         channel_ids_constr.datalen = channel_ids->arr_len;
26251         if (channel_ids_constr.datalen > 0)
26252                 channel_ids_constr.data = MALLOC(channel_ids_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_ThirtyTwoBytesZ Elements");
26253         else
26254                 channel_ids_constr.data = NULL;
26255         int8_tArray* channel_ids_vals = (void*) channel_ids->elems;
26256         for (size_t m = 0; m < channel_ids_constr.datalen; m++) {
26257                 int8_tArray channel_ids_conv_12 = channel_ids_vals[m];
26258                 LDKThirtyTwoBytes channel_ids_conv_12_ref;
26259                 CHECK(channel_ids_conv_12->arr_len == 32);
26260                 memcpy(channel_ids_conv_12_ref.data, channel_ids_conv_12->elems, 32); FREE(channel_ids_conv_12);
26261                 channel_ids_constr.data[m] = channel_ids_conv_12_ref;
26262         }
26263         FREE(channel_ids);
26264         LDKChannelConfig config_conv;
26265         config_conv.inner = untag_ptr(config);
26266         config_conv.is_owned = ptr_is_owned(config);
26267         CHECK_INNER_FIELD_ACCESS_OR_NULL(config_conv);
26268         config_conv.is_owned = false;
26269         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
26270         *ret_conv = ChannelManager_update_channel_config(&this_arg_conv, counterparty_node_id_ref, channel_ids_constr, &config_conv);
26271         return tag_ptr(ret_conv, true);
26272 }
26273
26274 void  __attribute__((export_name("TS_ChannelManager_process_pending_htlc_forwards"))) TS_ChannelManager_process_pending_htlc_forwards(uint64_t this_arg) {
26275         LDKChannelManager this_arg_conv;
26276         this_arg_conv.inner = untag_ptr(this_arg);
26277         this_arg_conv.is_owned = ptr_is_owned(this_arg);
26278         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26279         this_arg_conv.is_owned = false;
26280         ChannelManager_process_pending_htlc_forwards(&this_arg_conv);
26281 }
26282
26283 void  __attribute__((export_name("TS_ChannelManager_timer_tick_occurred"))) TS_ChannelManager_timer_tick_occurred(uint64_t this_arg) {
26284         LDKChannelManager this_arg_conv;
26285         this_arg_conv.inner = untag_ptr(this_arg);
26286         this_arg_conv.is_owned = ptr_is_owned(this_arg);
26287         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26288         this_arg_conv.is_owned = false;
26289         ChannelManager_timer_tick_occurred(&this_arg_conv);
26290 }
26291
26292 void  __attribute__((export_name("TS_ChannelManager_fail_htlc_backwards"))) TS_ChannelManager_fail_htlc_backwards(uint64_t this_arg, int8_tArray payment_hash) {
26293         LDKChannelManager this_arg_conv;
26294         this_arg_conv.inner = untag_ptr(this_arg);
26295         this_arg_conv.is_owned = ptr_is_owned(this_arg);
26296         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26297         this_arg_conv.is_owned = false;
26298         unsigned char payment_hash_arr[32];
26299         CHECK(payment_hash->arr_len == 32);
26300         memcpy(payment_hash_arr, payment_hash->elems, 32); FREE(payment_hash);
26301         unsigned char (*payment_hash_ref)[32] = &payment_hash_arr;
26302         ChannelManager_fail_htlc_backwards(&this_arg_conv, payment_hash_ref);
26303 }
26304
26305 void  __attribute__((export_name("TS_ChannelManager_claim_funds"))) TS_ChannelManager_claim_funds(uint64_t this_arg, int8_tArray payment_preimage) {
26306         LDKChannelManager this_arg_conv;
26307         this_arg_conv.inner = untag_ptr(this_arg);
26308         this_arg_conv.is_owned = ptr_is_owned(this_arg);
26309         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26310         this_arg_conv.is_owned = false;
26311         LDKThirtyTwoBytes payment_preimage_ref;
26312         CHECK(payment_preimage->arr_len == 32);
26313         memcpy(payment_preimage_ref.data, payment_preimage->elems, 32); FREE(payment_preimage);
26314         ChannelManager_claim_funds(&this_arg_conv, payment_preimage_ref);
26315 }
26316
26317 int8_tArray  __attribute__((export_name("TS_ChannelManager_get_our_node_id"))) TS_ChannelManager_get_our_node_id(uint64_t this_arg) {
26318         LDKChannelManager this_arg_conv;
26319         this_arg_conv.inner = untag_ptr(this_arg);
26320         this_arg_conv.is_owned = ptr_is_owned(this_arg);
26321         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26322         this_arg_conv.is_owned = false;
26323         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
26324         memcpy(ret_arr->elems, ChannelManager_get_our_node_id(&this_arg_conv).compressed_form, 33);
26325         return ret_arr;
26326 }
26327
26328 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) {
26329         LDKChannelManager this_arg_conv;
26330         this_arg_conv.inner = untag_ptr(this_arg);
26331         this_arg_conv.is_owned = ptr_is_owned(this_arg);
26332         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26333         this_arg_conv.is_owned = false;
26334         unsigned char temporary_channel_id_arr[32];
26335         CHECK(temporary_channel_id->arr_len == 32);
26336         memcpy(temporary_channel_id_arr, temporary_channel_id->elems, 32); FREE(temporary_channel_id);
26337         unsigned char (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr;
26338         LDKPublicKey counterparty_node_id_ref;
26339         CHECK(counterparty_node_id->arr_len == 33);
26340         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
26341         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
26342         *ret_conv = ChannelManager_accept_inbound_channel(&this_arg_conv, temporary_channel_id_ref, counterparty_node_id_ref, user_channel_id);
26343         return tag_ptr(ret_conv, true);
26344 }
26345
26346 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) {
26347         LDKChannelManager this_arg_conv;
26348         this_arg_conv.inner = untag_ptr(this_arg);
26349         this_arg_conv.is_owned = ptr_is_owned(this_arg);
26350         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26351         this_arg_conv.is_owned = false;
26352         unsigned char temporary_channel_id_arr[32];
26353         CHECK(temporary_channel_id->arr_len == 32);
26354         memcpy(temporary_channel_id_arr, temporary_channel_id->elems, 32); FREE(temporary_channel_id);
26355         unsigned char (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr;
26356         LDKPublicKey counterparty_node_id_ref;
26357         CHECK(counterparty_node_id->arr_len == 33);
26358         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
26359         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
26360         *ret_conv = ChannelManager_accept_inbound_channel_from_trusted_peer_0conf(&this_arg_conv, temporary_channel_id_ref, counterparty_node_id_ref, user_channel_id);
26361         return tag_ptr(ret_conv, true);
26362 }
26363
26364 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) {
26365         LDKChannelManager this_arg_conv;
26366         this_arg_conv.inner = untag_ptr(this_arg);
26367         this_arg_conv.is_owned = ptr_is_owned(this_arg);
26368         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26369         this_arg_conv.is_owned = false;
26370         void* min_value_msat_ptr = untag_ptr(min_value_msat);
26371         CHECK_ACCESS(min_value_msat_ptr);
26372         LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
26373         min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(min_value_msat));
26374         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
26375         *ret_conv = ChannelManager_create_inbound_payment(&this_arg_conv, min_value_msat_conv, invoice_expiry_delta_secs);
26376         return tag_ptr(ret_conv, true);
26377 }
26378
26379 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) {
26380         LDKChannelManager this_arg_conv;
26381         this_arg_conv.inner = untag_ptr(this_arg);
26382         this_arg_conv.is_owned = ptr_is_owned(this_arg);
26383         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26384         this_arg_conv.is_owned = false;
26385         void* min_value_msat_ptr = untag_ptr(min_value_msat);
26386         CHECK_ACCESS(min_value_msat_ptr);
26387         LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
26388         min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(min_value_msat));
26389         LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ");
26390         *ret_conv = ChannelManager_create_inbound_payment_legacy(&this_arg_conv, min_value_msat_conv, invoice_expiry_delta_secs);
26391         return tag_ptr(ret_conv, true);
26392 }
26393
26394 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) {
26395         LDKChannelManager this_arg_conv;
26396         this_arg_conv.inner = untag_ptr(this_arg);
26397         this_arg_conv.is_owned = ptr_is_owned(this_arg);
26398         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26399         this_arg_conv.is_owned = false;
26400         LDKThirtyTwoBytes payment_hash_ref;
26401         CHECK(payment_hash->arr_len == 32);
26402         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
26403         void* min_value_msat_ptr = untag_ptr(min_value_msat);
26404         CHECK_ACCESS(min_value_msat_ptr);
26405         LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
26406         min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(min_value_msat));
26407         LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
26408         *ret_conv = ChannelManager_create_inbound_payment_for_hash(&this_arg_conv, payment_hash_ref, min_value_msat_conv, invoice_expiry_delta_secs);
26409         return tag_ptr(ret_conv, true);
26410 }
26411
26412 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) {
26413         LDKChannelManager this_arg_conv;
26414         this_arg_conv.inner = untag_ptr(this_arg);
26415         this_arg_conv.is_owned = ptr_is_owned(this_arg);
26416         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26417         this_arg_conv.is_owned = false;
26418         LDKThirtyTwoBytes payment_hash_ref;
26419         CHECK(payment_hash->arr_len == 32);
26420         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
26421         void* min_value_msat_ptr = untag_ptr(min_value_msat);
26422         CHECK_ACCESS(min_value_msat_ptr);
26423         LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
26424         min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(min_value_msat));
26425         LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
26426         *ret_conv = ChannelManager_create_inbound_payment_for_hash_legacy(&this_arg_conv, payment_hash_ref, min_value_msat_conv, invoice_expiry_delta_secs);
26427         return tag_ptr(ret_conv, true);
26428 }
26429
26430 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) {
26431         LDKChannelManager this_arg_conv;
26432         this_arg_conv.inner = untag_ptr(this_arg);
26433         this_arg_conv.is_owned = ptr_is_owned(this_arg);
26434         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26435         this_arg_conv.is_owned = false;
26436         LDKThirtyTwoBytes payment_hash_ref;
26437         CHECK(payment_hash->arr_len == 32);
26438         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
26439         LDKThirtyTwoBytes payment_secret_ref;
26440         CHECK(payment_secret->arr_len == 32);
26441         memcpy(payment_secret_ref.data, payment_secret->elems, 32); FREE(payment_secret);
26442         LDKCResult_PaymentPreimageAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPreimageAPIErrorZ), "LDKCResult_PaymentPreimageAPIErrorZ");
26443         *ret_conv = ChannelManager_get_payment_preimage(&this_arg_conv, payment_hash_ref, payment_secret_ref);
26444         return tag_ptr(ret_conv, true);
26445 }
26446
26447 int64_t  __attribute__((export_name("TS_ChannelManager_get_phantom_scid"))) TS_ChannelManager_get_phantom_scid(uint64_t this_arg) {
26448         LDKChannelManager this_arg_conv;
26449         this_arg_conv.inner = untag_ptr(this_arg);
26450         this_arg_conv.is_owned = ptr_is_owned(this_arg);
26451         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26452         this_arg_conv.is_owned = false;
26453         int64_t ret_conv = ChannelManager_get_phantom_scid(&this_arg_conv);
26454         return ret_conv;
26455 }
26456
26457 uint64_t  __attribute__((export_name("TS_ChannelManager_get_phantom_route_hints"))) TS_ChannelManager_get_phantom_route_hints(uint64_t this_arg) {
26458         LDKChannelManager this_arg_conv;
26459         this_arg_conv.inner = untag_ptr(this_arg);
26460         this_arg_conv.is_owned = ptr_is_owned(this_arg);
26461         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26462         this_arg_conv.is_owned = false;
26463         LDKPhantomRouteHints ret_var = ChannelManager_get_phantom_route_hints(&this_arg_conv);
26464         uint64_t ret_ref = 0;
26465         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26466         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
26467         return ret_ref;
26468 }
26469
26470 uint64_t  __attribute__((export_name("TS_ChannelManager_as_MessageSendEventsProvider"))) TS_ChannelManager_as_MessageSendEventsProvider(uint64_t this_arg) {
26471         LDKChannelManager this_arg_conv;
26472         this_arg_conv.inner = untag_ptr(this_arg);
26473         this_arg_conv.is_owned = ptr_is_owned(this_arg);
26474         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26475         this_arg_conv.is_owned = false;
26476         LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
26477         *ret_ret = ChannelManager_as_MessageSendEventsProvider(&this_arg_conv);
26478         return tag_ptr(ret_ret, true);
26479 }
26480
26481 uint64_t  __attribute__((export_name("TS_ChannelManager_as_EventsProvider"))) TS_ChannelManager_as_EventsProvider(uint64_t this_arg) {
26482         LDKChannelManager this_arg_conv;
26483         this_arg_conv.inner = untag_ptr(this_arg);
26484         this_arg_conv.is_owned = ptr_is_owned(this_arg);
26485         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26486         this_arg_conv.is_owned = false;
26487         LDKEventsProvider* ret_ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
26488         *ret_ret = ChannelManager_as_EventsProvider(&this_arg_conv);
26489         return tag_ptr(ret_ret, true);
26490 }
26491
26492 uint64_t  __attribute__((export_name("TS_ChannelManager_as_Listen"))) TS_ChannelManager_as_Listen(uint64_t this_arg) {
26493         LDKChannelManager this_arg_conv;
26494         this_arg_conv.inner = untag_ptr(this_arg);
26495         this_arg_conv.is_owned = ptr_is_owned(this_arg);
26496         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26497         this_arg_conv.is_owned = false;
26498         LDKListen* ret_ret = MALLOC(sizeof(LDKListen), "LDKListen");
26499         *ret_ret = ChannelManager_as_Listen(&this_arg_conv);
26500         return tag_ptr(ret_ret, true);
26501 }
26502
26503 uint64_t  __attribute__((export_name("TS_ChannelManager_as_Confirm"))) TS_ChannelManager_as_Confirm(uint64_t this_arg) {
26504         LDKChannelManager this_arg_conv;
26505         this_arg_conv.inner = untag_ptr(this_arg);
26506         this_arg_conv.is_owned = ptr_is_owned(this_arg);
26507         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26508         this_arg_conv.is_owned = false;
26509         LDKConfirm* ret_ret = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
26510         *ret_ret = ChannelManager_as_Confirm(&this_arg_conv);
26511         return tag_ptr(ret_ret, true);
26512 }
26513
26514 void  __attribute__((export_name("TS_ChannelManager_await_persistable_update"))) TS_ChannelManager_await_persistable_update(uint64_t this_arg) {
26515         LDKChannelManager this_arg_conv;
26516         this_arg_conv.inner = untag_ptr(this_arg);
26517         this_arg_conv.is_owned = ptr_is_owned(this_arg);
26518         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26519         this_arg_conv.is_owned = false;
26520         ChannelManager_await_persistable_update(&this_arg_conv);
26521 }
26522
26523 uint64_t  __attribute__((export_name("TS_ChannelManager_current_best_block"))) TS_ChannelManager_current_best_block(uint64_t this_arg) {
26524         LDKChannelManager this_arg_conv;
26525         this_arg_conv.inner = untag_ptr(this_arg);
26526         this_arg_conv.is_owned = ptr_is_owned(this_arg);
26527         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26528         this_arg_conv.is_owned = false;
26529         LDKBestBlock ret_var = ChannelManager_current_best_block(&this_arg_conv);
26530         uint64_t ret_ref = 0;
26531         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26532         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
26533         return ret_ref;
26534 }
26535
26536 uint64_t  __attribute__((export_name("TS_ChannelManager_as_ChannelMessageHandler"))) TS_ChannelManager_as_ChannelMessageHandler(uint64_t this_arg) {
26537         LDKChannelManager this_arg_conv;
26538         this_arg_conv.inner = untag_ptr(this_arg);
26539         this_arg_conv.is_owned = ptr_is_owned(this_arg);
26540         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26541         this_arg_conv.is_owned = false;
26542         LDKChannelMessageHandler* ret_ret = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
26543         *ret_ret = ChannelManager_as_ChannelMessageHandler(&this_arg_conv);
26544         return tag_ptr(ret_ret, true);
26545 }
26546
26547 int8_tArray  __attribute__((export_name("TS_CounterpartyForwardingInfo_write"))) TS_CounterpartyForwardingInfo_write(uint64_t obj) {
26548         LDKCounterpartyForwardingInfo obj_conv;
26549         obj_conv.inner = untag_ptr(obj);
26550         obj_conv.is_owned = ptr_is_owned(obj);
26551         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
26552         obj_conv.is_owned = false;
26553         LDKCVec_u8Z ret_var = CounterpartyForwardingInfo_write(&obj_conv);
26554         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
26555         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
26556         CVec_u8Z_free(ret_var);
26557         return ret_arr;
26558 }
26559
26560 uint64_t  __attribute__((export_name("TS_CounterpartyForwardingInfo_read"))) TS_CounterpartyForwardingInfo_read(int8_tArray ser) {
26561         LDKu8slice ser_ref;
26562         ser_ref.datalen = ser->arr_len;
26563         ser_ref.data = ser->elems;
26564         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
26565         *ret_conv = CounterpartyForwardingInfo_read(ser_ref);
26566         FREE(ser);
26567         return tag_ptr(ret_conv, true);
26568 }
26569
26570 int8_tArray  __attribute__((export_name("TS_ChannelCounterparty_write"))) TS_ChannelCounterparty_write(uint64_t obj) {
26571         LDKChannelCounterparty obj_conv;
26572         obj_conv.inner = untag_ptr(obj);
26573         obj_conv.is_owned = ptr_is_owned(obj);
26574         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
26575         obj_conv.is_owned = false;
26576         LDKCVec_u8Z ret_var = ChannelCounterparty_write(&obj_conv);
26577         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
26578         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
26579         CVec_u8Z_free(ret_var);
26580         return ret_arr;
26581 }
26582
26583 uint64_t  __attribute__((export_name("TS_ChannelCounterparty_read"))) TS_ChannelCounterparty_read(int8_tArray ser) {
26584         LDKu8slice ser_ref;
26585         ser_ref.datalen = ser->arr_len;
26586         ser_ref.data = ser->elems;
26587         LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
26588         *ret_conv = ChannelCounterparty_read(ser_ref);
26589         FREE(ser);
26590         return tag_ptr(ret_conv, true);
26591 }
26592
26593 int8_tArray  __attribute__((export_name("TS_ChannelDetails_write"))) TS_ChannelDetails_write(uint64_t obj) {
26594         LDKChannelDetails obj_conv;
26595         obj_conv.inner = untag_ptr(obj);
26596         obj_conv.is_owned = ptr_is_owned(obj);
26597         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
26598         obj_conv.is_owned = false;
26599         LDKCVec_u8Z ret_var = ChannelDetails_write(&obj_conv);
26600         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
26601         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
26602         CVec_u8Z_free(ret_var);
26603         return ret_arr;
26604 }
26605
26606 uint64_t  __attribute__((export_name("TS_ChannelDetails_read"))) TS_ChannelDetails_read(int8_tArray ser) {
26607         LDKu8slice ser_ref;
26608         ser_ref.datalen = ser->arr_len;
26609         ser_ref.data = ser->elems;
26610         LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
26611         *ret_conv = ChannelDetails_read(ser_ref);
26612         FREE(ser);
26613         return tag_ptr(ret_conv, true);
26614 }
26615
26616 int8_tArray  __attribute__((export_name("TS_PhantomRouteHints_write"))) TS_PhantomRouteHints_write(uint64_t obj) {
26617         LDKPhantomRouteHints obj_conv;
26618         obj_conv.inner = untag_ptr(obj);
26619         obj_conv.is_owned = ptr_is_owned(obj);
26620         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
26621         obj_conv.is_owned = false;
26622         LDKCVec_u8Z ret_var = PhantomRouteHints_write(&obj_conv);
26623         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
26624         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
26625         CVec_u8Z_free(ret_var);
26626         return ret_arr;
26627 }
26628
26629 uint64_t  __attribute__((export_name("TS_PhantomRouteHints_read"))) TS_PhantomRouteHints_read(int8_tArray ser) {
26630         LDKu8slice ser_ref;
26631         ser_ref.datalen = ser->arr_len;
26632         ser_ref.data = ser->elems;
26633         LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
26634         *ret_conv = PhantomRouteHints_read(ser_ref);
26635         FREE(ser);
26636         return tag_ptr(ret_conv, true);
26637 }
26638
26639 int8_tArray  __attribute__((export_name("TS_ChannelManager_write"))) TS_ChannelManager_write(uint64_t obj) {
26640         LDKChannelManager obj_conv;
26641         obj_conv.inner = untag_ptr(obj);
26642         obj_conv.is_owned = ptr_is_owned(obj);
26643         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
26644         obj_conv.is_owned = false;
26645         LDKCVec_u8Z ret_var = ChannelManager_write(&obj_conv);
26646         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
26647         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
26648         CVec_u8Z_free(ret_var);
26649         return ret_arr;
26650 }
26651
26652 void  __attribute__((export_name("TS_ChannelManagerReadArgs_free"))) TS_ChannelManagerReadArgs_free(uint64_t this_obj) {
26653         LDKChannelManagerReadArgs this_obj_conv;
26654         this_obj_conv.inner = untag_ptr(this_obj);
26655         this_obj_conv.is_owned = ptr_is_owned(this_obj);
26656         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
26657         ChannelManagerReadArgs_free(this_obj_conv);
26658 }
26659
26660 uint64_t  __attribute__((export_name("TS_ChannelManagerReadArgs_get_keys_manager"))) TS_ChannelManagerReadArgs_get_keys_manager(uint64_t this_ptr) {
26661         LDKChannelManagerReadArgs this_ptr_conv;
26662         this_ptr_conv.inner = untag_ptr(this_ptr);
26663         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26664         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26665         this_ptr_conv.is_owned = false;
26666         // WARNING: This object doesn't live past this scope, needs clone!
26667         uint64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_keys_manager(&this_ptr_conv), false);
26668         return ret_ret;
26669 }
26670
26671 void  __attribute__((export_name("TS_ChannelManagerReadArgs_set_keys_manager"))) TS_ChannelManagerReadArgs_set_keys_manager(uint64_t this_ptr, uint64_t val) {
26672         LDKChannelManagerReadArgs this_ptr_conv;
26673         this_ptr_conv.inner = untag_ptr(this_ptr);
26674         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26675         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26676         this_ptr_conv.is_owned = false;
26677         void* val_ptr = untag_ptr(val);
26678         CHECK_ACCESS(val_ptr);
26679         LDKKeysInterface val_conv = *(LDKKeysInterface*)(val_ptr);
26680         if (val_conv.free == LDKKeysInterface_JCalls_free) {
26681                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
26682                 LDKKeysInterface_JCalls_cloned(&val_conv);
26683         }
26684         ChannelManagerReadArgs_set_keys_manager(&this_ptr_conv, val_conv);
26685 }
26686
26687 uint64_t  __attribute__((export_name("TS_ChannelManagerReadArgs_get_fee_estimator"))) TS_ChannelManagerReadArgs_get_fee_estimator(uint64_t this_ptr) {
26688         LDKChannelManagerReadArgs this_ptr_conv;
26689         this_ptr_conv.inner = untag_ptr(this_ptr);
26690         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26691         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26692         this_ptr_conv.is_owned = false;
26693         // WARNING: This object doesn't live past this scope, needs clone!
26694         uint64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_fee_estimator(&this_ptr_conv), false);
26695         return ret_ret;
26696 }
26697
26698 void  __attribute__((export_name("TS_ChannelManagerReadArgs_set_fee_estimator"))) TS_ChannelManagerReadArgs_set_fee_estimator(uint64_t this_ptr, uint64_t val) {
26699         LDKChannelManagerReadArgs this_ptr_conv;
26700         this_ptr_conv.inner = untag_ptr(this_ptr);
26701         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26702         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26703         this_ptr_conv.is_owned = false;
26704         void* val_ptr = untag_ptr(val);
26705         CHECK_ACCESS(val_ptr);
26706         LDKFeeEstimator val_conv = *(LDKFeeEstimator*)(val_ptr);
26707         if (val_conv.free == LDKFeeEstimator_JCalls_free) {
26708                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
26709                 LDKFeeEstimator_JCalls_cloned(&val_conv);
26710         }
26711         ChannelManagerReadArgs_set_fee_estimator(&this_ptr_conv, val_conv);
26712 }
26713
26714 uint64_t  __attribute__((export_name("TS_ChannelManagerReadArgs_get_chain_monitor"))) TS_ChannelManagerReadArgs_get_chain_monitor(uint64_t this_ptr) {
26715         LDKChannelManagerReadArgs this_ptr_conv;
26716         this_ptr_conv.inner = untag_ptr(this_ptr);
26717         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26718         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26719         this_ptr_conv.is_owned = false;
26720         // WARNING: This object doesn't live past this scope, needs clone!
26721         uint64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_chain_monitor(&this_ptr_conv), false);
26722         return ret_ret;
26723 }
26724
26725 void  __attribute__((export_name("TS_ChannelManagerReadArgs_set_chain_monitor"))) TS_ChannelManagerReadArgs_set_chain_monitor(uint64_t this_ptr, uint64_t val) {
26726         LDKChannelManagerReadArgs this_ptr_conv;
26727         this_ptr_conv.inner = untag_ptr(this_ptr);
26728         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26729         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26730         this_ptr_conv.is_owned = false;
26731         void* val_ptr = untag_ptr(val);
26732         CHECK_ACCESS(val_ptr);
26733         LDKWatch val_conv = *(LDKWatch*)(val_ptr);
26734         if (val_conv.free == LDKWatch_JCalls_free) {
26735                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
26736                 LDKWatch_JCalls_cloned(&val_conv);
26737         }
26738         ChannelManagerReadArgs_set_chain_monitor(&this_ptr_conv, val_conv);
26739 }
26740
26741 uint64_t  __attribute__((export_name("TS_ChannelManagerReadArgs_get_tx_broadcaster"))) TS_ChannelManagerReadArgs_get_tx_broadcaster(uint64_t this_ptr) {
26742         LDKChannelManagerReadArgs this_ptr_conv;
26743         this_ptr_conv.inner = untag_ptr(this_ptr);
26744         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26745         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26746         this_ptr_conv.is_owned = false;
26747         // WARNING: This object doesn't live past this scope, needs clone!
26748         uint64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_tx_broadcaster(&this_ptr_conv), false);
26749         return ret_ret;
26750 }
26751
26752 void  __attribute__((export_name("TS_ChannelManagerReadArgs_set_tx_broadcaster"))) TS_ChannelManagerReadArgs_set_tx_broadcaster(uint64_t this_ptr, uint64_t val) {
26753         LDKChannelManagerReadArgs this_ptr_conv;
26754         this_ptr_conv.inner = untag_ptr(this_ptr);
26755         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26756         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26757         this_ptr_conv.is_owned = false;
26758         void* val_ptr = untag_ptr(val);
26759         CHECK_ACCESS(val_ptr);
26760         LDKBroadcasterInterface val_conv = *(LDKBroadcasterInterface*)(val_ptr);
26761         if (val_conv.free == LDKBroadcasterInterface_JCalls_free) {
26762                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
26763                 LDKBroadcasterInterface_JCalls_cloned(&val_conv);
26764         }
26765         ChannelManagerReadArgs_set_tx_broadcaster(&this_ptr_conv, val_conv);
26766 }
26767
26768 uint64_t  __attribute__((export_name("TS_ChannelManagerReadArgs_get_logger"))) TS_ChannelManagerReadArgs_get_logger(uint64_t this_ptr) {
26769         LDKChannelManagerReadArgs this_ptr_conv;
26770         this_ptr_conv.inner = untag_ptr(this_ptr);
26771         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26772         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26773         this_ptr_conv.is_owned = false;
26774         // WARNING: This object doesn't live past this scope, needs clone!
26775         uint64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_logger(&this_ptr_conv), false);
26776         return ret_ret;
26777 }
26778
26779 void  __attribute__((export_name("TS_ChannelManagerReadArgs_set_logger"))) TS_ChannelManagerReadArgs_set_logger(uint64_t this_ptr, uint64_t val) {
26780         LDKChannelManagerReadArgs this_ptr_conv;
26781         this_ptr_conv.inner = untag_ptr(this_ptr);
26782         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26783         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26784         this_ptr_conv.is_owned = false;
26785         void* val_ptr = untag_ptr(val);
26786         CHECK_ACCESS(val_ptr);
26787         LDKLogger val_conv = *(LDKLogger*)(val_ptr);
26788         if (val_conv.free == LDKLogger_JCalls_free) {
26789                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
26790                 LDKLogger_JCalls_cloned(&val_conv);
26791         }
26792         ChannelManagerReadArgs_set_logger(&this_ptr_conv, val_conv);
26793 }
26794
26795 uint64_t  __attribute__((export_name("TS_ChannelManagerReadArgs_get_default_config"))) TS_ChannelManagerReadArgs_get_default_config(uint64_t this_ptr) {
26796         LDKChannelManagerReadArgs this_ptr_conv;
26797         this_ptr_conv.inner = untag_ptr(this_ptr);
26798         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26799         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26800         this_ptr_conv.is_owned = false;
26801         LDKUserConfig ret_var = ChannelManagerReadArgs_get_default_config(&this_ptr_conv);
26802         uint64_t ret_ref = 0;
26803         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26804         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
26805         return ret_ref;
26806 }
26807
26808 void  __attribute__((export_name("TS_ChannelManagerReadArgs_set_default_config"))) TS_ChannelManagerReadArgs_set_default_config(uint64_t this_ptr, uint64_t val) {
26809         LDKChannelManagerReadArgs this_ptr_conv;
26810         this_ptr_conv.inner = untag_ptr(this_ptr);
26811         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26812         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26813         this_ptr_conv.is_owned = false;
26814         LDKUserConfig val_conv;
26815         val_conv.inner = untag_ptr(val);
26816         val_conv.is_owned = ptr_is_owned(val);
26817         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
26818         val_conv = UserConfig_clone(&val_conv);
26819         ChannelManagerReadArgs_set_default_config(&this_ptr_conv, val_conv);
26820 }
26821
26822 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) {
26823         void* keys_manager_ptr = untag_ptr(keys_manager);
26824         CHECK_ACCESS(keys_manager_ptr);
26825         LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr);
26826         if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
26827                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
26828                 LDKKeysInterface_JCalls_cloned(&keys_manager_conv);
26829         }
26830         void* fee_estimator_ptr = untag_ptr(fee_estimator);
26831         CHECK_ACCESS(fee_estimator_ptr);
26832         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
26833         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
26834                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
26835                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
26836         }
26837         void* chain_monitor_ptr = untag_ptr(chain_monitor);
26838         CHECK_ACCESS(chain_monitor_ptr);
26839         LDKWatch chain_monitor_conv = *(LDKWatch*)(chain_monitor_ptr);
26840         if (chain_monitor_conv.free == LDKWatch_JCalls_free) {
26841                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
26842                 LDKWatch_JCalls_cloned(&chain_monitor_conv);
26843         }
26844         void* tx_broadcaster_ptr = untag_ptr(tx_broadcaster);
26845         CHECK_ACCESS(tx_broadcaster_ptr);
26846         LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)(tx_broadcaster_ptr);
26847         if (tx_broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
26848                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
26849                 LDKBroadcasterInterface_JCalls_cloned(&tx_broadcaster_conv);
26850         }
26851         void* logger_ptr = untag_ptr(logger);
26852         CHECK_ACCESS(logger_ptr);
26853         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
26854         if (logger_conv.free == LDKLogger_JCalls_free) {
26855                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
26856                 LDKLogger_JCalls_cloned(&logger_conv);
26857         }
26858         LDKUserConfig default_config_conv;
26859         default_config_conv.inner = untag_ptr(default_config);
26860         default_config_conv.is_owned = ptr_is_owned(default_config);
26861         CHECK_INNER_FIELD_ACCESS_OR_NULL(default_config_conv);
26862         default_config_conv = UserConfig_clone(&default_config_conv);
26863         LDKCVec_ChannelMonitorZ channel_monitors_constr;
26864         channel_monitors_constr.datalen = channel_monitors->arr_len;
26865         if (channel_monitors_constr.datalen > 0)
26866                 channel_monitors_constr.data = MALLOC(channel_monitors_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
26867         else
26868                 channel_monitors_constr.data = NULL;
26869         uint64_t* channel_monitors_vals = channel_monitors->elems;
26870         for (size_t q = 0; q < channel_monitors_constr.datalen; q++) {
26871                 uint64_t channel_monitors_conv_16 = channel_monitors_vals[q];
26872                 LDKChannelMonitor channel_monitors_conv_16_conv;
26873                 channel_monitors_conv_16_conv.inner = untag_ptr(channel_monitors_conv_16);
26874                 channel_monitors_conv_16_conv.is_owned = ptr_is_owned(channel_monitors_conv_16);
26875                 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_monitors_conv_16_conv);
26876                 channel_monitors_conv_16_conv.is_owned = false;
26877                 channel_monitors_constr.data[q] = channel_monitors_conv_16_conv;
26878         }
26879         FREE(channel_monitors);
26880         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);
26881         uint64_t ret_ref = 0;
26882         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26883         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
26884         return ret_ref;
26885 }
26886
26887 uint64_t  __attribute__((export_name("TS_C2Tuple_BlockHashChannelManagerZ_read"))) TS_C2Tuple_BlockHashChannelManagerZ_read(int8_tArray ser, uint64_t arg) {
26888         LDKu8slice ser_ref;
26889         ser_ref.datalen = ser->arr_len;
26890         ser_ref.data = ser->elems;
26891         LDKChannelManagerReadArgs arg_conv;
26892         arg_conv.inner = untag_ptr(arg);
26893         arg_conv.is_owned = ptr_is_owned(arg);
26894         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
26895         // WARNING: we need a move here but no clone is available for LDKChannelManagerReadArgs
26896         
26897         LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
26898         *ret_conv = C2Tuple_BlockHashChannelManagerZ_read(ser_ref, arg_conv);
26899         FREE(ser);
26900         return tag_ptr(ret_conv, true);
26901 }
26902
26903 void  __attribute__((export_name("TS_ExpandedKey_free"))) TS_ExpandedKey_free(uint64_t this_obj) {
26904         LDKExpandedKey this_obj_conv;
26905         this_obj_conv.inner = untag_ptr(this_obj);
26906         this_obj_conv.is_owned = ptr_is_owned(this_obj);
26907         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
26908         ExpandedKey_free(this_obj_conv);
26909 }
26910
26911 uint64_t  __attribute__((export_name("TS_ExpandedKey_new"))) TS_ExpandedKey_new(int8_tArray key_material) {
26912         unsigned char key_material_arr[32];
26913         CHECK(key_material->arr_len == 32);
26914         memcpy(key_material_arr, key_material->elems, 32); FREE(key_material);
26915         unsigned char (*key_material_ref)[32] = &key_material_arr;
26916         LDKExpandedKey ret_var = ExpandedKey_new(key_material_ref);
26917         uint64_t ret_ref = 0;
26918         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26919         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
26920         return ret_ref;
26921 }
26922
26923 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) {
26924         LDKExpandedKey keys_conv;
26925         keys_conv.inner = untag_ptr(keys);
26926         keys_conv.is_owned = ptr_is_owned(keys);
26927         CHECK_INNER_FIELD_ACCESS_OR_NULL(keys_conv);
26928         keys_conv.is_owned = false;
26929         void* min_value_msat_ptr = untag_ptr(min_value_msat);
26930         CHECK_ACCESS(min_value_msat_ptr);
26931         LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
26932         min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(min_value_msat));
26933         void* keys_manager_ptr = untag_ptr(keys_manager);
26934         if (ptr_is_owned(keys_manager)) { CHECK_ACCESS(keys_manager_ptr); }
26935         LDKKeysInterface* keys_manager_conv = (LDKKeysInterface*)keys_manager_ptr;
26936         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
26937         *ret_conv = create(&keys_conv, min_value_msat_conv, invoice_expiry_delta_secs, keys_manager_conv, current_time);
26938         return tag_ptr(ret_conv, true);
26939 }
26940
26941 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) {
26942         LDKExpandedKey keys_conv;
26943         keys_conv.inner = untag_ptr(keys);
26944         keys_conv.is_owned = ptr_is_owned(keys);
26945         CHECK_INNER_FIELD_ACCESS_OR_NULL(keys_conv);
26946         keys_conv.is_owned = false;
26947         void* min_value_msat_ptr = untag_ptr(min_value_msat);
26948         CHECK_ACCESS(min_value_msat_ptr);
26949         LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
26950         min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(min_value_msat));
26951         LDKThirtyTwoBytes payment_hash_ref;
26952         CHECK(payment_hash->arr_len == 32);
26953         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
26954         LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
26955         *ret_conv = create_from_hash(&keys_conv, min_value_msat_conv, payment_hash_ref, invoice_expiry_delta_secs, current_time);
26956         return tag_ptr(ret_conv, true);
26957 }
26958
26959 void  __attribute__((export_name("TS_DecodeError_free"))) TS_DecodeError_free(uint64_t this_obj) {
26960         LDKDecodeError this_obj_conv;
26961         this_obj_conv.inner = untag_ptr(this_obj);
26962         this_obj_conv.is_owned = ptr_is_owned(this_obj);
26963         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
26964         DecodeError_free(this_obj_conv);
26965 }
26966
26967 static inline uint64_t DecodeError_clone_ptr(LDKDecodeError *NONNULL_PTR arg) {
26968         LDKDecodeError ret_var = DecodeError_clone(arg);
26969         uint64_t ret_ref = 0;
26970         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26971         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
26972         return ret_ref;
26973 }
26974 int64_t  __attribute__((export_name("TS_DecodeError_clone_ptr"))) TS_DecodeError_clone_ptr(uint64_t arg) {
26975         LDKDecodeError arg_conv;
26976         arg_conv.inner = untag_ptr(arg);
26977         arg_conv.is_owned = ptr_is_owned(arg);
26978         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
26979         arg_conv.is_owned = false;
26980         int64_t ret_conv = DecodeError_clone_ptr(&arg_conv);
26981         return ret_conv;
26982 }
26983
26984 uint64_t  __attribute__((export_name("TS_DecodeError_clone"))) TS_DecodeError_clone(uint64_t orig) {
26985         LDKDecodeError orig_conv;
26986         orig_conv.inner = untag_ptr(orig);
26987         orig_conv.is_owned = ptr_is_owned(orig);
26988         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
26989         orig_conv.is_owned = false;
26990         LDKDecodeError ret_var = DecodeError_clone(&orig_conv);
26991         uint64_t ret_ref = 0;
26992         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26993         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
26994         return ret_ref;
26995 }
26996
26997 void  __attribute__((export_name("TS_Init_free"))) TS_Init_free(uint64_t this_obj) {
26998         LDKInit this_obj_conv;
26999         this_obj_conv.inner = untag_ptr(this_obj);
27000         this_obj_conv.is_owned = ptr_is_owned(this_obj);
27001         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
27002         Init_free(this_obj_conv);
27003 }
27004
27005 uint64_t  __attribute__((export_name("TS_Init_get_features"))) TS_Init_get_features(uint64_t this_ptr) {
27006         LDKInit this_ptr_conv;
27007         this_ptr_conv.inner = untag_ptr(this_ptr);
27008         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27009         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27010         this_ptr_conv.is_owned = false;
27011         LDKInitFeatures ret_var = Init_get_features(&this_ptr_conv);
27012         uint64_t ret_ref = 0;
27013         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27014         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27015         return ret_ref;
27016 }
27017
27018 void  __attribute__((export_name("TS_Init_set_features"))) TS_Init_set_features(uint64_t this_ptr, uint64_t val) {
27019         LDKInit this_ptr_conv;
27020         this_ptr_conv.inner = untag_ptr(this_ptr);
27021         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27022         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27023         this_ptr_conv.is_owned = false;
27024         LDKInitFeatures val_conv;
27025         val_conv.inner = untag_ptr(val);
27026         val_conv.is_owned = ptr_is_owned(val);
27027         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
27028         val_conv = InitFeatures_clone(&val_conv);
27029         Init_set_features(&this_ptr_conv, val_conv);
27030 }
27031
27032 uint64_t  __attribute__((export_name("TS_Init_get_remote_network_address"))) TS_Init_get_remote_network_address(uint64_t this_ptr) {
27033         LDKInit this_ptr_conv;
27034         this_ptr_conv.inner = untag_ptr(this_ptr);
27035         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27036         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27037         this_ptr_conv.is_owned = false;
27038         LDKCOption_NetAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_NetAddressZ), "LDKCOption_NetAddressZ");
27039         *ret_copy = Init_get_remote_network_address(&this_ptr_conv);
27040         uint64_t ret_ref = tag_ptr(ret_copy, true);
27041         return ret_ref;
27042 }
27043
27044 void  __attribute__((export_name("TS_Init_set_remote_network_address"))) TS_Init_set_remote_network_address(uint64_t this_ptr, uint64_t val) {
27045         LDKInit this_ptr_conv;
27046         this_ptr_conv.inner = untag_ptr(this_ptr);
27047         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27048         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27049         this_ptr_conv.is_owned = false;
27050         void* val_ptr = untag_ptr(val);
27051         CHECK_ACCESS(val_ptr);
27052         LDKCOption_NetAddressZ val_conv = *(LDKCOption_NetAddressZ*)(val_ptr);
27053         val_conv = COption_NetAddressZ_clone((LDKCOption_NetAddressZ*)untag_ptr(val));
27054         Init_set_remote_network_address(&this_ptr_conv, val_conv);
27055 }
27056
27057 uint64_t  __attribute__((export_name("TS_Init_new"))) TS_Init_new(uint64_t features_arg, uint64_t remote_network_address_arg) {
27058         LDKInitFeatures features_arg_conv;
27059         features_arg_conv.inner = untag_ptr(features_arg);
27060         features_arg_conv.is_owned = ptr_is_owned(features_arg);
27061         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
27062         features_arg_conv = InitFeatures_clone(&features_arg_conv);
27063         void* remote_network_address_arg_ptr = untag_ptr(remote_network_address_arg);
27064         CHECK_ACCESS(remote_network_address_arg_ptr);
27065         LDKCOption_NetAddressZ remote_network_address_arg_conv = *(LDKCOption_NetAddressZ*)(remote_network_address_arg_ptr);
27066         LDKInit ret_var = Init_new(features_arg_conv, remote_network_address_arg_conv);
27067         uint64_t ret_ref = 0;
27068         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27069         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27070         return ret_ref;
27071 }
27072
27073 static inline uint64_t Init_clone_ptr(LDKInit *NONNULL_PTR arg) {
27074         LDKInit ret_var = Init_clone(arg);
27075         uint64_t ret_ref = 0;
27076         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27077         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27078         return ret_ref;
27079 }
27080 int64_t  __attribute__((export_name("TS_Init_clone_ptr"))) TS_Init_clone_ptr(uint64_t arg) {
27081         LDKInit arg_conv;
27082         arg_conv.inner = untag_ptr(arg);
27083         arg_conv.is_owned = ptr_is_owned(arg);
27084         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
27085         arg_conv.is_owned = false;
27086         int64_t ret_conv = Init_clone_ptr(&arg_conv);
27087         return ret_conv;
27088 }
27089
27090 uint64_t  __attribute__((export_name("TS_Init_clone"))) TS_Init_clone(uint64_t orig) {
27091         LDKInit orig_conv;
27092         orig_conv.inner = untag_ptr(orig);
27093         orig_conv.is_owned = ptr_is_owned(orig);
27094         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
27095         orig_conv.is_owned = false;
27096         LDKInit ret_var = Init_clone(&orig_conv);
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 void  __attribute__((export_name("TS_ErrorMessage_free"))) TS_ErrorMessage_free(uint64_t this_obj) {
27104         LDKErrorMessage this_obj_conv;
27105         this_obj_conv.inner = untag_ptr(this_obj);
27106         this_obj_conv.is_owned = ptr_is_owned(this_obj);
27107         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
27108         ErrorMessage_free(this_obj_conv);
27109 }
27110
27111 int8_tArray  __attribute__((export_name("TS_ErrorMessage_get_channel_id"))) TS_ErrorMessage_get_channel_id(uint64_t this_ptr) {
27112         LDKErrorMessage this_ptr_conv;
27113         this_ptr_conv.inner = untag_ptr(this_ptr);
27114         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27115         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27116         this_ptr_conv.is_owned = false;
27117         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
27118         memcpy(ret_arr->elems, *ErrorMessage_get_channel_id(&this_ptr_conv), 32);
27119         return ret_arr;
27120 }
27121
27122 void  __attribute__((export_name("TS_ErrorMessage_set_channel_id"))) TS_ErrorMessage_set_channel_id(uint64_t this_ptr, int8_tArray val) {
27123         LDKErrorMessage this_ptr_conv;
27124         this_ptr_conv.inner = untag_ptr(this_ptr);
27125         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27126         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27127         this_ptr_conv.is_owned = false;
27128         LDKThirtyTwoBytes val_ref;
27129         CHECK(val->arr_len == 32);
27130         memcpy(val_ref.data, val->elems, 32); FREE(val);
27131         ErrorMessage_set_channel_id(&this_ptr_conv, val_ref);
27132 }
27133
27134 jstring  __attribute__((export_name("TS_ErrorMessage_get_data"))) TS_ErrorMessage_get_data(uint64_t this_ptr) {
27135         LDKErrorMessage this_ptr_conv;
27136         this_ptr_conv.inner = untag_ptr(this_ptr);
27137         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27138         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27139         this_ptr_conv.is_owned = false;
27140         LDKStr ret_str = ErrorMessage_get_data(&this_ptr_conv);
27141         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
27142         Str_free(ret_str);
27143         return ret_conv;
27144 }
27145
27146 void  __attribute__((export_name("TS_ErrorMessage_set_data"))) TS_ErrorMessage_set_data(uint64_t this_ptr, jstring val) {
27147         LDKErrorMessage this_ptr_conv;
27148         this_ptr_conv.inner = untag_ptr(this_ptr);
27149         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27150         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27151         this_ptr_conv.is_owned = false;
27152         LDKStr val_conv = str_ref_to_owned_c(val);
27153         ErrorMessage_set_data(&this_ptr_conv, val_conv);
27154 }
27155
27156 uint64_t  __attribute__((export_name("TS_ErrorMessage_new"))) TS_ErrorMessage_new(int8_tArray channel_id_arg, jstring data_arg) {
27157         LDKThirtyTwoBytes channel_id_arg_ref;
27158         CHECK(channel_id_arg->arr_len == 32);
27159         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
27160         LDKStr data_arg_conv = str_ref_to_owned_c(data_arg);
27161         LDKErrorMessage ret_var = ErrorMessage_new(channel_id_arg_ref, data_arg_conv);
27162         uint64_t ret_ref = 0;
27163         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27164         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27165         return ret_ref;
27166 }
27167
27168 static inline uint64_t ErrorMessage_clone_ptr(LDKErrorMessage *NONNULL_PTR arg) {
27169         LDKErrorMessage ret_var = ErrorMessage_clone(arg);
27170         uint64_t ret_ref = 0;
27171         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27172         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27173         return ret_ref;
27174 }
27175 int64_t  __attribute__((export_name("TS_ErrorMessage_clone_ptr"))) TS_ErrorMessage_clone_ptr(uint64_t arg) {
27176         LDKErrorMessage arg_conv;
27177         arg_conv.inner = untag_ptr(arg);
27178         arg_conv.is_owned = ptr_is_owned(arg);
27179         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
27180         arg_conv.is_owned = false;
27181         int64_t ret_conv = ErrorMessage_clone_ptr(&arg_conv);
27182         return ret_conv;
27183 }
27184
27185 uint64_t  __attribute__((export_name("TS_ErrorMessage_clone"))) TS_ErrorMessage_clone(uint64_t orig) {
27186         LDKErrorMessage orig_conv;
27187         orig_conv.inner = untag_ptr(orig);
27188         orig_conv.is_owned = ptr_is_owned(orig);
27189         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
27190         orig_conv.is_owned = false;
27191         LDKErrorMessage ret_var = ErrorMessage_clone(&orig_conv);
27192         uint64_t ret_ref = 0;
27193         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27194         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27195         return ret_ref;
27196 }
27197
27198 void  __attribute__((export_name("TS_WarningMessage_free"))) TS_WarningMessage_free(uint64_t this_obj) {
27199         LDKWarningMessage this_obj_conv;
27200         this_obj_conv.inner = untag_ptr(this_obj);
27201         this_obj_conv.is_owned = ptr_is_owned(this_obj);
27202         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
27203         WarningMessage_free(this_obj_conv);
27204 }
27205
27206 int8_tArray  __attribute__((export_name("TS_WarningMessage_get_channel_id"))) TS_WarningMessage_get_channel_id(uint64_t this_ptr) {
27207         LDKWarningMessage this_ptr_conv;
27208         this_ptr_conv.inner = untag_ptr(this_ptr);
27209         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27210         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27211         this_ptr_conv.is_owned = false;
27212         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
27213         memcpy(ret_arr->elems, *WarningMessage_get_channel_id(&this_ptr_conv), 32);
27214         return ret_arr;
27215 }
27216
27217 void  __attribute__((export_name("TS_WarningMessage_set_channel_id"))) TS_WarningMessage_set_channel_id(uint64_t this_ptr, int8_tArray val) {
27218         LDKWarningMessage this_ptr_conv;
27219         this_ptr_conv.inner = untag_ptr(this_ptr);
27220         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27221         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27222         this_ptr_conv.is_owned = false;
27223         LDKThirtyTwoBytes val_ref;
27224         CHECK(val->arr_len == 32);
27225         memcpy(val_ref.data, val->elems, 32); FREE(val);
27226         WarningMessage_set_channel_id(&this_ptr_conv, val_ref);
27227 }
27228
27229 jstring  __attribute__((export_name("TS_WarningMessage_get_data"))) TS_WarningMessage_get_data(uint64_t this_ptr) {
27230         LDKWarningMessage this_ptr_conv;
27231         this_ptr_conv.inner = untag_ptr(this_ptr);
27232         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27233         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27234         this_ptr_conv.is_owned = false;
27235         LDKStr ret_str = WarningMessage_get_data(&this_ptr_conv);
27236         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
27237         Str_free(ret_str);
27238         return ret_conv;
27239 }
27240
27241 void  __attribute__((export_name("TS_WarningMessage_set_data"))) TS_WarningMessage_set_data(uint64_t this_ptr, jstring val) {
27242         LDKWarningMessage this_ptr_conv;
27243         this_ptr_conv.inner = untag_ptr(this_ptr);
27244         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27245         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27246         this_ptr_conv.is_owned = false;
27247         LDKStr val_conv = str_ref_to_owned_c(val);
27248         WarningMessage_set_data(&this_ptr_conv, val_conv);
27249 }
27250
27251 uint64_t  __attribute__((export_name("TS_WarningMessage_new"))) TS_WarningMessage_new(int8_tArray channel_id_arg, jstring data_arg) {
27252         LDKThirtyTwoBytes channel_id_arg_ref;
27253         CHECK(channel_id_arg->arr_len == 32);
27254         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
27255         LDKStr data_arg_conv = str_ref_to_owned_c(data_arg);
27256         LDKWarningMessage ret_var = WarningMessage_new(channel_id_arg_ref, data_arg_conv);
27257         uint64_t ret_ref = 0;
27258         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27259         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27260         return ret_ref;
27261 }
27262
27263 static inline uint64_t WarningMessage_clone_ptr(LDKWarningMessage *NONNULL_PTR arg) {
27264         LDKWarningMessage ret_var = WarningMessage_clone(arg);
27265         uint64_t ret_ref = 0;
27266         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27267         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27268         return ret_ref;
27269 }
27270 int64_t  __attribute__((export_name("TS_WarningMessage_clone_ptr"))) TS_WarningMessage_clone_ptr(uint64_t arg) {
27271         LDKWarningMessage arg_conv;
27272         arg_conv.inner = untag_ptr(arg);
27273         arg_conv.is_owned = ptr_is_owned(arg);
27274         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
27275         arg_conv.is_owned = false;
27276         int64_t ret_conv = WarningMessage_clone_ptr(&arg_conv);
27277         return ret_conv;
27278 }
27279
27280 uint64_t  __attribute__((export_name("TS_WarningMessage_clone"))) TS_WarningMessage_clone(uint64_t orig) {
27281         LDKWarningMessage orig_conv;
27282         orig_conv.inner = untag_ptr(orig);
27283         orig_conv.is_owned = ptr_is_owned(orig);
27284         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
27285         orig_conv.is_owned = false;
27286         LDKWarningMessage ret_var = WarningMessage_clone(&orig_conv);
27287         uint64_t ret_ref = 0;
27288         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27289         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27290         return ret_ref;
27291 }
27292
27293 void  __attribute__((export_name("TS_Ping_free"))) TS_Ping_free(uint64_t this_obj) {
27294         LDKPing this_obj_conv;
27295         this_obj_conv.inner = untag_ptr(this_obj);
27296         this_obj_conv.is_owned = ptr_is_owned(this_obj);
27297         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
27298         Ping_free(this_obj_conv);
27299 }
27300
27301 int16_t  __attribute__((export_name("TS_Ping_get_ponglen"))) TS_Ping_get_ponglen(uint64_t this_ptr) {
27302         LDKPing this_ptr_conv;
27303         this_ptr_conv.inner = untag_ptr(this_ptr);
27304         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27305         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27306         this_ptr_conv.is_owned = false;
27307         int16_t ret_conv = Ping_get_ponglen(&this_ptr_conv);
27308         return ret_conv;
27309 }
27310
27311 void  __attribute__((export_name("TS_Ping_set_ponglen"))) TS_Ping_set_ponglen(uint64_t this_ptr, int16_t val) {
27312         LDKPing this_ptr_conv;
27313         this_ptr_conv.inner = untag_ptr(this_ptr);
27314         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27315         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27316         this_ptr_conv.is_owned = false;
27317         Ping_set_ponglen(&this_ptr_conv, val);
27318 }
27319
27320 int16_t  __attribute__((export_name("TS_Ping_get_byteslen"))) TS_Ping_get_byteslen(uint64_t this_ptr) {
27321         LDKPing this_ptr_conv;
27322         this_ptr_conv.inner = untag_ptr(this_ptr);
27323         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27324         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27325         this_ptr_conv.is_owned = false;
27326         int16_t ret_conv = Ping_get_byteslen(&this_ptr_conv);
27327         return ret_conv;
27328 }
27329
27330 void  __attribute__((export_name("TS_Ping_set_byteslen"))) TS_Ping_set_byteslen(uint64_t this_ptr, int16_t val) {
27331         LDKPing this_ptr_conv;
27332         this_ptr_conv.inner = untag_ptr(this_ptr);
27333         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27334         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27335         this_ptr_conv.is_owned = false;
27336         Ping_set_byteslen(&this_ptr_conv, val);
27337 }
27338
27339 uint64_t  __attribute__((export_name("TS_Ping_new"))) TS_Ping_new(int16_t ponglen_arg, int16_t byteslen_arg) {
27340         LDKPing ret_var = Ping_new(ponglen_arg, byteslen_arg);
27341         uint64_t ret_ref = 0;
27342         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27343         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27344         return ret_ref;
27345 }
27346
27347 static inline uint64_t Ping_clone_ptr(LDKPing *NONNULL_PTR arg) {
27348         LDKPing ret_var = Ping_clone(arg);
27349         uint64_t ret_ref = 0;
27350         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27351         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27352         return ret_ref;
27353 }
27354 int64_t  __attribute__((export_name("TS_Ping_clone_ptr"))) TS_Ping_clone_ptr(uint64_t arg) {
27355         LDKPing arg_conv;
27356         arg_conv.inner = untag_ptr(arg);
27357         arg_conv.is_owned = ptr_is_owned(arg);
27358         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
27359         arg_conv.is_owned = false;
27360         int64_t ret_conv = Ping_clone_ptr(&arg_conv);
27361         return ret_conv;
27362 }
27363
27364 uint64_t  __attribute__((export_name("TS_Ping_clone"))) TS_Ping_clone(uint64_t orig) {
27365         LDKPing orig_conv;
27366         orig_conv.inner = untag_ptr(orig);
27367         orig_conv.is_owned = ptr_is_owned(orig);
27368         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
27369         orig_conv.is_owned = false;
27370         LDKPing ret_var = Ping_clone(&orig_conv);
27371         uint64_t ret_ref = 0;
27372         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27373         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27374         return ret_ref;
27375 }
27376
27377 void  __attribute__((export_name("TS_Pong_free"))) TS_Pong_free(uint64_t this_obj) {
27378         LDKPong this_obj_conv;
27379         this_obj_conv.inner = untag_ptr(this_obj);
27380         this_obj_conv.is_owned = ptr_is_owned(this_obj);
27381         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
27382         Pong_free(this_obj_conv);
27383 }
27384
27385 int16_t  __attribute__((export_name("TS_Pong_get_byteslen"))) TS_Pong_get_byteslen(uint64_t this_ptr) {
27386         LDKPong this_ptr_conv;
27387         this_ptr_conv.inner = untag_ptr(this_ptr);
27388         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27389         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27390         this_ptr_conv.is_owned = false;
27391         int16_t ret_conv = Pong_get_byteslen(&this_ptr_conv);
27392         return ret_conv;
27393 }
27394
27395 void  __attribute__((export_name("TS_Pong_set_byteslen"))) TS_Pong_set_byteslen(uint64_t this_ptr, int16_t val) {
27396         LDKPong this_ptr_conv;
27397         this_ptr_conv.inner = untag_ptr(this_ptr);
27398         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27399         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27400         this_ptr_conv.is_owned = false;
27401         Pong_set_byteslen(&this_ptr_conv, val);
27402 }
27403
27404 uint64_t  __attribute__((export_name("TS_Pong_new"))) TS_Pong_new(int16_t byteslen_arg) {
27405         LDKPong ret_var = Pong_new(byteslen_arg);
27406         uint64_t ret_ref = 0;
27407         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27408         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27409         return ret_ref;
27410 }
27411
27412 static inline uint64_t Pong_clone_ptr(LDKPong *NONNULL_PTR arg) {
27413         LDKPong ret_var = Pong_clone(arg);
27414         uint64_t ret_ref = 0;
27415         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27416         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27417         return ret_ref;
27418 }
27419 int64_t  __attribute__((export_name("TS_Pong_clone_ptr"))) TS_Pong_clone_ptr(uint64_t arg) {
27420         LDKPong arg_conv;
27421         arg_conv.inner = untag_ptr(arg);
27422         arg_conv.is_owned = ptr_is_owned(arg);
27423         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
27424         arg_conv.is_owned = false;
27425         int64_t ret_conv = Pong_clone_ptr(&arg_conv);
27426         return ret_conv;
27427 }
27428
27429 uint64_t  __attribute__((export_name("TS_Pong_clone"))) TS_Pong_clone(uint64_t orig) {
27430         LDKPong orig_conv;
27431         orig_conv.inner = untag_ptr(orig);
27432         orig_conv.is_owned = ptr_is_owned(orig);
27433         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
27434         orig_conv.is_owned = false;
27435         LDKPong ret_var = Pong_clone(&orig_conv);
27436         uint64_t ret_ref = 0;
27437         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27438         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27439         return ret_ref;
27440 }
27441
27442 void  __attribute__((export_name("TS_OpenChannel_free"))) TS_OpenChannel_free(uint64_t this_obj) {
27443         LDKOpenChannel this_obj_conv;
27444         this_obj_conv.inner = untag_ptr(this_obj);
27445         this_obj_conv.is_owned = ptr_is_owned(this_obj);
27446         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
27447         OpenChannel_free(this_obj_conv);
27448 }
27449
27450 int8_tArray  __attribute__((export_name("TS_OpenChannel_get_chain_hash"))) TS_OpenChannel_get_chain_hash(uint64_t this_ptr) {
27451         LDKOpenChannel this_ptr_conv;
27452         this_ptr_conv.inner = untag_ptr(this_ptr);
27453         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27454         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27455         this_ptr_conv.is_owned = false;
27456         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
27457         memcpy(ret_arr->elems, *OpenChannel_get_chain_hash(&this_ptr_conv), 32);
27458         return ret_arr;
27459 }
27460
27461 void  __attribute__((export_name("TS_OpenChannel_set_chain_hash"))) TS_OpenChannel_set_chain_hash(uint64_t this_ptr, int8_tArray val) {
27462         LDKOpenChannel this_ptr_conv;
27463         this_ptr_conv.inner = untag_ptr(this_ptr);
27464         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27465         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27466         this_ptr_conv.is_owned = false;
27467         LDKThirtyTwoBytes val_ref;
27468         CHECK(val->arr_len == 32);
27469         memcpy(val_ref.data, val->elems, 32); FREE(val);
27470         OpenChannel_set_chain_hash(&this_ptr_conv, val_ref);
27471 }
27472
27473 int8_tArray  __attribute__((export_name("TS_OpenChannel_get_temporary_channel_id"))) TS_OpenChannel_get_temporary_channel_id(uint64_t this_ptr) {
27474         LDKOpenChannel this_ptr_conv;
27475         this_ptr_conv.inner = untag_ptr(this_ptr);
27476         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27477         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27478         this_ptr_conv.is_owned = false;
27479         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
27480         memcpy(ret_arr->elems, *OpenChannel_get_temporary_channel_id(&this_ptr_conv), 32);
27481         return ret_arr;
27482 }
27483
27484 void  __attribute__((export_name("TS_OpenChannel_set_temporary_channel_id"))) TS_OpenChannel_set_temporary_channel_id(uint64_t this_ptr, int8_tArray val) {
27485         LDKOpenChannel this_ptr_conv;
27486         this_ptr_conv.inner = untag_ptr(this_ptr);
27487         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27488         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27489         this_ptr_conv.is_owned = false;
27490         LDKThirtyTwoBytes val_ref;
27491         CHECK(val->arr_len == 32);
27492         memcpy(val_ref.data, val->elems, 32); FREE(val);
27493         OpenChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
27494 }
27495
27496 int64_t  __attribute__((export_name("TS_OpenChannel_get_funding_satoshis"))) TS_OpenChannel_get_funding_satoshis(uint64_t this_ptr) {
27497         LDKOpenChannel this_ptr_conv;
27498         this_ptr_conv.inner = untag_ptr(this_ptr);
27499         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27500         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27501         this_ptr_conv.is_owned = false;
27502         int64_t ret_conv = OpenChannel_get_funding_satoshis(&this_ptr_conv);
27503         return ret_conv;
27504 }
27505
27506 void  __attribute__((export_name("TS_OpenChannel_set_funding_satoshis"))) TS_OpenChannel_set_funding_satoshis(uint64_t this_ptr, int64_t val) {
27507         LDKOpenChannel this_ptr_conv;
27508         this_ptr_conv.inner = untag_ptr(this_ptr);
27509         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27510         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27511         this_ptr_conv.is_owned = false;
27512         OpenChannel_set_funding_satoshis(&this_ptr_conv, val);
27513 }
27514
27515 int64_t  __attribute__((export_name("TS_OpenChannel_get_push_msat"))) TS_OpenChannel_get_push_msat(uint64_t this_ptr) {
27516         LDKOpenChannel this_ptr_conv;
27517         this_ptr_conv.inner = untag_ptr(this_ptr);
27518         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27519         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27520         this_ptr_conv.is_owned = false;
27521         int64_t ret_conv = OpenChannel_get_push_msat(&this_ptr_conv);
27522         return ret_conv;
27523 }
27524
27525 void  __attribute__((export_name("TS_OpenChannel_set_push_msat"))) TS_OpenChannel_set_push_msat(uint64_t this_ptr, int64_t val) {
27526         LDKOpenChannel this_ptr_conv;
27527         this_ptr_conv.inner = untag_ptr(this_ptr);
27528         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27529         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27530         this_ptr_conv.is_owned = false;
27531         OpenChannel_set_push_msat(&this_ptr_conv, val);
27532 }
27533
27534 int64_t  __attribute__((export_name("TS_OpenChannel_get_dust_limit_satoshis"))) TS_OpenChannel_get_dust_limit_satoshis(uint64_t this_ptr) {
27535         LDKOpenChannel this_ptr_conv;
27536         this_ptr_conv.inner = untag_ptr(this_ptr);
27537         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27538         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27539         this_ptr_conv.is_owned = false;
27540         int64_t ret_conv = OpenChannel_get_dust_limit_satoshis(&this_ptr_conv);
27541         return ret_conv;
27542 }
27543
27544 void  __attribute__((export_name("TS_OpenChannel_set_dust_limit_satoshis"))) TS_OpenChannel_set_dust_limit_satoshis(uint64_t this_ptr, int64_t val) {
27545         LDKOpenChannel this_ptr_conv;
27546         this_ptr_conv.inner = untag_ptr(this_ptr);
27547         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27548         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27549         this_ptr_conv.is_owned = false;
27550         OpenChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
27551 }
27552
27553 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) {
27554         LDKOpenChannel this_ptr_conv;
27555         this_ptr_conv.inner = untag_ptr(this_ptr);
27556         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27557         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27558         this_ptr_conv.is_owned = false;
27559         int64_t ret_conv = OpenChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
27560         return ret_conv;
27561 }
27562
27563 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) {
27564         LDKOpenChannel this_ptr_conv;
27565         this_ptr_conv.inner = untag_ptr(this_ptr);
27566         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27567         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27568         this_ptr_conv.is_owned = false;
27569         OpenChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
27570 }
27571
27572 int64_t  __attribute__((export_name("TS_OpenChannel_get_channel_reserve_satoshis"))) TS_OpenChannel_get_channel_reserve_satoshis(uint64_t this_ptr) {
27573         LDKOpenChannel this_ptr_conv;
27574         this_ptr_conv.inner = untag_ptr(this_ptr);
27575         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27576         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27577         this_ptr_conv.is_owned = false;
27578         int64_t ret_conv = OpenChannel_get_channel_reserve_satoshis(&this_ptr_conv);
27579         return ret_conv;
27580 }
27581
27582 void  __attribute__((export_name("TS_OpenChannel_set_channel_reserve_satoshis"))) TS_OpenChannel_set_channel_reserve_satoshis(uint64_t this_ptr, int64_t val) {
27583         LDKOpenChannel this_ptr_conv;
27584         this_ptr_conv.inner = untag_ptr(this_ptr);
27585         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27586         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27587         this_ptr_conv.is_owned = false;
27588         OpenChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
27589 }
27590
27591 int64_t  __attribute__((export_name("TS_OpenChannel_get_htlc_minimum_msat"))) TS_OpenChannel_get_htlc_minimum_msat(uint64_t this_ptr) {
27592         LDKOpenChannel this_ptr_conv;
27593         this_ptr_conv.inner = untag_ptr(this_ptr);
27594         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27595         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27596         this_ptr_conv.is_owned = false;
27597         int64_t ret_conv = OpenChannel_get_htlc_minimum_msat(&this_ptr_conv);
27598         return ret_conv;
27599 }
27600
27601 void  __attribute__((export_name("TS_OpenChannel_set_htlc_minimum_msat"))) TS_OpenChannel_set_htlc_minimum_msat(uint64_t this_ptr, int64_t val) {
27602         LDKOpenChannel this_ptr_conv;
27603         this_ptr_conv.inner = untag_ptr(this_ptr);
27604         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27605         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27606         this_ptr_conv.is_owned = false;
27607         OpenChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
27608 }
27609
27610 int32_t  __attribute__((export_name("TS_OpenChannel_get_feerate_per_kw"))) TS_OpenChannel_get_feerate_per_kw(uint64_t this_ptr) {
27611         LDKOpenChannel this_ptr_conv;
27612         this_ptr_conv.inner = untag_ptr(this_ptr);
27613         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27614         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27615         this_ptr_conv.is_owned = false;
27616         int32_t ret_conv = OpenChannel_get_feerate_per_kw(&this_ptr_conv);
27617         return ret_conv;
27618 }
27619
27620 void  __attribute__((export_name("TS_OpenChannel_set_feerate_per_kw"))) TS_OpenChannel_set_feerate_per_kw(uint64_t this_ptr, int32_t val) {
27621         LDKOpenChannel this_ptr_conv;
27622         this_ptr_conv.inner = untag_ptr(this_ptr);
27623         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27624         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27625         this_ptr_conv.is_owned = false;
27626         OpenChannel_set_feerate_per_kw(&this_ptr_conv, val);
27627 }
27628
27629 int16_t  __attribute__((export_name("TS_OpenChannel_get_to_self_delay"))) TS_OpenChannel_get_to_self_delay(uint64_t this_ptr) {
27630         LDKOpenChannel this_ptr_conv;
27631         this_ptr_conv.inner = untag_ptr(this_ptr);
27632         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27633         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27634         this_ptr_conv.is_owned = false;
27635         int16_t ret_conv = OpenChannel_get_to_self_delay(&this_ptr_conv);
27636         return ret_conv;
27637 }
27638
27639 void  __attribute__((export_name("TS_OpenChannel_set_to_self_delay"))) TS_OpenChannel_set_to_self_delay(uint64_t this_ptr, int16_t val) {
27640         LDKOpenChannel this_ptr_conv;
27641         this_ptr_conv.inner = untag_ptr(this_ptr);
27642         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27643         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27644         this_ptr_conv.is_owned = false;
27645         OpenChannel_set_to_self_delay(&this_ptr_conv, val);
27646 }
27647
27648 int16_t  __attribute__((export_name("TS_OpenChannel_get_max_accepted_htlcs"))) TS_OpenChannel_get_max_accepted_htlcs(uint64_t this_ptr) {
27649         LDKOpenChannel this_ptr_conv;
27650         this_ptr_conv.inner = untag_ptr(this_ptr);
27651         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27652         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27653         this_ptr_conv.is_owned = false;
27654         int16_t ret_conv = OpenChannel_get_max_accepted_htlcs(&this_ptr_conv);
27655         return ret_conv;
27656 }
27657
27658 void  __attribute__((export_name("TS_OpenChannel_set_max_accepted_htlcs"))) TS_OpenChannel_set_max_accepted_htlcs(uint64_t this_ptr, int16_t val) {
27659         LDKOpenChannel this_ptr_conv;
27660         this_ptr_conv.inner = untag_ptr(this_ptr);
27661         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27662         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27663         this_ptr_conv.is_owned = false;
27664         OpenChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
27665 }
27666
27667 int8_tArray  __attribute__((export_name("TS_OpenChannel_get_funding_pubkey"))) TS_OpenChannel_get_funding_pubkey(uint64_t this_ptr) {
27668         LDKOpenChannel this_ptr_conv;
27669         this_ptr_conv.inner = untag_ptr(this_ptr);
27670         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27671         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27672         this_ptr_conv.is_owned = false;
27673         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
27674         memcpy(ret_arr->elems, OpenChannel_get_funding_pubkey(&this_ptr_conv).compressed_form, 33);
27675         return ret_arr;
27676 }
27677
27678 void  __attribute__((export_name("TS_OpenChannel_set_funding_pubkey"))) TS_OpenChannel_set_funding_pubkey(uint64_t this_ptr, int8_tArray val) {
27679         LDKOpenChannel this_ptr_conv;
27680         this_ptr_conv.inner = untag_ptr(this_ptr);
27681         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27682         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27683         this_ptr_conv.is_owned = false;
27684         LDKPublicKey val_ref;
27685         CHECK(val->arr_len == 33);
27686         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
27687         OpenChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
27688 }
27689
27690 int8_tArray  __attribute__((export_name("TS_OpenChannel_get_revocation_basepoint"))) TS_OpenChannel_get_revocation_basepoint(uint64_t this_ptr) {
27691         LDKOpenChannel this_ptr_conv;
27692         this_ptr_conv.inner = untag_ptr(this_ptr);
27693         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27694         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27695         this_ptr_conv.is_owned = false;
27696         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
27697         memcpy(ret_arr->elems, OpenChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form, 33);
27698         return ret_arr;
27699 }
27700
27701 void  __attribute__((export_name("TS_OpenChannel_set_revocation_basepoint"))) TS_OpenChannel_set_revocation_basepoint(uint64_t this_ptr, int8_tArray val) {
27702         LDKOpenChannel this_ptr_conv;
27703         this_ptr_conv.inner = untag_ptr(this_ptr);
27704         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27705         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27706         this_ptr_conv.is_owned = false;
27707         LDKPublicKey val_ref;
27708         CHECK(val->arr_len == 33);
27709         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
27710         OpenChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
27711 }
27712
27713 int8_tArray  __attribute__((export_name("TS_OpenChannel_get_payment_point"))) TS_OpenChannel_get_payment_point(uint64_t this_ptr) {
27714         LDKOpenChannel this_ptr_conv;
27715         this_ptr_conv.inner = untag_ptr(this_ptr);
27716         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27717         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27718         this_ptr_conv.is_owned = false;
27719         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
27720         memcpy(ret_arr->elems, OpenChannel_get_payment_point(&this_ptr_conv).compressed_form, 33);
27721         return ret_arr;
27722 }
27723
27724 void  __attribute__((export_name("TS_OpenChannel_set_payment_point"))) TS_OpenChannel_set_payment_point(uint64_t this_ptr, int8_tArray val) {
27725         LDKOpenChannel this_ptr_conv;
27726         this_ptr_conv.inner = untag_ptr(this_ptr);
27727         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27728         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27729         this_ptr_conv.is_owned = false;
27730         LDKPublicKey val_ref;
27731         CHECK(val->arr_len == 33);
27732         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
27733         OpenChannel_set_payment_point(&this_ptr_conv, val_ref);
27734 }
27735
27736 int8_tArray  __attribute__((export_name("TS_OpenChannel_get_delayed_payment_basepoint"))) TS_OpenChannel_get_delayed_payment_basepoint(uint64_t this_ptr) {
27737         LDKOpenChannel this_ptr_conv;
27738         this_ptr_conv.inner = untag_ptr(this_ptr);
27739         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27740         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27741         this_ptr_conv.is_owned = false;
27742         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
27743         memcpy(ret_arr->elems, OpenChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form, 33);
27744         return ret_arr;
27745 }
27746
27747 void  __attribute__((export_name("TS_OpenChannel_set_delayed_payment_basepoint"))) TS_OpenChannel_set_delayed_payment_basepoint(uint64_t this_ptr, int8_tArray val) {
27748         LDKOpenChannel this_ptr_conv;
27749         this_ptr_conv.inner = untag_ptr(this_ptr);
27750         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27751         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27752         this_ptr_conv.is_owned = false;
27753         LDKPublicKey val_ref;
27754         CHECK(val->arr_len == 33);
27755         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
27756         OpenChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
27757 }
27758
27759 int8_tArray  __attribute__((export_name("TS_OpenChannel_get_htlc_basepoint"))) TS_OpenChannel_get_htlc_basepoint(uint64_t this_ptr) {
27760         LDKOpenChannel this_ptr_conv;
27761         this_ptr_conv.inner = untag_ptr(this_ptr);
27762         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27763         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27764         this_ptr_conv.is_owned = false;
27765         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
27766         memcpy(ret_arr->elems, OpenChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form, 33);
27767         return ret_arr;
27768 }
27769
27770 void  __attribute__((export_name("TS_OpenChannel_set_htlc_basepoint"))) TS_OpenChannel_set_htlc_basepoint(uint64_t this_ptr, int8_tArray val) {
27771         LDKOpenChannel this_ptr_conv;
27772         this_ptr_conv.inner = untag_ptr(this_ptr);
27773         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27774         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27775         this_ptr_conv.is_owned = false;
27776         LDKPublicKey val_ref;
27777         CHECK(val->arr_len == 33);
27778         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
27779         OpenChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
27780 }
27781
27782 int8_tArray  __attribute__((export_name("TS_OpenChannel_get_first_per_commitment_point"))) TS_OpenChannel_get_first_per_commitment_point(uint64_t this_ptr) {
27783         LDKOpenChannel this_ptr_conv;
27784         this_ptr_conv.inner = untag_ptr(this_ptr);
27785         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27786         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27787         this_ptr_conv.is_owned = false;
27788         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
27789         memcpy(ret_arr->elems, OpenChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form, 33);
27790         return ret_arr;
27791 }
27792
27793 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) {
27794         LDKOpenChannel this_ptr_conv;
27795         this_ptr_conv.inner = untag_ptr(this_ptr);
27796         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27797         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27798         this_ptr_conv.is_owned = false;
27799         LDKPublicKey val_ref;
27800         CHECK(val->arr_len == 33);
27801         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
27802         OpenChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
27803 }
27804
27805 int8_t  __attribute__((export_name("TS_OpenChannel_get_channel_flags"))) TS_OpenChannel_get_channel_flags(uint64_t this_ptr) {
27806         LDKOpenChannel this_ptr_conv;
27807         this_ptr_conv.inner = untag_ptr(this_ptr);
27808         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27809         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27810         this_ptr_conv.is_owned = false;
27811         int8_t ret_conv = OpenChannel_get_channel_flags(&this_ptr_conv);
27812         return ret_conv;
27813 }
27814
27815 void  __attribute__((export_name("TS_OpenChannel_set_channel_flags"))) TS_OpenChannel_set_channel_flags(uint64_t this_ptr, int8_t val) {
27816         LDKOpenChannel this_ptr_conv;
27817         this_ptr_conv.inner = untag_ptr(this_ptr);
27818         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27819         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27820         this_ptr_conv.is_owned = false;
27821         OpenChannel_set_channel_flags(&this_ptr_conv, val);
27822 }
27823
27824 uint64_t  __attribute__((export_name("TS_OpenChannel_get_channel_type"))) TS_OpenChannel_get_channel_type(uint64_t this_ptr) {
27825         LDKOpenChannel this_ptr_conv;
27826         this_ptr_conv.inner = untag_ptr(this_ptr);
27827         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27828         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27829         this_ptr_conv.is_owned = false;
27830         LDKChannelTypeFeatures ret_var = OpenChannel_get_channel_type(&this_ptr_conv);
27831         uint64_t ret_ref = 0;
27832         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27833         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27834         return ret_ref;
27835 }
27836
27837 void  __attribute__((export_name("TS_OpenChannel_set_channel_type"))) TS_OpenChannel_set_channel_type(uint64_t this_ptr, uint64_t val) {
27838         LDKOpenChannel this_ptr_conv;
27839         this_ptr_conv.inner = untag_ptr(this_ptr);
27840         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27841         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27842         this_ptr_conv.is_owned = false;
27843         LDKChannelTypeFeatures val_conv;
27844         val_conv.inner = untag_ptr(val);
27845         val_conv.is_owned = ptr_is_owned(val);
27846         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
27847         val_conv = ChannelTypeFeatures_clone(&val_conv);
27848         OpenChannel_set_channel_type(&this_ptr_conv, val_conv);
27849 }
27850
27851 static inline uint64_t OpenChannel_clone_ptr(LDKOpenChannel *NONNULL_PTR arg) {
27852         LDKOpenChannel ret_var = OpenChannel_clone(arg);
27853         uint64_t ret_ref = 0;
27854         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27855         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27856         return ret_ref;
27857 }
27858 int64_t  __attribute__((export_name("TS_OpenChannel_clone_ptr"))) TS_OpenChannel_clone_ptr(uint64_t arg) {
27859         LDKOpenChannel arg_conv;
27860         arg_conv.inner = untag_ptr(arg);
27861         arg_conv.is_owned = ptr_is_owned(arg);
27862         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
27863         arg_conv.is_owned = false;
27864         int64_t ret_conv = OpenChannel_clone_ptr(&arg_conv);
27865         return ret_conv;
27866 }
27867
27868 uint64_t  __attribute__((export_name("TS_OpenChannel_clone"))) TS_OpenChannel_clone(uint64_t orig) {
27869         LDKOpenChannel orig_conv;
27870         orig_conv.inner = untag_ptr(orig);
27871         orig_conv.is_owned = ptr_is_owned(orig);
27872         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
27873         orig_conv.is_owned = false;
27874         LDKOpenChannel ret_var = OpenChannel_clone(&orig_conv);
27875         uint64_t ret_ref = 0;
27876         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27877         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27878         return ret_ref;
27879 }
27880
27881 void  __attribute__((export_name("TS_AcceptChannel_free"))) TS_AcceptChannel_free(uint64_t this_obj) {
27882         LDKAcceptChannel this_obj_conv;
27883         this_obj_conv.inner = untag_ptr(this_obj);
27884         this_obj_conv.is_owned = ptr_is_owned(this_obj);
27885         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
27886         AcceptChannel_free(this_obj_conv);
27887 }
27888
27889 int8_tArray  __attribute__((export_name("TS_AcceptChannel_get_temporary_channel_id"))) TS_AcceptChannel_get_temporary_channel_id(uint64_t this_ptr) {
27890         LDKAcceptChannel this_ptr_conv;
27891         this_ptr_conv.inner = untag_ptr(this_ptr);
27892         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27893         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27894         this_ptr_conv.is_owned = false;
27895         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
27896         memcpy(ret_arr->elems, *AcceptChannel_get_temporary_channel_id(&this_ptr_conv), 32);
27897         return ret_arr;
27898 }
27899
27900 void  __attribute__((export_name("TS_AcceptChannel_set_temporary_channel_id"))) TS_AcceptChannel_set_temporary_channel_id(uint64_t this_ptr, int8_tArray val) {
27901         LDKAcceptChannel this_ptr_conv;
27902         this_ptr_conv.inner = untag_ptr(this_ptr);
27903         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27904         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27905         this_ptr_conv.is_owned = false;
27906         LDKThirtyTwoBytes val_ref;
27907         CHECK(val->arr_len == 32);
27908         memcpy(val_ref.data, val->elems, 32); FREE(val);
27909         AcceptChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
27910 }
27911
27912 int64_t  __attribute__((export_name("TS_AcceptChannel_get_dust_limit_satoshis"))) TS_AcceptChannel_get_dust_limit_satoshis(uint64_t this_ptr) {
27913         LDKAcceptChannel this_ptr_conv;
27914         this_ptr_conv.inner = untag_ptr(this_ptr);
27915         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27916         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27917         this_ptr_conv.is_owned = false;
27918         int64_t ret_conv = AcceptChannel_get_dust_limit_satoshis(&this_ptr_conv);
27919         return ret_conv;
27920 }
27921
27922 void  __attribute__((export_name("TS_AcceptChannel_set_dust_limit_satoshis"))) TS_AcceptChannel_set_dust_limit_satoshis(uint64_t this_ptr, int64_t val) {
27923         LDKAcceptChannel this_ptr_conv;
27924         this_ptr_conv.inner = untag_ptr(this_ptr);
27925         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27926         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27927         this_ptr_conv.is_owned = false;
27928         AcceptChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
27929 }
27930
27931 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) {
27932         LDKAcceptChannel this_ptr_conv;
27933         this_ptr_conv.inner = untag_ptr(this_ptr);
27934         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27935         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27936         this_ptr_conv.is_owned = false;
27937         int64_t ret_conv = AcceptChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
27938         return ret_conv;
27939 }
27940
27941 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) {
27942         LDKAcceptChannel this_ptr_conv;
27943         this_ptr_conv.inner = untag_ptr(this_ptr);
27944         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27945         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27946         this_ptr_conv.is_owned = false;
27947         AcceptChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
27948 }
27949
27950 int64_t  __attribute__((export_name("TS_AcceptChannel_get_channel_reserve_satoshis"))) TS_AcceptChannel_get_channel_reserve_satoshis(uint64_t this_ptr) {
27951         LDKAcceptChannel this_ptr_conv;
27952         this_ptr_conv.inner = untag_ptr(this_ptr);
27953         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27954         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27955         this_ptr_conv.is_owned = false;
27956         int64_t ret_conv = AcceptChannel_get_channel_reserve_satoshis(&this_ptr_conv);
27957         return ret_conv;
27958 }
27959
27960 void  __attribute__((export_name("TS_AcceptChannel_set_channel_reserve_satoshis"))) TS_AcceptChannel_set_channel_reserve_satoshis(uint64_t this_ptr, int64_t val) {
27961         LDKAcceptChannel this_ptr_conv;
27962         this_ptr_conv.inner = untag_ptr(this_ptr);
27963         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27964         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27965         this_ptr_conv.is_owned = false;
27966         AcceptChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
27967 }
27968
27969 int64_t  __attribute__((export_name("TS_AcceptChannel_get_htlc_minimum_msat"))) TS_AcceptChannel_get_htlc_minimum_msat(uint64_t this_ptr) {
27970         LDKAcceptChannel this_ptr_conv;
27971         this_ptr_conv.inner = untag_ptr(this_ptr);
27972         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27973         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27974         this_ptr_conv.is_owned = false;
27975         int64_t ret_conv = AcceptChannel_get_htlc_minimum_msat(&this_ptr_conv);
27976         return ret_conv;
27977 }
27978
27979 void  __attribute__((export_name("TS_AcceptChannel_set_htlc_minimum_msat"))) TS_AcceptChannel_set_htlc_minimum_msat(uint64_t this_ptr, int64_t val) {
27980         LDKAcceptChannel this_ptr_conv;
27981         this_ptr_conv.inner = untag_ptr(this_ptr);
27982         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27983         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27984         this_ptr_conv.is_owned = false;
27985         AcceptChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
27986 }
27987
27988 int32_t  __attribute__((export_name("TS_AcceptChannel_get_minimum_depth"))) TS_AcceptChannel_get_minimum_depth(uint64_t this_ptr) {
27989         LDKAcceptChannel this_ptr_conv;
27990         this_ptr_conv.inner = untag_ptr(this_ptr);
27991         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27992         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27993         this_ptr_conv.is_owned = false;
27994         int32_t ret_conv = AcceptChannel_get_minimum_depth(&this_ptr_conv);
27995         return ret_conv;
27996 }
27997
27998 void  __attribute__((export_name("TS_AcceptChannel_set_minimum_depth"))) TS_AcceptChannel_set_minimum_depth(uint64_t this_ptr, int32_t val) {
27999         LDKAcceptChannel this_ptr_conv;
28000         this_ptr_conv.inner = untag_ptr(this_ptr);
28001         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28002         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28003         this_ptr_conv.is_owned = false;
28004         AcceptChannel_set_minimum_depth(&this_ptr_conv, val);
28005 }
28006
28007 int16_t  __attribute__((export_name("TS_AcceptChannel_get_to_self_delay"))) TS_AcceptChannel_get_to_self_delay(uint64_t this_ptr) {
28008         LDKAcceptChannel this_ptr_conv;
28009         this_ptr_conv.inner = untag_ptr(this_ptr);
28010         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28011         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28012         this_ptr_conv.is_owned = false;
28013         int16_t ret_conv = AcceptChannel_get_to_self_delay(&this_ptr_conv);
28014         return ret_conv;
28015 }
28016
28017 void  __attribute__((export_name("TS_AcceptChannel_set_to_self_delay"))) TS_AcceptChannel_set_to_self_delay(uint64_t this_ptr, int16_t val) {
28018         LDKAcceptChannel this_ptr_conv;
28019         this_ptr_conv.inner = untag_ptr(this_ptr);
28020         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28021         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28022         this_ptr_conv.is_owned = false;
28023         AcceptChannel_set_to_self_delay(&this_ptr_conv, val);
28024 }
28025
28026 int16_t  __attribute__((export_name("TS_AcceptChannel_get_max_accepted_htlcs"))) TS_AcceptChannel_get_max_accepted_htlcs(uint64_t this_ptr) {
28027         LDKAcceptChannel this_ptr_conv;
28028         this_ptr_conv.inner = untag_ptr(this_ptr);
28029         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28030         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28031         this_ptr_conv.is_owned = false;
28032         int16_t ret_conv = AcceptChannel_get_max_accepted_htlcs(&this_ptr_conv);
28033         return ret_conv;
28034 }
28035
28036 void  __attribute__((export_name("TS_AcceptChannel_set_max_accepted_htlcs"))) TS_AcceptChannel_set_max_accepted_htlcs(uint64_t this_ptr, int16_t val) {
28037         LDKAcceptChannel this_ptr_conv;
28038         this_ptr_conv.inner = untag_ptr(this_ptr);
28039         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28040         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28041         this_ptr_conv.is_owned = false;
28042         AcceptChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
28043 }
28044
28045 int8_tArray  __attribute__((export_name("TS_AcceptChannel_get_funding_pubkey"))) TS_AcceptChannel_get_funding_pubkey(uint64_t this_ptr) {
28046         LDKAcceptChannel this_ptr_conv;
28047         this_ptr_conv.inner = untag_ptr(this_ptr);
28048         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28049         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28050         this_ptr_conv.is_owned = false;
28051         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
28052         memcpy(ret_arr->elems, AcceptChannel_get_funding_pubkey(&this_ptr_conv).compressed_form, 33);
28053         return ret_arr;
28054 }
28055
28056 void  __attribute__((export_name("TS_AcceptChannel_set_funding_pubkey"))) TS_AcceptChannel_set_funding_pubkey(uint64_t this_ptr, int8_tArray val) {
28057         LDKAcceptChannel 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         LDKPublicKey val_ref;
28063         CHECK(val->arr_len == 33);
28064         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
28065         AcceptChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
28066 }
28067
28068 int8_tArray  __attribute__((export_name("TS_AcceptChannel_get_revocation_basepoint"))) TS_AcceptChannel_get_revocation_basepoint(uint64_t this_ptr) {
28069         LDKAcceptChannel this_ptr_conv;
28070         this_ptr_conv.inner = untag_ptr(this_ptr);
28071         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28072         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28073         this_ptr_conv.is_owned = false;
28074         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
28075         memcpy(ret_arr->elems, AcceptChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form, 33);
28076         return ret_arr;
28077 }
28078
28079 void  __attribute__((export_name("TS_AcceptChannel_set_revocation_basepoint"))) TS_AcceptChannel_set_revocation_basepoint(uint64_t this_ptr, int8_tArray val) {
28080         LDKAcceptChannel this_ptr_conv;
28081         this_ptr_conv.inner = untag_ptr(this_ptr);
28082         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28083         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28084         this_ptr_conv.is_owned = false;
28085         LDKPublicKey val_ref;
28086         CHECK(val->arr_len == 33);
28087         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
28088         AcceptChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
28089 }
28090
28091 int8_tArray  __attribute__((export_name("TS_AcceptChannel_get_payment_point"))) TS_AcceptChannel_get_payment_point(uint64_t this_ptr) {
28092         LDKAcceptChannel this_ptr_conv;
28093         this_ptr_conv.inner = untag_ptr(this_ptr);
28094         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28095         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28096         this_ptr_conv.is_owned = false;
28097         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
28098         memcpy(ret_arr->elems, AcceptChannel_get_payment_point(&this_ptr_conv).compressed_form, 33);
28099         return ret_arr;
28100 }
28101
28102 void  __attribute__((export_name("TS_AcceptChannel_set_payment_point"))) TS_AcceptChannel_set_payment_point(uint64_t this_ptr, int8_tArray val) {
28103         LDKAcceptChannel this_ptr_conv;
28104         this_ptr_conv.inner = untag_ptr(this_ptr);
28105         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28106         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28107         this_ptr_conv.is_owned = false;
28108         LDKPublicKey val_ref;
28109         CHECK(val->arr_len == 33);
28110         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
28111         AcceptChannel_set_payment_point(&this_ptr_conv, val_ref);
28112 }
28113
28114 int8_tArray  __attribute__((export_name("TS_AcceptChannel_get_delayed_payment_basepoint"))) TS_AcceptChannel_get_delayed_payment_basepoint(uint64_t this_ptr) {
28115         LDKAcceptChannel this_ptr_conv;
28116         this_ptr_conv.inner = untag_ptr(this_ptr);
28117         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28118         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28119         this_ptr_conv.is_owned = false;
28120         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
28121         memcpy(ret_arr->elems, AcceptChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form, 33);
28122         return ret_arr;
28123 }
28124
28125 void  __attribute__((export_name("TS_AcceptChannel_set_delayed_payment_basepoint"))) TS_AcceptChannel_set_delayed_payment_basepoint(uint64_t this_ptr, int8_tArray val) {
28126         LDKAcceptChannel this_ptr_conv;
28127         this_ptr_conv.inner = untag_ptr(this_ptr);
28128         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28129         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28130         this_ptr_conv.is_owned = false;
28131         LDKPublicKey val_ref;
28132         CHECK(val->arr_len == 33);
28133         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
28134         AcceptChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
28135 }
28136
28137 int8_tArray  __attribute__((export_name("TS_AcceptChannel_get_htlc_basepoint"))) TS_AcceptChannel_get_htlc_basepoint(uint64_t this_ptr) {
28138         LDKAcceptChannel this_ptr_conv;
28139         this_ptr_conv.inner = untag_ptr(this_ptr);
28140         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28141         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28142         this_ptr_conv.is_owned = false;
28143         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
28144         memcpy(ret_arr->elems, AcceptChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form, 33);
28145         return ret_arr;
28146 }
28147
28148 void  __attribute__((export_name("TS_AcceptChannel_set_htlc_basepoint"))) TS_AcceptChannel_set_htlc_basepoint(uint64_t this_ptr, int8_tArray val) {
28149         LDKAcceptChannel this_ptr_conv;
28150         this_ptr_conv.inner = untag_ptr(this_ptr);
28151         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28152         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28153         this_ptr_conv.is_owned = false;
28154         LDKPublicKey val_ref;
28155         CHECK(val->arr_len == 33);
28156         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
28157         AcceptChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
28158 }
28159
28160 int8_tArray  __attribute__((export_name("TS_AcceptChannel_get_first_per_commitment_point"))) TS_AcceptChannel_get_first_per_commitment_point(uint64_t this_ptr) {
28161         LDKAcceptChannel this_ptr_conv;
28162         this_ptr_conv.inner = untag_ptr(this_ptr);
28163         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28164         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28165         this_ptr_conv.is_owned = false;
28166         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
28167         memcpy(ret_arr->elems, AcceptChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form, 33);
28168         return ret_arr;
28169 }
28170
28171 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) {
28172         LDKAcceptChannel this_ptr_conv;
28173         this_ptr_conv.inner = untag_ptr(this_ptr);
28174         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28175         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28176         this_ptr_conv.is_owned = false;
28177         LDKPublicKey val_ref;
28178         CHECK(val->arr_len == 33);
28179         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
28180         AcceptChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
28181 }
28182
28183 uint64_t  __attribute__((export_name("TS_AcceptChannel_get_channel_type"))) TS_AcceptChannel_get_channel_type(uint64_t this_ptr) {
28184         LDKAcceptChannel this_ptr_conv;
28185         this_ptr_conv.inner = untag_ptr(this_ptr);
28186         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28187         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28188         this_ptr_conv.is_owned = false;
28189         LDKChannelTypeFeatures ret_var = AcceptChannel_get_channel_type(&this_ptr_conv);
28190         uint64_t ret_ref = 0;
28191         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28192         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28193         return ret_ref;
28194 }
28195
28196 void  __attribute__((export_name("TS_AcceptChannel_set_channel_type"))) TS_AcceptChannel_set_channel_type(uint64_t this_ptr, uint64_t val) {
28197         LDKAcceptChannel this_ptr_conv;
28198         this_ptr_conv.inner = untag_ptr(this_ptr);
28199         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28200         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28201         this_ptr_conv.is_owned = false;
28202         LDKChannelTypeFeatures val_conv;
28203         val_conv.inner = untag_ptr(val);
28204         val_conv.is_owned = ptr_is_owned(val);
28205         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
28206         val_conv = ChannelTypeFeatures_clone(&val_conv);
28207         AcceptChannel_set_channel_type(&this_ptr_conv, val_conv);
28208 }
28209
28210 static inline uint64_t AcceptChannel_clone_ptr(LDKAcceptChannel *NONNULL_PTR arg) {
28211         LDKAcceptChannel ret_var = AcceptChannel_clone(arg);
28212         uint64_t ret_ref = 0;
28213         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28214         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28215         return ret_ref;
28216 }
28217 int64_t  __attribute__((export_name("TS_AcceptChannel_clone_ptr"))) TS_AcceptChannel_clone_ptr(uint64_t arg) {
28218         LDKAcceptChannel arg_conv;
28219         arg_conv.inner = untag_ptr(arg);
28220         arg_conv.is_owned = ptr_is_owned(arg);
28221         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
28222         arg_conv.is_owned = false;
28223         int64_t ret_conv = AcceptChannel_clone_ptr(&arg_conv);
28224         return ret_conv;
28225 }
28226
28227 uint64_t  __attribute__((export_name("TS_AcceptChannel_clone"))) TS_AcceptChannel_clone(uint64_t orig) {
28228         LDKAcceptChannel orig_conv;
28229         orig_conv.inner = untag_ptr(orig);
28230         orig_conv.is_owned = ptr_is_owned(orig);
28231         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
28232         orig_conv.is_owned = false;
28233         LDKAcceptChannel ret_var = AcceptChannel_clone(&orig_conv);
28234         uint64_t ret_ref = 0;
28235         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28236         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28237         return ret_ref;
28238 }
28239
28240 void  __attribute__((export_name("TS_FundingCreated_free"))) TS_FundingCreated_free(uint64_t this_obj) {
28241         LDKFundingCreated this_obj_conv;
28242         this_obj_conv.inner = untag_ptr(this_obj);
28243         this_obj_conv.is_owned = ptr_is_owned(this_obj);
28244         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
28245         FundingCreated_free(this_obj_conv);
28246 }
28247
28248 int8_tArray  __attribute__((export_name("TS_FundingCreated_get_temporary_channel_id"))) TS_FundingCreated_get_temporary_channel_id(uint64_t this_ptr) {
28249         LDKFundingCreated this_ptr_conv;
28250         this_ptr_conv.inner = untag_ptr(this_ptr);
28251         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28252         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28253         this_ptr_conv.is_owned = false;
28254         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
28255         memcpy(ret_arr->elems, *FundingCreated_get_temporary_channel_id(&this_ptr_conv), 32);
28256         return ret_arr;
28257 }
28258
28259 void  __attribute__((export_name("TS_FundingCreated_set_temporary_channel_id"))) TS_FundingCreated_set_temporary_channel_id(uint64_t this_ptr, int8_tArray val) {
28260         LDKFundingCreated this_ptr_conv;
28261         this_ptr_conv.inner = untag_ptr(this_ptr);
28262         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28263         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28264         this_ptr_conv.is_owned = false;
28265         LDKThirtyTwoBytes val_ref;
28266         CHECK(val->arr_len == 32);
28267         memcpy(val_ref.data, val->elems, 32); FREE(val);
28268         FundingCreated_set_temporary_channel_id(&this_ptr_conv, val_ref);
28269 }
28270
28271 int8_tArray  __attribute__((export_name("TS_FundingCreated_get_funding_txid"))) TS_FundingCreated_get_funding_txid(uint64_t this_ptr) {
28272         LDKFundingCreated this_ptr_conv;
28273         this_ptr_conv.inner = untag_ptr(this_ptr);
28274         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28275         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28276         this_ptr_conv.is_owned = false;
28277         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
28278         memcpy(ret_arr->elems, *FundingCreated_get_funding_txid(&this_ptr_conv), 32);
28279         return ret_arr;
28280 }
28281
28282 void  __attribute__((export_name("TS_FundingCreated_set_funding_txid"))) TS_FundingCreated_set_funding_txid(uint64_t this_ptr, int8_tArray val) {
28283         LDKFundingCreated this_ptr_conv;
28284         this_ptr_conv.inner = untag_ptr(this_ptr);
28285         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28286         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28287         this_ptr_conv.is_owned = false;
28288         LDKThirtyTwoBytes val_ref;
28289         CHECK(val->arr_len == 32);
28290         memcpy(val_ref.data, val->elems, 32); FREE(val);
28291         FundingCreated_set_funding_txid(&this_ptr_conv, val_ref);
28292 }
28293
28294 int16_t  __attribute__((export_name("TS_FundingCreated_get_funding_output_index"))) TS_FundingCreated_get_funding_output_index(uint64_t this_ptr) {
28295         LDKFundingCreated this_ptr_conv;
28296         this_ptr_conv.inner = untag_ptr(this_ptr);
28297         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28298         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28299         this_ptr_conv.is_owned = false;
28300         int16_t ret_conv = FundingCreated_get_funding_output_index(&this_ptr_conv);
28301         return ret_conv;
28302 }
28303
28304 void  __attribute__((export_name("TS_FundingCreated_set_funding_output_index"))) TS_FundingCreated_set_funding_output_index(uint64_t this_ptr, int16_t val) {
28305         LDKFundingCreated this_ptr_conv;
28306         this_ptr_conv.inner = untag_ptr(this_ptr);
28307         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28308         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28309         this_ptr_conv.is_owned = false;
28310         FundingCreated_set_funding_output_index(&this_ptr_conv, val);
28311 }
28312
28313 int8_tArray  __attribute__((export_name("TS_FundingCreated_get_signature"))) TS_FundingCreated_get_signature(uint64_t this_ptr) {
28314         LDKFundingCreated this_ptr_conv;
28315         this_ptr_conv.inner = untag_ptr(this_ptr);
28316         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28317         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28318         this_ptr_conv.is_owned = false;
28319         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
28320         memcpy(ret_arr->elems, FundingCreated_get_signature(&this_ptr_conv).compact_form, 64);
28321         return ret_arr;
28322 }
28323
28324 void  __attribute__((export_name("TS_FundingCreated_set_signature"))) TS_FundingCreated_set_signature(uint64_t this_ptr, int8_tArray val) {
28325         LDKFundingCreated this_ptr_conv;
28326         this_ptr_conv.inner = untag_ptr(this_ptr);
28327         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28328         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28329         this_ptr_conv.is_owned = false;
28330         LDKSignature val_ref;
28331         CHECK(val->arr_len == 64);
28332         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
28333         FundingCreated_set_signature(&this_ptr_conv, val_ref);
28334 }
28335
28336 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) {
28337         LDKThirtyTwoBytes temporary_channel_id_arg_ref;
28338         CHECK(temporary_channel_id_arg->arr_len == 32);
28339         memcpy(temporary_channel_id_arg_ref.data, temporary_channel_id_arg->elems, 32); FREE(temporary_channel_id_arg);
28340         LDKThirtyTwoBytes funding_txid_arg_ref;
28341         CHECK(funding_txid_arg->arr_len == 32);
28342         memcpy(funding_txid_arg_ref.data, funding_txid_arg->elems, 32); FREE(funding_txid_arg);
28343         LDKSignature signature_arg_ref;
28344         CHECK(signature_arg->arr_len == 64);
28345         memcpy(signature_arg_ref.compact_form, signature_arg->elems, 64); FREE(signature_arg);
28346         LDKFundingCreated ret_var = FundingCreated_new(temporary_channel_id_arg_ref, funding_txid_arg_ref, funding_output_index_arg, signature_arg_ref);
28347         uint64_t ret_ref = 0;
28348         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28349         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28350         return ret_ref;
28351 }
28352
28353 static inline uint64_t FundingCreated_clone_ptr(LDKFundingCreated *NONNULL_PTR arg) {
28354         LDKFundingCreated ret_var = FundingCreated_clone(arg);
28355         uint64_t ret_ref = 0;
28356         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28357         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28358         return ret_ref;
28359 }
28360 int64_t  __attribute__((export_name("TS_FundingCreated_clone_ptr"))) TS_FundingCreated_clone_ptr(uint64_t arg) {
28361         LDKFundingCreated arg_conv;
28362         arg_conv.inner = untag_ptr(arg);
28363         arg_conv.is_owned = ptr_is_owned(arg);
28364         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
28365         arg_conv.is_owned = false;
28366         int64_t ret_conv = FundingCreated_clone_ptr(&arg_conv);
28367         return ret_conv;
28368 }
28369
28370 uint64_t  __attribute__((export_name("TS_FundingCreated_clone"))) TS_FundingCreated_clone(uint64_t orig) {
28371         LDKFundingCreated orig_conv;
28372         orig_conv.inner = untag_ptr(orig);
28373         orig_conv.is_owned = ptr_is_owned(orig);
28374         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
28375         orig_conv.is_owned = false;
28376         LDKFundingCreated ret_var = FundingCreated_clone(&orig_conv);
28377         uint64_t ret_ref = 0;
28378         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28379         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28380         return ret_ref;
28381 }
28382
28383 void  __attribute__((export_name("TS_FundingSigned_free"))) TS_FundingSigned_free(uint64_t this_obj) {
28384         LDKFundingSigned this_obj_conv;
28385         this_obj_conv.inner = untag_ptr(this_obj);
28386         this_obj_conv.is_owned = ptr_is_owned(this_obj);
28387         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
28388         FundingSigned_free(this_obj_conv);
28389 }
28390
28391 int8_tArray  __attribute__((export_name("TS_FundingSigned_get_channel_id"))) TS_FundingSigned_get_channel_id(uint64_t this_ptr) {
28392         LDKFundingSigned this_ptr_conv;
28393         this_ptr_conv.inner = untag_ptr(this_ptr);
28394         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28395         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28396         this_ptr_conv.is_owned = false;
28397         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
28398         memcpy(ret_arr->elems, *FundingSigned_get_channel_id(&this_ptr_conv), 32);
28399         return ret_arr;
28400 }
28401
28402 void  __attribute__((export_name("TS_FundingSigned_set_channel_id"))) TS_FundingSigned_set_channel_id(uint64_t this_ptr, int8_tArray val) {
28403         LDKFundingSigned this_ptr_conv;
28404         this_ptr_conv.inner = untag_ptr(this_ptr);
28405         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28406         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28407         this_ptr_conv.is_owned = false;
28408         LDKThirtyTwoBytes val_ref;
28409         CHECK(val->arr_len == 32);
28410         memcpy(val_ref.data, val->elems, 32); FREE(val);
28411         FundingSigned_set_channel_id(&this_ptr_conv, val_ref);
28412 }
28413
28414 int8_tArray  __attribute__((export_name("TS_FundingSigned_get_signature"))) TS_FundingSigned_get_signature(uint64_t this_ptr) {
28415         LDKFundingSigned this_ptr_conv;
28416         this_ptr_conv.inner = untag_ptr(this_ptr);
28417         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28418         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28419         this_ptr_conv.is_owned = false;
28420         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
28421         memcpy(ret_arr->elems, FundingSigned_get_signature(&this_ptr_conv).compact_form, 64);
28422         return ret_arr;
28423 }
28424
28425 void  __attribute__((export_name("TS_FundingSigned_set_signature"))) TS_FundingSigned_set_signature(uint64_t this_ptr, int8_tArray val) {
28426         LDKFundingSigned this_ptr_conv;
28427         this_ptr_conv.inner = untag_ptr(this_ptr);
28428         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28429         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28430         this_ptr_conv.is_owned = false;
28431         LDKSignature val_ref;
28432         CHECK(val->arr_len == 64);
28433         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
28434         FundingSigned_set_signature(&this_ptr_conv, val_ref);
28435 }
28436
28437 uint64_t  __attribute__((export_name("TS_FundingSigned_new"))) TS_FundingSigned_new(int8_tArray channel_id_arg, int8_tArray signature_arg) {
28438         LDKThirtyTwoBytes channel_id_arg_ref;
28439         CHECK(channel_id_arg->arr_len == 32);
28440         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
28441         LDKSignature signature_arg_ref;
28442         CHECK(signature_arg->arr_len == 64);
28443         memcpy(signature_arg_ref.compact_form, signature_arg->elems, 64); FREE(signature_arg);
28444         LDKFundingSigned ret_var = FundingSigned_new(channel_id_arg_ref, signature_arg_ref);
28445         uint64_t ret_ref = 0;
28446         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28447         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28448         return ret_ref;
28449 }
28450
28451 static inline uint64_t FundingSigned_clone_ptr(LDKFundingSigned *NONNULL_PTR arg) {
28452         LDKFundingSigned ret_var = FundingSigned_clone(arg);
28453         uint64_t ret_ref = 0;
28454         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28455         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28456         return ret_ref;
28457 }
28458 int64_t  __attribute__((export_name("TS_FundingSigned_clone_ptr"))) TS_FundingSigned_clone_ptr(uint64_t arg) {
28459         LDKFundingSigned arg_conv;
28460         arg_conv.inner = untag_ptr(arg);
28461         arg_conv.is_owned = ptr_is_owned(arg);
28462         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
28463         arg_conv.is_owned = false;
28464         int64_t ret_conv = FundingSigned_clone_ptr(&arg_conv);
28465         return ret_conv;
28466 }
28467
28468 uint64_t  __attribute__((export_name("TS_FundingSigned_clone"))) TS_FundingSigned_clone(uint64_t orig) {
28469         LDKFundingSigned orig_conv;
28470         orig_conv.inner = untag_ptr(orig);
28471         orig_conv.is_owned = ptr_is_owned(orig);
28472         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
28473         orig_conv.is_owned = false;
28474         LDKFundingSigned ret_var = FundingSigned_clone(&orig_conv);
28475         uint64_t ret_ref = 0;
28476         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28477         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28478         return ret_ref;
28479 }
28480
28481 void  __attribute__((export_name("TS_ChannelReady_free"))) TS_ChannelReady_free(uint64_t this_obj) {
28482         LDKChannelReady this_obj_conv;
28483         this_obj_conv.inner = untag_ptr(this_obj);
28484         this_obj_conv.is_owned = ptr_is_owned(this_obj);
28485         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
28486         ChannelReady_free(this_obj_conv);
28487 }
28488
28489 int8_tArray  __attribute__((export_name("TS_ChannelReady_get_channel_id"))) TS_ChannelReady_get_channel_id(uint64_t this_ptr) {
28490         LDKChannelReady 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         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
28496         memcpy(ret_arr->elems, *ChannelReady_get_channel_id(&this_ptr_conv), 32);
28497         return ret_arr;
28498 }
28499
28500 void  __attribute__((export_name("TS_ChannelReady_set_channel_id"))) TS_ChannelReady_set_channel_id(uint64_t this_ptr, int8_tArray val) {
28501         LDKChannelReady this_ptr_conv;
28502         this_ptr_conv.inner = untag_ptr(this_ptr);
28503         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28504         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28505         this_ptr_conv.is_owned = false;
28506         LDKThirtyTwoBytes val_ref;
28507         CHECK(val->arr_len == 32);
28508         memcpy(val_ref.data, val->elems, 32); FREE(val);
28509         ChannelReady_set_channel_id(&this_ptr_conv, val_ref);
28510 }
28511
28512 int8_tArray  __attribute__((export_name("TS_ChannelReady_get_next_per_commitment_point"))) TS_ChannelReady_get_next_per_commitment_point(uint64_t this_ptr) {
28513         LDKChannelReady this_ptr_conv;
28514         this_ptr_conv.inner = untag_ptr(this_ptr);
28515         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28516         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28517         this_ptr_conv.is_owned = false;
28518         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
28519         memcpy(ret_arr->elems, ChannelReady_get_next_per_commitment_point(&this_ptr_conv).compressed_form, 33);
28520         return ret_arr;
28521 }
28522
28523 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) {
28524         LDKChannelReady this_ptr_conv;
28525         this_ptr_conv.inner = untag_ptr(this_ptr);
28526         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28527         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28528         this_ptr_conv.is_owned = false;
28529         LDKPublicKey val_ref;
28530         CHECK(val->arr_len == 33);
28531         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
28532         ChannelReady_set_next_per_commitment_point(&this_ptr_conv, val_ref);
28533 }
28534
28535 uint64_t  __attribute__((export_name("TS_ChannelReady_get_short_channel_id_alias"))) TS_ChannelReady_get_short_channel_id_alias(uint64_t this_ptr) {
28536         LDKChannelReady this_ptr_conv;
28537         this_ptr_conv.inner = untag_ptr(this_ptr);
28538         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28539         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28540         this_ptr_conv.is_owned = false;
28541         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
28542         *ret_copy = ChannelReady_get_short_channel_id_alias(&this_ptr_conv);
28543         uint64_t ret_ref = tag_ptr(ret_copy, true);
28544         return ret_ref;
28545 }
28546
28547 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) {
28548         LDKChannelReady this_ptr_conv;
28549         this_ptr_conv.inner = untag_ptr(this_ptr);
28550         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28551         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28552         this_ptr_conv.is_owned = false;
28553         void* val_ptr = untag_ptr(val);
28554         CHECK_ACCESS(val_ptr);
28555         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
28556         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
28557         ChannelReady_set_short_channel_id_alias(&this_ptr_conv, val_conv);
28558 }
28559
28560 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) {
28561         LDKThirtyTwoBytes channel_id_arg_ref;
28562         CHECK(channel_id_arg->arr_len == 32);
28563         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
28564         LDKPublicKey next_per_commitment_point_arg_ref;
28565         CHECK(next_per_commitment_point_arg->arr_len == 33);
28566         memcpy(next_per_commitment_point_arg_ref.compressed_form, next_per_commitment_point_arg->elems, 33); FREE(next_per_commitment_point_arg);
28567         void* short_channel_id_alias_arg_ptr = untag_ptr(short_channel_id_alias_arg);
28568         CHECK_ACCESS(short_channel_id_alias_arg_ptr);
28569         LDKCOption_u64Z short_channel_id_alias_arg_conv = *(LDKCOption_u64Z*)(short_channel_id_alias_arg_ptr);
28570         short_channel_id_alias_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(short_channel_id_alias_arg));
28571         LDKChannelReady ret_var = ChannelReady_new(channel_id_arg_ref, next_per_commitment_point_arg_ref, short_channel_id_alias_arg_conv);
28572         uint64_t ret_ref = 0;
28573         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28574         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28575         return ret_ref;
28576 }
28577
28578 static inline uint64_t ChannelReady_clone_ptr(LDKChannelReady *NONNULL_PTR arg) {
28579         LDKChannelReady ret_var = ChannelReady_clone(arg);
28580         uint64_t ret_ref = 0;
28581         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28582         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28583         return ret_ref;
28584 }
28585 int64_t  __attribute__((export_name("TS_ChannelReady_clone_ptr"))) TS_ChannelReady_clone_ptr(uint64_t arg) {
28586         LDKChannelReady arg_conv;
28587         arg_conv.inner = untag_ptr(arg);
28588         arg_conv.is_owned = ptr_is_owned(arg);
28589         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
28590         arg_conv.is_owned = false;
28591         int64_t ret_conv = ChannelReady_clone_ptr(&arg_conv);
28592         return ret_conv;
28593 }
28594
28595 uint64_t  __attribute__((export_name("TS_ChannelReady_clone"))) TS_ChannelReady_clone(uint64_t orig) {
28596         LDKChannelReady orig_conv;
28597         orig_conv.inner = untag_ptr(orig);
28598         orig_conv.is_owned = ptr_is_owned(orig);
28599         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
28600         orig_conv.is_owned = false;
28601         LDKChannelReady ret_var = ChannelReady_clone(&orig_conv);
28602         uint64_t ret_ref = 0;
28603         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28604         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28605         return ret_ref;
28606 }
28607
28608 void  __attribute__((export_name("TS_Shutdown_free"))) TS_Shutdown_free(uint64_t this_obj) {
28609         LDKShutdown this_obj_conv;
28610         this_obj_conv.inner = untag_ptr(this_obj);
28611         this_obj_conv.is_owned = ptr_is_owned(this_obj);
28612         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
28613         Shutdown_free(this_obj_conv);
28614 }
28615
28616 int8_tArray  __attribute__((export_name("TS_Shutdown_get_channel_id"))) TS_Shutdown_get_channel_id(uint64_t this_ptr) {
28617         LDKShutdown this_ptr_conv;
28618         this_ptr_conv.inner = untag_ptr(this_ptr);
28619         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28620         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28621         this_ptr_conv.is_owned = false;
28622         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
28623         memcpy(ret_arr->elems, *Shutdown_get_channel_id(&this_ptr_conv), 32);
28624         return ret_arr;
28625 }
28626
28627 void  __attribute__((export_name("TS_Shutdown_set_channel_id"))) TS_Shutdown_set_channel_id(uint64_t this_ptr, int8_tArray val) {
28628         LDKShutdown this_ptr_conv;
28629         this_ptr_conv.inner = untag_ptr(this_ptr);
28630         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28631         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28632         this_ptr_conv.is_owned = false;
28633         LDKThirtyTwoBytes val_ref;
28634         CHECK(val->arr_len == 32);
28635         memcpy(val_ref.data, val->elems, 32); FREE(val);
28636         Shutdown_set_channel_id(&this_ptr_conv, val_ref);
28637 }
28638
28639 int8_tArray  __attribute__((export_name("TS_Shutdown_get_scriptpubkey"))) TS_Shutdown_get_scriptpubkey(uint64_t this_ptr) {
28640         LDKShutdown this_ptr_conv;
28641         this_ptr_conv.inner = untag_ptr(this_ptr);
28642         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28643         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28644         this_ptr_conv.is_owned = false;
28645         LDKu8slice ret_var = Shutdown_get_scriptpubkey(&this_ptr_conv);
28646         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
28647         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
28648         return ret_arr;
28649 }
28650
28651 void  __attribute__((export_name("TS_Shutdown_set_scriptpubkey"))) TS_Shutdown_set_scriptpubkey(uint64_t this_ptr, int8_tArray val) {
28652         LDKShutdown this_ptr_conv;
28653         this_ptr_conv.inner = untag_ptr(this_ptr);
28654         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28655         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28656         this_ptr_conv.is_owned = false;
28657         LDKCVec_u8Z val_ref;
28658         val_ref.datalen = val->arr_len;
28659         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
28660         memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
28661         Shutdown_set_scriptpubkey(&this_ptr_conv, val_ref);
28662 }
28663
28664 uint64_t  __attribute__((export_name("TS_Shutdown_new"))) TS_Shutdown_new(int8_tArray channel_id_arg, int8_tArray scriptpubkey_arg) {
28665         LDKThirtyTwoBytes channel_id_arg_ref;
28666         CHECK(channel_id_arg->arr_len == 32);
28667         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
28668         LDKCVec_u8Z scriptpubkey_arg_ref;
28669         scriptpubkey_arg_ref.datalen = scriptpubkey_arg->arr_len;
28670         scriptpubkey_arg_ref.data = MALLOC(scriptpubkey_arg_ref.datalen, "LDKCVec_u8Z Bytes");
28671         memcpy(scriptpubkey_arg_ref.data, scriptpubkey_arg->elems, scriptpubkey_arg_ref.datalen); FREE(scriptpubkey_arg);
28672         LDKShutdown ret_var = Shutdown_new(channel_id_arg_ref, scriptpubkey_arg_ref);
28673         uint64_t ret_ref = 0;
28674         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28675         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28676         return ret_ref;
28677 }
28678
28679 static inline uint64_t Shutdown_clone_ptr(LDKShutdown *NONNULL_PTR arg) {
28680         LDKShutdown ret_var = Shutdown_clone(arg);
28681         uint64_t ret_ref = 0;
28682         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28683         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28684         return ret_ref;
28685 }
28686 int64_t  __attribute__((export_name("TS_Shutdown_clone_ptr"))) TS_Shutdown_clone_ptr(uint64_t arg) {
28687         LDKShutdown arg_conv;
28688         arg_conv.inner = untag_ptr(arg);
28689         arg_conv.is_owned = ptr_is_owned(arg);
28690         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
28691         arg_conv.is_owned = false;
28692         int64_t ret_conv = Shutdown_clone_ptr(&arg_conv);
28693         return ret_conv;
28694 }
28695
28696 uint64_t  __attribute__((export_name("TS_Shutdown_clone"))) TS_Shutdown_clone(uint64_t orig) {
28697         LDKShutdown orig_conv;
28698         orig_conv.inner = untag_ptr(orig);
28699         orig_conv.is_owned = ptr_is_owned(orig);
28700         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
28701         orig_conv.is_owned = false;
28702         LDKShutdown ret_var = Shutdown_clone(&orig_conv);
28703         uint64_t ret_ref = 0;
28704         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28705         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28706         return ret_ref;
28707 }
28708
28709 void  __attribute__((export_name("TS_ClosingSignedFeeRange_free"))) TS_ClosingSignedFeeRange_free(uint64_t this_obj) {
28710         LDKClosingSignedFeeRange this_obj_conv;
28711         this_obj_conv.inner = untag_ptr(this_obj);
28712         this_obj_conv.is_owned = ptr_is_owned(this_obj);
28713         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
28714         ClosingSignedFeeRange_free(this_obj_conv);
28715 }
28716
28717 int64_t  __attribute__((export_name("TS_ClosingSignedFeeRange_get_min_fee_satoshis"))) TS_ClosingSignedFeeRange_get_min_fee_satoshis(uint64_t this_ptr) {
28718         LDKClosingSignedFeeRange this_ptr_conv;
28719         this_ptr_conv.inner = untag_ptr(this_ptr);
28720         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28721         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28722         this_ptr_conv.is_owned = false;
28723         int64_t ret_conv = ClosingSignedFeeRange_get_min_fee_satoshis(&this_ptr_conv);
28724         return ret_conv;
28725 }
28726
28727 void  __attribute__((export_name("TS_ClosingSignedFeeRange_set_min_fee_satoshis"))) TS_ClosingSignedFeeRange_set_min_fee_satoshis(uint64_t this_ptr, int64_t val) {
28728         LDKClosingSignedFeeRange this_ptr_conv;
28729         this_ptr_conv.inner = untag_ptr(this_ptr);
28730         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28731         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28732         this_ptr_conv.is_owned = false;
28733         ClosingSignedFeeRange_set_min_fee_satoshis(&this_ptr_conv, val);
28734 }
28735
28736 int64_t  __attribute__((export_name("TS_ClosingSignedFeeRange_get_max_fee_satoshis"))) TS_ClosingSignedFeeRange_get_max_fee_satoshis(uint64_t this_ptr) {
28737         LDKClosingSignedFeeRange this_ptr_conv;
28738         this_ptr_conv.inner = untag_ptr(this_ptr);
28739         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28740         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28741         this_ptr_conv.is_owned = false;
28742         int64_t ret_conv = ClosingSignedFeeRange_get_max_fee_satoshis(&this_ptr_conv);
28743         return ret_conv;
28744 }
28745
28746 void  __attribute__((export_name("TS_ClosingSignedFeeRange_set_max_fee_satoshis"))) TS_ClosingSignedFeeRange_set_max_fee_satoshis(uint64_t this_ptr, int64_t val) {
28747         LDKClosingSignedFeeRange this_ptr_conv;
28748         this_ptr_conv.inner = untag_ptr(this_ptr);
28749         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28750         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28751         this_ptr_conv.is_owned = false;
28752         ClosingSignedFeeRange_set_max_fee_satoshis(&this_ptr_conv, val);
28753 }
28754
28755 uint64_t  __attribute__((export_name("TS_ClosingSignedFeeRange_new"))) TS_ClosingSignedFeeRange_new(int64_t min_fee_satoshis_arg, int64_t max_fee_satoshis_arg) {
28756         LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_new(min_fee_satoshis_arg, max_fee_satoshis_arg);
28757         uint64_t ret_ref = 0;
28758         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28759         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28760         return ret_ref;
28761 }
28762
28763 static inline uint64_t ClosingSignedFeeRange_clone_ptr(LDKClosingSignedFeeRange *NONNULL_PTR arg) {
28764         LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_clone(arg);
28765         uint64_t ret_ref = 0;
28766         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28767         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28768         return ret_ref;
28769 }
28770 int64_t  __attribute__((export_name("TS_ClosingSignedFeeRange_clone_ptr"))) TS_ClosingSignedFeeRange_clone_ptr(uint64_t arg) {
28771         LDKClosingSignedFeeRange arg_conv;
28772         arg_conv.inner = untag_ptr(arg);
28773         arg_conv.is_owned = ptr_is_owned(arg);
28774         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
28775         arg_conv.is_owned = false;
28776         int64_t ret_conv = ClosingSignedFeeRange_clone_ptr(&arg_conv);
28777         return ret_conv;
28778 }
28779
28780 uint64_t  __attribute__((export_name("TS_ClosingSignedFeeRange_clone"))) TS_ClosingSignedFeeRange_clone(uint64_t orig) {
28781         LDKClosingSignedFeeRange orig_conv;
28782         orig_conv.inner = untag_ptr(orig);
28783         orig_conv.is_owned = ptr_is_owned(orig);
28784         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
28785         orig_conv.is_owned = false;
28786         LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_clone(&orig_conv);
28787         uint64_t ret_ref = 0;
28788         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28789         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28790         return ret_ref;
28791 }
28792
28793 void  __attribute__((export_name("TS_ClosingSigned_free"))) TS_ClosingSigned_free(uint64_t this_obj) {
28794         LDKClosingSigned this_obj_conv;
28795         this_obj_conv.inner = untag_ptr(this_obj);
28796         this_obj_conv.is_owned = ptr_is_owned(this_obj);
28797         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
28798         ClosingSigned_free(this_obj_conv);
28799 }
28800
28801 int8_tArray  __attribute__((export_name("TS_ClosingSigned_get_channel_id"))) TS_ClosingSigned_get_channel_id(uint64_t this_ptr) {
28802         LDKClosingSigned 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         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
28808         memcpy(ret_arr->elems, *ClosingSigned_get_channel_id(&this_ptr_conv), 32);
28809         return ret_arr;
28810 }
28811
28812 void  __attribute__((export_name("TS_ClosingSigned_set_channel_id"))) TS_ClosingSigned_set_channel_id(uint64_t this_ptr, int8_tArray val) {
28813         LDKClosingSigned this_ptr_conv;
28814         this_ptr_conv.inner = untag_ptr(this_ptr);
28815         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28816         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28817         this_ptr_conv.is_owned = false;
28818         LDKThirtyTwoBytes val_ref;
28819         CHECK(val->arr_len == 32);
28820         memcpy(val_ref.data, val->elems, 32); FREE(val);
28821         ClosingSigned_set_channel_id(&this_ptr_conv, val_ref);
28822 }
28823
28824 int64_t  __attribute__((export_name("TS_ClosingSigned_get_fee_satoshis"))) TS_ClosingSigned_get_fee_satoshis(uint64_t this_ptr) {
28825         LDKClosingSigned this_ptr_conv;
28826         this_ptr_conv.inner = untag_ptr(this_ptr);
28827         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28828         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28829         this_ptr_conv.is_owned = false;
28830         int64_t ret_conv = ClosingSigned_get_fee_satoshis(&this_ptr_conv);
28831         return ret_conv;
28832 }
28833
28834 void  __attribute__((export_name("TS_ClosingSigned_set_fee_satoshis"))) TS_ClosingSigned_set_fee_satoshis(uint64_t this_ptr, int64_t val) {
28835         LDKClosingSigned this_ptr_conv;
28836         this_ptr_conv.inner = untag_ptr(this_ptr);
28837         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28838         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28839         this_ptr_conv.is_owned = false;
28840         ClosingSigned_set_fee_satoshis(&this_ptr_conv, val);
28841 }
28842
28843 int8_tArray  __attribute__((export_name("TS_ClosingSigned_get_signature"))) TS_ClosingSigned_get_signature(uint64_t this_ptr) {
28844         LDKClosingSigned this_ptr_conv;
28845         this_ptr_conv.inner = untag_ptr(this_ptr);
28846         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28847         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28848         this_ptr_conv.is_owned = false;
28849         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
28850         memcpy(ret_arr->elems, ClosingSigned_get_signature(&this_ptr_conv).compact_form, 64);
28851         return ret_arr;
28852 }
28853
28854 void  __attribute__((export_name("TS_ClosingSigned_set_signature"))) TS_ClosingSigned_set_signature(uint64_t this_ptr, int8_tArray val) {
28855         LDKClosingSigned this_ptr_conv;
28856         this_ptr_conv.inner = untag_ptr(this_ptr);
28857         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28858         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28859         this_ptr_conv.is_owned = false;
28860         LDKSignature val_ref;
28861         CHECK(val->arr_len == 64);
28862         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
28863         ClosingSigned_set_signature(&this_ptr_conv, val_ref);
28864 }
28865
28866 uint64_t  __attribute__((export_name("TS_ClosingSigned_get_fee_range"))) TS_ClosingSigned_get_fee_range(uint64_t this_ptr) {
28867         LDKClosingSigned this_ptr_conv;
28868         this_ptr_conv.inner = untag_ptr(this_ptr);
28869         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28870         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28871         this_ptr_conv.is_owned = false;
28872         LDKClosingSignedFeeRange ret_var = ClosingSigned_get_fee_range(&this_ptr_conv);
28873         uint64_t ret_ref = 0;
28874         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28875         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28876         return ret_ref;
28877 }
28878
28879 void  __attribute__((export_name("TS_ClosingSigned_set_fee_range"))) TS_ClosingSigned_set_fee_range(uint64_t this_ptr, uint64_t val) {
28880         LDKClosingSigned this_ptr_conv;
28881         this_ptr_conv.inner = untag_ptr(this_ptr);
28882         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28883         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28884         this_ptr_conv.is_owned = false;
28885         LDKClosingSignedFeeRange val_conv;
28886         val_conv.inner = untag_ptr(val);
28887         val_conv.is_owned = ptr_is_owned(val);
28888         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
28889         val_conv = ClosingSignedFeeRange_clone(&val_conv);
28890         ClosingSigned_set_fee_range(&this_ptr_conv, val_conv);
28891 }
28892
28893 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) {
28894         LDKThirtyTwoBytes channel_id_arg_ref;
28895         CHECK(channel_id_arg->arr_len == 32);
28896         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
28897         LDKSignature signature_arg_ref;
28898         CHECK(signature_arg->arr_len == 64);
28899         memcpy(signature_arg_ref.compact_form, signature_arg->elems, 64); FREE(signature_arg);
28900         LDKClosingSignedFeeRange fee_range_arg_conv;
28901         fee_range_arg_conv.inner = untag_ptr(fee_range_arg);
28902         fee_range_arg_conv.is_owned = ptr_is_owned(fee_range_arg);
28903         CHECK_INNER_FIELD_ACCESS_OR_NULL(fee_range_arg_conv);
28904         fee_range_arg_conv = ClosingSignedFeeRange_clone(&fee_range_arg_conv);
28905         LDKClosingSigned ret_var = ClosingSigned_new(channel_id_arg_ref, fee_satoshis_arg, signature_arg_ref, fee_range_arg_conv);
28906         uint64_t ret_ref = 0;
28907         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28908         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28909         return ret_ref;
28910 }
28911
28912 static inline uint64_t ClosingSigned_clone_ptr(LDKClosingSigned *NONNULL_PTR arg) {
28913         LDKClosingSigned ret_var = ClosingSigned_clone(arg);
28914         uint64_t ret_ref = 0;
28915         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28916         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28917         return ret_ref;
28918 }
28919 int64_t  __attribute__((export_name("TS_ClosingSigned_clone_ptr"))) TS_ClosingSigned_clone_ptr(uint64_t arg) {
28920         LDKClosingSigned arg_conv;
28921         arg_conv.inner = untag_ptr(arg);
28922         arg_conv.is_owned = ptr_is_owned(arg);
28923         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
28924         arg_conv.is_owned = false;
28925         int64_t ret_conv = ClosingSigned_clone_ptr(&arg_conv);
28926         return ret_conv;
28927 }
28928
28929 uint64_t  __attribute__((export_name("TS_ClosingSigned_clone"))) TS_ClosingSigned_clone(uint64_t orig) {
28930         LDKClosingSigned orig_conv;
28931         orig_conv.inner = untag_ptr(orig);
28932         orig_conv.is_owned = ptr_is_owned(orig);
28933         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
28934         orig_conv.is_owned = false;
28935         LDKClosingSigned ret_var = ClosingSigned_clone(&orig_conv);
28936         uint64_t ret_ref = 0;
28937         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28938         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28939         return ret_ref;
28940 }
28941
28942 void  __attribute__((export_name("TS_UpdateAddHTLC_free"))) TS_UpdateAddHTLC_free(uint64_t this_obj) {
28943         LDKUpdateAddHTLC this_obj_conv;
28944         this_obj_conv.inner = untag_ptr(this_obj);
28945         this_obj_conv.is_owned = ptr_is_owned(this_obj);
28946         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
28947         UpdateAddHTLC_free(this_obj_conv);
28948 }
28949
28950 int8_tArray  __attribute__((export_name("TS_UpdateAddHTLC_get_channel_id"))) TS_UpdateAddHTLC_get_channel_id(uint64_t this_ptr) {
28951         LDKUpdateAddHTLC this_ptr_conv;
28952         this_ptr_conv.inner = untag_ptr(this_ptr);
28953         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28954         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28955         this_ptr_conv.is_owned = false;
28956         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
28957         memcpy(ret_arr->elems, *UpdateAddHTLC_get_channel_id(&this_ptr_conv), 32);
28958         return ret_arr;
28959 }
28960
28961 void  __attribute__((export_name("TS_UpdateAddHTLC_set_channel_id"))) TS_UpdateAddHTLC_set_channel_id(uint64_t this_ptr, int8_tArray val) {
28962         LDKUpdateAddHTLC 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         LDKThirtyTwoBytes val_ref;
28968         CHECK(val->arr_len == 32);
28969         memcpy(val_ref.data, val->elems, 32); FREE(val);
28970         UpdateAddHTLC_set_channel_id(&this_ptr_conv, val_ref);
28971 }
28972
28973 int64_t  __attribute__((export_name("TS_UpdateAddHTLC_get_htlc_id"))) TS_UpdateAddHTLC_get_htlc_id(uint64_t this_ptr) {
28974         LDKUpdateAddHTLC this_ptr_conv;
28975         this_ptr_conv.inner = untag_ptr(this_ptr);
28976         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28977         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28978         this_ptr_conv.is_owned = false;
28979         int64_t ret_conv = UpdateAddHTLC_get_htlc_id(&this_ptr_conv);
28980         return ret_conv;
28981 }
28982
28983 void  __attribute__((export_name("TS_UpdateAddHTLC_set_htlc_id"))) TS_UpdateAddHTLC_set_htlc_id(uint64_t this_ptr, int64_t val) {
28984         LDKUpdateAddHTLC this_ptr_conv;
28985         this_ptr_conv.inner = untag_ptr(this_ptr);
28986         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28987         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28988         this_ptr_conv.is_owned = false;
28989         UpdateAddHTLC_set_htlc_id(&this_ptr_conv, val);
28990 }
28991
28992 int64_t  __attribute__((export_name("TS_UpdateAddHTLC_get_amount_msat"))) TS_UpdateAddHTLC_get_amount_msat(uint64_t this_ptr) {
28993         LDKUpdateAddHTLC this_ptr_conv;
28994         this_ptr_conv.inner = untag_ptr(this_ptr);
28995         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28996         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28997         this_ptr_conv.is_owned = false;
28998         int64_t ret_conv = UpdateAddHTLC_get_amount_msat(&this_ptr_conv);
28999         return ret_conv;
29000 }
29001
29002 void  __attribute__((export_name("TS_UpdateAddHTLC_set_amount_msat"))) TS_UpdateAddHTLC_set_amount_msat(uint64_t this_ptr, int64_t val) {
29003         LDKUpdateAddHTLC this_ptr_conv;
29004         this_ptr_conv.inner = untag_ptr(this_ptr);
29005         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29006         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29007         this_ptr_conv.is_owned = false;
29008         UpdateAddHTLC_set_amount_msat(&this_ptr_conv, val);
29009 }
29010
29011 int8_tArray  __attribute__((export_name("TS_UpdateAddHTLC_get_payment_hash"))) TS_UpdateAddHTLC_get_payment_hash(uint64_t this_ptr) {
29012         LDKUpdateAddHTLC this_ptr_conv;
29013         this_ptr_conv.inner = untag_ptr(this_ptr);
29014         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29015         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29016         this_ptr_conv.is_owned = false;
29017         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
29018         memcpy(ret_arr->elems, *UpdateAddHTLC_get_payment_hash(&this_ptr_conv), 32);
29019         return ret_arr;
29020 }
29021
29022 void  __attribute__((export_name("TS_UpdateAddHTLC_set_payment_hash"))) TS_UpdateAddHTLC_set_payment_hash(uint64_t this_ptr, int8_tArray val) {
29023         LDKUpdateAddHTLC this_ptr_conv;
29024         this_ptr_conv.inner = untag_ptr(this_ptr);
29025         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29026         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29027         this_ptr_conv.is_owned = false;
29028         LDKThirtyTwoBytes val_ref;
29029         CHECK(val->arr_len == 32);
29030         memcpy(val_ref.data, val->elems, 32); FREE(val);
29031         UpdateAddHTLC_set_payment_hash(&this_ptr_conv, val_ref);
29032 }
29033
29034 int32_t  __attribute__((export_name("TS_UpdateAddHTLC_get_cltv_expiry"))) TS_UpdateAddHTLC_get_cltv_expiry(uint64_t this_ptr) {
29035         LDKUpdateAddHTLC this_ptr_conv;
29036         this_ptr_conv.inner = untag_ptr(this_ptr);
29037         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29038         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29039         this_ptr_conv.is_owned = false;
29040         int32_t ret_conv = UpdateAddHTLC_get_cltv_expiry(&this_ptr_conv);
29041         return ret_conv;
29042 }
29043
29044 void  __attribute__((export_name("TS_UpdateAddHTLC_set_cltv_expiry"))) TS_UpdateAddHTLC_set_cltv_expiry(uint64_t this_ptr, int32_t val) {
29045         LDKUpdateAddHTLC this_ptr_conv;
29046         this_ptr_conv.inner = untag_ptr(this_ptr);
29047         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29048         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29049         this_ptr_conv.is_owned = false;
29050         UpdateAddHTLC_set_cltv_expiry(&this_ptr_conv, val);
29051 }
29052
29053 static inline uint64_t UpdateAddHTLC_clone_ptr(LDKUpdateAddHTLC *NONNULL_PTR arg) {
29054         LDKUpdateAddHTLC ret_var = UpdateAddHTLC_clone(arg);
29055         uint64_t ret_ref = 0;
29056         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29057         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29058         return ret_ref;
29059 }
29060 int64_t  __attribute__((export_name("TS_UpdateAddHTLC_clone_ptr"))) TS_UpdateAddHTLC_clone_ptr(uint64_t arg) {
29061         LDKUpdateAddHTLC arg_conv;
29062         arg_conv.inner = untag_ptr(arg);
29063         arg_conv.is_owned = ptr_is_owned(arg);
29064         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
29065         arg_conv.is_owned = false;
29066         int64_t ret_conv = UpdateAddHTLC_clone_ptr(&arg_conv);
29067         return ret_conv;
29068 }
29069
29070 uint64_t  __attribute__((export_name("TS_UpdateAddHTLC_clone"))) TS_UpdateAddHTLC_clone(uint64_t orig) {
29071         LDKUpdateAddHTLC orig_conv;
29072         orig_conv.inner = untag_ptr(orig);
29073         orig_conv.is_owned = ptr_is_owned(orig);
29074         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
29075         orig_conv.is_owned = false;
29076         LDKUpdateAddHTLC ret_var = UpdateAddHTLC_clone(&orig_conv);
29077         uint64_t ret_ref = 0;
29078         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29079         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29080         return ret_ref;
29081 }
29082
29083 void  __attribute__((export_name("TS_UpdateFulfillHTLC_free"))) TS_UpdateFulfillHTLC_free(uint64_t this_obj) {
29084         LDKUpdateFulfillHTLC this_obj_conv;
29085         this_obj_conv.inner = untag_ptr(this_obj);
29086         this_obj_conv.is_owned = ptr_is_owned(this_obj);
29087         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
29088         UpdateFulfillHTLC_free(this_obj_conv);
29089 }
29090
29091 int8_tArray  __attribute__((export_name("TS_UpdateFulfillHTLC_get_channel_id"))) TS_UpdateFulfillHTLC_get_channel_id(uint64_t this_ptr) {
29092         LDKUpdateFulfillHTLC this_ptr_conv;
29093         this_ptr_conv.inner = untag_ptr(this_ptr);
29094         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29095         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29096         this_ptr_conv.is_owned = false;
29097         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
29098         memcpy(ret_arr->elems, *UpdateFulfillHTLC_get_channel_id(&this_ptr_conv), 32);
29099         return ret_arr;
29100 }
29101
29102 void  __attribute__((export_name("TS_UpdateFulfillHTLC_set_channel_id"))) TS_UpdateFulfillHTLC_set_channel_id(uint64_t this_ptr, int8_tArray val) {
29103         LDKUpdateFulfillHTLC this_ptr_conv;
29104         this_ptr_conv.inner = untag_ptr(this_ptr);
29105         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29106         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29107         this_ptr_conv.is_owned = false;
29108         LDKThirtyTwoBytes val_ref;
29109         CHECK(val->arr_len == 32);
29110         memcpy(val_ref.data, val->elems, 32); FREE(val);
29111         UpdateFulfillHTLC_set_channel_id(&this_ptr_conv, val_ref);
29112 }
29113
29114 int64_t  __attribute__((export_name("TS_UpdateFulfillHTLC_get_htlc_id"))) TS_UpdateFulfillHTLC_get_htlc_id(uint64_t this_ptr) {
29115         LDKUpdateFulfillHTLC this_ptr_conv;
29116         this_ptr_conv.inner = untag_ptr(this_ptr);
29117         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29118         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29119         this_ptr_conv.is_owned = false;
29120         int64_t ret_conv = UpdateFulfillHTLC_get_htlc_id(&this_ptr_conv);
29121         return ret_conv;
29122 }
29123
29124 void  __attribute__((export_name("TS_UpdateFulfillHTLC_set_htlc_id"))) TS_UpdateFulfillHTLC_set_htlc_id(uint64_t this_ptr, int64_t val) {
29125         LDKUpdateFulfillHTLC this_ptr_conv;
29126         this_ptr_conv.inner = untag_ptr(this_ptr);
29127         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29128         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29129         this_ptr_conv.is_owned = false;
29130         UpdateFulfillHTLC_set_htlc_id(&this_ptr_conv, val);
29131 }
29132
29133 int8_tArray  __attribute__((export_name("TS_UpdateFulfillHTLC_get_payment_preimage"))) TS_UpdateFulfillHTLC_get_payment_preimage(uint64_t this_ptr) {
29134         LDKUpdateFulfillHTLC this_ptr_conv;
29135         this_ptr_conv.inner = untag_ptr(this_ptr);
29136         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29137         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29138         this_ptr_conv.is_owned = false;
29139         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
29140         memcpy(ret_arr->elems, *UpdateFulfillHTLC_get_payment_preimage(&this_ptr_conv), 32);
29141         return ret_arr;
29142 }
29143
29144 void  __attribute__((export_name("TS_UpdateFulfillHTLC_set_payment_preimage"))) TS_UpdateFulfillHTLC_set_payment_preimage(uint64_t this_ptr, int8_tArray val) {
29145         LDKUpdateFulfillHTLC this_ptr_conv;
29146         this_ptr_conv.inner = untag_ptr(this_ptr);
29147         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29148         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29149         this_ptr_conv.is_owned = false;
29150         LDKThirtyTwoBytes val_ref;
29151         CHECK(val->arr_len == 32);
29152         memcpy(val_ref.data, val->elems, 32); FREE(val);
29153         UpdateFulfillHTLC_set_payment_preimage(&this_ptr_conv, val_ref);
29154 }
29155
29156 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) {
29157         LDKThirtyTwoBytes channel_id_arg_ref;
29158         CHECK(channel_id_arg->arr_len == 32);
29159         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
29160         LDKThirtyTwoBytes payment_preimage_arg_ref;
29161         CHECK(payment_preimage_arg->arr_len == 32);
29162         memcpy(payment_preimage_arg_ref.data, payment_preimage_arg->elems, 32); FREE(payment_preimage_arg);
29163         LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_new(channel_id_arg_ref, htlc_id_arg, payment_preimage_arg_ref);
29164         uint64_t ret_ref = 0;
29165         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29166         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29167         return ret_ref;
29168 }
29169
29170 static inline uint64_t UpdateFulfillHTLC_clone_ptr(LDKUpdateFulfillHTLC *NONNULL_PTR arg) {
29171         LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_clone(arg);
29172         uint64_t ret_ref = 0;
29173         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29174         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29175         return ret_ref;
29176 }
29177 int64_t  __attribute__((export_name("TS_UpdateFulfillHTLC_clone_ptr"))) TS_UpdateFulfillHTLC_clone_ptr(uint64_t arg) {
29178         LDKUpdateFulfillHTLC arg_conv;
29179         arg_conv.inner = untag_ptr(arg);
29180         arg_conv.is_owned = ptr_is_owned(arg);
29181         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
29182         arg_conv.is_owned = false;
29183         int64_t ret_conv = UpdateFulfillHTLC_clone_ptr(&arg_conv);
29184         return ret_conv;
29185 }
29186
29187 uint64_t  __attribute__((export_name("TS_UpdateFulfillHTLC_clone"))) TS_UpdateFulfillHTLC_clone(uint64_t orig) {
29188         LDKUpdateFulfillHTLC orig_conv;
29189         orig_conv.inner = untag_ptr(orig);
29190         orig_conv.is_owned = ptr_is_owned(orig);
29191         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
29192         orig_conv.is_owned = false;
29193         LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_clone(&orig_conv);
29194         uint64_t ret_ref = 0;
29195         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29196         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29197         return ret_ref;
29198 }
29199
29200 void  __attribute__((export_name("TS_UpdateFailHTLC_free"))) TS_UpdateFailHTLC_free(uint64_t this_obj) {
29201         LDKUpdateFailHTLC this_obj_conv;
29202         this_obj_conv.inner = untag_ptr(this_obj);
29203         this_obj_conv.is_owned = ptr_is_owned(this_obj);
29204         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
29205         UpdateFailHTLC_free(this_obj_conv);
29206 }
29207
29208 int8_tArray  __attribute__((export_name("TS_UpdateFailHTLC_get_channel_id"))) TS_UpdateFailHTLC_get_channel_id(uint64_t this_ptr) {
29209         LDKUpdateFailHTLC 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         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
29215         memcpy(ret_arr->elems, *UpdateFailHTLC_get_channel_id(&this_ptr_conv), 32);
29216         return ret_arr;
29217 }
29218
29219 void  __attribute__((export_name("TS_UpdateFailHTLC_set_channel_id"))) TS_UpdateFailHTLC_set_channel_id(uint64_t this_ptr, int8_tArray val) {
29220         LDKUpdateFailHTLC this_ptr_conv;
29221         this_ptr_conv.inner = untag_ptr(this_ptr);
29222         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29223         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29224         this_ptr_conv.is_owned = false;
29225         LDKThirtyTwoBytes val_ref;
29226         CHECK(val->arr_len == 32);
29227         memcpy(val_ref.data, val->elems, 32); FREE(val);
29228         UpdateFailHTLC_set_channel_id(&this_ptr_conv, val_ref);
29229 }
29230
29231 int64_t  __attribute__((export_name("TS_UpdateFailHTLC_get_htlc_id"))) TS_UpdateFailHTLC_get_htlc_id(uint64_t this_ptr) {
29232         LDKUpdateFailHTLC this_ptr_conv;
29233         this_ptr_conv.inner = untag_ptr(this_ptr);
29234         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29235         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29236         this_ptr_conv.is_owned = false;
29237         int64_t ret_conv = UpdateFailHTLC_get_htlc_id(&this_ptr_conv);
29238         return ret_conv;
29239 }
29240
29241 void  __attribute__((export_name("TS_UpdateFailHTLC_set_htlc_id"))) TS_UpdateFailHTLC_set_htlc_id(uint64_t this_ptr, int64_t val) {
29242         LDKUpdateFailHTLC this_ptr_conv;
29243         this_ptr_conv.inner = untag_ptr(this_ptr);
29244         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29245         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29246         this_ptr_conv.is_owned = false;
29247         UpdateFailHTLC_set_htlc_id(&this_ptr_conv, val);
29248 }
29249
29250 static inline uint64_t UpdateFailHTLC_clone_ptr(LDKUpdateFailHTLC *NONNULL_PTR arg) {
29251         LDKUpdateFailHTLC ret_var = UpdateFailHTLC_clone(arg);
29252         uint64_t ret_ref = 0;
29253         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29254         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29255         return ret_ref;
29256 }
29257 int64_t  __attribute__((export_name("TS_UpdateFailHTLC_clone_ptr"))) TS_UpdateFailHTLC_clone_ptr(uint64_t arg) {
29258         LDKUpdateFailHTLC arg_conv;
29259         arg_conv.inner = untag_ptr(arg);
29260         arg_conv.is_owned = ptr_is_owned(arg);
29261         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
29262         arg_conv.is_owned = false;
29263         int64_t ret_conv = UpdateFailHTLC_clone_ptr(&arg_conv);
29264         return ret_conv;
29265 }
29266
29267 uint64_t  __attribute__((export_name("TS_UpdateFailHTLC_clone"))) TS_UpdateFailHTLC_clone(uint64_t orig) {
29268         LDKUpdateFailHTLC orig_conv;
29269         orig_conv.inner = untag_ptr(orig);
29270         orig_conv.is_owned = ptr_is_owned(orig);
29271         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
29272         orig_conv.is_owned = false;
29273         LDKUpdateFailHTLC ret_var = UpdateFailHTLC_clone(&orig_conv);
29274         uint64_t ret_ref = 0;
29275         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29276         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29277         return ret_ref;
29278 }
29279
29280 void  __attribute__((export_name("TS_UpdateFailMalformedHTLC_free"))) TS_UpdateFailMalformedHTLC_free(uint64_t this_obj) {
29281         LDKUpdateFailMalformedHTLC this_obj_conv;
29282         this_obj_conv.inner = untag_ptr(this_obj);
29283         this_obj_conv.is_owned = ptr_is_owned(this_obj);
29284         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
29285         UpdateFailMalformedHTLC_free(this_obj_conv);
29286 }
29287
29288 int8_tArray  __attribute__((export_name("TS_UpdateFailMalformedHTLC_get_channel_id"))) TS_UpdateFailMalformedHTLC_get_channel_id(uint64_t this_ptr) {
29289         LDKUpdateFailMalformedHTLC this_ptr_conv;
29290         this_ptr_conv.inner = untag_ptr(this_ptr);
29291         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29292         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29293         this_ptr_conv.is_owned = false;
29294         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
29295         memcpy(ret_arr->elems, *UpdateFailMalformedHTLC_get_channel_id(&this_ptr_conv), 32);
29296         return ret_arr;
29297 }
29298
29299 void  __attribute__((export_name("TS_UpdateFailMalformedHTLC_set_channel_id"))) TS_UpdateFailMalformedHTLC_set_channel_id(uint64_t this_ptr, int8_tArray val) {
29300         LDKUpdateFailMalformedHTLC this_ptr_conv;
29301         this_ptr_conv.inner = untag_ptr(this_ptr);
29302         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29303         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29304         this_ptr_conv.is_owned = false;
29305         LDKThirtyTwoBytes val_ref;
29306         CHECK(val->arr_len == 32);
29307         memcpy(val_ref.data, val->elems, 32); FREE(val);
29308         UpdateFailMalformedHTLC_set_channel_id(&this_ptr_conv, val_ref);
29309 }
29310
29311 int64_t  __attribute__((export_name("TS_UpdateFailMalformedHTLC_get_htlc_id"))) TS_UpdateFailMalformedHTLC_get_htlc_id(uint64_t this_ptr) {
29312         LDKUpdateFailMalformedHTLC this_ptr_conv;
29313         this_ptr_conv.inner = untag_ptr(this_ptr);
29314         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29315         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29316         this_ptr_conv.is_owned = false;
29317         int64_t ret_conv = UpdateFailMalformedHTLC_get_htlc_id(&this_ptr_conv);
29318         return ret_conv;
29319 }
29320
29321 void  __attribute__((export_name("TS_UpdateFailMalformedHTLC_set_htlc_id"))) TS_UpdateFailMalformedHTLC_set_htlc_id(uint64_t this_ptr, int64_t val) {
29322         LDKUpdateFailMalformedHTLC this_ptr_conv;
29323         this_ptr_conv.inner = untag_ptr(this_ptr);
29324         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29325         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29326         this_ptr_conv.is_owned = false;
29327         UpdateFailMalformedHTLC_set_htlc_id(&this_ptr_conv, val);
29328 }
29329
29330 int16_t  __attribute__((export_name("TS_UpdateFailMalformedHTLC_get_failure_code"))) TS_UpdateFailMalformedHTLC_get_failure_code(uint64_t this_ptr) {
29331         LDKUpdateFailMalformedHTLC this_ptr_conv;
29332         this_ptr_conv.inner = untag_ptr(this_ptr);
29333         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29334         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29335         this_ptr_conv.is_owned = false;
29336         int16_t ret_conv = UpdateFailMalformedHTLC_get_failure_code(&this_ptr_conv);
29337         return ret_conv;
29338 }
29339
29340 void  __attribute__((export_name("TS_UpdateFailMalformedHTLC_set_failure_code"))) TS_UpdateFailMalformedHTLC_set_failure_code(uint64_t this_ptr, int16_t val) {
29341         LDKUpdateFailMalformedHTLC this_ptr_conv;
29342         this_ptr_conv.inner = untag_ptr(this_ptr);
29343         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29344         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29345         this_ptr_conv.is_owned = false;
29346         UpdateFailMalformedHTLC_set_failure_code(&this_ptr_conv, val);
29347 }
29348
29349 static inline uint64_t UpdateFailMalformedHTLC_clone_ptr(LDKUpdateFailMalformedHTLC *NONNULL_PTR arg) {
29350         LDKUpdateFailMalformedHTLC ret_var = UpdateFailMalformedHTLC_clone(arg);
29351         uint64_t ret_ref = 0;
29352         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29353         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29354         return ret_ref;
29355 }
29356 int64_t  __attribute__((export_name("TS_UpdateFailMalformedHTLC_clone_ptr"))) TS_UpdateFailMalformedHTLC_clone_ptr(uint64_t arg) {
29357         LDKUpdateFailMalformedHTLC arg_conv;
29358         arg_conv.inner = untag_ptr(arg);
29359         arg_conv.is_owned = ptr_is_owned(arg);
29360         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
29361         arg_conv.is_owned = false;
29362         int64_t ret_conv = UpdateFailMalformedHTLC_clone_ptr(&arg_conv);
29363         return ret_conv;
29364 }
29365
29366 uint64_t  __attribute__((export_name("TS_UpdateFailMalformedHTLC_clone"))) TS_UpdateFailMalformedHTLC_clone(uint64_t orig) {
29367         LDKUpdateFailMalformedHTLC orig_conv;
29368         orig_conv.inner = untag_ptr(orig);
29369         orig_conv.is_owned = ptr_is_owned(orig);
29370         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
29371         orig_conv.is_owned = false;
29372         LDKUpdateFailMalformedHTLC ret_var = UpdateFailMalformedHTLC_clone(&orig_conv);
29373         uint64_t ret_ref = 0;
29374         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29375         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29376         return ret_ref;
29377 }
29378
29379 void  __attribute__((export_name("TS_CommitmentSigned_free"))) TS_CommitmentSigned_free(uint64_t this_obj) {
29380         LDKCommitmentSigned this_obj_conv;
29381         this_obj_conv.inner = untag_ptr(this_obj);
29382         this_obj_conv.is_owned = ptr_is_owned(this_obj);
29383         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
29384         CommitmentSigned_free(this_obj_conv);
29385 }
29386
29387 int8_tArray  __attribute__((export_name("TS_CommitmentSigned_get_channel_id"))) TS_CommitmentSigned_get_channel_id(uint64_t this_ptr) {
29388         LDKCommitmentSigned this_ptr_conv;
29389         this_ptr_conv.inner = untag_ptr(this_ptr);
29390         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29391         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29392         this_ptr_conv.is_owned = false;
29393         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
29394         memcpy(ret_arr->elems, *CommitmentSigned_get_channel_id(&this_ptr_conv), 32);
29395         return ret_arr;
29396 }
29397
29398 void  __attribute__((export_name("TS_CommitmentSigned_set_channel_id"))) TS_CommitmentSigned_set_channel_id(uint64_t this_ptr, int8_tArray val) {
29399         LDKCommitmentSigned this_ptr_conv;
29400         this_ptr_conv.inner = untag_ptr(this_ptr);
29401         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29402         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29403         this_ptr_conv.is_owned = false;
29404         LDKThirtyTwoBytes val_ref;
29405         CHECK(val->arr_len == 32);
29406         memcpy(val_ref.data, val->elems, 32); FREE(val);
29407         CommitmentSigned_set_channel_id(&this_ptr_conv, val_ref);
29408 }
29409
29410 int8_tArray  __attribute__((export_name("TS_CommitmentSigned_get_signature"))) TS_CommitmentSigned_get_signature(uint64_t this_ptr) {
29411         LDKCommitmentSigned this_ptr_conv;
29412         this_ptr_conv.inner = untag_ptr(this_ptr);
29413         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29414         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29415         this_ptr_conv.is_owned = false;
29416         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
29417         memcpy(ret_arr->elems, CommitmentSigned_get_signature(&this_ptr_conv).compact_form, 64);
29418         return ret_arr;
29419 }
29420
29421 void  __attribute__((export_name("TS_CommitmentSigned_set_signature"))) TS_CommitmentSigned_set_signature(uint64_t this_ptr, int8_tArray val) {
29422         LDKCommitmentSigned this_ptr_conv;
29423         this_ptr_conv.inner = untag_ptr(this_ptr);
29424         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29425         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29426         this_ptr_conv.is_owned = false;
29427         LDKSignature val_ref;
29428         CHECK(val->arr_len == 64);
29429         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
29430         CommitmentSigned_set_signature(&this_ptr_conv, val_ref);
29431 }
29432
29433 ptrArray  __attribute__((export_name("TS_CommitmentSigned_get_htlc_signatures"))) TS_CommitmentSigned_get_htlc_signatures(uint64_t this_ptr) {
29434         LDKCommitmentSigned this_ptr_conv;
29435         this_ptr_conv.inner = untag_ptr(this_ptr);
29436         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29437         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29438         this_ptr_conv.is_owned = false;
29439         LDKCVec_SignatureZ ret_var = CommitmentSigned_get_htlc_signatures(&this_ptr_conv);
29440         ptrArray ret_arr = NULL;
29441         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
29442         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
29443         for (size_t m = 0; m < ret_var.datalen; m++) {
29444                 int8_tArray ret_conv_12_arr = init_int8_tArray(64, __LINE__);
29445                 memcpy(ret_conv_12_arr->elems, ret_var.data[m].compact_form, 64);
29446                 ret_arr_ptr[m] = ret_conv_12_arr;
29447         }
29448         
29449         FREE(ret_var.data);
29450         return ret_arr;
29451 }
29452
29453 void  __attribute__((export_name("TS_CommitmentSigned_set_htlc_signatures"))) TS_CommitmentSigned_set_htlc_signatures(uint64_t this_ptr, ptrArray val) {
29454         LDKCommitmentSigned this_ptr_conv;
29455         this_ptr_conv.inner = untag_ptr(this_ptr);
29456         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29457         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29458         this_ptr_conv.is_owned = false;
29459         LDKCVec_SignatureZ val_constr;
29460         val_constr.datalen = val->arr_len;
29461         if (val_constr.datalen > 0)
29462                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
29463         else
29464                 val_constr.data = NULL;
29465         int8_tArray* val_vals = (void*) val->elems;
29466         for (size_t m = 0; m < val_constr.datalen; m++) {
29467                 int8_tArray val_conv_12 = val_vals[m];
29468                 LDKSignature val_conv_12_ref;
29469                 CHECK(val_conv_12->arr_len == 64);
29470                 memcpy(val_conv_12_ref.compact_form, val_conv_12->elems, 64); FREE(val_conv_12);
29471                 val_constr.data[m] = val_conv_12_ref;
29472         }
29473         FREE(val);
29474         CommitmentSigned_set_htlc_signatures(&this_ptr_conv, val_constr);
29475 }
29476
29477 uint64_t  __attribute__((export_name("TS_CommitmentSigned_new"))) TS_CommitmentSigned_new(int8_tArray channel_id_arg, int8_tArray signature_arg, ptrArray htlc_signatures_arg) {
29478         LDKThirtyTwoBytes channel_id_arg_ref;
29479         CHECK(channel_id_arg->arr_len == 32);
29480         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
29481         LDKSignature signature_arg_ref;
29482         CHECK(signature_arg->arr_len == 64);
29483         memcpy(signature_arg_ref.compact_form, signature_arg->elems, 64); FREE(signature_arg);
29484         LDKCVec_SignatureZ htlc_signatures_arg_constr;
29485         htlc_signatures_arg_constr.datalen = htlc_signatures_arg->arr_len;
29486         if (htlc_signatures_arg_constr.datalen > 0)
29487                 htlc_signatures_arg_constr.data = MALLOC(htlc_signatures_arg_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
29488         else
29489                 htlc_signatures_arg_constr.data = NULL;
29490         int8_tArray* htlc_signatures_arg_vals = (void*) htlc_signatures_arg->elems;
29491         for (size_t m = 0; m < htlc_signatures_arg_constr.datalen; m++) {
29492                 int8_tArray htlc_signatures_arg_conv_12 = htlc_signatures_arg_vals[m];
29493                 LDKSignature htlc_signatures_arg_conv_12_ref;
29494                 CHECK(htlc_signatures_arg_conv_12->arr_len == 64);
29495                 memcpy(htlc_signatures_arg_conv_12_ref.compact_form, htlc_signatures_arg_conv_12->elems, 64); FREE(htlc_signatures_arg_conv_12);
29496                 htlc_signatures_arg_constr.data[m] = htlc_signatures_arg_conv_12_ref;
29497         }
29498         FREE(htlc_signatures_arg);
29499         LDKCommitmentSigned ret_var = CommitmentSigned_new(channel_id_arg_ref, signature_arg_ref, htlc_signatures_arg_constr);
29500         uint64_t ret_ref = 0;
29501         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29502         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29503         return ret_ref;
29504 }
29505
29506 static inline uint64_t CommitmentSigned_clone_ptr(LDKCommitmentSigned *NONNULL_PTR arg) {
29507         LDKCommitmentSigned ret_var = CommitmentSigned_clone(arg);
29508         uint64_t ret_ref = 0;
29509         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29510         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29511         return ret_ref;
29512 }
29513 int64_t  __attribute__((export_name("TS_CommitmentSigned_clone_ptr"))) TS_CommitmentSigned_clone_ptr(uint64_t arg) {
29514         LDKCommitmentSigned arg_conv;
29515         arg_conv.inner = untag_ptr(arg);
29516         arg_conv.is_owned = ptr_is_owned(arg);
29517         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
29518         arg_conv.is_owned = false;
29519         int64_t ret_conv = CommitmentSigned_clone_ptr(&arg_conv);
29520         return ret_conv;
29521 }
29522
29523 uint64_t  __attribute__((export_name("TS_CommitmentSigned_clone"))) TS_CommitmentSigned_clone(uint64_t orig) {
29524         LDKCommitmentSigned orig_conv;
29525         orig_conv.inner = untag_ptr(orig);
29526         orig_conv.is_owned = ptr_is_owned(orig);
29527         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
29528         orig_conv.is_owned = false;
29529         LDKCommitmentSigned ret_var = CommitmentSigned_clone(&orig_conv);
29530         uint64_t ret_ref = 0;
29531         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29532         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29533         return ret_ref;
29534 }
29535
29536 void  __attribute__((export_name("TS_RevokeAndACK_free"))) TS_RevokeAndACK_free(uint64_t this_obj) {
29537         LDKRevokeAndACK this_obj_conv;
29538         this_obj_conv.inner = untag_ptr(this_obj);
29539         this_obj_conv.is_owned = ptr_is_owned(this_obj);
29540         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
29541         RevokeAndACK_free(this_obj_conv);
29542 }
29543
29544 int8_tArray  __attribute__((export_name("TS_RevokeAndACK_get_channel_id"))) TS_RevokeAndACK_get_channel_id(uint64_t this_ptr) {
29545         LDKRevokeAndACK this_ptr_conv;
29546         this_ptr_conv.inner = untag_ptr(this_ptr);
29547         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29548         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29549         this_ptr_conv.is_owned = false;
29550         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
29551         memcpy(ret_arr->elems, *RevokeAndACK_get_channel_id(&this_ptr_conv), 32);
29552         return ret_arr;
29553 }
29554
29555 void  __attribute__((export_name("TS_RevokeAndACK_set_channel_id"))) TS_RevokeAndACK_set_channel_id(uint64_t this_ptr, int8_tArray val) {
29556         LDKRevokeAndACK this_ptr_conv;
29557         this_ptr_conv.inner = untag_ptr(this_ptr);
29558         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29559         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29560         this_ptr_conv.is_owned = false;
29561         LDKThirtyTwoBytes val_ref;
29562         CHECK(val->arr_len == 32);
29563         memcpy(val_ref.data, val->elems, 32); FREE(val);
29564         RevokeAndACK_set_channel_id(&this_ptr_conv, val_ref);
29565 }
29566
29567 int8_tArray  __attribute__((export_name("TS_RevokeAndACK_get_per_commitment_secret"))) TS_RevokeAndACK_get_per_commitment_secret(uint64_t this_ptr) {
29568         LDKRevokeAndACK this_ptr_conv;
29569         this_ptr_conv.inner = untag_ptr(this_ptr);
29570         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29571         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29572         this_ptr_conv.is_owned = false;
29573         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
29574         memcpy(ret_arr->elems, *RevokeAndACK_get_per_commitment_secret(&this_ptr_conv), 32);
29575         return ret_arr;
29576 }
29577
29578 void  __attribute__((export_name("TS_RevokeAndACK_set_per_commitment_secret"))) TS_RevokeAndACK_set_per_commitment_secret(uint64_t this_ptr, int8_tArray val) {
29579         LDKRevokeAndACK this_ptr_conv;
29580         this_ptr_conv.inner = untag_ptr(this_ptr);
29581         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29582         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29583         this_ptr_conv.is_owned = false;
29584         LDKThirtyTwoBytes val_ref;
29585         CHECK(val->arr_len == 32);
29586         memcpy(val_ref.data, val->elems, 32); FREE(val);
29587         RevokeAndACK_set_per_commitment_secret(&this_ptr_conv, val_ref);
29588 }
29589
29590 int8_tArray  __attribute__((export_name("TS_RevokeAndACK_get_next_per_commitment_point"))) TS_RevokeAndACK_get_next_per_commitment_point(uint64_t this_ptr) {
29591         LDKRevokeAndACK this_ptr_conv;
29592         this_ptr_conv.inner = untag_ptr(this_ptr);
29593         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29594         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29595         this_ptr_conv.is_owned = false;
29596         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
29597         memcpy(ret_arr->elems, RevokeAndACK_get_next_per_commitment_point(&this_ptr_conv).compressed_form, 33);
29598         return ret_arr;
29599 }
29600
29601 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) {
29602         LDKRevokeAndACK this_ptr_conv;
29603         this_ptr_conv.inner = untag_ptr(this_ptr);
29604         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29605         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29606         this_ptr_conv.is_owned = false;
29607         LDKPublicKey val_ref;
29608         CHECK(val->arr_len == 33);
29609         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
29610         RevokeAndACK_set_next_per_commitment_point(&this_ptr_conv, val_ref);
29611 }
29612
29613 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) {
29614         LDKThirtyTwoBytes channel_id_arg_ref;
29615         CHECK(channel_id_arg->arr_len == 32);
29616         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
29617         LDKThirtyTwoBytes per_commitment_secret_arg_ref;
29618         CHECK(per_commitment_secret_arg->arr_len == 32);
29619         memcpy(per_commitment_secret_arg_ref.data, per_commitment_secret_arg->elems, 32); FREE(per_commitment_secret_arg);
29620         LDKPublicKey next_per_commitment_point_arg_ref;
29621         CHECK(next_per_commitment_point_arg->arr_len == 33);
29622         memcpy(next_per_commitment_point_arg_ref.compressed_form, next_per_commitment_point_arg->elems, 33); FREE(next_per_commitment_point_arg);
29623         LDKRevokeAndACK ret_var = RevokeAndACK_new(channel_id_arg_ref, per_commitment_secret_arg_ref, next_per_commitment_point_arg_ref);
29624         uint64_t ret_ref = 0;
29625         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29626         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29627         return ret_ref;
29628 }
29629
29630 static inline uint64_t RevokeAndACK_clone_ptr(LDKRevokeAndACK *NONNULL_PTR arg) {
29631         LDKRevokeAndACK ret_var = RevokeAndACK_clone(arg);
29632         uint64_t ret_ref = 0;
29633         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29634         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29635         return ret_ref;
29636 }
29637 int64_t  __attribute__((export_name("TS_RevokeAndACK_clone_ptr"))) TS_RevokeAndACK_clone_ptr(uint64_t arg) {
29638         LDKRevokeAndACK arg_conv;
29639         arg_conv.inner = untag_ptr(arg);
29640         arg_conv.is_owned = ptr_is_owned(arg);
29641         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
29642         arg_conv.is_owned = false;
29643         int64_t ret_conv = RevokeAndACK_clone_ptr(&arg_conv);
29644         return ret_conv;
29645 }
29646
29647 uint64_t  __attribute__((export_name("TS_RevokeAndACK_clone"))) TS_RevokeAndACK_clone(uint64_t orig) {
29648         LDKRevokeAndACK orig_conv;
29649         orig_conv.inner = untag_ptr(orig);
29650         orig_conv.is_owned = ptr_is_owned(orig);
29651         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
29652         orig_conv.is_owned = false;
29653         LDKRevokeAndACK ret_var = RevokeAndACK_clone(&orig_conv);
29654         uint64_t ret_ref = 0;
29655         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29656         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29657         return ret_ref;
29658 }
29659
29660 void  __attribute__((export_name("TS_UpdateFee_free"))) TS_UpdateFee_free(uint64_t this_obj) {
29661         LDKUpdateFee this_obj_conv;
29662         this_obj_conv.inner = untag_ptr(this_obj);
29663         this_obj_conv.is_owned = ptr_is_owned(this_obj);
29664         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
29665         UpdateFee_free(this_obj_conv);
29666 }
29667
29668 int8_tArray  __attribute__((export_name("TS_UpdateFee_get_channel_id"))) TS_UpdateFee_get_channel_id(uint64_t this_ptr) {
29669         LDKUpdateFee this_ptr_conv;
29670         this_ptr_conv.inner = untag_ptr(this_ptr);
29671         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29672         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29673         this_ptr_conv.is_owned = false;
29674         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
29675         memcpy(ret_arr->elems, *UpdateFee_get_channel_id(&this_ptr_conv), 32);
29676         return ret_arr;
29677 }
29678
29679 void  __attribute__((export_name("TS_UpdateFee_set_channel_id"))) TS_UpdateFee_set_channel_id(uint64_t this_ptr, int8_tArray val) {
29680         LDKUpdateFee this_ptr_conv;
29681         this_ptr_conv.inner = untag_ptr(this_ptr);
29682         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29683         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29684         this_ptr_conv.is_owned = false;
29685         LDKThirtyTwoBytes val_ref;
29686         CHECK(val->arr_len == 32);
29687         memcpy(val_ref.data, val->elems, 32); FREE(val);
29688         UpdateFee_set_channel_id(&this_ptr_conv, val_ref);
29689 }
29690
29691 int32_t  __attribute__((export_name("TS_UpdateFee_get_feerate_per_kw"))) TS_UpdateFee_get_feerate_per_kw(uint64_t this_ptr) {
29692         LDKUpdateFee this_ptr_conv;
29693         this_ptr_conv.inner = untag_ptr(this_ptr);
29694         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29695         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29696         this_ptr_conv.is_owned = false;
29697         int32_t ret_conv = UpdateFee_get_feerate_per_kw(&this_ptr_conv);
29698         return ret_conv;
29699 }
29700
29701 void  __attribute__((export_name("TS_UpdateFee_set_feerate_per_kw"))) TS_UpdateFee_set_feerate_per_kw(uint64_t this_ptr, int32_t val) {
29702         LDKUpdateFee this_ptr_conv;
29703         this_ptr_conv.inner = untag_ptr(this_ptr);
29704         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29705         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29706         this_ptr_conv.is_owned = false;
29707         UpdateFee_set_feerate_per_kw(&this_ptr_conv, val);
29708 }
29709
29710 uint64_t  __attribute__((export_name("TS_UpdateFee_new"))) TS_UpdateFee_new(int8_tArray channel_id_arg, int32_t feerate_per_kw_arg) {
29711         LDKThirtyTwoBytes channel_id_arg_ref;
29712         CHECK(channel_id_arg->arr_len == 32);
29713         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
29714         LDKUpdateFee ret_var = UpdateFee_new(channel_id_arg_ref, feerate_per_kw_arg);
29715         uint64_t ret_ref = 0;
29716         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29717         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29718         return ret_ref;
29719 }
29720
29721 static inline uint64_t UpdateFee_clone_ptr(LDKUpdateFee *NONNULL_PTR arg) {
29722         LDKUpdateFee ret_var = UpdateFee_clone(arg);
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 int64_t  __attribute__((export_name("TS_UpdateFee_clone_ptr"))) TS_UpdateFee_clone_ptr(uint64_t arg) {
29729         LDKUpdateFee arg_conv;
29730         arg_conv.inner = untag_ptr(arg);
29731         arg_conv.is_owned = ptr_is_owned(arg);
29732         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
29733         arg_conv.is_owned = false;
29734         int64_t ret_conv = UpdateFee_clone_ptr(&arg_conv);
29735         return ret_conv;
29736 }
29737
29738 uint64_t  __attribute__((export_name("TS_UpdateFee_clone"))) TS_UpdateFee_clone(uint64_t orig) {
29739         LDKUpdateFee orig_conv;
29740         orig_conv.inner = untag_ptr(orig);
29741         orig_conv.is_owned = ptr_is_owned(orig);
29742         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
29743         orig_conv.is_owned = false;
29744         LDKUpdateFee ret_var = UpdateFee_clone(&orig_conv);
29745         uint64_t ret_ref = 0;
29746         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29747         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29748         return ret_ref;
29749 }
29750
29751 void  __attribute__((export_name("TS_DataLossProtect_free"))) TS_DataLossProtect_free(uint64_t this_obj) {
29752         LDKDataLossProtect this_obj_conv;
29753         this_obj_conv.inner = untag_ptr(this_obj);
29754         this_obj_conv.is_owned = ptr_is_owned(this_obj);
29755         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
29756         DataLossProtect_free(this_obj_conv);
29757 }
29758
29759 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) {
29760         LDKDataLossProtect this_ptr_conv;
29761         this_ptr_conv.inner = untag_ptr(this_ptr);
29762         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29763         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29764         this_ptr_conv.is_owned = false;
29765         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
29766         memcpy(ret_arr->elems, *DataLossProtect_get_your_last_per_commitment_secret(&this_ptr_conv), 32);
29767         return ret_arr;
29768 }
29769
29770 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) {
29771         LDKDataLossProtect this_ptr_conv;
29772         this_ptr_conv.inner = untag_ptr(this_ptr);
29773         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29774         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29775         this_ptr_conv.is_owned = false;
29776         LDKThirtyTwoBytes val_ref;
29777         CHECK(val->arr_len == 32);
29778         memcpy(val_ref.data, val->elems, 32); FREE(val);
29779         DataLossProtect_set_your_last_per_commitment_secret(&this_ptr_conv, val_ref);
29780 }
29781
29782 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) {
29783         LDKDataLossProtect this_ptr_conv;
29784         this_ptr_conv.inner = untag_ptr(this_ptr);
29785         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29786         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29787         this_ptr_conv.is_owned = false;
29788         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
29789         memcpy(ret_arr->elems, DataLossProtect_get_my_current_per_commitment_point(&this_ptr_conv).compressed_form, 33);
29790         return ret_arr;
29791 }
29792
29793 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) {
29794         LDKDataLossProtect this_ptr_conv;
29795         this_ptr_conv.inner = untag_ptr(this_ptr);
29796         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29797         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29798         this_ptr_conv.is_owned = false;
29799         LDKPublicKey val_ref;
29800         CHECK(val->arr_len == 33);
29801         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
29802         DataLossProtect_set_my_current_per_commitment_point(&this_ptr_conv, val_ref);
29803 }
29804
29805 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) {
29806         LDKThirtyTwoBytes your_last_per_commitment_secret_arg_ref;
29807         CHECK(your_last_per_commitment_secret_arg->arr_len == 32);
29808         memcpy(your_last_per_commitment_secret_arg_ref.data, your_last_per_commitment_secret_arg->elems, 32); FREE(your_last_per_commitment_secret_arg);
29809         LDKPublicKey my_current_per_commitment_point_arg_ref;
29810         CHECK(my_current_per_commitment_point_arg->arr_len == 33);
29811         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);
29812         LDKDataLossProtect ret_var = DataLossProtect_new(your_last_per_commitment_secret_arg_ref, my_current_per_commitment_point_arg_ref);
29813         uint64_t ret_ref = 0;
29814         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29815         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29816         return ret_ref;
29817 }
29818
29819 static inline uint64_t DataLossProtect_clone_ptr(LDKDataLossProtect *NONNULL_PTR arg) {
29820         LDKDataLossProtect ret_var = DataLossProtect_clone(arg);
29821         uint64_t ret_ref = 0;
29822         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29823         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29824         return ret_ref;
29825 }
29826 int64_t  __attribute__((export_name("TS_DataLossProtect_clone_ptr"))) TS_DataLossProtect_clone_ptr(uint64_t arg) {
29827         LDKDataLossProtect arg_conv;
29828         arg_conv.inner = untag_ptr(arg);
29829         arg_conv.is_owned = ptr_is_owned(arg);
29830         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
29831         arg_conv.is_owned = false;
29832         int64_t ret_conv = DataLossProtect_clone_ptr(&arg_conv);
29833         return ret_conv;
29834 }
29835
29836 uint64_t  __attribute__((export_name("TS_DataLossProtect_clone"))) TS_DataLossProtect_clone(uint64_t orig) {
29837         LDKDataLossProtect orig_conv;
29838         orig_conv.inner = untag_ptr(orig);
29839         orig_conv.is_owned = ptr_is_owned(orig);
29840         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
29841         orig_conv.is_owned = false;
29842         LDKDataLossProtect ret_var = DataLossProtect_clone(&orig_conv);
29843         uint64_t ret_ref = 0;
29844         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29845         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29846         return ret_ref;
29847 }
29848
29849 void  __attribute__((export_name("TS_ChannelReestablish_free"))) TS_ChannelReestablish_free(uint64_t this_obj) {
29850         LDKChannelReestablish this_obj_conv;
29851         this_obj_conv.inner = untag_ptr(this_obj);
29852         this_obj_conv.is_owned = ptr_is_owned(this_obj);
29853         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
29854         ChannelReestablish_free(this_obj_conv);
29855 }
29856
29857 int8_tArray  __attribute__((export_name("TS_ChannelReestablish_get_channel_id"))) TS_ChannelReestablish_get_channel_id(uint64_t this_ptr) {
29858         LDKChannelReestablish this_ptr_conv;
29859         this_ptr_conv.inner = untag_ptr(this_ptr);
29860         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29861         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29862         this_ptr_conv.is_owned = false;
29863         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
29864         memcpy(ret_arr->elems, *ChannelReestablish_get_channel_id(&this_ptr_conv), 32);
29865         return ret_arr;
29866 }
29867
29868 void  __attribute__((export_name("TS_ChannelReestablish_set_channel_id"))) TS_ChannelReestablish_set_channel_id(uint64_t this_ptr, int8_tArray val) {
29869         LDKChannelReestablish this_ptr_conv;
29870         this_ptr_conv.inner = untag_ptr(this_ptr);
29871         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29872         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29873         this_ptr_conv.is_owned = false;
29874         LDKThirtyTwoBytes val_ref;
29875         CHECK(val->arr_len == 32);
29876         memcpy(val_ref.data, val->elems, 32); FREE(val);
29877         ChannelReestablish_set_channel_id(&this_ptr_conv, val_ref);
29878 }
29879
29880 int64_t  __attribute__((export_name("TS_ChannelReestablish_get_next_local_commitment_number"))) TS_ChannelReestablish_get_next_local_commitment_number(uint64_t this_ptr) {
29881         LDKChannelReestablish this_ptr_conv;
29882         this_ptr_conv.inner = untag_ptr(this_ptr);
29883         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29884         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29885         this_ptr_conv.is_owned = false;
29886         int64_t ret_conv = ChannelReestablish_get_next_local_commitment_number(&this_ptr_conv);
29887         return ret_conv;
29888 }
29889
29890 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) {
29891         LDKChannelReestablish this_ptr_conv;
29892         this_ptr_conv.inner = untag_ptr(this_ptr);
29893         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29894         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29895         this_ptr_conv.is_owned = false;
29896         ChannelReestablish_set_next_local_commitment_number(&this_ptr_conv, val);
29897 }
29898
29899 int64_t  __attribute__((export_name("TS_ChannelReestablish_get_next_remote_commitment_number"))) TS_ChannelReestablish_get_next_remote_commitment_number(uint64_t this_ptr) {
29900         LDKChannelReestablish 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         int64_t ret_conv = ChannelReestablish_get_next_remote_commitment_number(&this_ptr_conv);
29906         return ret_conv;
29907 }
29908
29909 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) {
29910         LDKChannelReestablish this_ptr_conv;
29911         this_ptr_conv.inner = untag_ptr(this_ptr);
29912         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29913         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29914         this_ptr_conv.is_owned = false;
29915         ChannelReestablish_set_next_remote_commitment_number(&this_ptr_conv, val);
29916 }
29917
29918 static inline uint64_t ChannelReestablish_clone_ptr(LDKChannelReestablish *NONNULL_PTR arg) {
29919         LDKChannelReestablish ret_var = ChannelReestablish_clone(arg);
29920         uint64_t ret_ref = 0;
29921         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29922         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29923         return ret_ref;
29924 }
29925 int64_t  __attribute__((export_name("TS_ChannelReestablish_clone_ptr"))) TS_ChannelReestablish_clone_ptr(uint64_t arg) {
29926         LDKChannelReestablish arg_conv;
29927         arg_conv.inner = untag_ptr(arg);
29928         arg_conv.is_owned = ptr_is_owned(arg);
29929         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
29930         arg_conv.is_owned = false;
29931         int64_t ret_conv = ChannelReestablish_clone_ptr(&arg_conv);
29932         return ret_conv;
29933 }
29934
29935 uint64_t  __attribute__((export_name("TS_ChannelReestablish_clone"))) TS_ChannelReestablish_clone(uint64_t orig) {
29936         LDKChannelReestablish orig_conv;
29937         orig_conv.inner = untag_ptr(orig);
29938         orig_conv.is_owned = ptr_is_owned(orig);
29939         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
29940         orig_conv.is_owned = false;
29941         LDKChannelReestablish ret_var = ChannelReestablish_clone(&orig_conv);
29942         uint64_t ret_ref = 0;
29943         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29944         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29945         return ret_ref;
29946 }
29947
29948 void  __attribute__((export_name("TS_AnnouncementSignatures_free"))) TS_AnnouncementSignatures_free(uint64_t this_obj) {
29949         LDKAnnouncementSignatures this_obj_conv;
29950         this_obj_conv.inner = untag_ptr(this_obj);
29951         this_obj_conv.is_owned = ptr_is_owned(this_obj);
29952         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
29953         AnnouncementSignatures_free(this_obj_conv);
29954 }
29955
29956 int8_tArray  __attribute__((export_name("TS_AnnouncementSignatures_get_channel_id"))) TS_AnnouncementSignatures_get_channel_id(uint64_t this_ptr) {
29957         LDKAnnouncementSignatures this_ptr_conv;
29958         this_ptr_conv.inner = untag_ptr(this_ptr);
29959         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29960         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29961         this_ptr_conv.is_owned = false;
29962         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
29963         memcpy(ret_arr->elems, *AnnouncementSignatures_get_channel_id(&this_ptr_conv), 32);
29964         return ret_arr;
29965 }
29966
29967 void  __attribute__((export_name("TS_AnnouncementSignatures_set_channel_id"))) TS_AnnouncementSignatures_set_channel_id(uint64_t this_ptr, int8_tArray val) {
29968         LDKAnnouncementSignatures this_ptr_conv;
29969         this_ptr_conv.inner = untag_ptr(this_ptr);
29970         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29971         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29972         this_ptr_conv.is_owned = false;
29973         LDKThirtyTwoBytes val_ref;
29974         CHECK(val->arr_len == 32);
29975         memcpy(val_ref.data, val->elems, 32); FREE(val);
29976         AnnouncementSignatures_set_channel_id(&this_ptr_conv, val_ref);
29977 }
29978
29979 int64_t  __attribute__((export_name("TS_AnnouncementSignatures_get_short_channel_id"))) TS_AnnouncementSignatures_get_short_channel_id(uint64_t this_ptr) {
29980         LDKAnnouncementSignatures this_ptr_conv;
29981         this_ptr_conv.inner = untag_ptr(this_ptr);
29982         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29983         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29984         this_ptr_conv.is_owned = false;
29985         int64_t ret_conv = AnnouncementSignatures_get_short_channel_id(&this_ptr_conv);
29986         return ret_conv;
29987 }
29988
29989 void  __attribute__((export_name("TS_AnnouncementSignatures_set_short_channel_id"))) TS_AnnouncementSignatures_set_short_channel_id(uint64_t this_ptr, int64_t val) {
29990         LDKAnnouncementSignatures this_ptr_conv;
29991         this_ptr_conv.inner = untag_ptr(this_ptr);
29992         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29993         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29994         this_ptr_conv.is_owned = false;
29995         AnnouncementSignatures_set_short_channel_id(&this_ptr_conv, val);
29996 }
29997
29998 int8_tArray  __attribute__((export_name("TS_AnnouncementSignatures_get_node_signature"))) TS_AnnouncementSignatures_get_node_signature(uint64_t this_ptr) {
29999         LDKAnnouncementSignatures this_ptr_conv;
30000         this_ptr_conv.inner = untag_ptr(this_ptr);
30001         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30002         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30003         this_ptr_conv.is_owned = false;
30004         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
30005         memcpy(ret_arr->elems, AnnouncementSignatures_get_node_signature(&this_ptr_conv).compact_form, 64);
30006         return ret_arr;
30007 }
30008
30009 void  __attribute__((export_name("TS_AnnouncementSignatures_set_node_signature"))) TS_AnnouncementSignatures_set_node_signature(uint64_t this_ptr, int8_tArray val) {
30010         LDKAnnouncementSignatures this_ptr_conv;
30011         this_ptr_conv.inner = untag_ptr(this_ptr);
30012         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30013         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30014         this_ptr_conv.is_owned = false;
30015         LDKSignature val_ref;
30016         CHECK(val->arr_len == 64);
30017         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
30018         AnnouncementSignatures_set_node_signature(&this_ptr_conv, val_ref);
30019 }
30020
30021 int8_tArray  __attribute__((export_name("TS_AnnouncementSignatures_get_bitcoin_signature"))) TS_AnnouncementSignatures_get_bitcoin_signature(uint64_t this_ptr) {
30022         LDKAnnouncementSignatures this_ptr_conv;
30023         this_ptr_conv.inner = untag_ptr(this_ptr);
30024         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30025         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30026         this_ptr_conv.is_owned = false;
30027         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
30028         memcpy(ret_arr->elems, AnnouncementSignatures_get_bitcoin_signature(&this_ptr_conv).compact_form, 64);
30029         return ret_arr;
30030 }
30031
30032 void  __attribute__((export_name("TS_AnnouncementSignatures_set_bitcoin_signature"))) TS_AnnouncementSignatures_set_bitcoin_signature(uint64_t this_ptr, int8_tArray val) {
30033         LDKAnnouncementSignatures this_ptr_conv;
30034         this_ptr_conv.inner = untag_ptr(this_ptr);
30035         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30036         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30037         this_ptr_conv.is_owned = false;
30038         LDKSignature val_ref;
30039         CHECK(val->arr_len == 64);
30040         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
30041         AnnouncementSignatures_set_bitcoin_signature(&this_ptr_conv, val_ref);
30042 }
30043
30044 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) {
30045         LDKThirtyTwoBytes channel_id_arg_ref;
30046         CHECK(channel_id_arg->arr_len == 32);
30047         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
30048         LDKSignature node_signature_arg_ref;
30049         CHECK(node_signature_arg->arr_len == 64);
30050         memcpy(node_signature_arg_ref.compact_form, node_signature_arg->elems, 64); FREE(node_signature_arg);
30051         LDKSignature bitcoin_signature_arg_ref;
30052         CHECK(bitcoin_signature_arg->arr_len == 64);
30053         memcpy(bitcoin_signature_arg_ref.compact_form, bitcoin_signature_arg->elems, 64); FREE(bitcoin_signature_arg);
30054         LDKAnnouncementSignatures ret_var = AnnouncementSignatures_new(channel_id_arg_ref, short_channel_id_arg, node_signature_arg_ref, bitcoin_signature_arg_ref);
30055         uint64_t ret_ref = 0;
30056         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30057         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30058         return ret_ref;
30059 }
30060
30061 static inline uint64_t AnnouncementSignatures_clone_ptr(LDKAnnouncementSignatures *NONNULL_PTR arg) {
30062         LDKAnnouncementSignatures ret_var = AnnouncementSignatures_clone(arg);
30063         uint64_t ret_ref = 0;
30064         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30065         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30066         return ret_ref;
30067 }
30068 int64_t  __attribute__((export_name("TS_AnnouncementSignatures_clone_ptr"))) TS_AnnouncementSignatures_clone_ptr(uint64_t arg) {
30069         LDKAnnouncementSignatures arg_conv;
30070         arg_conv.inner = untag_ptr(arg);
30071         arg_conv.is_owned = ptr_is_owned(arg);
30072         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30073         arg_conv.is_owned = false;
30074         int64_t ret_conv = AnnouncementSignatures_clone_ptr(&arg_conv);
30075         return ret_conv;
30076 }
30077
30078 uint64_t  __attribute__((export_name("TS_AnnouncementSignatures_clone"))) TS_AnnouncementSignatures_clone(uint64_t orig) {
30079         LDKAnnouncementSignatures orig_conv;
30080         orig_conv.inner = untag_ptr(orig);
30081         orig_conv.is_owned = ptr_is_owned(orig);
30082         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30083         orig_conv.is_owned = false;
30084         LDKAnnouncementSignatures ret_var = AnnouncementSignatures_clone(&orig_conv);
30085         uint64_t ret_ref = 0;
30086         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30087         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30088         return ret_ref;
30089 }
30090
30091 void  __attribute__((export_name("TS_NetAddress_free"))) TS_NetAddress_free(uint64_t this_ptr) {
30092         if (!ptr_is_owned(this_ptr)) return;
30093         void* this_ptr_ptr = untag_ptr(this_ptr);
30094         CHECK_ACCESS(this_ptr_ptr);
30095         LDKNetAddress this_ptr_conv = *(LDKNetAddress*)(this_ptr_ptr);
30096         FREE(untag_ptr(this_ptr));
30097         NetAddress_free(this_ptr_conv);
30098 }
30099
30100 static inline uint64_t NetAddress_clone_ptr(LDKNetAddress *NONNULL_PTR arg) {
30101         LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
30102         *ret_copy = NetAddress_clone(arg);
30103         uint64_t ret_ref = tag_ptr(ret_copy, true);
30104         return ret_ref;
30105 }
30106 int64_t  __attribute__((export_name("TS_NetAddress_clone_ptr"))) TS_NetAddress_clone_ptr(uint64_t arg) {
30107         LDKNetAddress* arg_conv = (LDKNetAddress*)untag_ptr(arg);
30108         int64_t ret_conv = NetAddress_clone_ptr(arg_conv);
30109         return ret_conv;
30110 }
30111
30112 uint64_t  __attribute__((export_name("TS_NetAddress_clone"))) TS_NetAddress_clone(uint64_t orig) {
30113         LDKNetAddress* orig_conv = (LDKNetAddress*)untag_ptr(orig);
30114         LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
30115         *ret_copy = NetAddress_clone(orig_conv);
30116         uint64_t ret_ref = tag_ptr(ret_copy, true);
30117         return ret_ref;
30118 }
30119
30120 uint64_t  __attribute__((export_name("TS_NetAddress_ipv4"))) TS_NetAddress_ipv4(int8_tArray addr, int16_t port) {
30121         LDKFourBytes addr_ref;
30122         CHECK(addr->arr_len == 4);
30123         memcpy(addr_ref.data, addr->elems, 4); FREE(addr);
30124         LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
30125         *ret_copy = NetAddress_ipv4(addr_ref, port);
30126         uint64_t ret_ref = tag_ptr(ret_copy, true);
30127         return ret_ref;
30128 }
30129
30130 uint64_t  __attribute__((export_name("TS_NetAddress_ipv6"))) TS_NetAddress_ipv6(int8_tArray addr, int16_t port) {
30131         LDKSixteenBytes addr_ref;
30132         CHECK(addr->arr_len == 16);
30133         memcpy(addr_ref.data, addr->elems, 16); FREE(addr);
30134         LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
30135         *ret_copy = NetAddress_ipv6(addr_ref, port);
30136         uint64_t ret_ref = tag_ptr(ret_copy, true);
30137         return ret_ref;
30138 }
30139
30140 uint64_t  __attribute__((export_name("TS_NetAddress_onion_v2"))) TS_NetAddress_onion_v2(int8_tArray a) {
30141         LDKTwelveBytes a_ref;
30142         CHECK(a->arr_len == 12);
30143         memcpy(a_ref.data, a->elems, 12); FREE(a);
30144         LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
30145         *ret_copy = NetAddress_onion_v2(a_ref);
30146         uint64_t ret_ref = tag_ptr(ret_copy, true);
30147         return ret_ref;
30148 }
30149
30150 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) {
30151         LDKThirtyTwoBytes ed25519_pubkey_ref;
30152         CHECK(ed25519_pubkey->arr_len == 32);
30153         memcpy(ed25519_pubkey_ref.data, ed25519_pubkey->elems, 32); FREE(ed25519_pubkey);
30154         LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
30155         *ret_copy = NetAddress_onion_v3(ed25519_pubkey_ref, checksum, version, port);
30156         uint64_t ret_ref = tag_ptr(ret_copy, true);
30157         return ret_ref;
30158 }
30159
30160 uint64_t  __attribute__((export_name("TS_NetAddress_hostname"))) TS_NetAddress_hostname(uint64_t hostname, int16_t port) {
30161         LDKHostname hostname_conv;
30162         hostname_conv.inner = untag_ptr(hostname);
30163         hostname_conv.is_owned = ptr_is_owned(hostname);
30164         CHECK_INNER_FIELD_ACCESS_OR_NULL(hostname_conv);
30165         hostname_conv = Hostname_clone(&hostname_conv);
30166         LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
30167         *ret_copy = NetAddress_hostname(hostname_conv, port);
30168         uint64_t ret_ref = tag_ptr(ret_copy, true);
30169         return ret_ref;
30170 }
30171
30172 int8_tArray  __attribute__((export_name("TS_NetAddress_write"))) TS_NetAddress_write(uint64_t obj) {
30173         LDKNetAddress* obj_conv = (LDKNetAddress*)untag_ptr(obj);
30174         LDKCVec_u8Z ret_var = NetAddress_write(obj_conv);
30175         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
30176         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
30177         CVec_u8Z_free(ret_var);
30178         return ret_arr;
30179 }
30180
30181 uint64_t  __attribute__((export_name("TS_NetAddress_read"))) TS_NetAddress_read(int8_tArray ser) {
30182         LDKu8slice ser_ref;
30183         ser_ref.datalen = ser->arr_len;
30184         ser_ref.data = ser->elems;
30185         LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
30186         *ret_conv = NetAddress_read(ser_ref);
30187         FREE(ser);
30188         return tag_ptr(ret_conv, true);
30189 }
30190
30191 void  __attribute__((export_name("TS_UnsignedNodeAnnouncement_free"))) TS_UnsignedNodeAnnouncement_free(uint64_t this_obj) {
30192         LDKUnsignedNodeAnnouncement this_obj_conv;
30193         this_obj_conv.inner = untag_ptr(this_obj);
30194         this_obj_conv.is_owned = ptr_is_owned(this_obj);
30195         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30196         UnsignedNodeAnnouncement_free(this_obj_conv);
30197 }
30198
30199 uint64_t  __attribute__((export_name("TS_UnsignedNodeAnnouncement_get_features"))) TS_UnsignedNodeAnnouncement_get_features(uint64_t this_ptr) {
30200         LDKUnsignedNodeAnnouncement this_ptr_conv;
30201         this_ptr_conv.inner = untag_ptr(this_ptr);
30202         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30203         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30204         this_ptr_conv.is_owned = false;
30205         LDKNodeFeatures ret_var = UnsignedNodeAnnouncement_get_features(&this_ptr_conv);
30206         uint64_t ret_ref = 0;
30207         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30208         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30209         return ret_ref;
30210 }
30211
30212 void  __attribute__((export_name("TS_UnsignedNodeAnnouncement_set_features"))) TS_UnsignedNodeAnnouncement_set_features(uint64_t this_ptr, uint64_t val) {
30213         LDKUnsignedNodeAnnouncement this_ptr_conv;
30214         this_ptr_conv.inner = untag_ptr(this_ptr);
30215         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30216         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30217         this_ptr_conv.is_owned = false;
30218         LDKNodeFeatures val_conv;
30219         val_conv.inner = untag_ptr(val);
30220         val_conv.is_owned = ptr_is_owned(val);
30221         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
30222         val_conv = NodeFeatures_clone(&val_conv);
30223         UnsignedNodeAnnouncement_set_features(&this_ptr_conv, val_conv);
30224 }
30225
30226 int32_t  __attribute__((export_name("TS_UnsignedNodeAnnouncement_get_timestamp"))) TS_UnsignedNodeAnnouncement_get_timestamp(uint64_t this_ptr) {
30227         LDKUnsignedNodeAnnouncement this_ptr_conv;
30228         this_ptr_conv.inner = untag_ptr(this_ptr);
30229         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30230         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30231         this_ptr_conv.is_owned = false;
30232         int32_t ret_conv = UnsignedNodeAnnouncement_get_timestamp(&this_ptr_conv);
30233         return ret_conv;
30234 }
30235
30236 void  __attribute__((export_name("TS_UnsignedNodeAnnouncement_set_timestamp"))) TS_UnsignedNodeAnnouncement_set_timestamp(uint64_t this_ptr, int32_t val) {
30237         LDKUnsignedNodeAnnouncement this_ptr_conv;
30238         this_ptr_conv.inner = untag_ptr(this_ptr);
30239         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30240         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30241         this_ptr_conv.is_owned = false;
30242         UnsignedNodeAnnouncement_set_timestamp(&this_ptr_conv, val);
30243 }
30244
30245 int8_tArray  __attribute__((export_name("TS_UnsignedNodeAnnouncement_get_node_id"))) TS_UnsignedNodeAnnouncement_get_node_id(uint64_t this_ptr) {
30246         LDKUnsignedNodeAnnouncement this_ptr_conv;
30247         this_ptr_conv.inner = untag_ptr(this_ptr);
30248         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30249         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30250         this_ptr_conv.is_owned = false;
30251         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
30252         memcpy(ret_arr->elems, UnsignedNodeAnnouncement_get_node_id(&this_ptr_conv).compressed_form, 33);
30253         return ret_arr;
30254 }
30255
30256 void  __attribute__((export_name("TS_UnsignedNodeAnnouncement_set_node_id"))) TS_UnsignedNodeAnnouncement_set_node_id(uint64_t this_ptr, int8_tArray val) {
30257         LDKUnsignedNodeAnnouncement this_ptr_conv;
30258         this_ptr_conv.inner = untag_ptr(this_ptr);
30259         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30260         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30261         this_ptr_conv.is_owned = false;
30262         LDKPublicKey val_ref;
30263         CHECK(val->arr_len == 33);
30264         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
30265         UnsignedNodeAnnouncement_set_node_id(&this_ptr_conv, val_ref);
30266 }
30267
30268 int8_tArray  __attribute__((export_name("TS_UnsignedNodeAnnouncement_get_rgb"))) TS_UnsignedNodeAnnouncement_get_rgb(uint64_t this_ptr) {
30269         LDKUnsignedNodeAnnouncement this_ptr_conv;
30270         this_ptr_conv.inner = untag_ptr(this_ptr);
30271         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30272         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30273         this_ptr_conv.is_owned = false;
30274         int8_tArray ret_arr = init_int8_tArray(3, __LINE__);
30275         memcpy(ret_arr->elems, *UnsignedNodeAnnouncement_get_rgb(&this_ptr_conv), 3);
30276         return ret_arr;
30277 }
30278
30279 void  __attribute__((export_name("TS_UnsignedNodeAnnouncement_set_rgb"))) TS_UnsignedNodeAnnouncement_set_rgb(uint64_t this_ptr, int8_tArray val) {
30280         LDKUnsignedNodeAnnouncement this_ptr_conv;
30281         this_ptr_conv.inner = untag_ptr(this_ptr);
30282         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30283         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30284         this_ptr_conv.is_owned = false;
30285         LDKThreeBytes val_ref;
30286         CHECK(val->arr_len == 3);
30287         memcpy(val_ref.data, val->elems, 3); FREE(val);
30288         UnsignedNodeAnnouncement_set_rgb(&this_ptr_conv, val_ref);
30289 }
30290
30291 int8_tArray  __attribute__((export_name("TS_UnsignedNodeAnnouncement_get_alias"))) TS_UnsignedNodeAnnouncement_get_alias(uint64_t this_ptr) {
30292         LDKUnsignedNodeAnnouncement this_ptr_conv;
30293         this_ptr_conv.inner = untag_ptr(this_ptr);
30294         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30295         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30296         this_ptr_conv.is_owned = false;
30297         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
30298         memcpy(ret_arr->elems, *UnsignedNodeAnnouncement_get_alias(&this_ptr_conv), 32);
30299         return ret_arr;
30300 }
30301
30302 void  __attribute__((export_name("TS_UnsignedNodeAnnouncement_set_alias"))) TS_UnsignedNodeAnnouncement_set_alias(uint64_t this_ptr, int8_tArray val) {
30303         LDKUnsignedNodeAnnouncement this_ptr_conv;
30304         this_ptr_conv.inner = untag_ptr(this_ptr);
30305         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30306         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30307         this_ptr_conv.is_owned = false;
30308         LDKThirtyTwoBytes val_ref;
30309         CHECK(val->arr_len == 32);
30310         memcpy(val_ref.data, val->elems, 32); FREE(val);
30311         UnsignedNodeAnnouncement_set_alias(&this_ptr_conv, val_ref);
30312 }
30313
30314 uint64_tArray  __attribute__((export_name("TS_UnsignedNodeAnnouncement_get_addresses"))) TS_UnsignedNodeAnnouncement_get_addresses(uint64_t this_ptr) {
30315         LDKUnsignedNodeAnnouncement this_ptr_conv;
30316         this_ptr_conv.inner = untag_ptr(this_ptr);
30317         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30318         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30319         this_ptr_conv.is_owned = false;
30320         LDKCVec_NetAddressZ ret_var = UnsignedNodeAnnouncement_get_addresses(&this_ptr_conv);
30321         uint64_tArray ret_arr = NULL;
30322         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
30323         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
30324         for (size_t m = 0; m < ret_var.datalen; m++) {
30325                 LDKNetAddress *ret_conv_12_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
30326                 *ret_conv_12_copy = ret_var.data[m];
30327                 uint64_t ret_conv_12_ref = tag_ptr(ret_conv_12_copy, true);
30328                 ret_arr_ptr[m] = ret_conv_12_ref;
30329         }
30330         
30331         FREE(ret_var.data);
30332         return ret_arr;
30333 }
30334
30335 void  __attribute__((export_name("TS_UnsignedNodeAnnouncement_set_addresses"))) TS_UnsignedNodeAnnouncement_set_addresses(uint64_t this_ptr, uint64_tArray val) {
30336         LDKUnsignedNodeAnnouncement this_ptr_conv;
30337         this_ptr_conv.inner = untag_ptr(this_ptr);
30338         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30339         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30340         this_ptr_conv.is_owned = false;
30341         LDKCVec_NetAddressZ val_constr;
30342         val_constr.datalen = val->arr_len;
30343         if (val_constr.datalen > 0)
30344                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
30345         else
30346                 val_constr.data = NULL;
30347         uint64_t* val_vals = val->elems;
30348         for (size_t m = 0; m < val_constr.datalen; m++) {
30349                 uint64_t val_conv_12 = val_vals[m];
30350                 void* val_conv_12_ptr = untag_ptr(val_conv_12);
30351                 CHECK_ACCESS(val_conv_12_ptr);
30352                 LDKNetAddress val_conv_12_conv = *(LDKNetAddress*)(val_conv_12_ptr);
30353                 val_conv_12_conv = NetAddress_clone((LDKNetAddress*)untag_ptr(val_conv_12));
30354                 val_constr.data[m] = val_conv_12_conv;
30355         }
30356         FREE(val);
30357         UnsignedNodeAnnouncement_set_addresses(&this_ptr_conv, val_constr);
30358 }
30359
30360 static inline uint64_t UnsignedNodeAnnouncement_clone_ptr(LDKUnsignedNodeAnnouncement *NONNULL_PTR arg) {
30361         LDKUnsignedNodeAnnouncement ret_var = UnsignedNodeAnnouncement_clone(arg);
30362         uint64_t ret_ref = 0;
30363         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30364         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30365         return ret_ref;
30366 }
30367 int64_t  __attribute__((export_name("TS_UnsignedNodeAnnouncement_clone_ptr"))) TS_UnsignedNodeAnnouncement_clone_ptr(uint64_t arg) {
30368         LDKUnsignedNodeAnnouncement arg_conv;
30369         arg_conv.inner = untag_ptr(arg);
30370         arg_conv.is_owned = ptr_is_owned(arg);
30371         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30372         arg_conv.is_owned = false;
30373         int64_t ret_conv = UnsignedNodeAnnouncement_clone_ptr(&arg_conv);
30374         return ret_conv;
30375 }
30376
30377 uint64_t  __attribute__((export_name("TS_UnsignedNodeAnnouncement_clone"))) TS_UnsignedNodeAnnouncement_clone(uint64_t orig) {
30378         LDKUnsignedNodeAnnouncement orig_conv;
30379         orig_conv.inner = untag_ptr(orig);
30380         orig_conv.is_owned = ptr_is_owned(orig);
30381         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30382         orig_conv.is_owned = false;
30383         LDKUnsignedNodeAnnouncement ret_var = UnsignedNodeAnnouncement_clone(&orig_conv);
30384         uint64_t ret_ref = 0;
30385         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30386         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30387         return ret_ref;
30388 }
30389
30390 void  __attribute__((export_name("TS_NodeAnnouncement_free"))) TS_NodeAnnouncement_free(uint64_t this_obj) {
30391         LDKNodeAnnouncement this_obj_conv;
30392         this_obj_conv.inner = untag_ptr(this_obj);
30393         this_obj_conv.is_owned = ptr_is_owned(this_obj);
30394         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30395         NodeAnnouncement_free(this_obj_conv);
30396 }
30397
30398 int8_tArray  __attribute__((export_name("TS_NodeAnnouncement_get_signature"))) TS_NodeAnnouncement_get_signature(uint64_t this_ptr) {
30399         LDKNodeAnnouncement this_ptr_conv;
30400         this_ptr_conv.inner = untag_ptr(this_ptr);
30401         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30402         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30403         this_ptr_conv.is_owned = false;
30404         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
30405         memcpy(ret_arr->elems, NodeAnnouncement_get_signature(&this_ptr_conv).compact_form, 64);
30406         return ret_arr;
30407 }
30408
30409 void  __attribute__((export_name("TS_NodeAnnouncement_set_signature"))) TS_NodeAnnouncement_set_signature(uint64_t this_ptr, int8_tArray val) {
30410         LDKNodeAnnouncement this_ptr_conv;
30411         this_ptr_conv.inner = untag_ptr(this_ptr);
30412         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30413         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30414         this_ptr_conv.is_owned = false;
30415         LDKSignature val_ref;
30416         CHECK(val->arr_len == 64);
30417         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
30418         NodeAnnouncement_set_signature(&this_ptr_conv, val_ref);
30419 }
30420
30421 uint64_t  __attribute__((export_name("TS_NodeAnnouncement_get_contents"))) TS_NodeAnnouncement_get_contents(uint64_t this_ptr) {
30422         LDKNodeAnnouncement this_ptr_conv;
30423         this_ptr_conv.inner = untag_ptr(this_ptr);
30424         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30425         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30426         this_ptr_conv.is_owned = false;
30427         LDKUnsignedNodeAnnouncement ret_var = NodeAnnouncement_get_contents(&this_ptr_conv);
30428         uint64_t ret_ref = 0;
30429         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30430         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30431         return ret_ref;
30432 }
30433
30434 void  __attribute__((export_name("TS_NodeAnnouncement_set_contents"))) TS_NodeAnnouncement_set_contents(uint64_t this_ptr, uint64_t val) {
30435         LDKNodeAnnouncement this_ptr_conv;
30436         this_ptr_conv.inner = untag_ptr(this_ptr);
30437         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30438         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30439         this_ptr_conv.is_owned = false;
30440         LDKUnsignedNodeAnnouncement val_conv;
30441         val_conv.inner = untag_ptr(val);
30442         val_conv.is_owned = ptr_is_owned(val);
30443         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
30444         val_conv = UnsignedNodeAnnouncement_clone(&val_conv);
30445         NodeAnnouncement_set_contents(&this_ptr_conv, val_conv);
30446 }
30447
30448 uint64_t  __attribute__((export_name("TS_NodeAnnouncement_new"))) TS_NodeAnnouncement_new(int8_tArray signature_arg, uint64_t contents_arg) {
30449         LDKSignature signature_arg_ref;
30450         CHECK(signature_arg->arr_len == 64);
30451         memcpy(signature_arg_ref.compact_form, signature_arg->elems, 64); FREE(signature_arg);
30452         LDKUnsignedNodeAnnouncement contents_arg_conv;
30453         contents_arg_conv.inner = untag_ptr(contents_arg);
30454         contents_arg_conv.is_owned = ptr_is_owned(contents_arg);
30455         CHECK_INNER_FIELD_ACCESS_OR_NULL(contents_arg_conv);
30456         contents_arg_conv = UnsignedNodeAnnouncement_clone(&contents_arg_conv);
30457         LDKNodeAnnouncement ret_var = NodeAnnouncement_new(signature_arg_ref, contents_arg_conv);
30458         uint64_t ret_ref = 0;
30459         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30460         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30461         return ret_ref;
30462 }
30463
30464 static inline uint64_t NodeAnnouncement_clone_ptr(LDKNodeAnnouncement *NONNULL_PTR arg) {
30465         LDKNodeAnnouncement ret_var = NodeAnnouncement_clone(arg);
30466         uint64_t ret_ref = 0;
30467         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30468         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30469         return ret_ref;
30470 }
30471 int64_t  __attribute__((export_name("TS_NodeAnnouncement_clone_ptr"))) TS_NodeAnnouncement_clone_ptr(uint64_t arg) {
30472         LDKNodeAnnouncement arg_conv;
30473         arg_conv.inner = untag_ptr(arg);
30474         arg_conv.is_owned = ptr_is_owned(arg);
30475         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30476         arg_conv.is_owned = false;
30477         int64_t ret_conv = NodeAnnouncement_clone_ptr(&arg_conv);
30478         return ret_conv;
30479 }
30480
30481 uint64_t  __attribute__((export_name("TS_NodeAnnouncement_clone"))) TS_NodeAnnouncement_clone(uint64_t orig) {
30482         LDKNodeAnnouncement orig_conv;
30483         orig_conv.inner = untag_ptr(orig);
30484         orig_conv.is_owned = ptr_is_owned(orig);
30485         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30486         orig_conv.is_owned = false;
30487         LDKNodeAnnouncement ret_var = NodeAnnouncement_clone(&orig_conv);
30488         uint64_t ret_ref = 0;
30489         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30490         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30491         return ret_ref;
30492 }
30493
30494 void  __attribute__((export_name("TS_UnsignedChannelAnnouncement_free"))) TS_UnsignedChannelAnnouncement_free(uint64_t this_obj) {
30495         LDKUnsignedChannelAnnouncement this_obj_conv;
30496         this_obj_conv.inner = untag_ptr(this_obj);
30497         this_obj_conv.is_owned = ptr_is_owned(this_obj);
30498         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30499         UnsignedChannelAnnouncement_free(this_obj_conv);
30500 }
30501
30502 uint64_t  __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_features"))) TS_UnsignedChannelAnnouncement_get_features(uint64_t this_ptr) {
30503         LDKUnsignedChannelAnnouncement this_ptr_conv;
30504         this_ptr_conv.inner = untag_ptr(this_ptr);
30505         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30506         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30507         this_ptr_conv.is_owned = false;
30508         LDKChannelFeatures ret_var = UnsignedChannelAnnouncement_get_features(&this_ptr_conv);
30509         uint64_t ret_ref = 0;
30510         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30511         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30512         return ret_ref;
30513 }
30514
30515 void  __attribute__((export_name("TS_UnsignedChannelAnnouncement_set_features"))) TS_UnsignedChannelAnnouncement_set_features(uint64_t this_ptr, uint64_t val) {
30516         LDKUnsignedChannelAnnouncement this_ptr_conv;
30517         this_ptr_conv.inner = untag_ptr(this_ptr);
30518         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30519         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30520         this_ptr_conv.is_owned = false;
30521         LDKChannelFeatures val_conv;
30522         val_conv.inner = untag_ptr(val);
30523         val_conv.is_owned = ptr_is_owned(val);
30524         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
30525         val_conv = ChannelFeatures_clone(&val_conv);
30526         UnsignedChannelAnnouncement_set_features(&this_ptr_conv, val_conv);
30527 }
30528
30529 int8_tArray  __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_chain_hash"))) TS_UnsignedChannelAnnouncement_get_chain_hash(uint64_t this_ptr) {
30530         LDKUnsignedChannelAnnouncement this_ptr_conv;
30531         this_ptr_conv.inner = untag_ptr(this_ptr);
30532         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30533         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30534         this_ptr_conv.is_owned = false;
30535         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
30536         memcpy(ret_arr->elems, *UnsignedChannelAnnouncement_get_chain_hash(&this_ptr_conv), 32);
30537         return ret_arr;
30538 }
30539
30540 void  __attribute__((export_name("TS_UnsignedChannelAnnouncement_set_chain_hash"))) TS_UnsignedChannelAnnouncement_set_chain_hash(uint64_t this_ptr, int8_tArray val) {
30541         LDKUnsignedChannelAnnouncement 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         LDKThirtyTwoBytes val_ref;
30547         CHECK(val->arr_len == 32);
30548         memcpy(val_ref.data, val->elems, 32); FREE(val);
30549         UnsignedChannelAnnouncement_set_chain_hash(&this_ptr_conv, val_ref);
30550 }
30551
30552 int64_t  __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_short_channel_id"))) TS_UnsignedChannelAnnouncement_get_short_channel_id(uint64_t this_ptr) {
30553         LDKUnsignedChannelAnnouncement this_ptr_conv;
30554         this_ptr_conv.inner = untag_ptr(this_ptr);
30555         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30556         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30557         this_ptr_conv.is_owned = false;
30558         int64_t ret_conv = UnsignedChannelAnnouncement_get_short_channel_id(&this_ptr_conv);
30559         return ret_conv;
30560 }
30561
30562 void  __attribute__((export_name("TS_UnsignedChannelAnnouncement_set_short_channel_id"))) TS_UnsignedChannelAnnouncement_set_short_channel_id(uint64_t this_ptr, int64_t val) {
30563         LDKUnsignedChannelAnnouncement this_ptr_conv;
30564         this_ptr_conv.inner = untag_ptr(this_ptr);
30565         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30566         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30567         this_ptr_conv.is_owned = false;
30568         UnsignedChannelAnnouncement_set_short_channel_id(&this_ptr_conv, val);
30569 }
30570
30571 int8_tArray  __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_node_id_1"))) TS_UnsignedChannelAnnouncement_get_node_id_1(uint64_t this_ptr) {
30572         LDKUnsignedChannelAnnouncement this_ptr_conv;
30573         this_ptr_conv.inner = untag_ptr(this_ptr);
30574         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30575         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30576         this_ptr_conv.is_owned = false;
30577         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
30578         memcpy(ret_arr->elems, UnsignedChannelAnnouncement_get_node_id_1(&this_ptr_conv).compressed_form, 33);
30579         return ret_arr;
30580 }
30581
30582 void  __attribute__((export_name("TS_UnsignedChannelAnnouncement_set_node_id_1"))) TS_UnsignedChannelAnnouncement_set_node_id_1(uint64_t this_ptr, int8_tArray val) {
30583         LDKUnsignedChannelAnnouncement this_ptr_conv;
30584         this_ptr_conv.inner = untag_ptr(this_ptr);
30585         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30586         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30587         this_ptr_conv.is_owned = false;
30588         LDKPublicKey val_ref;
30589         CHECK(val->arr_len == 33);
30590         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
30591         UnsignedChannelAnnouncement_set_node_id_1(&this_ptr_conv, val_ref);
30592 }
30593
30594 int8_tArray  __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_node_id_2"))) TS_UnsignedChannelAnnouncement_get_node_id_2(uint64_t this_ptr) {
30595         LDKUnsignedChannelAnnouncement this_ptr_conv;
30596         this_ptr_conv.inner = untag_ptr(this_ptr);
30597         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30598         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30599         this_ptr_conv.is_owned = false;
30600         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
30601         memcpy(ret_arr->elems, UnsignedChannelAnnouncement_get_node_id_2(&this_ptr_conv).compressed_form, 33);
30602         return ret_arr;
30603 }
30604
30605 void  __attribute__((export_name("TS_UnsignedChannelAnnouncement_set_node_id_2"))) TS_UnsignedChannelAnnouncement_set_node_id_2(uint64_t this_ptr, int8_tArray val) {
30606         LDKUnsignedChannelAnnouncement this_ptr_conv;
30607         this_ptr_conv.inner = untag_ptr(this_ptr);
30608         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30609         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30610         this_ptr_conv.is_owned = false;
30611         LDKPublicKey val_ref;
30612         CHECK(val->arr_len == 33);
30613         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
30614         UnsignedChannelAnnouncement_set_node_id_2(&this_ptr_conv, val_ref);
30615 }
30616
30617 int8_tArray  __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_bitcoin_key_1"))) TS_UnsignedChannelAnnouncement_get_bitcoin_key_1(uint64_t this_ptr) {
30618         LDKUnsignedChannelAnnouncement this_ptr_conv;
30619         this_ptr_conv.inner = untag_ptr(this_ptr);
30620         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30621         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30622         this_ptr_conv.is_owned = false;
30623         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
30624         memcpy(ret_arr->elems, UnsignedChannelAnnouncement_get_bitcoin_key_1(&this_ptr_conv).compressed_form, 33);
30625         return ret_arr;
30626 }
30627
30628 void  __attribute__((export_name("TS_UnsignedChannelAnnouncement_set_bitcoin_key_1"))) TS_UnsignedChannelAnnouncement_set_bitcoin_key_1(uint64_t this_ptr, int8_tArray val) {
30629         LDKUnsignedChannelAnnouncement this_ptr_conv;
30630         this_ptr_conv.inner = untag_ptr(this_ptr);
30631         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30632         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30633         this_ptr_conv.is_owned = false;
30634         LDKPublicKey val_ref;
30635         CHECK(val->arr_len == 33);
30636         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
30637         UnsignedChannelAnnouncement_set_bitcoin_key_1(&this_ptr_conv, val_ref);
30638 }
30639
30640 int8_tArray  __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_bitcoin_key_2"))) TS_UnsignedChannelAnnouncement_get_bitcoin_key_2(uint64_t this_ptr) {
30641         LDKUnsignedChannelAnnouncement this_ptr_conv;
30642         this_ptr_conv.inner = untag_ptr(this_ptr);
30643         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30644         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30645         this_ptr_conv.is_owned = false;
30646         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
30647         memcpy(ret_arr->elems, UnsignedChannelAnnouncement_get_bitcoin_key_2(&this_ptr_conv).compressed_form, 33);
30648         return ret_arr;
30649 }
30650
30651 void  __attribute__((export_name("TS_UnsignedChannelAnnouncement_set_bitcoin_key_2"))) TS_UnsignedChannelAnnouncement_set_bitcoin_key_2(uint64_t this_ptr, int8_tArray val) {
30652         LDKUnsignedChannelAnnouncement this_ptr_conv;
30653         this_ptr_conv.inner = untag_ptr(this_ptr);
30654         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30655         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30656         this_ptr_conv.is_owned = false;
30657         LDKPublicKey val_ref;
30658         CHECK(val->arr_len == 33);
30659         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
30660         UnsignedChannelAnnouncement_set_bitcoin_key_2(&this_ptr_conv, val_ref);
30661 }
30662
30663 static inline uint64_t UnsignedChannelAnnouncement_clone_ptr(LDKUnsignedChannelAnnouncement *NONNULL_PTR arg) {
30664         LDKUnsignedChannelAnnouncement ret_var = UnsignedChannelAnnouncement_clone(arg);
30665         uint64_t ret_ref = 0;
30666         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30667         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30668         return ret_ref;
30669 }
30670 int64_t  __attribute__((export_name("TS_UnsignedChannelAnnouncement_clone_ptr"))) TS_UnsignedChannelAnnouncement_clone_ptr(uint64_t arg) {
30671         LDKUnsignedChannelAnnouncement arg_conv;
30672         arg_conv.inner = untag_ptr(arg);
30673         arg_conv.is_owned = ptr_is_owned(arg);
30674         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30675         arg_conv.is_owned = false;
30676         int64_t ret_conv = UnsignedChannelAnnouncement_clone_ptr(&arg_conv);
30677         return ret_conv;
30678 }
30679
30680 uint64_t  __attribute__((export_name("TS_UnsignedChannelAnnouncement_clone"))) TS_UnsignedChannelAnnouncement_clone(uint64_t orig) {
30681         LDKUnsignedChannelAnnouncement orig_conv;
30682         orig_conv.inner = untag_ptr(orig);
30683         orig_conv.is_owned = ptr_is_owned(orig);
30684         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30685         orig_conv.is_owned = false;
30686         LDKUnsignedChannelAnnouncement ret_var = UnsignedChannelAnnouncement_clone(&orig_conv);
30687         uint64_t ret_ref = 0;
30688         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30689         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30690         return ret_ref;
30691 }
30692
30693 void  __attribute__((export_name("TS_ChannelAnnouncement_free"))) TS_ChannelAnnouncement_free(uint64_t this_obj) {
30694         LDKChannelAnnouncement this_obj_conv;
30695         this_obj_conv.inner = untag_ptr(this_obj);
30696         this_obj_conv.is_owned = ptr_is_owned(this_obj);
30697         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30698         ChannelAnnouncement_free(this_obj_conv);
30699 }
30700
30701 int8_tArray  __attribute__((export_name("TS_ChannelAnnouncement_get_node_signature_1"))) TS_ChannelAnnouncement_get_node_signature_1(uint64_t this_ptr) {
30702         LDKChannelAnnouncement this_ptr_conv;
30703         this_ptr_conv.inner = untag_ptr(this_ptr);
30704         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30705         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30706         this_ptr_conv.is_owned = false;
30707         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
30708         memcpy(ret_arr->elems, ChannelAnnouncement_get_node_signature_1(&this_ptr_conv).compact_form, 64);
30709         return ret_arr;
30710 }
30711
30712 void  __attribute__((export_name("TS_ChannelAnnouncement_set_node_signature_1"))) TS_ChannelAnnouncement_set_node_signature_1(uint64_t this_ptr, int8_tArray val) {
30713         LDKChannelAnnouncement this_ptr_conv;
30714         this_ptr_conv.inner = untag_ptr(this_ptr);
30715         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30716         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30717         this_ptr_conv.is_owned = false;
30718         LDKSignature val_ref;
30719         CHECK(val->arr_len == 64);
30720         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
30721         ChannelAnnouncement_set_node_signature_1(&this_ptr_conv, val_ref);
30722 }
30723
30724 int8_tArray  __attribute__((export_name("TS_ChannelAnnouncement_get_node_signature_2"))) TS_ChannelAnnouncement_get_node_signature_2(uint64_t this_ptr) {
30725         LDKChannelAnnouncement this_ptr_conv;
30726         this_ptr_conv.inner = untag_ptr(this_ptr);
30727         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30728         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30729         this_ptr_conv.is_owned = false;
30730         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
30731         memcpy(ret_arr->elems, ChannelAnnouncement_get_node_signature_2(&this_ptr_conv).compact_form, 64);
30732         return ret_arr;
30733 }
30734
30735 void  __attribute__((export_name("TS_ChannelAnnouncement_set_node_signature_2"))) TS_ChannelAnnouncement_set_node_signature_2(uint64_t this_ptr, int8_tArray val) {
30736         LDKChannelAnnouncement this_ptr_conv;
30737         this_ptr_conv.inner = untag_ptr(this_ptr);
30738         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30739         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30740         this_ptr_conv.is_owned = false;
30741         LDKSignature val_ref;
30742         CHECK(val->arr_len == 64);
30743         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
30744         ChannelAnnouncement_set_node_signature_2(&this_ptr_conv, val_ref);
30745 }
30746
30747 int8_tArray  __attribute__((export_name("TS_ChannelAnnouncement_get_bitcoin_signature_1"))) TS_ChannelAnnouncement_get_bitcoin_signature_1(uint64_t this_ptr) {
30748         LDKChannelAnnouncement this_ptr_conv;
30749         this_ptr_conv.inner = untag_ptr(this_ptr);
30750         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30751         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30752         this_ptr_conv.is_owned = false;
30753         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
30754         memcpy(ret_arr->elems, ChannelAnnouncement_get_bitcoin_signature_1(&this_ptr_conv).compact_form, 64);
30755         return ret_arr;
30756 }
30757
30758 void  __attribute__((export_name("TS_ChannelAnnouncement_set_bitcoin_signature_1"))) TS_ChannelAnnouncement_set_bitcoin_signature_1(uint64_t this_ptr, int8_tArray val) {
30759         LDKChannelAnnouncement this_ptr_conv;
30760         this_ptr_conv.inner = untag_ptr(this_ptr);
30761         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30762         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30763         this_ptr_conv.is_owned = false;
30764         LDKSignature val_ref;
30765         CHECK(val->arr_len == 64);
30766         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
30767         ChannelAnnouncement_set_bitcoin_signature_1(&this_ptr_conv, val_ref);
30768 }
30769
30770 int8_tArray  __attribute__((export_name("TS_ChannelAnnouncement_get_bitcoin_signature_2"))) TS_ChannelAnnouncement_get_bitcoin_signature_2(uint64_t this_ptr) {
30771         LDKChannelAnnouncement this_ptr_conv;
30772         this_ptr_conv.inner = untag_ptr(this_ptr);
30773         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30774         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30775         this_ptr_conv.is_owned = false;
30776         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
30777         memcpy(ret_arr->elems, ChannelAnnouncement_get_bitcoin_signature_2(&this_ptr_conv).compact_form, 64);
30778         return ret_arr;
30779 }
30780
30781 void  __attribute__((export_name("TS_ChannelAnnouncement_set_bitcoin_signature_2"))) TS_ChannelAnnouncement_set_bitcoin_signature_2(uint64_t this_ptr, int8_tArray val) {
30782         LDKChannelAnnouncement this_ptr_conv;
30783         this_ptr_conv.inner = untag_ptr(this_ptr);
30784         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30785         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30786         this_ptr_conv.is_owned = false;
30787         LDKSignature val_ref;
30788         CHECK(val->arr_len == 64);
30789         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
30790         ChannelAnnouncement_set_bitcoin_signature_2(&this_ptr_conv, val_ref);
30791 }
30792
30793 uint64_t  __attribute__((export_name("TS_ChannelAnnouncement_get_contents"))) TS_ChannelAnnouncement_get_contents(uint64_t this_ptr) {
30794         LDKChannelAnnouncement this_ptr_conv;
30795         this_ptr_conv.inner = untag_ptr(this_ptr);
30796         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30797         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30798         this_ptr_conv.is_owned = false;
30799         LDKUnsignedChannelAnnouncement ret_var = ChannelAnnouncement_get_contents(&this_ptr_conv);
30800         uint64_t ret_ref = 0;
30801         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30802         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30803         return ret_ref;
30804 }
30805
30806 void  __attribute__((export_name("TS_ChannelAnnouncement_set_contents"))) TS_ChannelAnnouncement_set_contents(uint64_t this_ptr, uint64_t val) {
30807         LDKChannelAnnouncement this_ptr_conv;
30808         this_ptr_conv.inner = untag_ptr(this_ptr);
30809         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30810         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30811         this_ptr_conv.is_owned = false;
30812         LDKUnsignedChannelAnnouncement val_conv;
30813         val_conv.inner = untag_ptr(val);
30814         val_conv.is_owned = ptr_is_owned(val);
30815         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
30816         val_conv = UnsignedChannelAnnouncement_clone(&val_conv);
30817         ChannelAnnouncement_set_contents(&this_ptr_conv, val_conv);
30818 }
30819
30820 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) {
30821         LDKSignature node_signature_1_arg_ref;
30822         CHECK(node_signature_1_arg->arr_len == 64);
30823         memcpy(node_signature_1_arg_ref.compact_form, node_signature_1_arg->elems, 64); FREE(node_signature_1_arg);
30824         LDKSignature node_signature_2_arg_ref;
30825         CHECK(node_signature_2_arg->arr_len == 64);
30826         memcpy(node_signature_2_arg_ref.compact_form, node_signature_2_arg->elems, 64); FREE(node_signature_2_arg);
30827         LDKSignature bitcoin_signature_1_arg_ref;
30828         CHECK(bitcoin_signature_1_arg->arr_len == 64);
30829         memcpy(bitcoin_signature_1_arg_ref.compact_form, bitcoin_signature_1_arg->elems, 64); FREE(bitcoin_signature_1_arg);
30830         LDKSignature bitcoin_signature_2_arg_ref;
30831         CHECK(bitcoin_signature_2_arg->arr_len == 64);
30832         memcpy(bitcoin_signature_2_arg_ref.compact_form, bitcoin_signature_2_arg->elems, 64); FREE(bitcoin_signature_2_arg);
30833         LDKUnsignedChannelAnnouncement contents_arg_conv;
30834         contents_arg_conv.inner = untag_ptr(contents_arg);
30835         contents_arg_conv.is_owned = ptr_is_owned(contents_arg);
30836         CHECK_INNER_FIELD_ACCESS_OR_NULL(contents_arg_conv);
30837         contents_arg_conv = UnsignedChannelAnnouncement_clone(&contents_arg_conv);
30838         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);
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 static inline uint64_t ChannelAnnouncement_clone_ptr(LDKChannelAnnouncement *NONNULL_PTR arg) {
30846         LDKChannelAnnouncement ret_var = ChannelAnnouncement_clone(arg);
30847         uint64_t ret_ref = 0;
30848         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30849         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30850         return ret_ref;
30851 }
30852 int64_t  __attribute__((export_name("TS_ChannelAnnouncement_clone_ptr"))) TS_ChannelAnnouncement_clone_ptr(uint64_t arg) {
30853         LDKChannelAnnouncement arg_conv;
30854         arg_conv.inner = untag_ptr(arg);
30855         arg_conv.is_owned = ptr_is_owned(arg);
30856         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30857         arg_conv.is_owned = false;
30858         int64_t ret_conv = ChannelAnnouncement_clone_ptr(&arg_conv);
30859         return ret_conv;
30860 }
30861
30862 uint64_t  __attribute__((export_name("TS_ChannelAnnouncement_clone"))) TS_ChannelAnnouncement_clone(uint64_t orig) {
30863         LDKChannelAnnouncement orig_conv;
30864         orig_conv.inner = untag_ptr(orig);
30865         orig_conv.is_owned = ptr_is_owned(orig);
30866         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30867         orig_conv.is_owned = false;
30868         LDKChannelAnnouncement ret_var = ChannelAnnouncement_clone(&orig_conv);
30869         uint64_t ret_ref = 0;
30870         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30871         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30872         return ret_ref;
30873 }
30874
30875 void  __attribute__((export_name("TS_UnsignedChannelUpdate_free"))) TS_UnsignedChannelUpdate_free(uint64_t this_obj) {
30876         LDKUnsignedChannelUpdate this_obj_conv;
30877         this_obj_conv.inner = untag_ptr(this_obj);
30878         this_obj_conv.is_owned = ptr_is_owned(this_obj);
30879         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30880         UnsignedChannelUpdate_free(this_obj_conv);
30881 }
30882
30883 int8_tArray  __attribute__((export_name("TS_UnsignedChannelUpdate_get_chain_hash"))) TS_UnsignedChannelUpdate_get_chain_hash(uint64_t this_ptr) {
30884         LDKUnsignedChannelUpdate this_ptr_conv;
30885         this_ptr_conv.inner = untag_ptr(this_ptr);
30886         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30887         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30888         this_ptr_conv.is_owned = false;
30889         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
30890         memcpy(ret_arr->elems, *UnsignedChannelUpdate_get_chain_hash(&this_ptr_conv), 32);
30891         return ret_arr;
30892 }
30893
30894 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_chain_hash"))) TS_UnsignedChannelUpdate_set_chain_hash(uint64_t this_ptr, int8_tArray val) {
30895         LDKUnsignedChannelUpdate this_ptr_conv;
30896         this_ptr_conv.inner = untag_ptr(this_ptr);
30897         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30898         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30899         this_ptr_conv.is_owned = false;
30900         LDKThirtyTwoBytes val_ref;
30901         CHECK(val->arr_len == 32);
30902         memcpy(val_ref.data, val->elems, 32); FREE(val);
30903         UnsignedChannelUpdate_set_chain_hash(&this_ptr_conv, val_ref);
30904 }
30905
30906 int64_t  __attribute__((export_name("TS_UnsignedChannelUpdate_get_short_channel_id"))) TS_UnsignedChannelUpdate_get_short_channel_id(uint64_t this_ptr) {
30907         LDKUnsignedChannelUpdate this_ptr_conv;
30908         this_ptr_conv.inner = untag_ptr(this_ptr);
30909         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30910         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30911         this_ptr_conv.is_owned = false;
30912         int64_t ret_conv = UnsignedChannelUpdate_get_short_channel_id(&this_ptr_conv);
30913         return ret_conv;
30914 }
30915
30916 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_short_channel_id"))) TS_UnsignedChannelUpdate_set_short_channel_id(uint64_t this_ptr, int64_t val) {
30917         LDKUnsignedChannelUpdate this_ptr_conv;
30918         this_ptr_conv.inner = untag_ptr(this_ptr);
30919         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30920         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30921         this_ptr_conv.is_owned = false;
30922         UnsignedChannelUpdate_set_short_channel_id(&this_ptr_conv, val);
30923 }
30924
30925 int32_t  __attribute__((export_name("TS_UnsignedChannelUpdate_get_timestamp"))) TS_UnsignedChannelUpdate_get_timestamp(uint64_t this_ptr) {
30926         LDKUnsignedChannelUpdate this_ptr_conv;
30927         this_ptr_conv.inner = untag_ptr(this_ptr);
30928         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30929         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30930         this_ptr_conv.is_owned = false;
30931         int32_t ret_conv = UnsignedChannelUpdate_get_timestamp(&this_ptr_conv);
30932         return ret_conv;
30933 }
30934
30935 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_timestamp"))) TS_UnsignedChannelUpdate_set_timestamp(uint64_t this_ptr, int32_t val) {
30936         LDKUnsignedChannelUpdate this_ptr_conv;
30937         this_ptr_conv.inner = untag_ptr(this_ptr);
30938         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30939         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30940         this_ptr_conv.is_owned = false;
30941         UnsignedChannelUpdate_set_timestamp(&this_ptr_conv, val);
30942 }
30943
30944 int8_t  __attribute__((export_name("TS_UnsignedChannelUpdate_get_flags"))) TS_UnsignedChannelUpdate_get_flags(uint64_t this_ptr) {
30945         LDKUnsignedChannelUpdate this_ptr_conv;
30946         this_ptr_conv.inner = untag_ptr(this_ptr);
30947         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30948         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30949         this_ptr_conv.is_owned = false;
30950         int8_t ret_conv = UnsignedChannelUpdate_get_flags(&this_ptr_conv);
30951         return ret_conv;
30952 }
30953
30954 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_flags"))) TS_UnsignedChannelUpdate_set_flags(uint64_t this_ptr, int8_t val) {
30955         LDKUnsignedChannelUpdate this_ptr_conv;
30956         this_ptr_conv.inner = untag_ptr(this_ptr);
30957         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30958         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30959         this_ptr_conv.is_owned = false;
30960         UnsignedChannelUpdate_set_flags(&this_ptr_conv, val);
30961 }
30962
30963 int16_t  __attribute__((export_name("TS_UnsignedChannelUpdate_get_cltv_expiry_delta"))) TS_UnsignedChannelUpdate_get_cltv_expiry_delta(uint64_t this_ptr) {
30964         LDKUnsignedChannelUpdate this_ptr_conv;
30965         this_ptr_conv.inner = untag_ptr(this_ptr);
30966         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30967         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30968         this_ptr_conv.is_owned = false;
30969         int16_t ret_conv = UnsignedChannelUpdate_get_cltv_expiry_delta(&this_ptr_conv);
30970         return ret_conv;
30971 }
30972
30973 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_cltv_expiry_delta"))) TS_UnsignedChannelUpdate_set_cltv_expiry_delta(uint64_t this_ptr, int16_t val) {
30974         LDKUnsignedChannelUpdate this_ptr_conv;
30975         this_ptr_conv.inner = untag_ptr(this_ptr);
30976         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30977         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30978         this_ptr_conv.is_owned = false;
30979         UnsignedChannelUpdate_set_cltv_expiry_delta(&this_ptr_conv, val);
30980 }
30981
30982 int64_t  __attribute__((export_name("TS_UnsignedChannelUpdate_get_htlc_minimum_msat"))) TS_UnsignedChannelUpdate_get_htlc_minimum_msat(uint64_t this_ptr) {
30983         LDKUnsignedChannelUpdate this_ptr_conv;
30984         this_ptr_conv.inner = untag_ptr(this_ptr);
30985         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30986         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30987         this_ptr_conv.is_owned = false;
30988         int64_t ret_conv = UnsignedChannelUpdate_get_htlc_minimum_msat(&this_ptr_conv);
30989         return ret_conv;
30990 }
30991
30992 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_htlc_minimum_msat"))) TS_UnsignedChannelUpdate_set_htlc_minimum_msat(uint64_t this_ptr, int64_t val) {
30993         LDKUnsignedChannelUpdate this_ptr_conv;
30994         this_ptr_conv.inner = untag_ptr(this_ptr);
30995         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30996         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30997         this_ptr_conv.is_owned = false;
30998         UnsignedChannelUpdate_set_htlc_minimum_msat(&this_ptr_conv, val);
30999 }
31000
31001 int64_t  __attribute__((export_name("TS_UnsignedChannelUpdate_get_htlc_maximum_msat"))) TS_UnsignedChannelUpdate_get_htlc_maximum_msat(uint64_t this_ptr) {
31002         LDKUnsignedChannelUpdate this_ptr_conv;
31003         this_ptr_conv.inner = untag_ptr(this_ptr);
31004         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31005         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31006         this_ptr_conv.is_owned = false;
31007         int64_t ret_conv = UnsignedChannelUpdate_get_htlc_maximum_msat(&this_ptr_conv);
31008         return ret_conv;
31009 }
31010
31011 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_htlc_maximum_msat"))) TS_UnsignedChannelUpdate_set_htlc_maximum_msat(uint64_t this_ptr, int64_t val) {
31012         LDKUnsignedChannelUpdate this_ptr_conv;
31013         this_ptr_conv.inner = untag_ptr(this_ptr);
31014         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31015         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31016         this_ptr_conv.is_owned = false;
31017         UnsignedChannelUpdate_set_htlc_maximum_msat(&this_ptr_conv, val);
31018 }
31019
31020 int32_t  __attribute__((export_name("TS_UnsignedChannelUpdate_get_fee_base_msat"))) TS_UnsignedChannelUpdate_get_fee_base_msat(uint64_t this_ptr) {
31021         LDKUnsignedChannelUpdate this_ptr_conv;
31022         this_ptr_conv.inner = untag_ptr(this_ptr);
31023         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31024         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31025         this_ptr_conv.is_owned = false;
31026         int32_t ret_conv = UnsignedChannelUpdate_get_fee_base_msat(&this_ptr_conv);
31027         return ret_conv;
31028 }
31029
31030 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_fee_base_msat"))) TS_UnsignedChannelUpdate_set_fee_base_msat(uint64_t this_ptr, int32_t val) {
31031         LDKUnsignedChannelUpdate this_ptr_conv;
31032         this_ptr_conv.inner = untag_ptr(this_ptr);
31033         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31034         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31035         this_ptr_conv.is_owned = false;
31036         UnsignedChannelUpdate_set_fee_base_msat(&this_ptr_conv, val);
31037 }
31038
31039 int32_t  __attribute__((export_name("TS_UnsignedChannelUpdate_get_fee_proportional_millionths"))) TS_UnsignedChannelUpdate_get_fee_proportional_millionths(uint64_t this_ptr) {
31040         LDKUnsignedChannelUpdate this_ptr_conv;
31041         this_ptr_conv.inner = untag_ptr(this_ptr);
31042         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31043         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31044         this_ptr_conv.is_owned = false;
31045         int32_t ret_conv = UnsignedChannelUpdate_get_fee_proportional_millionths(&this_ptr_conv);
31046         return ret_conv;
31047 }
31048
31049 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_fee_proportional_millionths"))) TS_UnsignedChannelUpdate_set_fee_proportional_millionths(uint64_t this_ptr, int32_t val) {
31050         LDKUnsignedChannelUpdate this_ptr_conv;
31051         this_ptr_conv.inner = untag_ptr(this_ptr);
31052         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31053         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31054         this_ptr_conv.is_owned = false;
31055         UnsignedChannelUpdate_set_fee_proportional_millionths(&this_ptr_conv, val);
31056 }
31057
31058 int8_tArray  __attribute__((export_name("TS_UnsignedChannelUpdate_get_excess_data"))) TS_UnsignedChannelUpdate_get_excess_data(uint64_t this_ptr) {
31059         LDKUnsignedChannelUpdate this_ptr_conv;
31060         this_ptr_conv.inner = untag_ptr(this_ptr);
31061         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31062         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31063         this_ptr_conv.is_owned = false;
31064         LDKCVec_u8Z ret_var = UnsignedChannelUpdate_get_excess_data(&this_ptr_conv);
31065         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
31066         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
31067         CVec_u8Z_free(ret_var);
31068         return ret_arr;
31069 }
31070
31071 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_excess_data"))) TS_UnsignedChannelUpdate_set_excess_data(uint64_t this_ptr, int8_tArray val) {
31072         LDKUnsignedChannelUpdate this_ptr_conv;
31073         this_ptr_conv.inner = untag_ptr(this_ptr);
31074         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31075         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31076         this_ptr_conv.is_owned = false;
31077         LDKCVec_u8Z val_ref;
31078         val_ref.datalen = val->arr_len;
31079         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
31080         memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
31081         UnsignedChannelUpdate_set_excess_data(&this_ptr_conv, val_ref);
31082 }
31083
31084 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) {
31085         LDKThirtyTwoBytes chain_hash_arg_ref;
31086         CHECK(chain_hash_arg->arr_len == 32);
31087         memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
31088         LDKCVec_u8Z excess_data_arg_ref;
31089         excess_data_arg_ref.datalen = excess_data_arg->arr_len;
31090         excess_data_arg_ref.data = MALLOC(excess_data_arg_ref.datalen, "LDKCVec_u8Z Bytes");
31091         memcpy(excess_data_arg_ref.data, excess_data_arg->elems, excess_data_arg_ref.datalen); FREE(excess_data_arg);
31092         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);
31093         uint64_t ret_ref = 0;
31094         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31095         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31096         return ret_ref;
31097 }
31098
31099 static inline uint64_t UnsignedChannelUpdate_clone_ptr(LDKUnsignedChannelUpdate *NONNULL_PTR arg) {
31100         LDKUnsignedChannelUpdate ret_var = UnsignedChannelUpdate_clone(arg);
31101         uint64_t ret_ref = 0;
31102         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31103         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31104         return ret_ref;
31105 }
31106 int64_t  __attribute__((export_name("TS_UnsignedChannelUpdate_clone_ptr"))) TS_UnsignedChannelUpdate_clone_ptr(uint64_t arg) {
31107         LDKUnsignedChannelUpdate arg_conv;
31108         arg_conv.inner = untag_ptr(arg);
31109         arg_conv.is_owned = ptr_is_owned(arg);
31110         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31111         arg_conv.is_owned = false;
31112         int64_t ret_conv = UnsignedChannelUpdate_clone_ptr(&arg_conv);
31113         return ret_conv;
31114 }
31115
31116 uint64_t  __attribute__((export_name("TS_UnsignedChannelUpdate_clone"))) TS_UnsignedChannelUpdate_clone(uint64_t orig) {
31117         LDKUnsignedChannelUpdate orig_conv;
31118         orig_conv.inner = untag_ptr(orig);
31119         orig_conv.is_owned = ptr_is_owned(orig);
31120         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31121         orig_conv.is_owned = false;
31122         LDKUnsignedChannelUpdate ret_var = UnsignedChannelUpdate_clone(&orig_conv);
31123         uint64_t ret_ref = 0;
31124         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31125         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31126         return ret_ref;
31127 }
31128
31129 void  __attribute__((export_name("TS_ChannelUpdate_free"))) TS_ChannelUpdate_free(uint64_t this_obj) {
31130         LDKChannelUpdate this_obj_conv;
31131         this_obj_conv.inner = untag_ptr(this_obj);
31132         this_obj_conv.is_owned = ptr_is_owned(this_obj);
31133         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31134         ChannelUpdate_free(this_obj_conv);
31135 }
31136
31137 int8_tArray  __attribute__((export_name("TS_ChannelUpdate_get_signature"))) TS_ChannelUpdate_get_signature(uint64_t this_ptr) {
31138         LDKChannelUpdate this_ptr_conv;
31139         this_ptr_conv.inner = untag_ptr(this_ptr);
31140         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31141         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31142         this_ptr_conv.is_owned = false;
31143         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
31144         memcpy(ret_arr->elems, ChannelUpdate_get_signature(&this_ptr_conv).compact_form, 64);
31145         return ret_arr;
31146 }
31147
31148 void  __attribute__((export_name("TS_ChannelUpdate_set_signature"))) TS_ChannelUpdate_set_signature(uint64_t this_ptr, int8_tArray val) {
31149         LDKChannelUpdate this_ptr_conv;
31150         this_ptr_conv.inner = untag_ptr(this_ptr);
31151         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31152         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31153         this_ptr_conv.is_owned = false;
31154         LDKSignature val_ref;
31155         CHECK(val->arr_len == 64);
31156         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
31157         ChannelUpdate_set_signature(&this_ptr_conv, val_ref);
31158 }
31159
31160 uint64_t  __attribute__((export_name("TS_ChannelUpdate_get_contents"))) TS_ChannelUpdate_get_contents(uint64_t this_ptr) {
31161         LDKChannelUpdate this_ptr_conv;
31162         this_ptr_conv.inner = untag_ptr(this_ptr);
31163         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31164         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31165         this_ptr_conv.is_owned = false;
31166         LDKUnsignedChannelUpdate ret_var = ChannelUpdate_get_contents(&this_ptr_conv);
31167         uint64_t ret_ref = 0;
31168         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31169         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31170         return ret_ref;
31171 }
31172
31173 void  __attribute__((export_name("TS_ChannelUpdate_set_contents"))) TS_ChannelUpdate_set_contents(uint64_t this_ptr, uint64_t val) {
31174         LDKChannelUpdate this_ptr_conv;
31175         this_ptr_conv.inner = untag_ptr(this_ptr);
31176         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31177         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31178         this_ptr_conv.is_owned = false;
31179         LDKUnsignedChannelUpdate val_conv;
31180         val_conv.inner = untag_ptr(val);
31181         val_conv.is_owned = ptr_is_owned(val);
31182         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
31183         val_conv = UnsignedChannelUpdate_clone(&val_conv);
31184         ChannelUpdate_set_contents(&this_ptr_conv, val_conv);
31185 }
31186
31187 uint64_t  __attribute__((export_name("TS_ChannelUpdate_new"))) TS_ChannelUpdate_new(int8_tArray signature_arg, uint64_t contents_arg) {
31188         LDKSignature signature_arg_ref;
31189         CHECK(signature_arg->arr_len == 64);
31190         memcpy(signature_arg_ref.compact_form, signature_arg->elems, 64); FREE(signature_arg);
31191         LDKUnsignedChannelUpdate contents_arg_conv;
31192         contents_arg_conv.inner = untag_ptr(contents_arg);
31193         contents_arg_conv.is_owned = ptr_is_owned(contents_arg);
31194         CHECK_INNER_FIELD_ACCESS_OR_NULL(contents_arg_conv);
31195         contents_arg_conv = UnsignedChannelUpdate_clone(&contents_arg_conv);
31196         LDKChannelUpdate ret_var = ChannelUpdate_new(signature_arg_ref, contents_arg_conv);
31197         uint64_t ret_ref = 0;
31198         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31199         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31200         return ret_ref;
31201 }
31202
31203 static inline uint64_t ChannelUpdate_clone_ptr(LDKChannelUpdate *NONNULL_PTR arg) {
31204         LDKChannelUpdate ret_var = ChannelUpdate_clone(arg);
31205         uint64_t ret_ref = 0;
31206         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31207         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31208         return ret_ref;
31209 }
31210 int64_t  __attribute__((export_name("TS_ChannelUpdate_clone_ptr"))) TS_ChannelUpdate_clone_ptr(uint64_t arg) {
31211         LDKChannelUpdate arg_conv;
31212         arg_conv.inner = untag_ptr(arg);
31213         arg_conv.is_owned = ptr_is_owned(arg);
31214         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31215         arg_conv.is_owned = false;
31216         int64_t ret_conv = ChannelUpdate_clone_ptr(&arg_conv);
31217         return ret_conv;
31218 }
31219
31220 uint64_t  __attribute__((export_name("TS_ChannelUpdate_clone"))) TS_ChannelUpdate_clone(uint64_t orig) {
31221         LDKChannelUpdate orig_conv;
31222         orig_conv.inner = untag_ptr(orig);
31223         orig_conv.is_owned = ptr_is_owned(orig);
31224         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31225         orig_conv.is_owned = false;
31226         LDKChannelUpdate ret_var = ChannelUpdate_clone(&orig_conv);
31227         uint64_t ret_ref = 0;
31228         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31229         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31230         return ret_ref;
31231 }
31232
31233 void  __attribute__((export_name("TS_QueryChannelRange_free"))) TS_QueryChannelRange_free(uint64_t this_obj) {
31234         LDKQueryChannelRange this_obj_conv;
31235         this_obj_conv.inner = untag_ptr(this_obj);
31236         this_obj_conv.is_owned = ptr_is_owned(this_obj);
31237         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31238         QueryChannelRange_free(this_obj_conv);
31239 }
31240
31241 int8_tArray  __attribute__((export_name("TS_QueryChannelRange_get_chain_hash"))) TS_QueryChannelRange_get_chain_hash(uint64_t this_ptr) {
31242         LDKQueryChannelRange this_ptr_conv;
31243         this_ptr_conv.inner = untag_ptr(this_ptr);
31244         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31245         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31246         this_ptr_conv.is_owned = false;
31247         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
31248         memcpy(ret_arr->elems, *QueryChannelRange_get_chain_hash(&this_ptr_conv), 32);
31249         return ret_arr;
31250 }
31251
31252 void  __attribute__((export_name("TS_QueryChannelRange_set_chain_hash"))) TS_QueryChannelRange_set_chain_hash(uint64_t this_ptr, int8_tArray val) {
31253         LDKQueryChannelRange this_ptr_conv;
31254         this_ptr_conv.inner = untag_ptr(this_ptr);
31255         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31256         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31257         this_ptr_conv.is_owned = false;
31258         LDKThirtyTwoBytes val_ref;
31259         CHECK(val->arr_len == 32);
31260         memcpy(val_ref.data, val->elems, 32); FREE(val);
31261         QueryChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
31262 }
31263
31264 int32_t  __attribute__((export_name("TS_QueryChannelRange_get_first_blocknum"))) TS_QueryChannelRange_get_first_blocknum(uint64_t this_ptr) {
31265         LDKQueryChannelRange this_ptr_conv;
31266         this_ptr_conv.inner = untag_ptr(this_ptr);
31267         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31268         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31269         this_ptr_conv.is_owned = false;
31270         int32_t ret_conv = QueryChannelRange_get_first_blocknum(&this_ptr_conv);
31271         return ret_conv;
31272 }
31273
31274 void  __attribute__((export_name("TS_QueryChannelRange_set_first_blocknum"))) TS_QueryChannelRange_set_first_blocknum(uint64_t this_ptr, int32_t val) {
31275         LDKQueryChannelRange this_ptr_conv;
31276         this_ptr_conv.inner = untag_ptr(this_ptr);
31277         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31278         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31279         this_ptr_conv.is_owned = false;
31280         QueryChannelRange_set_first_blocknum(&this_ptr_conv, val);
31281 }
31282
31283 int32_t  __attribute__((export_name("TS_QueryChannelRange_get_number_of_blocks"))) TS_QueryChannelRange_get_number_of_blocks(uint64_t this_ptr) {
31284         LDKQueryChannelRange this_ptr_conv;
31285         this_ptr_conv.inner = untag_ptr(this_ptr);
31286         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31287         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31288         this_ptr_conv.is_owned = false;
31289         int32_t ret_conv = QueryChannelRange_get_number_of_blocks(&this_ptr_conv);
31290         return ret_conv;
31291 }
31292
31293 void  __attribute__((export_name("TS_QueryChannelRange_set_number_of_blocks"))) TS_QueryChannelRange_set_number_of_blocks(uint64_t this_ptr, int32_t val) {
31294         LDKQueryChannelRange this_ptr_conv;
31295         this_ptr_conv.inner = untag_ptr(this_ptr);
31296         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31297         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31298         this_ptr_conv.is_owned = false;
31299         QueryChannelRange_set_number_of_blocks(&this_ptr_conv, val);
31300 }
31301
31302 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) {
31303         LDKThirtyTwoBytes chain_hash_arg_ref;
31304         CHECK(chain_hash_arg->arr_len == 32);
31305         memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
31306         LDKQueryChannelRange ret_var = QueryChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg);
31307         uint64_t ret_ref = 0;
31308         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31309         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31310         return ret_ref;
31311 }
31312
31313 static inline uint64_t QueryChannelRange_clone_ptr(LDKQueryChannelRange *NONNULL_PTR arg) {
31314         LDKQueryChannelRange ret_var = QueryChannelRange_clone(arg);
31315         uint64_t ret_ref = 0;
31316         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31317         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31318         return ret_ref;
31319 }
31320 int64_t  __attribute__((export_name("TS_QueryChannelRange_clone_ptr"))) TS_QueryChannelRange_clone_ptr(uint64_t arg) {
31321         LDKQueryChannelRange arg_conv;
31322         arg_conv.inner = untag_ptr(arg);
31323         arg_conv.is_owned = ptr_is_owned(arg);
31324         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31325         arg_conv.is_owned = false;
31326         int64_t ret_conv = QueryChannelRange_clone_ptr(&arg_conv);
31327         return ret_conv;
31328 }
31329
31330 uint64_t  __attribute__((export_name("TS_QueryChannelRange_clone"))) TS_QueryChannelRange_clone(uint64_t orig) {
31331         LDKQueryChannelRange orig_conv;
31332         orig_conv.inner = untag_ptr(orig);
31333         orig_conv.is_owned = ptr_is_owned(orig);
31334         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31335         orig_conv.is_owned = false;
31336         LDKQueryChannelRange ret_var = QueryChannelRange_clone(&orig_conv);
31337         uint64_t ret_ref = 0;
31338         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31339         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31340         return ret_ref;
31341 }
31342
31343 void  __attribute__((export_name("TS_ReplyChannelRange_free"))) TS_ReplyChannelRange_free(uint64_t this_obj) {
31344         LDKReplyChannelRange this_obj_conv;
31345         this_obj_conv.inner = untag_ptr(this_obj);
31346         this_obj_conv.is_owned = ptr_is_owned(this_obj);
31347         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31348         ReplyChannelRange_free(this_obj_conv);
31349 }
31350
31351 int8_tArray  __attribute__((export_name("TS_ReplyChannelRange_get_chain_hash"))) TS_ReplyChannelRange_get_chain_hash(uint64_t this_ptr) {
31352         LDKReplyChannelRange this_ptr_conv;
31353         this_ptr_conv.inner = untag_ptr(this_ptr);
31354         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31355         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31356         this_ptr_conv.is_owned = false;
31357         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
31358         memcpy(ret_arr->elems, *ReplyChannelRange_get_chain_hash(&this_ptr_conv), 32);
31359         return ret_arr;
31360 }
31361
31362 void  __attribute__((export_name("TS_ReplyChannelRange_set_chain_hash"))) TS_ReplyChannelRange_set_chain_hash(uint64_t this_ptr, int8_tArray val) {
31363         LDKReplyChannelRange this_ptr_conv;
31364         this_ptr_conv.inner = untag_ptr(this_ptr);
31365         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31366         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31367         this_ptr_conv.is_owned = false;
31368         LDKThirtyTwoBytes val_ref;
31369         CHECK(val->arr_len == 32);
31370         memcpy(val_ref.data, val->elems, 32); FREE(val);
31371         ReplyChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
31372 }
31373
31374 int32_t  __attribute__((export_name("TS_ReplyChannelRange_get_first_blocknum"))) TS_ReplyChannelRange_get_first_blocknum(uint64_t this_ptr) {
31375         LDKReplyChannelRange this_ptr_conv;
31376         this_ptr_conv.inner = untag_ptr(this_ptr);
31377         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31378         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31379         this_ptr_conv.is_owned = false;
31380         int32_t ret_conv = ReplyChannelRange_get_first_blocknum(&this_ptr_conv);
31381         return ret_conv;
31382 }
31383
31384 void  __attribute__((export_name("TS_ReplyChannelRange_set_first_blocknum"))) TS_ReplyChannelRange_set_first_blocknum(uint64_t this_ptr, int32_t val) {
31385         LDKReplyChannelRange this_ptr_conv;
31386         this_ptr_conv.inner = untag_ptr(this_ptr);
31387         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31388         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31389         this_ptr_conv.is_owned = false;
31390         ReplyChannelRange_set_first_blocknum(&this_ptr_conv, val);
31391 }
31392
31393 int32_t  __attribute__((export_name("TS_ReplyChannelRange_get_number_of_blocks"))) TS_ReplyChannelRange_get_number_of_blocks(uint64_t this_ptr) {
31394         LDKReplyChannelRange this_ptr_conv;
31395         this_ptr_conv.inner = untag_ptr(this_ptr);
31396         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31397         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31398         this_ptr_conv.is_owned = false;
31399         int32_t ret_conv = ReplyChannelRange_get_number_of_blocks(&this_ptr_conv);
31400         return ret_conv;
31401 }
31402
31403 void  __attribute__((export_name("TS_ReplyChannelRange_set_number_of_blocks"))) TS_ReplyChannelRange_set_number_of_blocks(uint64_t this_ptr, int32_t val) {
31404         LDKReplyChannelRange this_ptr_conv;
31405         this_ptr_conv.inner = untag_ptr(this_ptr);
31406         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31407         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31408         this_ptr_conv.is_owned = false;
31409         ReplyChannelRange_set_number_of_blocks(&this_ptr_conv, val);
31410 }
31411
31412 jboolean  __attribute__((export_name("TS_ReplyChannelRange_get_sync_complete"))) TS_ReplyChannelRange_get_sync_complete(uint64_t this_ptr) {
31413         LDKReplyChannelRange this_ptr_conv;
31414         this_ptr_conv.inner = untag_ptr(this_ptr);
31415         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31416         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31417         this_ptr_conv.is_owned = false;
31418         jboolean ret_conv = ReplyChannelRange_get_sync_complete(&this_ptr_conv);
31419         return ret_conv;
31420 }
31421
31422 void  __attribute__((export_name("TS_ReplyChannelRange_set_sync_complete"))) TS_ReplyChannelRange_set_sync_complete(uint64_t this_ptr, jboolean val) {
31423         LDKReplyChannelRange this_ptr_conv;
31424         this_ptr_conv.inner = untag_ptr(this_ptr);
31425         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31426         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31427         this_ptr_conv.is_owned = false;
31428         ReplyChannelRange_set_sync_complete(&this_ptr_conv, val);
31429 }
31430
31431 int64_tArray  __attribute__((export_name("TS_ReplyChannelRange_get_short_channel_ids"))) TS_ReplyChannelRange_get_short_channel_ids(uint64_t this_ptr) {
31432         LDKReplyChannelRange this_ptr_conv;
31433         this_ptr_conv.inner = untag_ptr(this_ptr);
31434         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31435         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31436         this_ptr_conv.is_owned = false;
31437         LDKCVec_u64Z ret_var = ReplyChannelRange_get_short_channel_ids(&this_ptr_conv);
31438         int64_tArray ret_arr = NULL;
31439         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
31440         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
31441         for (size_t i = 0; i < ret_var.datalen; i++) {
31442                 int64_t ret_conv_8_conv = ret_var.data[i];
31443                 ret_arr_ptr[i] = ret_conv_8_conv;
31444         }
31445         
31446         FREE(ret_var.data);
31447         return ret_arr;
31448 }
31449
31450 void  __attribute__((export_name("TS_ReplyChannelRange_set_short_channel_ids"))) TS_ReplyChannelRange_set_short_channel_ids(uint64_t this_ptr, int64_tArray val) {
31451         LDKReplyChannelRange this_ptr_conv;
31452         this_ptr_conv.inner = untag_ptr(this_ptr);
31453         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31454         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31455         this_ptr_conv.is_owned = false;
31456         LDKCVec_u64Z val_constr;
31457         val_constr.datalen = val->arr_len;
31458         if (val_constr.datalen > 0)
31459                 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
31460         else
31461                 val_constr.data = NULL;
31462         int64_t* val_vals = val->elems;
31463         for (size_t i = 0; i < val_constr.datalen; i++) {
31464                 int64_t val_conv_8 = val_vals[i];
31465                 val_constr.data[i] = val_conv_8;
31466         }
31467         FREE(val);
31468         ReplyChannelRange_set_short_channel_ids(&this_ptr_conv, val_constr);
31469 }
31470
31471 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) {
31472         LDKThirtyTwoBytes chain_hash_arg_ref;
31473         CHECK(chain_hash_arg->arr_len == 32);
31474         memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
31475         LDKCVec_u64Z short_channel_ids_arg_constr;
31476         short_channel_ids_arg_constr.datalen = short_channel_ids_arg->arr_len;
31477         if (short_channel_ids_arg_constr.datalen > 0)
31478                 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
31479         else
31480                 short_channel_ids_arg_constr.data = NULL;
31481         int64_t* short_channel_ids_arg_vals = short_channel_ids_arg->elems;
31482         for (size_t i = 0; i < short_channel_ids_arg_constr.datalen; i++) {
31483                 int64_t short_channel_ids_arg_conv_8 = short_channel_ids_arg_vals[i];
31484                 short_channel_ids_arg_constr.data[i] = short_channel_ids_arg_conv_8;
31485         }
31486         FREE(short_channel_ids_arg);
31487         LDKReplyChannelRange ret_var = ReplyChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg, sync_complete_arg, short_channel_ids_arg_constr);
31488         uint64_t ret_ref = 0;
31489         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31490         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31491         return ret_ref;
31492 }
31493
31494 static inline uint64_t ReplyChannelRange_clone_ptr(LDKReplyChannelRange *NONNULL_PTR arg) {
31495         LDKReplyChannelRange ret_var = ReplyChannelRange_clone(arg);
31496         uint64_t ret_ref = 0;
31497         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31498         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31499         return ret_ref;
31500 }
31501 int64_t  __attribute__((export_name("TS_ReplyChannelRange_clone_ptr"))) TS_ReplyChannelRange_clone_ptr(uint64_t arg) {
31502         LDKReplyChannelRange arg_conv;
31503         arg_conv.inner = untag_ptr(arg);
31504         arg_conv.is_owned = ptr_is_owned(arg);
31505         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31506         arg_conv.is_owned = false;
31507         int64_t ret_conv = ReplyChannelRange_clone_ptr(&arg_conv);
31508         return ret_conv;
31509 }
31510
31511 uint64_t  __attribute__((export_name("TS_ReplyChannelRange_clone"))) TS_ReplyChannelRange_clone(uint64_t orig) {
31512         LDKReplyChannelRange orig_conv;
31513         orig_conv.inner = untag_ptr(orig);
31514         orig_conv.is_owned = ptr_is_owned(orig);
31515         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31516         orig_conv.is_owned = false;
31517         LDKReplyChannelRange ret_var = ReplyChannelRange_clone(&orig_conv);
31518         uint64_t ret_ref = 0;
31519         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31520         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31521         return ret_ref;
31522 }
31523
31524 void  __attribute__((export_name("TS_QueryShortChannelIds_free"))) TS_QueryShortChannelIds_free(uint64_t this_obj) {
31525         LDKQueryShortChannelIds this_obj_conv;
31526         this_obj_conv.inner = untag_ptr(this_obj);
31527         this_obj_conv.is_owned = ptr_is_owned(this_obj);
31528         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31529         QueryShortChannelIds_free(this_obj_conv);
31530 }
31531
31532 int8_tArray  __attribute__((export_name("TS_QueryShortChannelIds_get_chain_hash"))) TS_QueryShortChannelIds_get_chain_hash(uint64_t this_ptr) {
31533         LDKQueryShortChannelIds this_ptr_conv;
31534         this_ptr_conv.inner = untag_ptr(this_ptr);
31535         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31536         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31537         this_ptr_conv.is_owned = false;
31538         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
31539         memcpy(ret_arr->elems, *QueryShortChannelIds_get_chain_hash(&this_ptr_conv), 32);
31540         return ret_arr;
31541 }
31542
31543 void  __attribute__((export_name("TS_QueryShortChannelIds_set_chain_hash"))) TS_QueryShortChannelIds_set_chain_hash(uint64_t this_ptr, int8_tArray val) {
31544         LDKQueryShortChannelIds this_ptr_conv;
31545         this_ptr_conv.inner = untag_ptr(this_ptr);
31546         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31547         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31548         this_ptr_conv.is_owned = false;
31549         LDKThirtyTwoBytes val_ref;
31550         CHECK(val->arr_len == 32);
31551         memcpy(val_ref.data, val->elems, 32); FREE(val);
31552         QueryShortChannelIds_set_chain_hash(&this_ptr_conv, val_ref);
31553 }
31554
31555 int64_tArray  __attribute__((export_name("TS_QueryShortChannelIds_get_short_channel_ids"))) TS_QueryShortChannelIds_get_short_channel_ids(uint64_t this_ptr) {
31556         LDKQueryShortChannelIds this_ptr_conv;
31557         this_ptr_conv.inner = untag_ptr(this_ptr);
31558         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31559         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31560         this_ptr_conv.is_owned = false;
31561         LDKCVec_u64Z ret_var = QueryShortChannelIds_get_short_channel_ids(&this_ptr_conv);
31562         int64_tArray ret_arr = NULL;
31563         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
31564         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
31565         for (size_t i = 0; i < ret_var.datalen; i++) {
31566                 int64_t ret_conv_8_conv = ret_var.data[i];
31567                 ret_arr_ptr[i] = ret_conv_8_conv;
31568         }
31569         
31570         FREE(ret_var.data);
31571         return ret_arr;
31572 }
31573
31574 void  __attribute__((export_name("TS_QueryShortChannelIds_set_short_channel_ids"))) TS_QueryShortChannelIds_set_short_channel_ids(uint64_t this_ptr, int64_tArray val) {
31575         LDKQueryShortChannelIds this_ptr_conv;
31576         this_ptr_conv.inner = untag_ptr(this_ptr);
31577         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31578         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31579         this_ptr_conv.is_owned = false;
31580         LDKCVec_u64Z val_constr;
31581         val_constr.datalen = val->arr_len;
31582         if (val_constr.datalen > 0)
31583                 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
31584         else
31585                 val_constr.data = NULL;
31586         int64_t* val_vals = val->elems;
31587         for (size_t i = 0; i < val_constr.datalen; i++) {
31588                 int64_t val_conv_8 = val_vals[i];
31589                 val_constr.data[i] = val_conv_8;
31590         }
31591         FREE(val);
31592         QueryShortChannelIds_set_short_channel_ids(&this_ptr_conv, val_constr);
31593 }
31594
31595 uint64_t  __attribute__((export_name("TS_QueryShortChannelIds_new"))) TS_QueryShortChannelIds_new(int8_tArray chain_hash_arg, int64_tArray short_channel_ids_arg) {
31596         LDKThirtyTwoBytes chain_hash_arg_ref;
31597         CHECK(chain_hash_arg->arr_len == 32);
31598         memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
31599         LDKCVec_u64Z short_channel_ids_arg_constr;
31600         short_channel_ids_arg_constr.datalen = short_channel_ids_arg->arr_len;
31601         if (short_channel_ids_arg_constr.datalen > 0)
31602                 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
31603         else
31604                 short_channel_ids_arg_constr.data = NULL;
31605         int64_t* short_channel_ids_arg_vals = short_channel_ids_arg->elems;
31606         for (size_t i = 0; i < short_channel_ids_arg_constr.datalen; i++) {
31607                 int64_t short_channel_ids_arg_conv_8 = short_channel_ids_arg_vals[i];
31608                 short_channel_ids_arg_constr.data[i] = short_channel_ids_arg_conv_8;
31609         }
31610         FREE(short_channel_ids_arg);
31611         LDKQueryShortChannelIds ret_var = QueryShortChannelIds_new(chain_hash_arg_ref, short_channel_ids_arg_constr);
31612         uint64_t ret_ref = 0;
31613         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31614         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31615         return ret_ref;
31616 }
31617
31618 static inline uint64_t QueryShortChannelIds_clone_ptr(LDKQueryShortChannelIds *NONNULL_PTR arg) {
31619         LDKQueryShortChannelIds ret_var = QueryShortChannelIds_clone(arg);
31620         uint64_t ret_ref = 0;
31621         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31622         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31623         return ret_ref;
31624 }
31625 int64_t  __attribute__((export_name("TS_QueryShortChannelIds_clone_ptr"))) TS_QueryShortChannelIds_clone_ptr(uint64_t arg) {
31626         LDKQueryShortChannelIds arg_conv;
31627         arg_conv.inner = untag_ptr(arg);
31628         arg_conv.is_owned = ptr_is_owned(arg);
31629         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31630         arg_conv.is_owned = false;
31631         int64_t ret_conv = QueryShortChannelIds_clone_ptr(&arg_conv);
31632         return ret_conv;
31633 }
31634
31635 uint64_t  __attribute__((export_name("TS_QueryShortChannelIds_clone"))) TS_QueryShortChannelIds_clone(uint64_t orig) {
31636         LDKQueryShortChannelIds orig_conv;
31637         orig_conv.inner = untag_ptr(orig);
31638         orig_conv.is_owned = ptr_is_owned(orig);
31639         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31640         orig_conv.is_owned = false;
31641         LDKQueryShortChannelIds ret_var = QueryShortChannelIds_clone(&orig_conv);
31642         uint64_t ret_ref = 0;
31643         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31644         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31645         return ret_ref;
31646 }
31647
31648 void  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_free"))) TS_ReplyShortChannelIdsEnd_free(uint64_t this_obj) {
31649         LDKReplyShortChannelIdsEnd this_obj_conv;
31650         this_obj_conv.inner = untag_ptr(this_obj);
31651         this_obj_conv.is_owned = ptr_is_owned(this_obj);
31652         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31653         ReplyShortChannelIdsEnd_free(this_obj_conv);
31654 }
31655
31656 int8_tArray  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_get_chain_hash"))) TS_ReplyShortChannelIdsEnd_get_chain_hash(uint64_t this_ptr) {
31657         LDKReplyShortChannelIdsEnd this_ptr_conv;
31658         this_ptr_conv.inner = untag_ptr(this_ptr);
31659         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31660         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31661         this_ptr_conv.is_owned = false;
31662         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
31663         memcpy(ret_arr->elems, *ReplyShortChannelIdsEnd_get_chain_hash(&this_ptr_conv), 32);
31664         return ret_arr;
31665 }
31666
31667 void  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_set_chain_hash"))) TS_ReplyShortChannelIdsEnd_set_chain_hash(uint64_t this_ptr, int8_tArray val) {
31668         LDKReplyShortChannelIdsEnd this_ptr_conv;
31669         this_ptr_conv.inner = untag_ptr(this_ptr);
31670         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31671         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31672         this_ptr_conv.is_owned = false;
31673         LDKThirtyTwoBytes val_ref;
31674         CHECK(val->arr_len == 32);
31675         memcpy(val_ref.data, val->elems, 32); FREE(val);
31676         ReplyShortChannelIdsEnd_set_chain_hash(&this_ptr_conv, val_ref);
31677 }
31678
31679 jboolean  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_get_full_information"))) TS_ReplyShortChannelIdsEnd_get_full_information(uint64_t this_ptr) {
31680         LDKReplyShortChannelIdsEnd this_ptr_conv;
31681         this_ptr_conv.inner = untag_ptr(this_ptr);
31682         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31683         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31684         this_ptr_conv.is_owned = false;
31685         jboolean ret_conv = ReplyShortChannelIdsEnd_get_full_information(&this_ptr_conv);
31686         return ret_conv;
31687 }
31688
31689 void  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_set_full_information"))) TS_ReplyShortChannelIdsEnd_set_full_information(uint64_t this_ptr, jboolean val) {
31690         LDKReplyShortChannelIdsEnd this_ptr_conv;
31691         this_ptr_conv.inner = untag_ptr(this_ptr);
31692         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31693         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31694         this_ptr_conv.is_owned = false;
31695         ReplyShortChannelIdsEnd_set_full_information(&this_ptr_conv, val);
31696 }
31697
31698 uint64_t  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_new"))) TS_ReplyShortChannelIdsEnd_new(int8_tArray chain_hash_arg, jboolean full_information_arg) {
31699         LDKThirtyTwoBytes chain_hash_arg_ref;
31700         CHECK(chain_hash_arg->arr_len == 32);
31701         memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
31702         LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_new(chain_hash_arg_ref, full_information_arg);
31703         uint64_t ret_ref = 0;
31704         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31705         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31706         return ret_ref;
31707 }
31708
31709 static inline uint64_t ReplyShortChannelIdsEnd_clone_ptr(LDKReplyShortChannelIdsEnd *NONNULL_PTR arg) {
31710         LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_clone(arg);
31711         uint64_t ret_ref = 0;
31712         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31713         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31714         return ret_ref;
31715 }
31716 int64_t  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_clone_ptr"))) TS_ReplyShortChannelIdsEnd_clone_ptr(uint64_t arg) {
31717         LDKReplyShortChannelIdsEnd arg_conv;
31718         arg_conv.inner = untag_ptr(arg);
31719         arg_conv.is_owned = ptr_is_owned(arg);
31720         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31721         arg_conv.is_owned = false;
31722         int64_t ret_conv = ReplyShortChannelIdsEnd_clone_ptr(&arg_conv);
31723         return ret_conv;
31724 }
31725
31726 uint64_t  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_clone"))) TS_ReplyShortChannelIdsEnd_clone(uint64_t orig) {
31727         LDKReplyShortChannelIdsEnd orig_conv;
31728         orig_conv.inner = untag_ptr(orig);
31729         orig_conv.is_owned = ptr_is_owned(orig);
31730         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31731         orig_conv.is_owned = false;
31732         LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_clone(&orig_conv);
31733         uint64_t ret_ref = 0;
31734         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31735         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31736         return ret_ref;
31737 }
31738
31739 void  __attribute__((export_name("TS_GossipTimestampFilter_free"))) TS_GossipTimestampFilter_free(uint64_t this_obj) {
31740         LDKGossipTimestampFilter this_obj_conv;
31741         this_obj_conv.inner = untag_ptr(this_obj);
31742         this_obj_conv.is_owned = ptr_is_owned(this_obj);
31743         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31744         GossipTimestampFilter_free(this_obj_conv);
31745 }
31746
31747 int8_tArray  __attribute__((export_name("TS_GossipTimestampFilter_get_chain_hash"))) TS_GossipTimestampFilter_get_chain_hash(uint64_t this_ptr) {
31748         LDKGossipTimestampFilter this_ptr_conv;
31749         this_ptr_conv.inner = untag_ptr(this_ptr);
31750         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31751         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31752         this_ptr_conv.is_owned = false;
31753         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
31754         memcpy(ret_arr->elems, *GossipTimestampFilter_get_chain_hash(&this_ptr_conv), 32);
31755         return ret_arr;
31756 }
31757
31758 void  __attribute__((export_name("TS_GossipTimestampFilter_set_chain_hash"))) TS_GossipTimestampFilter_set_chain_hash(uint64_t this_ptr, int8_tArray val) {
31759         LDKGossipTimestampFilter this_ptr_conv;
31760         this_ptr_conv.inner = untag_ptr(this_ptr);
31761         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31762         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31763         this_ptr_conv.is_owned = false;
31764         LDKThirtyTwoBytes val_ref;
31765         CHECK(val->arr_len == 32);
31766         memcpy(val_ref.data, val->elems, 32); FREE(val);
31767         GossipTimestampFilter_set_chain_hash(&this_ptr_conv, val_ref);
31768 }
31769
31770 int32_t  __attribute__((export_name("TS_GossipTimestampFilter_get_first_timestamp"))) TS_GossipTimestampFilter_get_first_timestamp(uint64_t this_ptr) {
31771         LDKGossipTimestampFilter this_ptr_conv;
31772         this_ptr_conv.inner = untag_ptr(this_ptr);
31773         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31774         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31775         this_ptr_conv.is_owned = false;
31776         int32_t ret_conv = GossipTimestampFilter_get_first_timestamp(&this_ptr_conv);
31777         return ret_conv;
31778 }
31779
31780 void  __attribute__((export_name("TS_GossipTimestampFilter_set_first_timestamp"))) TS_GossipTimestampFilter_set_first_timestamp(uint64_t this_ptr, int32_t val) {
31781         LDKGossipTimestampFilter this_ptr_conv;
31782         this_ptr_conv.inner = untag_ptr(this_ptr);
31783         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31784         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31785         this_ptr_conv.is_owned = false;
31786         GossipTimestampFilter_set_first_timestamp(&this_ptr_conv, val);
31787 }
31788
31789 int32_t  __attribute__((export_name("TS_GossipTimestampFilter_get_timestamp_range"))) TS_GossipTimestampFilter_get_timestamp_range(uint64_t this_ptr) {
31790         LDKGossipTimestampFilter this_ptr_conv;
31791         this_ptr_conv.inner = untag_ptr(this_ptr);
31792         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31793         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31794         this_ptr_conv.is_owned = false;
31795         int32_t ret_conv = GossipTimestampFilter_get_timestamp_range(&this_ptr_conv);
31796         return ret_conv;
31797 }
31798
31799 void  __attribute__((export_name("TS_GossipTimestampFilter_set_timestamp_range"))) TS_GossipTimestampFilter_set_timestamp_range(uint64_t this_ptr, int32_t val) {
31800         LDKGossipTimestampFilter this_ptr_conv;
31801         this_ptr_conv.inner = untag_ptr(this_ptr);
31802         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31803         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31804         this_ptr_conv.is_owned = false;
31805         GossipTimestampFilter_set_timestamp_range(&this_ptr_conv, val);
31806 }
31807
31808 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) {
31809         LDKThirtyTwoBytes chain_hash_arg_ref;
31810         CHECK(chain_hash_arg->arr_len == 32);
31811         memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
31812         LDKGossipTimestampFilter ret_var = GossipTimestampFilter_new(chain_hash_arg_ref, first_timestamp_arg, timestamp_range_arg);
31813         uint64_t ret_ref = 0;
31814         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31815         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31816         return ret_ref;
31817 }
31818
31819 static inline uint64_t GossipTimestampFilter_clone_ptr(LDKGossipTimestampFilter *NONNULL_PTR arg) {
31820         LDKGossipTimestampFilter ret_var = GossipTimestampFilter_clone(arg);
31821         uint64_t ret_ref = 0;
31822         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31823         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31824         return ret_ref;
31825 }
31826 int64_t  __attribute__((export_name("TS_GossipTimestampFilter_clone_ptr"))) TS_GossipTimestampFilter_clone_ptr(uint64_t arg) {
31827         LDKGossipTimestampFilter arg_conv;
31828         arg_conv.inner = untag_ptr(arg);
31829         arg_conv.is_owned = ptr_is_owned(arg);
31830         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31831         arg_conv.is_owned = false;
31832         int64_t ret_conv = GossipTimestampFilter_clone_ptr(&arg_conv);
31833         return ret_conv;
31834 }
31835
31836 uint64_t  __attribute__((export_name("TS_GossipTimestampFilter_clone"))) TS_GossipTimestampFilter_clone(uint64_t orig) {
31837         LDKGossipTimestampFilter orig_conv;
31838         orig_conv.inner = untag_ptr(orig);
31839         orig_conv.is_owned = ptr_is_owned(orig);
31840         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31841         orig_conv.is_owned = false;
31842         LDKGossipTimestampFilter ret_var = GossipTimestampFilter_clone(&orig_conv);
31843         uint64_t ret_ref = 0;
31844         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31845         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31846         return ret_ref;
31847 }
31848
31849 void  __attribute__((export_name("TS_ErrorAction_free"))) TS_ErrorAction_free(uint64_t this_ptr) {
31850         if (!ptr_is_owned(this_ptr)) return;
31851         void* this_ptr_ptr = untag_ptr(this_ptr);
31852         CHECK_ACCESS(this_ptr_ptr);
31853         LDKErrorAction this_ptr_conv = *(LDKErrorAction*)(this_ptr_ptr);
31854         FREE(untag_ptr(this_ptr));
31855         ErrorAction_free(this_ptr_conv);
31856 }
31857
31858 static inline uint64_t ErrorAction_clone_ptr(LDKErrorAction *NONNULL_PTR arg) {
31859         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
31860         *ret_copy = ErrorAction_clone(arg);
31861         uint64_t ret_ref = tag_ptr(ret_copy, true);
31862         return ret_ref;
31863 }
31864 int64_t  __attribute__((export_name("TS_ErrorAction_clone_ptr"))) TS_ErrorAction_clone_ptr(uint64_t arg) {
31865         LDKErrorAction* arg_conv = (LDKErrorAction*)untag_ptr(arg);
31866         int64_t ret_conv = ErrorAction_clone_ptr(arg_conv);
31867         return ret_conv;
31868 }
31869
31870 uint64_t  __attribute__((export_name("TS_ErrorAction_clone"))) TS_ErrorAction_clone(uint64_t orig) {
31871         LDKErrorAction* orig_conv = (LDKErrorAction*)untag_ptr(orig);
31872         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
31873         *ret_copy = ErrorAction_clone(orig_conv);
31874         uint64_t ret_ref = tag_ptr(ret_copy, true);
31875         return ret_ref;
31876 }
31877
31878 uint64_t  __attribute__((export_name("TS_ErrorAction_disconnect_peer"))) TS_ErrorAction_disconnect_peer(uint64_t msg) {
31879         LDKErrorMessage msg_conv;
31880         msg_conv.inner = untag_ptr(msg);
31881         msg_conv.is_owned = ptr_is_owned(msg);
31882         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
31883         msg_conv = ErrorMessage_clone(&msg_conv);
31884         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
31885         *ret_copy = ErrorAction_disconnect_peer(msg_conv);
31886         uint64_t ret_ref = tag_ptr(ret_copy, true);
31887         return ret_ref;
31888 }
31889
31890 uint64_t  __attribute__((export_name("TS_ErrorAction_ignore_error"))) TS_ErrorAction_ignore_error() {
31891         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
31892         *ret_copy = ErrorAction_ignore_error();
31893         uint64_t ret_ref = tag_ptr(ret_copy, true);
31894         return ret_ref;
31895 }
31896
31897 uint64_t  __attribute__((export_name("TS_ErrorAction_ignore_and_log"))) TS_ErrorAction_ignore_and_log(uint32_t a) {
31898         LDKLevel a_conv = LDKLevel_from_js(a);
31899         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
31900         *ret_copy = ErrorAction_ignore_and_log(a_conv);
31901         uint64_t ret_ref = tag_ptr(ret_copy, true);
31902         return ret_ref;
31903 }
31904
31905 uint64_t  __attribute__((export_name("TS_ErrorAction_ignore_duplicate_gossip"))) TS_ErrorAction_ignore_duplicate_gossip() {
31906         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
31907         *ret_copy = ErrorAction_ignore_duplicate_gossip();
31908         uint64_t ret_ref = tag_ptr(ret_copy, true);
31909         return ret_ref;
31910 }
31911
31912 uint64_t  __attribute__((export_name("TS_ErrorAction_send_error_message"))) TS_ErrorAction_send_error_message(uint64_t msg) {
31913         LDKErrorMessage msg_conv;
31914         msg_conv.inner = untag_ptr(msg);
31915         msg_conv.is_owned = ptr_is_owned(msg);
31916         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
31917         msg_conv = ErrorMessage_clone(&msg_conv);
31918         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
31919         *ret_copy = ErrorAction_send_error_message(msg_conv);
31920         uint64_t ret_ref = tag_ptr(ret_copy, true);
31921         return ret_ref;
31922 }
31923
31924 uint64_t  __attribute__((export_name("TS_ErrorAction_send_warning_message"))) TS_ErrorAction_send_warning_message(uint64_t msg, uint32_t log_level) {
31925         LDKWarningMessage msg_conv;
31926         msg_conv.inner = untag_ptr(msg);
31927         msg_conv.is_owned = ptr_is_owned(msg);
31928         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
31929         msg_conv = WarningMessage_clone(&msg_conv);
31930         LDKLevel log_level_conv = LDKLevel_from_js(log_level);
31931         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
31932         *ret_copy = ErrorAction_send_warning_message(msg_conv, log_level_conv);
31933         uint64_t ret_ref = tag_ptr(ret_copy, true);
31934         return ret_ref;
31935 }
31936
31937 void  __attribute__((export_name("TS_LightningError_free"))) TS_LightningError_free(uint64_t this_obj) {
31938         LDKLightningError this_obj_conv;
31939         this_obj_conv.inner = untag_ptr(this_obj);
31940         this_obj_conv.is_owned = ptr_is_owned(this_obj);
31941         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31942         LightningError_free(this_obj_conv);
31943 }
31944
31945 jstring  __attribute__((export_name("TS_LightningError_get_err"))) TS_LightningError_get_err(uint64_t this_ptr) {
31946         LDKLightningError this_ptr_conv;
31947         this_ptr_conv.inner = untag_ptr(this_ptr);
31948         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31949         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31950         this_ptr_conv.is_owned = false;
31951         LDKStr ret_str = LightningError_get_err(&this_ptr_conv);
31952         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
31953         Str_free(ret_str);
31954         return ret_conv;
31955 }
31956
31957 void  __attribute__((export_name("TS_LightningError_set_err"))) TS_LightningError_set_err(uint64_t this_ptr, jstring val) {
31958         LDKLightningError this_ptr_conv;
31959         this_ptr_conv.inner = untag_ptr(this_ptr);
31960         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31961         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31962         this_ptr_conv.is_owned = false;
31963         LDKStr val_conv = str_ref_to_owned_c(val);
31964         LightningError_set_err(&this_ptr_conv, val_conv);
31965 }
31966
31967 uint64_t  __attribute__((export_name("TS_LightningError_get_action"))) TS_LightningError_get_action(uint64_t this_ptr) {
31968         LDKLightningError this_ptr_conv;
31969         this_ptr_conv.inner = untag_ptr(this_ptr);
31970         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31971         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31972         this_ptr_conv.is_owned = false;
31973         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
31974         *ret_copy = LightningError_get_action(&this_ptr_conv);
31975         uint64_t ret_ref = tag_ptr(ret_copy, true);
31976         return ret_ref;
31977 }
31978
31979 void  __attribute__((export_name("TS_LightningError_set_action"))) TS_LightningError_set_action(uint64_t this_ptr, uint64_t val) {
31980         LDKLightningError this_ptr_conv;
31981         this_ptr_conv.inner = untag_ptr(this_ptr);
31982         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31983         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31984         this_ptr_conv.is_owned = false;
31985         void* val_ptr = untag_ptr(val);
31986         CHECK_ACCESS(val_ptr);
31987         LDKErrorAction val_conv = *(LDKErrorAction*)(val_ptr);
31988         val_conv = ErrorAction_clone((LDKErrorAction*)untag_ptr(val));
31989         LightningError_set_action(&this_ptr_conv, val_conv);
31990 }
31991
31992 uint64_t  __attribute__((export_name("TS_LightningError_new"))) TS_LightningError_new(jstring err_arg, uint64_t action_arg) {
31993         LDKStr err_arg_conv = str_ref_to_owned_c(err_arg);
31994         void* action_arg_ptr = untag_ptr(action_arg);
31995         CHECK_ACCESS(action_arg_ptr);
31996         LDKErrorAction action_arg_conv = *(LDKErrorAction*)(action_arg_ptr);
31997         action_arg_conv = ErrorAction_clone((LDKErrorAction*)untag_ptr(action_arg));
31998         LDKLightningError ret_var = LightningError_new(err_arg_conv, action_arg_conv);
31999         uint64_t ret_ref = 0;
32000         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32001         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32002         return ret_ref;
32003 }
32004
32005 static inline uint64_t LightningError_clone_ptr(LDKLightningError *NONNULL_PTR arg) {
32006         LDKLightningError ret_var = LightningError_clone(arg);
32007         uint64_t ret_ref = 0;
32008         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32009         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32010         return ret_ref;
32011 }
32012 int64_t  __attribute__((export_name("TS_LightningError_clone_ptr"))) TS_LightningError_clone_ptr(uint64_t arg) {
32013         LDKLightningError arg_conv;
32014         arg_conv.inner = untag_ptr(arg);
32015         arg_conv.is_owned = ptr_is_owned(arg);
32016         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32017         arg_conv.is_owned = false;
32018         int64_t ret_conv = LightningError_clone_ptr(&arg_conv);
32019         return ret_conv;
32020 }
32021
32022 uint64_t  __attribute__((export_name("TS_LightningError_clone"))) TS_LightningError_clone(uint64_t orig) {
32023         LDKLightningError orig_conv;
32024         orig_conv.inner = untag_ptr(orig);
32025         orig_conv.is_owned = ptr_is_owned(orig);
32026         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32027         orig_conv.is_owned = false;
32028         LDKLightningError ret_var = LightningError_clone(&orig_conv);
32029         uint64_t ret_ref = 0;
32030         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32031         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32032         return ret_ref;
32033 }
32034
32035 void  __attribute__((export_name("TS_CommitmentUpdate_free"))) TS_CommitmentUpdate_free(uint64_t this_obj) {
32036         LDKCommitmentUpdate this_obj_conv;
32037         this_obj_conv.inner = untag_ptr(this_obj);
32038         this_obj_conv.is_owned = ptr_is_owned(this_obj);
32039         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32040         CommitmentUpdate_free(this_obj_conv);
32041 }
32042
32043 uint64_tArray  __attribute__((export_name("TS_CommitmentUpdate_get_update_add_htlcs"))) TS_CommitmentUpdate_get_update_add_htlcs(uint64_t this_ptr) {
32044         LDKCommitmentUpdate this_ptr_conv;
32045         this_ptr_conv.inner = untag_ptr(this_ptr);
32046         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32047         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32048         this_ptr_conv.is_owned = false;
32049         LDKCVec_UpdateAddHTLCZ ret_var = CommitmentUpdate_get_update_add_htlcs(&this_ptr_conv);
32050         uint64_tArray ret_arr = NULL;
32051         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
32052         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
32053         for (size_t p = 0; p < ret_var.datalen; p++) {
32054                 LDKUpdateAddHTLC ret_conv_15_var = ret_var.data[p];
32055                 uint64_t ret_conv_15_ref = 0;
32056                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_15_var);
32057                 ret_conv_15_ref = tag_ptr(ret_conv_15_var.inner, ret_conv_15_var.is_owned);
32058                 ret_arr_ptr[p] = ret_conv_15_ref;
32059         }
32060         
32061         FREE(ret_var.data);
32062         return ret_arr;
32063 }
32064
32065 void  __attribute__((export_name("TS_CommitmentUpdate_set_update_add_htlcs"))) TS_CommitmentUpdate_set_update_add_htlcs(uint64_t this_ptr, uint64_tArray val) {
32066         LDKCommitmentUpdate this_ptr_conv;
32067         this_ptr_conv.inner = untag_ptr(this_ptr);
32068         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32069         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32070         this_ptr_conv.is_owned = false;
32071         LDKCVec_UpdateAddHTLCZ val_constr;
32072         val_constr.datalen = val->arr_len;
32073         if (val_constr.datalen > 0)
32074                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
32075         else
32076                 val_constr.data = NULL;
32077         uint64_t* val_vals = val->elems;
32078         for (size_t p = 0; p < val_constr.datalen; p++) {
32079                 uint64_t val_conv_15 = val_vals[p];
32080                 LDKUpdateAddHTLC val_conv_15_conv;
32081                 val_conv_15_conv.inner = untag_ptr(val_conv_15);
32082                 val_conv_15_conv.is_owned = ptr_is_owned(val_conv_15);
32083                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_15_conv);
32084                 val_conv_15_conv = UpdateAddHTLC_clone(&val_conv_15_conv);
32085                 val_constr.data[p] = val_conv_15_conv;
32086         }
32087         FREE(val);
32088         CommitmentUpdate_set_update_add_htlcs(&this_ptr_conv, val_constr);
32089 }
32090
32091 uint64_tArray  __attribute__((export_name("TS_CommitmentUpdate_get_update_fulfill_htlcs"))) TS_CommitmentUpdate_get_update_fulfill_htlcs(uint64_t this_ptr) {
32092         LDKCommitmentUpdate this_ptr_conv;
32093         this_ptr_conv.inner = untag_ptr(this_ptr);
32094         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32095         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32096         this_ptr_conv.is_owned = false;
32097         LDKCVec_UpdateFulfillHTLCZ ret_var = CommitmentUpdate_get_update_fulfill_htlcs(&this_ptr_conv);
32098         uint64_tArray ret_arr = NULL;
32099         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
32100         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
32101         for (size_t t = 0; t < ret_var.datalen; t++) {
32102                 LDKUpdateFulfillHTLC ret_conv_19_var = ret_var.data[t];
32103                 uint64_t ret_conv_19_ref = 0;
32104                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_19_var);
32105                 ret_conv_19_ref = tag_ptr(ret_conv_19_var.inner, ret_conv_19_var.is_owned);
32106                 ret_arr_ptr[t] = ret_conv_19_ref;
32107         }
32108         
32109         FREE(ret_var.data);
32110         return ret_arr;
32111 }
32112
32113 void  __attribute__((export_name("TS_CommitmentUpdate_set_update_fulfill_htlcs"))) TS_CommitmentUpdate_set_update_fulfill_htlcs(uint64_t this_ptr, uint64_tArray val) {
32114         LDKCommitmentUpdate this_ptr_conv;
32115         this_ptr_conv.inner = untag_ptr(this_ptr);
32116         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32117         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32118         this_ptr_conv.is_owned = false;
32119         LDKCVec_UpdateFulfillHTLCZ val_constr;
32120         val_constr.datalen = val->arr_len;
32121         if (val_constr.datalen > 0)
32122                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
32123         else
32124                 val_constr.data = NULL;
32125         uint64_t* val_vals = val->elems;
32126         for (size_t t = 0; t < val_constr.datalen; t++) {
32127                 uint64_t val_conv_19 = val_vals[t];
32128                 LDKUpdateFulfillHTLC val_conv_19_conv;
32129                 val_conv_19_conv.inner = untag_ptr(val_conv_19);
32130                 val_conv_19_conv.is_owned = ptr_is_owned(val_conv_19);
32131                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_19_conv);
32132                 val_conv_19_conv = UpdateFulfillHTLC_clone(&val_conv_19_conv);
32133                 val_constr.data[t] = val_conv_19_conv;
32134         }
32135         FREE(val);
32136         CommitmentUpdate_set_update_fulfill_htlcs(&this_ptr_conv, val_constr);
32137 }
32138
32139 uint64_tArray  __attribute__((export_name("TS_CommitmentUpdate_get_update_fail_htlcs"))) TS_CommitmentUpdate_get_update_fail_htlcs(uint64_t this_ptr) {
32140         LDKCommitmentUpdate this_ptr_conv;
32141         this_ptr_conv.inner = untag_ptr(this_ptr);
32142         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32143         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32144         this_ptr_conv.is_owned = false;
32145         LDKCVec_UpdateFailHTLCZ ret_var = CommitmentUpdate_get_update_fail_htlcs(&this_ptr_conv);
32146         uint64_tArray ret_arr = NULL;
32147         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
32148         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
32149         for (size_t q = 0; q < ret_var.datalen; q++) {
32150                 LDKUpdateFailHTLC ret_conv_16_var = ret_var.data[q];
32151                 uint64_t ret_conv_16_ref = 0;
32152                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
32153                 ret_conv_16_ref = tag_ptr(ret_conv_16_var.inner, ret_conv_16_var.is_owned);
32154                 ret_arr_ptr[q] = ret_conv_16_ref;
32155         }
32156         
32157         FREE(ret_var.data);
32158         return ret_arr;
32159 }
32160
32161 void  __attribute__((export_name("TS_CommitmentUpdate_set_update_fail_htlcs"))) TS_CommitmentUpdate_set_update_fail_htlcs(uint64_t this_ptr, uint64_tArray val) {
32162         LDKCommitmentUpdate this_ptr_conv;
32163         this_ptr_conv.inner = untag_ptr(this_ptr);
32164         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32165         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32166         this_ptr_conv.is_owned = false;
32167         LDKCVec_UpdateFailHTLCZ val_constr;
32168         val_constr.datalen = val->arr_len;
32169         if (val_constr.datalen > 0)
32170                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
32171         else
32172                 val_constr.data = NULL;
32173         uint64_t* val_vals = val->elems;
32174         for (size_t q = 0; q < val_constr.datalen; q++) {
32175                 uint64_t val_conv_16 = val_vals[q];
32176                 LDKUpdateFailHTLC val_conv_16_conv;
32177                 val_conv_16_conv.inner = untag_ptr(val_conv_16);
32178                 val_conv_16_conv.is_owned = ptr_is_owned(val_conv_16);
32179                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_16_conv);
32180                 val_conv_16_conv = UpdateFailHTLC_clone(&val_conv_16_conv);
32181                 val_constr.data[q] = val_conv_16_conv;
32182         }
32183         FREE(val);
32184         CommitmentUpdate_set_update_fail_htlcs(&this_ptr_conv, val_constr);
32185 }
32186
32187 uint64_tArray  __attribute__((export_name("TS_CommitmentUpdate_get_update_fail_malformed_htlcs"))) TS_CommitmentUpdate_get_update_fail_malformed_htlcs(uint64_t this_ptr) {
32188         LDKCommitmentUpdate this_ptr_conv;
32189         this_ptr_conv.inner = untag_ptr(this_ptr);
32190         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32191         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32192         this_ptr_conv.is_owned = false;
32193         LDKCVec_UpdateFailMalformedHTLCZ ret_var = CommitmentUpdate_get_update_fail_malformed_htlcs(&this_ptr_conv);
32194         uint64_tArray ret_arr = NULL;
32195         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
32196         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
32197         for (size_t z = 0; z < ret_var.datalen; z++) {
32198                 LDKUpdateFailMalformedHTLC ret_conv_25_var = ret_var.data[z];
32199                 uint64_t ret_conv_25_ref = 0;
32200                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_25_var);
32201                 ret_conv_25_ref = tag_ptr(ret_conv_25_var.inner, ret_conv_25_var.is_owned);
32202                 ret_arr_ptr[z] = ret_conv_25_ref;
32203         }
32204         
32205         FREE(ret_var.data);
32206         return ret_arr;
32207 }
32208
32209 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) {
32210         LDKCommitmentUpdate this_ptr_conv;
32211         this_ptr_conv.inner = untag_ptr(this_ptr);
32212         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32213         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32214         this_ptr_conv.is_owned = false;
32215         LDKCVec_UpdateFailMalformedHTLCZ val_constr;
32216         val_constr.datalen = val->arr_len;
32217         if (val_constr.datalen > 0)
32218                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
32219         else
32220                 val_constr.data = NULL;
32221         uint64_t* val_vals = val->elems;
32222         for (size_t z = 0; z < val_constr.datalen; z++) {
32223                 uint64_t val_conv_25 = val_vals[z];
32224                 LDKUpdateFailMalformedHTLC val_conv_25_conv;
32225                 val_conv_25_conv.inner = untag_ptr(val_conv_25);
32226                 val_conv_25_conv.is_owned = ptr_is_owned(val_conv_25);
32227                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_25_conv);
32228                 val_conv_25_conv = UpdateFailMalformedHTLC_clone(&val_conv_25_conv);
32229                 val_constr.data[z] = val_conv_25_conv;
32230         }
32231         FREE(val);
32232         CommitmentUpdate_set_update_fail_malformed_htlcs(&this_ptr_conv, val_constr);
32233 }
32234
32235 uint64_t  __attribute__((export_name("TS_CommitmentUpdate_get_update_fee"))) TS_CommitmentUpdate_get_update_fee(uint64_t this_ptr) {
32236         LDKCommitmentUpdate this_ptr_conv;
32237         this_ptr_conv.inner = untag_ptr(this_ptr);
32238         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32239         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32240         this_ptr_conv.is_owned = false;
32241         LDKUpdateFee ret_var = CommitmentUpdate_get_update_fee(&this_ptr_conv);
32242         uint64_t ret_ref = 0;
32243         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32244         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32245         return ret_ref;
32246 }
32247
32248 void  __attribute__((export_name("TS_CommitmentUpdate_set_update_fee"))) TS_CommitmentUpdate_set_update_fee(uint64_t this_ptr, uint64_t val) {
32249         LDKCommitmentUpdate this_ptr_conv;
32250         this_ptr_conv.inner = untag_ptr(this_ptr);
32251         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32252         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32253         this_ptr_conv.is_owned = false;
32254         LDKUpdateFee val_conv;
32255         val_conv.inner = untag_ptr(val);
32256         val_conv.is_owned = ptr_is_owned(val);
32257         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
32258         val_conv = UpdateFee_clone(&val_conv);
32259         CommitmentUpdate_set_update_fee(&this_ptr_conv, val_conv);
32260 }
32261
32262 uint64_t  __attribute__((export_name("TS_CommitmentUpdate_get_commitment_signed"))) TS_CommitmentUpdate_get_commitment_signed(uint64_t this_ptr) {
32263         LDKCommitmentUpdate this_ptr_conv;
32264         this_ptr_conv.inner = untag_ptr(this_ptr);
32265         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32266         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32267         this_ptr_conv.is_owned = false;
32268         LDKCommitmentSigned ret_var = CommitmentUpdate_get_commitment_signed(&this_ptr_conv);
32269         uint64_t ret_ref = 0;
32270         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32271         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32272         return ret_ref;
32273 }
32274
32275 void  __attribute__((export_name("TS_CommitmentUpdate_set_commitment_signed"))) TS_CommitmentUpdate_set_commitment_signed(uint64_t this_ptr, uint64_t val) {
32276         LDKCommitmentUpdate this_ptr_conv;
32277         this_ptr_conv.inner = untag_ptr(this_ptr);
32278         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32279         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32280         this_ptr_conv.is_owned = false;
32281         LDKCommitmentSigned val_conv;
32282         val_conv.inner = untag_ptr(val);
32283         val_conv.is_owned = ptr_is_owned(val);
32284         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
32285         val_conv = CommitmentSigned_clone(&val_conv);
32286         CommitmentUpdate_set_commitment_signed(&this_ptr_conv, val_conv);
32287 }
32288
32289 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) {
32290         LDKCVec_UpdateAddHTLCZ update_add_htlcs_arg_constr;
32291         update_add_htlcs_arg_constr.datalen = update_add_htlcs_arg->arr_len;
32292         if (update_add_htlcs_arg_constr.datalen > 0)
32293                 update_add_htlcs_arg_constr.data = MALLOC(update_add_htlcs_arg_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
32294         else
32295                 update_add_htlcs_arg_constr.data = NULL;
32296         uint64_t* update_add_htlcs_arg_vals = update_add_htlcs_arg->elems;
32297         for (size_t p = 0; p < update_add_htlcs_arg_constr.datalen; p++) {
32298                 uint64_t update_add_htlcs_arg_conv_15 = update_add_htlcs_arg_vals[p];
32299                 LDKUpdateAddHTLC update_add_htlcs_arg_conv_15_conv;
32300                 update_add_htlcs_arg_conv_15_conv.inner = untag_ptr(update_add_htlcs_arg_conv_15);
32301                 update_add_htlcs_arg_conv_15_conv.is_owned = ptr_is_owned(update_add_htlcs_arg_conv_15);
32302                 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_add_htlcs_arg_conv_15_conv);
32303                 update_add_htlcs_arg_conv_15_conv = UpdateAddHTLC_clone(&update_add_htlcs_arg_conv_15_conv);
32304                 update_add_htlcs_arg_constr.data[p] = update_add_htlcs_arg_conv_15_conv;
32305         }
32306         FREE(update_add_htlcs_arg);
32307         LDKCVec_UpdateFulfillHTLCZ update_fulfill_htlcs_arg_constr;
32308         update_fulfill_htlcs_arg_constr.datalen = update_fulfill_htlcs_arg->arr_len;
32309         if (update_fulfill_htlcs_arg_constr.datalen > 0)
32310                 update_fulfill_htlcs_arg_constr.data = MALLOC(update_fulfill_htlcs_arg_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
32311         else
32312                 update_fulfill_htlcs_arg_constr.data = NULL;
32313         uint64_t* update_fulfill_htlcs_arg_vals = update_fulfill_htlcs_arg->elems;
32314         for (size_t t = 0; t < update_fulfill_htlcs_arg_constr.datalen; t++) {
32315                 uint64_t update_fulfill_htlcs_arg_conv_19 = update_fulfill_htlcs_arg_vals[t];
32316                 LDKUpdateFulfillHTLC update_fulfill_htlcs_arg_conv_19_conv;
32317                 update_fulfill_htlcs_arg_conv_19_conv.inner = untag_ptr(update_fulfill_htlcs_arg_conv_19);
32318                 update_fulfill_htlcs_arg_conv_19_conv.is_owned = ptr_is_owned(update_fulfill_htlcs_arg_conv_19);
32319                 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fulfill_htlcs_arg_conv_19_conv);
32320                 update_fulfill_htlcs_arg_conv_19_conv = UpdateFulfillHTLC_clone(&update_fulfill_htlcs_arg_conv_19_conv);
32321                 update_fulfill_htlcs_arg_constr.data[t] = update_fulfill_htlcs_arg_conv_19_conv;
32322         }
32323         FREE(update_fulfill_htlcs_arg);
32324         LDKCVec_UpdateFailHTLCZ update_fail_htlcs_arg_constr;
32325         update_fail_htlcs_arg_constr.datalen = update_fail_htlcs_arg->arr_len;
32326         if (update_fail_htlcs_arg_constr.datalen > 0)
32327                 update_fail_htlcs_arg_constr.data = MALLOC(update_fail_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
32328         else
32329                 update_fail_htlcs_arg_constr.data = NULL;
32330         uint64_t* update_fail_htlcs_arg_vals = update_fail_htlcs_arg->elems;
32331         for (size_t q = 0; q < update_fail_htlcs_arg_constr.datalen; q++) {
32332                 uint64_t update_fail_htlcs_arg_conv_16 = update_fail_htlcs_arg_vals[q];
32333                 LDKUpdateFailHTLC update_fail_htlcs_arg_conv_16_conv;
32334                 update_fail_htlcs_arg_conv_16_conv.inner = untag_ptr(update_fail_htlcs_arg_conv_16);
32335                 update_fail_htlcs_arg_conv_16_conv.is_owned = ptr_is_owned(update_fail_htlcs_arg_conv_16);
32336                 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fail_htlcs_arg_conv_16_conv);
32337                 update_fail_htlcs_arg_conv_16_conv = UpdateFailHTLC_clone(&update_fail_htlcs_arg_conv_16_conv);
32338                 update_fail_htlcs_arg_constr.data[q] = update_fail_htlcs_arg_conv_16_conv;
32339         }
32340         FREE(update_fail_htlcs_arg);
32341         LDKCVec_UpdateFailMalformedHTLCZ update_fail_malformed_htlcs_arg_constr;
32342         update_fail_malformed_htlcs_arg_constr.datalen = update_fail_malformed_htlcs_arg->arr_len;
32343         if (update_fail_malformed_htlcs_arg_constr.datalen > 0)
32344                 update_fail_malformed_htlcs_arg_constr.data = MALLOC(update_fail_malformed_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
32345         else
32346                 update_fail_malformed_htlcs_arg_constr.data = NULL;
32347         uint64_t* update_fail_malformed_htlcs_arg_vals = update_fail_malformed_htlcs_arg->elems;
32348         for (size_t z = 0; z < update_fail_malformed_htlcs_arg_constr.datalen; z++) {
32349                 uint64_t update_fail_malformed_htlcs_arg_conv_25 = update_fail_malformed_htlcs_arg_vals[z];
32350                 LDKUpdateFailMalformedHTLC update_fail_malformed_htlcs_arg_conv_25_conv;
32351                 update_fail_malformed_htlcs_arg_conv_25_conv.inner = untag_ptr(update_fail_malformed_htlcs_arg_conv_25);
32352                 update_fail_malformed_htlcs_arg_conv_25_conv.is_owned = ptr_is_owned(update_fail_malformed_htlcs_arg_conv_25);
32353                 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fail_malformed_htlcs_arg_conv_25_conv);
32354                 update_fail_malformed_htlcs_arg_conv_25_conv = UpdateFailMalformedHTLC_clone(&update_fail_malformed_htlcs_arg_conv_25_conv);
32355                 update_fail_malformed_htlcs_arg_constr.data[z] = update_fail_malformed_htlcs_arg_conv_25_conv;
32356         }
32357         FREE(update_fail_malformed_htlcs_arg);
32358         LDKUpdateFee update_fee_arg_conv;
32359         update_fee_arg_conv.inner = untag_ptr(update_fee_arg);
32360         update_fee_arg_conv.is_owned = ptr_is_owned(update_fee_arg);
32361         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fee_arg_conv);
32362         update_fee_arg_conv = UpdateFee_clone(&update_fee_arg_conv);
32363         LDKCommitmentSigned commitment_signed_arg_conv;
32364         commitment_signed_arg_conv.inner = untag_ptr(commitment_signed_arg);
32365         commitment_signed_arg_conv.is_owned = ptr_is_owned(commitment_signed_arg);
32366         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_signed_arg_conv);
32367         commitment_signed_arg_conv = CommitmentSigned_clone(&commitment_signed_arg_conv);
32368         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);
32369         uint64_t ret_ref = 0;
32370         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32371         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32372         return ret_ref;
32373 }
32374
32375 static inline uint64_t CommitmentUpdate_clone_ptr(LDKCommitmentUpdate *NONNULL_PTR arg) {
32376         LDKCommitmentUpdate ret_var = CommitmentUpdate_clone(arg);
32377         uint64_t ret_ref = 0;
32378         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32379         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32380         return ret_ref;
32381 }
32382 int64_t  __attribute__((export_name("TS_CommitmentUpdate_clone_ptr"))) TS_CommitmentUpdate_clone_ptr(uint64_t arg) {
32383         LDKCommitmentUpdate arg_conv;
32384         arg_conv.inner = untag_ptr(arg);
32385         arg_conv.is_owned = ptr_is_owned(arg);
32386         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32387         arg_conv.is_owned = false;
32388         int64_t ret_conv = CommitmentUpdate_clone_ptr(&arg_conv);
32389         return ret_conv;
32390 }
32391
32392 uint64_t  __attribute__((export_name("TS_CommitmentUpdate_clone"))) TS_CommitmentUpdate_clone(uint64_t orig) {
32393         LDKCommitmentUpdate orig_conv;
32394         orig_conv.inner = untag_ptr(orig);
32395         orig_conv.is_owned = ptr_is_owned(orig);
32396         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32397         orig_conv.is_owned = false;
32398         LDKCommitmentUpdate ret_var = CommitmentUpdate_clone(&orig_conv);
32399         uint64_t ret_ref = 0;
32400         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32401         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32402         return ret_ref;
32403 }
32404
32405 void  __attribute__((export_name("TS_ChannelMessageHandler_free"))) TS_ChannelMessageHandler_free(uint64_t this_ptr) {
32406         if (!ptr_is_owned(this_ptr)) return;
32407         void* this_ptr_ptr = untag_ptr(this_ptr);
32408         CHECK_ACCESS(this_ptr_ptr);
32409         LDKChannelMessageHandler this_ptr_conv = *(LDKChannelMessageHandler*)(this_ptr_ptr);
32410         FREE(untag_ptr(this_ptr));
32411         ChannelMessageHandler_free(this_ptr_conv);
32412 }
32413
32414 void  __attribute__((export_name("TS_RoutingMessageHandler_free"))) TS_RoutingMessageHandler_free(uint64_t this_ptr) {
32415         if (!ptr_is_owned(this_ptr)) return;
32416         void* this_ptr_ptr = untag_ptr(this_ptr);
32417         CHECK_ACCESS(this_ptr_ptr);
32418         LDKRoutingMessageHandler this_ptr_conv = *(LDKRoutingMessageHandler*)(this_ptr_ptr);
32419         FREE(untag_ptr(this_ptr));
32420         RoutingMessageHandler_free(this_ptr_conv);
32421 }
32422
32423 int8_tArray  __attribute__((export_name("TS_AcceptChannel_write"))) TS_AcceptChannel_write(uint64_t obj) {
32424         LDKAcceptChannel obj_conv;
32425         obj_conv.inner = untag_ptr(obj);
32426         obj_conv.is_owned = ptr_is_owned(obj);
32427         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
32428         obj_conv.is_owned = false;
32429         LDKCVec_u8Z ret_var = AcceptChannel_write(&obj_conv);
32430         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
32431         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
32432         CVec_u8Z_free(ret_var);
32433         return ret_arr;
32434 }
32435
32436 uint64_t  __attribute__((export_name("TS_AcceptChannel_read"))) TS_AcceptChannel_read(int8_tArray ser) {
32437         LDKu8slice ser_ref;
32438         ser_ref.datalen = ser->arr_len;
32439         ser_ref.data = ser->elems;
32440         LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
32441         *ret_conv = AcceptChannel_read(ser_ref);
32442         FREE(ser);
32443         return tag_ptr(ret_conv, true);
32444 }
32445
32446 int8_tArray  __attribute__((export_name("TS_AnnouncementSignatures_write"))) TS_AnnouncementSignatures_write(uint64_t obj) {
32447         LDKAnnouncementSignatures obj_conv;
32448         obj_conv.inner = untag_ptr(obj);
32449         obj_conv.is_owned = ptr_is_owned(obj);
32450         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
32451         obj_conv.is_owned = false;
32452         LDKCVec_u8Z ret_var = AnnouncementSignatures_write(&obj_conv);
32453         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
32454         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
32455         CVec_u8Z_free(ret_var);
32456         return ret_arr;
32457 }
32458
32459 uint64_t  __attribute__((export_name("TS_AnnouncementSignatures_read"))) TS_AnnouncementSignatures_read(int8_tArray ser) {
32460         LDKu8slice ser_ref;
32461         ser_ref.datalen = ser->arr_len;
32462         ser_ref.data = ser->elems;
32463         LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
32464         *ret_conv = AnnouncementSignatures_read(ser_ref);
32465         FREE(ser);
32466         return tag_ptr(ret_conv, true);
32467 }
32468
32469 int8_tArray  __attribute__((export_name("TS_ChannelReestablish_write"))) TS_ChannelReestablish_write(uint64_t obj) {
32470         LDKChannelReestablish obj_conv;
32471         obj_conv.inner = untag_ptr(obj);
32472         obj_conv.is_owned = ptr_is_owned(obj);
32473         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
32474         obj_conv.is_owned = false;
32475         LDKCVec_u8Z ret_var = ChannelReestablish_write(&obj_conv);
32476         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
32477         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
32478         CVec_u8Z_free(ret_var);
32479         return ret_arr;
32480 }
32481
32482 uint64_t  __attribute__((export_name("TS_ChannelReestablish_read"))) TS_ChannelReestablish_read(int8_tArray ser) {
32483         LDKu8slice ser_ref;
32484         ser_ref.datalen = ser->arr_len;
32485         ser_ref.data = ser->elems;
32486         LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
32487         *ret_conv = ChannelReestablish_read(ser_ref);
32488         FREE(ser);
32489         return tag_ptr(ret_conv, true);
32490 }
32491
32492 int8_tArray  __attribute__((export_name("TS_ClosingSigned_write"))) TS_ClosingSigned_write(uint64_t obj) {
32493         LDKClosingSigned obj_conv;
32494         obj_conv.inner = untag_ptr(obj);
32495         obj_conv.is_owned = ptr_is_owned(obj);
32496         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
32497         obj_conv.is_owned = false;
32498         LDKCVec_u8Z ret_var = ClosingSigned_write(&obj_conv);
32499         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
32500         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
32501         CVec_u8Z_free(ret_var);
32502         return ret_arr;
32503 }
32504
32505 uint64_t  __attribute__((export_name("TS_ClosingSigned_read"))) TS_ClosingSigned_read(int8_tArray ser) {
32506         LDKu8slice ser_ref;
32507         ser_ref.datalen = ser->arr_len;
32508         ser_ref.data = ser->elems;
32509         LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
32510         *ret_conv = ClosingSigned_read(ser_ref);
32511         FREE(ser);
32512         return tag_ptr(ret_conv, true);
32513 }
32514
32515 int8_tArray  __attribute__((export_name("TS_ClosingSignedFeeRange_write"))) TS_ClosingSignedFeeRange_write(uint64_t obj) {
32516         LDKClosingSignedFeeRange obj_conv;
32517         obj_conv.inner = untag_ptr(obj);
32518         obj_conv.is_owned = ptr_is_owned(obj);
32519         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
32520         obj_conv.is_owned = false;
32521         LDKCVec_u8Z ret_var = ClosingSignedFeeRange_write(&obj_conv);
32522         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
32523         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
32524         CVec_u8Z_free(ret_var);
32525         return ret_arr;
32526 }
32527
32528 uint64_t  __attribute__((export_name("TS_ClosingSignedFeeRange_read"))) TS_ClosingSignedFeeRange_read(int8_tArray ser) {
32529         LDKu8slice ser_ref;
32530         ser_ref.datalen = ser->arr_len;
32531         ser_ref.data = ser->elems;
32532         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
32533         *ret_conv = ClosingSignedFeeRange_read(ser_ref);
32534         FREE(ser);
32535         return tag_ptr(ret_conv, true);
32536 }
32537
32538 int8_tArray  __attribute__((export_name("TS_CommitmentSigned_write"))) TS_CommitmentSigned_write(uint64_t obj) {
32539         LDKCommitmentSigned obj_conv;
32540         obj_conv.inner = untag_ptr(obj);
32541         obj_conv.is_owned = ptr_is_owned(obj);
32542         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
32543         obj_conv.is_owned = false;
32544         LDKCVec_u8Z ret_var = CommitmentSigned_write(&obj_conv);
32545         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
32546         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
32547         CVec_u8Z_free(ret_var);
32548         return ret_arr;
32549 }
32550
32551 uint64_t  __attribute__((export_name("TS_CommitmentSigned_read"))) TS_CommitmentSigned_read(int8_tArray ser) {
32552         LDKu8slice ser_ref;
32553         ser_ref.datalen = ser->arr_len;
32554         ser_ref.data = ser->elems;
32555         LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
32556         *ret_conv = CommitmentSigned_read(ser_ref);
32557         FREE(ser);
32558         return tag_ptr(ret_conv, true);
32559 }
32560
32561 int8_tArray  __attribute__((export_name("TS_FundingCreated_write"))) TS_FundingCreated_write(uint64_t obj) {
32562         LDKFundingCreated obj_conv;
32563         obj_conv.inner = untag_ptr(obj);
32564         obj_conv.is_owned = ptr_is_owned(obj);
32565         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
32566         obj_conv.is_owned = false;
32567         LDKCVec_u8Z ret_var = FundingCreated_write(&obj_conv);
32568         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
32569         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
32570         CVec_u8Z_free(ret_var);
32571         return ret_arr;
32572 }
32573
32574 uint64_t  __attribute__((export_name("TS_FundingCreated_read"))) TS_FundingCreated_read(int8_tArray ser) {
32575         LDKu8slice ser_ref;
32576         ser_ref.datalen = ser->arr_len;
32577         ser_ref.data = ser->elems;
32578         LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
32579         *ret_conv = FundingCreated_read(ser_ref);
32580         FREE(ser);
32581         return tag_ptr(ret_conv, true);
32582 }
32583
32584 int8_tArray  __attribute__((export_name("TS_FundingSigned_write"))) TS_FundingSigned_write(uint64_t obj) {
32585         LDKFundingSigned obj_conv;
32586         obj_conv.inner = untag_ptr(obj);
32587         obj_conv.is_owned = ptr_is_owned(obj);
32588         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
32589         obj_conv.is_owned = false;
32590         LDKCVec_u8Z ret_var = FundingSigned_write(&obj_conv);
32591         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
32592         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
32593         CVec_u8Z_free(ret_var);
32594         return ret_arr;
32595 }
32596
32597 uint64_t  __attribute__((export_name("TS_FundingSigned_read"))) TS_FundingSigned_read(int8_tArray ser) {
32598         LDKu8slice ser_ref;
32599         ser_ref.datalen = ser->arr_len;
32600         ser_ref.data = ser->elems;
32601         LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
32602         *ret_conv = FundingSigned_read(ser_ref);
32603         FREE(ser);
32604         return tag_ptr(ret_conv, true);
32605 }
32606
32607 int8_tArray  __attribute__((export_name("TS_ChannelReady_write"))) TS_ChannelReady_write(uint64_t obj) {
32608         LDKChannelReady obj_conv;
32609         obj_conv.inner = untag_ptr(obj);
32610         obj_conv.is_owned = ptr_is_owned(obj);
32611         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
32612         obj_conv.is_owned = false;
32613         LDKCVec_u8Z ret_var = ChannelReady_write(&obj_conv);
32614         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
32615         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
32616         CVec_u8Z_free(ret_var);
32617         return ret_arr;
32618 }
32619
32620 uint64_t  __attribute__((export_name("TS_ChannelReady_read"))) TS_ChannelReady_read(int8_tArray ser) {
32621         LDKu8slice ser_ref;
32622         ser_ref.datalen = ser->arr_len;
32623         ser_ref.data = ser->elems;
32624         LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
32625         *ret_conv = ChannelReady_read(ser_ref);
32626         FREE(ser);
32627         return tag_ptr(ret_conv, true);
32628 }
32629
32630 int8_tArray  __attribute__((export_name("TS_Init_write"))) TS_Init_write(uint64_t obj) {
32631         LDKInit obj_conv;
32632         obj_conv.inner = untag_ptr(obj);
32633         obj_conv.is_owned = ptr_is_owned(obj);
32634         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
32635         obj_conv.is_owned = false;
32636         LDKCVec_u8Z ret_var = Init_write(&obj_conv);
32637         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
32638         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
32639         CVec_u8Z_free(ret_var);
32640         return ret_arr;
32641 }
32642
32643 uint64_t  __attribute__((export_name("TS_Init_read"))) TS_Init_read(int8_tArray ser) {
32644         LDKu8slice ser_ref;
32645         ser_ref.datalen = ser->arr_len;
32646         ser_ref.data = ser->elems;
32647         LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
32648         *ret_conv = Init_read(ser_ref);
32649         FREE(ser);
32650         return tag_ptr(ret_conv, true);
32651 }
32652
32653 int8_tArray  __attribute__((export_name("TS_OpenChannel_write"))) TS_OpenChannel_write(uint64_t obj) {
32654         LDKOpenChannel obj_conv;
32655         obj_conv.inner = untag_ptr(obj);
32656         obj_conv.is_owned = ptr_is_owned(obj);
32657         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
32658         obj_conv.is_owned = false;
32659         LDKCVec_u8Z ret_var = OpenChannel_write(&obj_conv);
32660         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
32661         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
32662         CVec_u8Z_free(ret_var);
32663         return ret_arr;
32664 }
32665
32666 uint64_t  __attribute__((export_name("TS_OpenChannel_read"))) TS_OpenChannel_read(int8_tArray ser) {
32667         LDKu8slice ser_ref;
32668         ser_ref.datalen = ser->arr_len;
32669         ser_ref.data = ser->elems;
32670         LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
32671         *ret_conv = OpenChannel_read(ser_ref);
32672         FREE(ser);
32673         return tag_ptr(ret_conv, true);
32674 }
32675
32676 int8_tArray  __attribute__((export_name("TS_RevokeAndACK_write"))) TS_RevokeAndACK_write(uint64_t obj) {
32677         LDKRevokeAndACK obj_conv;
32678         obj_conv.inner = untag_ptr(obj);
32679         obj_conv.is_owned = ptr_is_owned(obj);
32680         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
32681         obj_conv.is_owned = false;
32682         LDKCVec_u8Z ret_var = RevokeAndACK_write(&obj_conv);
32683         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
32684         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
32685         CVec_u8Z_free(ret_var);
32686         return ret_arr;
32687 }
32688
32689 uint64_t  __attribute__((export_name("TS_RevokeAndACK_read"))) TS_RevokeAndACK_read(int8_tArray ser) {
32690         LDKu8slice ser_ref;
32691         ser_ref.datalen = ser->arr_len;
32692         ser_ref.data = ser->elems;
32693         LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
32694         *ret_conv = RevokeAndACK_read(ser_ref);
32695         FREE(ser);
32696         return tag_ptr(ret_conv, true);
32697 }
32698
32699 int8_tArray  __attribute__((export_name("TS_Shutdown_write"))) TS_Shutdown_write(uint64_t obj) {
32700         LDKShutdown obj_conv;
32701         obj_conv.inner = untag_ptr(obj);
32702         obj_conv.is_owned = ptr_is_owned(obj);
32703         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
32704         obj_conv.is_owned = false;
32705         LDKCVec_u8Z ret_var = Shutdown_write(&obj_conv);
32706         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
32707         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
32708         CVec_u8Z_free(ret_var);
32709         return ret_arr;
32710 }
32711
32712 uint64_t  __attribute__((export_name("TS_Shutdown_read"))) TS_Shutdown_read(int8_tArray ser) {
32713         LDKu8slice ser_ref;
32714         ser_ref.datalen = ser->arr_len;
32715         ser_ref.data = ser->elems;
32716         LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
32717         *ret_conv = Shutdown_read(ser_ref);
32718         FREE(ser);
32719         return tag_ptr(ret_conv, true);
32720 }
32721
32722 int8_tArray  __attribute__((export_name("TS_UpdateFailHTLC_write"))) TS_UpdateFailHTLC_write(uint64_t obj) {
32723         LDKUpdateFailHTLC obj_conv;
32724         obj_conv.inner = untag_ptr(obj);
32725         obj_conv.is_owned = ptr_is_owned(obj);
32726         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
32727         obj_conv.is_owned = false;
32728         LDKCVec_u8Z ret_var = UpdateFailHTLC_write(&obj_conv);
32729         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
32730         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
32731         CVec_u8Z_free(ret_var);
32732         return ret_arr;
32733 }
32734
32735 uint64_t  __attribute__((export_name("TS_UpdateFailHTLC_read"))) TS_UpdateFailHTLC_read(int8_tArray ser) {
32736         LDKu8slice ser_ref;
32737         ser_ref.datalen = ser->arr_len;
32738         ser_ref.data = ser->elems;
32739         LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
32740         *ret_conv = UpdateFailHTLC_read(ser_ref);
32741         FREE(ser);
32742         return tag_ptr(ret_conv, true);
32743 }
32744
32745 int8_tArray  __attribute__((export_name("TS_UpdateFailMalformedHTLC_write"))) TS_UpdateFailMalformedHTLC_write(uint64_t obj) {
32746         LDKUpdateFailMalformedHTLC obj_conv;
32747         obj_conv.inner = untag_ptr(obj);
32748         obj_conv.is_owned = ptr_is_owned(obj);
32749         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
32750         obj_conv.is_owned = false;
32751         LDKCVec_u8Z ret_var = UpdateFailMalformedHTLC_write(&obj_conv);
32752         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
32753         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
32754         CVec_u8Z_free(ret_var);
32755         return ret_arr;
32756 }
32757
32758 uint64_t  __attribute__((export_name("TS_UpdateFailMalformedHTLC_read"))) TS_UpdateFailMalformedHTLC_read(int8_tArray ser) {
32759         LDKu8slice ser_ref;
32760         ser_ref.datalen = ser->arr_len;
32761         ser_ref.data = ser->elems;
32762         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
32763         *ret_conv = UpdateFailMalformedHTLC_read(ser_ref);
32764         FREE(ser);
32765         return tag_ptr(ret_conv, true);
32766 }
32767
32768 int8_tArray  __attribute__((export_name("TS_UpdateFee_write"))) TS_UpdateFee_write(uint64_t obj) {
32769         LDKUpdateFee obj_conv;
32770         obj_conv.inner = untag_ptr(obj);
32771         obj_conv.is_owned = ptr_is_owned(obj);
32772         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
32773         obj_conv.is_owned = false;
32774         LDKCVec_u8Z ret_var = UpdateFee_write(&obj_conv);
32775         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
32776         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
32777         CVec_u8Z_free(ret_var);
32778         return ret_arr;
32779 }
32780
32781 uint64_t  __attribute__((export_name("TS_UpdateFee_read"))) TS_UpdateFee_read(int8_tArray ser) {
32782         LDKu8slice ser_ref;
32783         ser_ref.datalen = ser->arr_len;
32784         ser_ref.data = ser->elems;
32785         LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
32786         *ret_conv = UpdateFee_read(ser_ref);
32787         FREE(ser);
32788         return tag_ptr(ret_conv, true);
32789 }
32790
32791 int8_tArray  __attribute__((export_name("TS_UpdateFulfillHTLC_write"))) TS_UpdateFulfillHTLC_write(uint64_t obj) {
32792         LDKUpdateFulfillHTLC obj_conv;
32793         obj_conv.inner = untag_ptr(obj);
32794         obj_conv.is_owned = ptr_is_owned(obj);
32795         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
32796         obj_conv.is_owned = false;
32797         LDKCVec_u8Z ret_var = UpdateFulfillHTLC_write(&obj_conv);
32798         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
32799         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
32800         CVec_u8Z_free(ret_var);
32801         return ret_arr;
32802 }
32803
32804 uint64_t  __attribute__((export_name("TS_UpdateFulfillHTLC_read"))) TS_UpdateFulfillHTLC_read(int8_tArray ser) {
32805         LDKu8slice ser_ref;
32806         ser_ref.datalen = ser->arr_len;
32807         ser_ref.data = ser->elems;
32808         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
32809         *ret_conv = UpdateFulfillHTLC_read(ser_ref);
32810         FREE(ser);
32811         return tag_ptr(ret_conv, true);
32812 }
32813
32814 int8_tArray  __attribute__((export_name("TS_UpdateAddHTLC_write"))) TS_UpdateAddHTLC_write(uint64_t obj) {
32815         LDKUpdateAddHTLC obj_conv;
32816         obj_conv.inner = untag_ptr(obj);
32817         obj_conv.is_owned = ptr_is_owned(obj);
32818         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
32819         obj_conv.is_owned = false;
32820         LDKCVec_u8Z ret_var = UpdateAddHTLC_write(&obj_conv);
32821         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
32822         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
32823         CVec_u8Z_free(ret_var);
32824         return ret_arr;
32825 }
32826
32827 uint64_t  __attribute__((export_name("TS_UpdateAddHTLC_read"))) TS_UpdateAddHTLC_read(int8_tArray ser) {
32828         LDKu8slice ser_ref;
32829         ser_ref.datalen = ser->arr_len;
32830         ser_ref.data = ser->elems;
32831         LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
32832         *ret_conv = UpdateAddHTLC_read(ser_ref);
32833         FREE(ser);
32834         return tag_ptr(ret_conv, true);
32835 }
32836
32837 int8_tArray  __attribute__((export_name("TS_Ping_write"))) TS_Ping_write(uint64_t obj) {
32838         LDKPing obj_conv;
32839         obj_conv.inner = untag_ptr(obj);
32840         obj_conv.is_owned = ptr_is_owned(obj);
32841         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
32842         obj_conv.is_owned = false;
32843         LDKCVec_u8Z ret_var = Ping_write(&obj_conv);
32844         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
32845         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
32846         CVec_u8Z_free(ret_var);
32847         return ret_arr;
32848 }
32849
32850 uint64_t  __attribute__((export_name("TS_Ping_read"))) TS_Ping_read(int8_tArray ser) {
32851         LDKu8slice ser_ref;
32852         ser_ref.datalen = ser->arr_len;
32853         ser_ref.data = ser->elems;
32854         LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
32855         *ret_conv = Ping_read(ser_ref);
32856         FREE(ser);
32857         return tag_ptr(ret_conv, true);
32858 }
32859
32860 int8_tArray  __attribute__((export_name("TS_Pong_write"))) TS_Pong_write(uint64_t obj) {
32861         LDKPong obj_conv;
32862         obj_conv.inner = untag_ptr(obj);
32863         obj_conv.is_owned = ptr_is_owned(obj);
32864         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
32865         obj_conv.is_owned = false;
32866         LDKCVec_u8Z ret_var = Pong_write(&obj_conv);
32867         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
32868         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
32869         CVec_u8Z_free(ret_var);
32870         return ret_arr;
32871 }
32872
32873 uint64_t  __attribute__((export_name("TS_Pong_read"))) TS_Pong_read(int8_tArray ser) {
32874         LDKu8slice ser_ref;
32875         ser_ref.datalen = ser->arr_len;
32876         ser_ref.data = ser->elems;
32877         LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
32878         *ret_conv = Pong_read(ser_ref);
32879         FREE(ser);
32880         return tag_ptr(ret_conv, true);
32881 }
32882
32883 int8_tArray  __attribute__((export_name("TS_UnsignedChannelAnnouncement_write"))) TS_UnsignedChannelAnnouncement_write(uint64_t obj) {
32884         LDKUnsignedChannelAnnouncement obj_conv;
32885         obj_conv.inner = untag_ptr(obj);
32886         obj_conv.is_owned = ptr_is_owned(obj);
32887         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
32888         obj_conv.is_owned = false;
32889         LDKCVec_u8Z ret_var = UnsignedChannelAnnouncement_write(&obj_conv);
32890         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
32891         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
32892         CVec_u8Z_free(ret_var);
32893         return ret_arr;
32894 }
32895
32896 uint64_t  __attribute__((export_name("TS_UnsignedChannelAnnouncement_read"))) TS_UnsignedChannelAnnouncement_read(int8_tArray ser) {
32897         LDKu8slice ser_ref;
32898         ser_ref.datalen = ser->arr_len;
32899         ser_ref.data = ser->elems;
32900         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
32901         *ret_conv = UnsignedChannelAnnouncement_read(ser_ref);
32902         FREE(ser);
32903         return tag_ptr(ret_conv, true);
32904 }
32905
32906 int8_tArray  __attribute__((export_name("TS_ChannelAnnouncement_write"))) TS_ChannelAnnouncement_write(uint64_t obj) {
32907         LDKChannelAnnouncement obj_conv;
32908         obj_conv.inner = untag_ptr(obj);
32909         obj_conv.is_owned = ptr_is_owned(obj);
32910         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
32911         obj_conv.is_owned = false;
32912         LDKCVec_u8Z ret_var = ChannelAnnouncement_write(&obj_conv);
32913         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
32914         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
32915         CVec_u8Z_free(ret_var);
32916         return ret_arr;
32917 }
32918
32919 uint64_t  __attribute__((export_name("TS_ChannelAnnouncement_read"))) TS_ChannelAnnouncement_read(int8_tArray ser) {
32920         LDKu8slice ser_ref;
32921         ser_ref.datalen = ser->arr_len;
32922         ser_ref.data = ser->elems;
32923         LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
32924         *ret_conv = ChannelAnnouncement_read(ser_ref);
32925         FREE(ser);
32926         return tag_ptr(ret_conv, true);
32927 }
32928
32929 int8_tArray  __attribute__((export_name("TS_UnsignedChannelUpdate_write"))) TS_UnsignedChannelUpdate_write(uint64_t obj) {
32930         LDKUnsignedChannelUpdate obj_conv;
32931         obj_conv.inner = untag_ptr(obj);
32932         obj_conv.is_owned = ptr_is_owned(obj);
32933         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
32934         obj_conv.is_owned = false;
32935         LDKCVec_u8Z ret_var = UnsignedChannelUpdate_write(&obj_conv);
32936         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
32937         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
32938         CVec_u8Z_free(ret_var);
32939         return ret_arr;
32940 }
32941
32942 uint64_t  __attribute__((export_name("TS_UnsignedChannelUpdate_read"))) TS_UnsignedChannelUpdate_read(int8_tArray ser) {
32943         LDKu8slice ser_ref;
32944         ser_ref.datalen = ser->arr_len;
32945         ser_ref.data = ser->elems;
32946         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
32947         *ret_conv = UnsignedChannelUpdate_read(ser_ref);
32948         FREE(ser);
32949         return tag_ptr(ret_conv, true);
32950 }
32951
32952 int8_tArray  __attribute__((export_name("TS_ChannelUpdate_write"))) TS_ChannelUpdate_write(uint64_t obj) {
32953         LDKChannelUpdate obj_conv;
32954         obj_conv.inner = untag_ptr(obj);
32955         obj_conv.is_owned = ptr_is_owned(obj);
32956         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
32957         obj_conv.is_owned = false;
32958         LDKCVec_u8Z ret_var = ChannelUpdate_write(&obj_conv);
32959         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
32960         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
32961         CVec_u8Z_free(ret_var);
32962         return ret_arr;
32963 }
32964
32965 uint64_t  __attribute__((export_name("TS_ChannelUpdate_read"))) TS_ChannelUpdate_read(int8_tArray ser) {
32966         LDKu8slice ser_ref;
32967         ser_ref.datalen = ser->arr_len;
32968         ser_ref.data = ser->elems;
32969         LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
32970         *ret_conv = ChannelUpdate_read(ser_ref);
32971         FREE(ser);
32972         return tag_ptr(ret_conv, true);
32973 }
32974
32975 int8_tArray  __attribute__((export_name("TS_ErrorMessage_write"))) TS_ErrorMessage_write(uint64_t obj) {
32976         LDKErrorMessage obj_conv;
32977         obj_conv.inner = untag_ptr(obj);
32978         obj_conv.is_owned = ptr_is_owned(obj);
32979         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
32980         obj_conv.is_owned = false;
32981         LDKCVec_u8Z ret_var = ErrorMessage_write(&obj_conv);
32982         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
32983         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
32984         CVec_u8Z_free(ret_var);
32985         return ret_arr;
32986 }
32987
32988 uint64_t  __attribute__((export_name("TS_ErrorMessage_read"))) TS_ErrorMessage_read(int8_tArray ser) {
32989         LDKu8slice ser_ref;
32990         ser_ref.datalen = ser->arr_len;
32991         ser_ref.data = ser->elems;
32992         LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
32993         *ret_conv = ErrorMessage_read(ser_ref);
32994         FREE(ser);
32995         return tag_ptr(ret_conv, true);
32996 }
32997
32998 int8_tArray  __attribute__((export_name("TS_WarningMessage_write"))) TS_WarningMessage_write(uint64_t obj) {
32999         LDKWarningMessage obj_conv;
33000         obj_conv.inner = untag_ptr(obj);
33001         obj_conv.is_owned = ptr_is_owned(obj);
33002         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
33003         obj_conv.is_owned = false;
33004         LDKCVec_u8Z ret_var = WarningMessage_write(&obj_conv);
33005         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
33006         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
33007         CVec_u8Z_free(ret_var);
33008         return ret_arr;
33009 }
33010
33011 uint64_t  __attribute__((export_name("TS_WarningMessage_read"))) TS_WarningMessage_read(int8_tArray ser) {
33012         LDKu8slice ser_ref;
33013         ser_ref.datalen = ser->arr_len;
33014         ser_ref.data = ser->elems;
33015         LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
33016         *ret_conv = WarningMessage_read(ser_ref);
33017         FREE(ser);
33018         return tag_ptr(ret_conv, true);
33019 }
33020
33021 int8_tArray  __attribute__((export_name("TS_UnsignedNodeAnnouncement_write"))) TS_UnsignedNodeAnnouncement_write(uint64_t obj) {
33022         LDKUnsignedNodeAnnouncement obj_conv;
33023         obj_conv.inner = untag_ptr(obj);
33024         obj_conv.is_owned = ptr_is_owned(obj);
33025         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
33026         obj_conv.is_owned = false;
33027         LDKCVec_u8Z ret_var = UnsignedNodeAnnouncement_write(&obj_conv);
33028         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
33029         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
33030         CVec_u8Z_free(ret_var);
33031         return ret_arr;
33032 }
33033
33034 uint64_t  __attribute__((export_name("TS_UnsignedNodeAnnouncement_read"))) TS_UnsignedNodeAnnouncement_read(int8_tArray ser) {
33035         LDKu8slice ser_ref;
33036         ser_ref.datalen = ser->arr_len;
33037         ser_ref.data = ser->elems;
33038         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
33039         *ret_conv = UnsignedNodeAnnouncement_read(ser_ref);
33040         FREE(ser);
33041         return tag_ptr(ret_conv, true);
33042 }
33043
33044 int8_tArray  __attribute__((export_name("TS_NodeAnnouncement_write"))) TS_NodeAnnouncement_write(uint64_t obj) {
33045         LDKNodeAnnouncement obj_conv;
33046         obj_conv.inner = untag_ptr(obj);
33047         obj_conv.is_owned = ptr_is_owned(obj);
33048         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
33049         obj_conv.is_owned = false;
33050         LDKCVec_u8Z ret_var = NodeAnnouncement_write(&obj_conv);
33051         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
33052         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
33053         CVec_u8Z_free(ret_var);
33054         return ret_arr;
33055 }
33056
33057 uint64_t  __attribute__((export_name("TS_NodeAnnouncement_read"))) TS_NodeAnnouncement_read(int8_tArray ser) {
33058         LDKu8slice ser_ref;
33059         ser_ref.datalen = ser->arr_len;
33060         ser_ref.data = ser->elems;
33061         LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
33062         *ret_conv = NodeAnnouncement_read(ser_ref);
33063         FREE(ser);
33064         return tag_ptr(ret_conv, true);
33065 }
33066
33067 uint64_t  __attribute__((export_name("TS_QueryShortChannelIds_read"))) TS_QueryShortChannelIds_read(int8_tArray ser) {
33068         LDKu8slice ser_ref;
33069         ser_ref.datalen = ser->arr_len;
33070         ser_ref.data = ser->elems;
33071         LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
33072         *ret_conv = QueryShortChannelIds_read(ser_ref);
33073         FREE(ser);
33074         return tag_ptr(ret_conv, true);
33075 }
33076
33077 int8_tArray  __attribute__((export_name("TS_QueryShortChannelIds_write"))) TS_QueryShortChannelIds_write(uint64_t obj) {
33078         LDKQueryShortChannelIds obj_conv;
33079         obj_conv.inner = untag_ptr(obj);
33080         obj_conv.is_owned = ptr_is_owned(obj);
33081         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
33082         obj_conv.is_owned = false;
33083         LDKCVec_u8Z ret_var = QueryShortChannelIds_write(&obj_conv);
33084         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
33085         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
33086         CVec_u8Z_free(ret_var);
33087         return ret_arr;
33088 }
33089
33090 int8_tArray  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_write"))) TS_ReplyShortChannelIdsEnd_write(uint64_t obj) {
33091         LDKReplyShortChannelIdsEnd obj_conv;
33092         obj_conv.inner = untag_ptr(obj);
33093         obj_conv.is_owned = ptr_is_owned(obj);
33094         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
33095         obj_conv.is_owned = false;
33096         LDKCVec_u8Z ret_var = ReplyShortChannelIdsEnd_write(&obj_conv);
33097         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
33098         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
33099         CVec_u8Z_free(ret_var);
33100         return ret_arr;
33101 }
33102
33103 uint64_t  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_read"))) TS_ReplyShortChannelIdsEnd_read(int8_tArray ser) {
33104         LDKu8slice ser_ref;
33105         ser_ref.datalen = ser->arr_len;
33106         ser_ref.data = ser->elems;
33107         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
33108         *ret_conv = ReplyShortChannelIdsEnd_read(ser_ref);
33109         FREE(ser);
33110         return tag_ptr(ret_conv, true);
33111 }
33112
33113 int32_t  __attribute__((export_name("TS_QueryChannelRange_end_blocknum"))) TS_QueryChannelRange_end_blocknum(uint64_t this_arg) {
33114         LDKQueryChannelRange this_arg_conv;
33115         this_arg_conv.inner = untag_ptr(this_arg);
33116         this_arg_conv.is_owned = ptr_is_owned(this_arg);
33117         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33118         this_arg_conv.is_owned = false;
33119         int32_t ret_conv = QueryChannelRange_end_blocknum(&this_arg_conv);
33120         return ret_conv;
33121 }
33122
33123 int8_tArray  __attribute__((export_name("TS_QueryChannelRange_write"))) TS_QueryChannelRange_write(uint64_t obj) {
33124         LDKQueryChannelRange obj_conv;
33125         obj_conv.inner = untag_ptr(obj);
33126         obj_conv.is_owned = ptr_is_owned(obj);
33127         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
33128         obj_conv.is_owned = false;
33129         LDKCVec_u8Z ret_var = QueryChannelRange_write(&obj_conv);
33130         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
33131         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
33132         CVec_u8Z_free(ret_var);
33133         return ret_arr;
33134 }
33135
33136 uint64_t  __attribute__((export_name("TS_QueryChannelRange_read"))) TS_QueryChannelRange_read(int8_tArray ser) {
33137         LDKu8slice ser_ref;
33138         ser_ref.datalen = ser->arr_len;
33139         ser_ref.data = ser->elems;
33140         LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
33141         *ret_conv = QueryChannelRange_read(ser_ref);
33142         FREE(ser);
33143         return tag_ptr(ret_conv, true);
33144 }
33145
33146 uint64_t  __attribute__((export_name("TS_ReplyChannelRange_read"))) TS_ReplyChannelRange_read(int8_tArray ser) {
33147         LDKu8slice ser_ref;
33148         ser_ref.datalen = ser->arr_len;
33149         ser_ref.data = ser->elems;
33150         LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
33151         *ret_conv = ReplyChannelRange_read(ser_ref);
33152         FREE(ser);
33153         return tag_ptr(ret_conv, true);
33154 }
33155
33156 int8_tArray  __attribute__((export_name("TS_ReplyChannelRange_write"))) TS_ReplyChannelRange_write(uint64_t obj) {
33157         LDKReplyChannelRange obj_conv;
33158         obj_conv.inner = untag_ptr(obj);
33159         obj_conv.is_owned = ptr_is_owned(obj);
33160         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
33161         obj_conv.is_owned = false;
33162         LDKCVec_u8Z ret_var = ReplyChannelRange_write(&obj_conv);
33163         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
33164         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
33165         CVec_u8Z_free(ret_var);
33166         return ret_arr;
33167 }
33168
33169 int8_tArray  __attribute__((export_name("TS_GossipTimestampFilter_write"))) TS_GossipTimestampFilter_write(uint64_t obj) {
33170         LDKGossipTimestampFilter obj_conv;
33171         obj_conv.inner = untag_ptr(obj);
33172         obj_conv.is_owned = ptr_is_owned(obj);
33173         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
33174         obj_conv.is_owned = false;
33175         LDKCVec_u8Z ret_var = GossipTimestampFilter_write(&obj_conv);
33176         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
33177         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
33178         CVec_u8Z_free(ret_var);
33179         return ret_arr;
33180 }
33181
33182 uint64_t  __attribute__((export_name("TS_GossipTimestampFilter_read"))) TS_GossipTimestampFilter_read(int8_tArray ser) {
33183         LDKu8slice ser_ref;
33184         ser_ref.datalen = ser->arr_len;
33185         ser_ref.data = ser->elems;
33186         LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
33187         *ret_conv = GossipTimestampFilter_read(ser_ref);
33188         FREE(ser);
33189         return tag_ptr(ret_conv, true);
33190 }
33191
33192 void  __attribute__((export_name("TS_CustomMessageHandler_free"))) TS_CustomMessageHandler_free(uint64_t this_ptr) {
33193         if (!ptr_is_owned(this_ptr)) return;
33194         void* this_ptr_ptr = untag_ptr(this_ptr);
33195         CHECK_ACCESS(this_ptr_ptr);
33196         LDKCustomMessageHandler this_ptr_conv = *(LDKCustomMessageHandler*)(this_ptr_ptr);
33197         FREE(untag_ptr(this_ptr));
33198         CustomMessageHandler_free(this_ptr_conv);
33199 }
33200
33201 void  __attribute__((export_name("TS_IgnoringMessageHandler_free"))) TS_IgnoringMessageHandler_free(uint64_t this_obj) {
33202         LDKIgnoringMessageHandler this_obj_conv;
33203         this_obj_conv.inner = untag_ptr(this_obj);
33204         this_obj_conv.is_owned = ptr_is_owned(this_obj);
33205         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33206         IgnoringMessageHandler_free(this_obj_conv);
33207 }
33208
33209 uint64_t  __attribute__((export_name("TS_IgnoringMessageHandler_new"))) TS_IgnoringMessageHandler_new() {
33210         LDKIgnoringMessageHandler ret_var = IgnoringMessageHandler_new();
33211         uint64_t ret_ref = 0;
33212         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33213         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33214         return ret_ref;
33215 }
33216
33217 uint64_t  __attribute__((export_name("TS_IgnoringMessageHandler_as_MessageSendEventsProvider"))) TS_IgnoringMessageHandler_as_MessageSendEventsProvider(uint64_t this_arg) {
33218         LDKIgnoringMessageHandler this_arg_conv;
33219         this_arg_conv.inner = untag_ptr(this_arg);
33220         this_arg_conv.is_owned = ptr_is_owned(this_arg);
33221         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33222         this_arg_conv.is_owned = false;
33223         LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
33224         *ret_ret = IgnoringMessageHandler_as_MessageSendEventsProvider(&this_arg_conv);
33225         return tag_ptr(ret_ret, true);
33226 }
33227
33228 uint64_t  __attribute__((export_name("TS_IgnoringMessageHandler_as_RoutingMessageHandler"))) TS_IgnoringMessageHandler_as_RoutingMessageHandler(uint64_t this_arg) {
33229         LDKIgnoringMessageHandler this_arg_conv;
33230         this_arg_conv.inner = untag_ptr(this_arg);
33231         this_arg_conv.is_owned = ptr_is_owned(this_arg);
33232         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33233         this_arg_conv.is_owned = false;
33234         LDKRoutingMessageHandler* ret_ret = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
33235         *ret_ret = IgnoringMessageHandler_as_RoutingMessageHandler(&this_arg_conv);
33236         return tag_ptr(ret_ret, true);
33237 }
33238
33239 uint64_t  __attribute__((export_name("TS_IgnoringMessageHandler_as_CustomMessageReader"))) TS_IgnoringMessageHandler_as_CustomMessageReader(uint64_t this_arg) {
33240         LDKIgnoringMessageHandler this_arg_conv;
33241         this_arg_conv.inner = untag_ptr(this_arg);
33242         this_arg_conv.is_owned = ptr_is_owned(this_arg);
33243         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33244         this_arg_conv.is_owned = false;
33245         LDKCustomMessageReader* ret_ret = MALLOC(sizeof(LDKCustomMessageReader), "LDKCustomMessageReader");
33246         *ret_ret = IgnoringMessageHandler_as_CustomMessageReader(&this_arg_conv);
33247         return tag_ptr(ret_ret, true);
33248 }
33249
33250 uint64_t  __attribute__((export_name("TS_IgnoringMessageHandler_as_CustomMessageHandler"))) TS_IgnoringMessageHandler_as_CustomMessageHandler(uint64_t this_arg) {
33251         LDKIgnoringMessageHandler this_arg_conv;
33252         this_arg_conv.inner = untag_ptr(this_arg);
33253         this_arg_conv.is_owned = ptr_is_owned(this_arg);
33254         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33255         this_arg_conv.is_owned = false;
33256         LDKCustomMessageHandler* ret_ret = MALLOC(sizeof(LDKCustomMessageHandler), "LDKCustomMessageHandler");
33257         *ret_ret = IgnoringMessageHandler_as_CustomMessageHandler(&this_arg_conv);
33258         return tag_ptr(ret_ret, true);
33259 }
33260
33261 void  __attribute__((export_name("TS_ErroringMessageHandler_free"))) TS_ErroringMessageHandler_free(uint64_t this_obj) {
33262         LDKErroringMessageHandler this_obj_conv;
33263         this_obj_conv.inner = untag_ptr(this_obj);
33264         this_obj_conv.is_owned = ptr_is_owned(this_obj);
33265         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33266         ErroringMessageHandler_free(this_obj_conv);
33267 }
33268
33269 uint64_t  __attribute__((export_name("TS_ErroringMessageHandler_new"))) TS_ErroringMessageHandler_new() {
33270         LDKErroringMessageHandler ret_var = ErroringMessageHandler_new();
33271         uint64_t ret_ref = 0;
33272         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33273         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33274         return ret_ref;
33275 }
33276
33277 uint64_t  __attribute__((export_name("TS_ErroringMessageHandler_as_MessageSendEventsProvider"))) TS_ErroringMessageHandler_as_MessageSendEventsProvider(uint64_t this_arg) {
33278         LDKErroringMessageHandler this_arg_conv;
33279         this_arg_conv.inner = untag_ptr(this_arg);
33280         this_arg_conv.is_owned = ptr_is_owned(this_arg);
33281         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33282         this_arg_conv.is_owned = false;
33283         LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
33284         *ret_ret = ErroringMessageHandler_as_MessageSendEventsProvider(&this_arg_conv);
33285         return tag_ptr(ret_ret, true);
33286 }
33287
33288 uint64_t  __attribute__((export_name("TS_ErroringMessageHandler_as_ChannelMessageHandler"))) TS_ErroringMessageHandler_as_ChannelMessageHandler(uint64_t this_arg) {
33289         LDKErroringMessageHandler this_arg_conv;
33290         this_arg_conv.inner = untag_ptr(this_arg);
33291         this_arg_conv.is_owned = ptr_is_owned(this_arg);
33292         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33293         this_arg_conv.is_owned = false;
33294         LDKChannelMessageHandler* ret_ret = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
33295         *ret_ret = ErroringMessageHandler_as_ChannelMessageHandler(&this_arg_conv);
33296         return tag_ptr(ret_ret, true);
33297 }
33298
33299 void  __attribute__((export_name("TS_MessageHandler_free"))) TS_MessageHandler_free(uint64_t this_obj) {
33300         LDKMessageHandler this_obj_conv;
33301         this_obj_conv.inner = untag_ptr(this_obj);
33302         this_obj_conv.is_owned = ptr_is_owned(this_obj);
33303         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33304         MessageHandler_free(this_obj_conv);
33305 }
33306
33307 uint64_t  __attribute__((export_name("TS_MessageHandler_get_chan_handler"))) TS_MessageHandler_get_chan_handler(uint64_t this_ptr) {
33308         LDKMessageHandler this_ptr_conv;
33309         this_ptr_conv.inner = untag_ptr(this_ptr);
33310         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33311         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33312         this_ptr_conv.is_owned = false;
33313         // WARNING: This object doesn't live past this scope, needs clone!
33314         uint64_t ret_ret = tag_ptr(MessageHandler_get_chan_handler(&this_ptr_conv), false);
33315         return ret_ret;
33316 }
33317
33318 void  __attribute__((export_name("TS_MessageHandler_set_chan_handler"))) TS_MessageHandler_set_chan_handler(uint64_t this_ptr, uint64_t val) {
33319         LDKMessageHandler this_ptr_conv;
33320         this_ptr_conv.inner = untag_ptr(this_ptr);
33321         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33322         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33323         this_ptr_conv.is_owned = false;
33324         void* val_ptr = untag_ptr(val);
33325         CHECK_ACCESS(val_ptr);
33326         LDKChannelMessageHandler val_conv = *(LDKChannelMessageHandler*)(val_ptr);
33327         if (val_conv.free == LDKChannelMessageHandler_JCalls_free) {
33328                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
33329                 LDKChannelMessageHandler_JCalls_cloned(&val_conv);
33330         }
33331         MessageHandler_set_chan_handler(&this_ptr_conv, val_conv);
33332 }
33333
33334 uint64_t  __attribute__((export_name("TS_MessageHandler_get_route_handler"))) TS_MessageHandler_get_route_handler(uint64_t this_ptr) {
33335         LDKMessageHandler this_ptr_conv;
33336         this_ptr_conv.inner = untag_ptr(this_ptr);
33337         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33338         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33339         this_ptr_conv.is_owned = false;
33340         // WARNING: This object doesn't live past this scope, needs clone!
33341         uint64_t ret_ret = tag_ptr(MessageHandler_get_route_handler(&this_ptr_conv), false);
33342         return ret_ret;
33343 }
33344
33345 void  __attribute__((export_name("TS_MessageHandler_set_route_handler"))) TS_MessageHandler_set_route_handler(uint64_t this_ptr, uint64_t val) {
33346         LDKMessageHandler this_ptr_conv;
33347         this_ptr_conv.inner = untag_ptr(this_ptr);
33348         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33349         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33350         this_ptr_conv.is_owned = false;
33351         void* val_ptr = untag_ptr(val);
33352         CHECK_ACCESS(val_ptr);
33353         LDKRoutingMessageHandler val_conv = *(LDKRoutingMessageHandler*)(val_ptr);
33354         if (val_conv.free == LDKRoutingMessageHandler_JCalls_free) {
33355                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
33356                 LDKRoutingMessageHandler_JCalls_cloned(&val_conv);
33357         }
33358         MessageHandler_set_route_handler(&this_ptr_conv, val_conv);
33359 }
33360
33361 uint64_t  __attribute__((export_name("TS_MessageHandler_new"))) TS_MessageHandler_new(uint64_t chan_handler_arg, uint64_t route_handler_arg) {
33362         void* chan_handler_arg_ptr = untag_ptr(chan_handler_arg);
33363         CHECK_ACCESS(chan_handler_arg_ptr);
33364         LDKChannelMessageHandler chan_handler_arg_conv = *(LDKChannelMessageHandler*)(chan_handler_arg_ptr);
33365         if (chan_handler_arg_conv.free == LDKChannelMessageHandler_JCalls_free) {
33366                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
33367                 LDKChannelMessageHandler_JCalls_cloned(&chan_handler_arg_conv);
33368         }
33369         void* route_handler_arg_ptr = untag_ptr(route_handler_arg);
33370         CHECK_ACCESS(route_handler_arg_ptr);
33371         LDKRoutingMessageHandler route_handler_arg_conv = *(LDKRoutingMessageHandler*)(route_handler_arg_ptr);
33372         if (route_handler_arg_conv.free == LDKRoutingMessageHandler_JCalls_free) {
33373                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
33374                 LDKRoutingMessageHandler_JCalls_cloned(&route_handler_arg_conv);
33375         }
33376         LDKMessageHandler ret_var = MessageHandler_new(chan_handler_arg_conv, route_handler_arg_conv);
33377         uint64_t ret_ref = 0;
33378         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33379         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33380         return ret_ref;
33381 }
33382
33383 static inline uint64_t SocketDescriptor_clone_ptr(LDKSocketDescriptor *NONNULL_PTR arg) {
33384         LDKSocketDescriptor* ret_ret = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
33385         *ret_ret = SocketDescriptor_clone(arg);
33386         return tag_ptr(ret_ret, true);
33387 }
33388 int64_t  __attribute__((export_name("TS_SocketDescriptor_clone_ptr"))) TS_SocketDescriptor_clone_ptr(uint64_t arg) {
33389         void* arg_ptr = untag_ptr(arg);
33390         if (ptr_is_owned(arg)) { CHECK_ACCESS(arg_ptr); }
33391         LDKSocketDescriptor* arg_conv = (LDKSocketDescriptor*)arg_ptr;
33392         int64_t ret_conv = SocketDescriptor_clone_ptr(arg_conv);
33393         return ret_conv;
33394 }
33395
33396 uint64_t  __attribute__((export_name("TS_SocketDescriptor_clone"))) TS_SocketDescriptor_clone(uint64_t orig) {
33397         void* orig_ptr = untag_ptr(orig);
33398         if (ptr_is_owned(orig)) { CHECK_ACCESS(orig_ptr); }
33399         LDKSocketDescriptor* orig_conv = (LDKSocketDescriptor*)orig_ptr;
33400         LDKSocketDescriptor* ret_ret = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
33401         *ret_ret = SocketDescriptor_clone(orig_conv);
33402         return tag_ptr(ret_ret, true);
33403 }
33404
33405 void  __attribute__((export_name("TS_SocketDescriptor_free"))) TS_SocketDescriptor_free(uint64_t this_ptr) {
33406         if (!ptr_is_owned(this_ptr)) return;
33407         void* this_ptr_ptr = untag_ptr(this_ptr);
33408         CHECK_ACCESS(this_ptr_ptr);
33409         LDKSocketDescriptor this_ptr_conv = *(LDKSocketDescriptor*)(this_ptr_ptr);
33410         FREE(untag_ptr(this_ptr));
33411         SocketDescriptor_free(this_ptr_conv);
33412 }
33413
33414 void  __attribute__((export_name("TS_PeerHandleError_free"))) TS_PeerHandleError_free(uint64_t this_obj) {
33415         LDKPeerHandleError this_obj_conv;
33416         this_obj_conv.inner = untag_ptr(this_obj);
33417         this_obj_conv.is_owned = ptr_is_owned(this_obj);
33418         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33419         PeerHandleError_free(this_obj_conv);
33420 }
33421
33422 jboolean  __attribute__((export_name("TS_PeerHandleError_get_no_connection_possible"))) TS_PeerHandleError_get_no_connection_possible(uint64_t this_ptr) {
33423         LDKPeerHandleError 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         jboolean ret_conv = PeerHandleError_get_no_connection_possible(&this_ptr_conv);
33429         return ret_conv;
33430 }
33431
33432 void  __attribute__((export_name("TS_PeerHandleError_set_no_connection_possible"))) TS_PeerHandleError_set_no_connection_possible(uint64_t this_ptr, jboolean val) {
33433         LDKPeerHandleError this_ptr_conv;
33434         this_ptr_conv.inner = untag_ptr(this_ptr);
33435         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33436         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33437         this_ptr_conv.is_owned = false;
33438         PeerHandleError_set_no_connection_possible(&this_ptr_conv, val);
33439 }
33440
33441 uint64_t  __attribute__((export_name("TS_PeerHandleError_new"))) TS_PeerHandleError_new(jboolean no_connection_possible_arg) {
33442         LDKPeerHandleError ret_var = PeerHandleError_new(no_connection_possible_arg);
33443         uint64_t ret_ref = 0;
33444         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33445         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33446         return ret_ref;
33447 }
33448
33449 static inline uint64_t PeerHandleError_clone_ptr(LDKPeerHandleError *NONNULL_PTR arg) {
33450         LDKPeerHandleError ret_var = PeerHandleError_clone(arg);
33451         uint64_t ret_ref = 0;
33452         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33453         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33454         return ret_ref;
33455 }
33456 int64_t  __attribute__((export_name("TS_PeerHandleError_clone_ptr"))) TS_PeerHandleError_clone_ptr(uint64_t arg) {
33457         LDKPeerHandleError arg_conv;
33458         arg_conv.inner = untag_ptr(arg);
33459         arg_conv.is_owned = ptr_is_owned(arg);
33460         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
33461         arg_conv.is_owned = false;
33462         int64_t ret_conv = PeerHandleError_clone_ptr(&arg_conv);
33463         return ret_conv;
33464 }
33465
33466 uint64_t  __attribute__((export_name("TS_PeerHandleError_clone"))) TS_PeerHandleError_clone(uint64_t orig) {
33467         LDKPeerHandleError orig_conv;
33468         orig_conv.inner = untag_ptr(orig);
33469         orig_conv.is_owned = ptr_is_owned(orig);
33470         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33471         orig_conv.is_owned = false;
33472         LDKPeerHandleError ret_var = PeerHandleError_clone(&orig_conv);
33473         uint64_t ret_ref = 0;
33474         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33475         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33476         return ret_ref;
33477 }
33478
33479 void  __attribute__((export_name("TS_PeerManager_free"))) TS_PeerManager_free(uint64_t this_obj) {
33480         LDKPeerManager this_obj_conv;
33481         this_obj_conv.inner = untag_ptr(this_obj);
33482         this_obj_conv.is_owned = ptr_is_owned(this_obj);
33483         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33484         PeerManager_free(this_obj_conv);
33485 }
33486
33487 uint64_t  __attribute__((export_name("TS_PeerManager_new"))) TS_PeerManager_new(uint64_t message_handler, int8_tArray our_node_secret, int8_tArray ephemeral_random_data, uint64_t logger, uint64_t custom_message_handler) {
33488         LDKMessageHandler message_handler_conv;
33489         message_handler_conv.inner = untag_ptr(message_handler);
33490         message_handler_conv.is_owned = ptr_is_owned(message_handler);
33491         CHECK_INNER_FIELD_ACCESS_OR_NULL(message_handler_conv);
33492         // WARNING: we need a move here but no clone is available for LDKMessageHandler
33493         
33494         LDKSecretKey our_node_secret_ref;
33495         CHECK(our_node_secret->arr_len == 32);
33496         memcpy(our_node_secret_ref.bytes, our_node_secret->elems, 32); FREE(our_node_secret);
33497         unsigned char ephemeral_random_data_arr[32];
33498         CHECK(ephemeral_random_data->arr_len == 32);
33499         memcpy(ephemeral_random_data_arr, ephemeral_random_data->elems, 32); FREE(ephemeral_random_data);
33500         unsigned char (*ephemeral_random_data_ref)[32] = &ephemeral_random_data_arr;
33501         void* logger_ptr = untag_ptr(logger);
33502         CHECK_ACCESS(logger_ptr);
33503         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
33504         if (logger_conv.free == LDKLogger_JCalls_free) {
33505                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
33506                 LDKLogger_JCalls_cloned(&logger_conv);
33507         }
33508         void* custom_message_handler_ptr = untag_ptr(custom_message_handler);
33509         CHECK_ACCESS(custom_message_handler_ptr);
33510         LDKCustomMessageHandler custom_message_handler_conv = *(LDKCustomMessageHandler*)(custom_message_handler_ptr);
33511         if (custom_message_handler_conv.free == LDKCustomMessageHandler_JCalls_free) {
33512                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
33513                 LDKCustomMessageHandler_JCalls_cloned(&custom_message_handler_conv);
33514         }
33515         LDKPeerManager ret_var = PeerManager_new(message_handler_conv, our_node_secret_ref, ephemeral_random_data_ref, logger_conv, custom_message_handler_conv);
33516         uint64_t ret_ref = 0;
33517         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33518         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33519         return ret_ref;
33520 }
33521
33522 ptrArray  __attribute__((export_name("TS_PeerManager_get_peer_node_ids"))) TS_PeerManager_get_peer_node_ids(uint64_t this_arg) {
33523         LDKPeerManager this_arg_conv;
33524         this_arg_conv.inner = untag_ptr(this_arg);
33525         this_arg_conv.is_owned = ptr_is_owned(this_arg);
33526         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33527         this_arg_conv.is_owned = false;
33528         LDKCVec_PublicKeyZ ret_var = PeerManager_get_peer_node_ids(&this_arg_conv);
33529         ptrArray ret_arr = NULL;
33530         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
33531         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
33532         for (size_t m = 0; m < ret_var.datalen; m++) {
33533                 int8_tArray ret_conv_12_arr = init_int8_tArray(33, __LINE__);
33534                 memcpy(ret_conv_12_arr->elems, ret_var.data[m].compressed_form, 33);
33535                 ret_arr_ptr[m] = ret_conv_12_arr;
33536         }
33537         
33538         FREE(ret_var.data);
33539         return ret_arr;
33540 }
33541
33542 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) {
33543         LDKPeerManager this_arg_conv;
33544         this_arg_conv.inner = untag_ptr(this_arg);
33545         this_arg_conv.is_owned = ptr_is_owned(this_arg);
33546         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33547         this_arg_conv.is_owned = false;
33548         LDKPublicKey their_node_id_ref;
33549         CHECK(their_node_id->arr_len == 33);
33550         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
33551         void* descriptor_ptr = untag_ptr(descriptor);
33552         CHECK_ACCESS(descriptor_ptr);
33553         LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)(descriptor_ptr);
33554         if (descriptor_conv.free == LDKSocketDescriptor_JCalls_free) {
33555                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
33556                 LDKSocketDescriptor_JCalls_cloned(&descriptor_conv);
33557         }
33558         void* remote_network_address_ptr = untag_ptr(remote_network_address);
33559         CHECK_ACCESS(remote_network_address_ptr);
33560         LDKCOption_NetAddressZ remote_network_address_conv = *(LDKCOption_NetAddressZ*)(remote_network_address_ptr);
33561         LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
33562         *ret_conv = PeerManager_new_outbound_connection(&this_arg_conv, their_node_id_ref, descriptor_conv, remote_network_address_conv);
33563         return tag_ptr(ret_conv, true);
33564 }
33565
33566 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) {
33567         LDKPeerManager this_arg_conv;
33568         this_arg_conv.inner = untag_ptr(this_arg);
33569         this_arg_conv.is_owned = ptr_is_owned(this_arg);
33570         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33571         this_arg_conv.is_owned = false;
33572         void* descriptor_ptr = untag_ptr(descriptor);
33573         CHECK_ACCESS(descriptor_ptr);
33574         LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)(descriptor_ptr);
33575         if (descriptor_conv.free == LDKSocketDescriptor_JCalls_free) {
33576                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
33577                 LDKSocketDescriptor_JCalls_cloned(&descriptor_conv);
33578         }
33579         void* remote_network_address_ptr = untag_ptr(remote_network_address);
33580         CHECK_ACCESS(remote_network_address_ptr);
33581         LDKCOption_NetAddressZ remote_network_address_conv = *(LDKCOption_NetAddressZ*)(remote_network_address_ptr);
33582         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
33583         *ret_conv = PeerManager_new_inbound_connection(&this_arg_conv, descriptor_conv, remote_network_address_conv);
33584         return tag_ptr(ret_conv, true);
33585 }
33586
33587 uint64_t  __attribute__((export_name("TS_PeerManager_write_buffer_space_avail"))) TS_PeerManager_write_buffer_space_avail(uint64_t this_arg, uint64_t descriptor) {
33588         LDKPeerManager this_arg_conv;
33589         this_arg_conv.inner = untag_ptr(this_arg);
33590         this_arg_conv.is_owned = ptr_is_owned(this_arg);
33591         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33592         this_arg_conv.is_owned = false;
33593         void* descriptor_ptr = untag_ptr(descriptor);
33594         if (ptr_is_owned(descriptor)) { CHECK_ACCESS(descriptor_ptr); }
33595         LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)descriptor_ptr;
33596         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
33597         *ret_conv = PeerManager_write_buffer_space_avail(&this_arg_conv, descriptor_conv);
33598         return tag_ptr(ret_conv, true);
33599 }
33600
33601 uint64_t  __attribute__((export_name("TS_PeerManager_read_event"))) TS_PeerManager_read_event(uint64_t this_arg, uint64_t peer_descriptor, int8_tArray data) {
33602         LDKPeerManager this_arg_conv;
33603         this_arg_conv.inner = untag_ptr(this_arg);
33604         this_arg_conv.is_owned = ptr_is_owned(this_arg);
33605         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33606         this_arg_conv.is_owned = false;
33607         void* peer_descriptor_ptr = untag_ptr(peer_descriptor);
33608         if (ptr_is_owned(peer_descriptor)) { CHECK_ACCESS(peer_descriptor_ptr); }
33609         LDKSocketDescriptor* peer_descriptor_conv = (LDKSocketDescriptor*)peer_descriptor_ptr;
33610         LDKu8slice data_ref;
33611         data_ref.datalen = data->arr_len;
33612         data_ref.data = data->elems;
33613         LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
33614         *ret_conv = PeerManager_read_event(&this_arg_conv, peer_descriptor_conv, data_ref);
33615         FREE(data);
33616         return tag_ptr(ret_conv, true);
33617 }
33618
33619 void  __attribute__((export_name("TS_PeerManager_process_events"))) TS_PeerManager_process_events(uint64_t this_arg) {
33620         LDKPeerManager this_arg_conv;
33621         this_arg_conv.inner = untag_ptr(this_arg);
33622         this_arg_conv.is_owned = ptr_is_owned(this_arg);
33623         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33624         this_arg_conv.is_owned = false;
33625         PeerManager_process_events(&this_arg_conv);
33626 }
33627
33628 void  __attribute__((export_name("TS_PeerManager_socket_disconnected"))) TS_PeerManager_socket_disconnected(uint64_t this_arg, uint64_t descriptor) {
33629         LDKPeerManager this_arg_conv;
33630         this_arg_conv.inner = untag_ptr(this_arg);
33631         this_arg_conv.is_owned = ptr_is_owned(this_arg);
33632         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33633         this_arg_conv.is_owned = false;
33634         void* descriptor_ptr = untag_ptr(descriptor);
33635         if (ptr_is_owned(descriptor)) { CHECK_ACCESS(descriptor_ptr); }
33636         LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)descriptor_ptr;
33637         PeerManager_socket_disconnected(&this_arg_conv, descriptor_conv);
33638 }
33639
33640 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) {
33641         LDKPeerManager this_arg_conv;
33642         this_arg_conv.inner = untag_ptr(this_arg);
33643         this_arg_conv.is_owned = ptr_is_owned(this_arg);
33644         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33645         this_arg_conv.is_owned = false;
33646         LDKPublicKey node_id_ref;
33647         CHECK(node_id->arr_len == 33);
33648         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
33649         PeerManager_disconnect_by_node_id(&this_arg_conv, node_id_ref, no_connection_possible);
33650 }
33651
33652 void  __attribute__((export_name("TS_PeerManager_disconnect_all_peers"))) TS_PeerManager_disconnect_all_peers(uint64_t this_arg) {
33653         LDKPeerManager this_arg_conv;
33654         this_arg_conv.inner = untag_ptr(this_arg);
33655         this_arg_conv.is_owned = ptr_is_owned(this_arg);
33656         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33657         this_arg_conv.is_owned = false;
33658         PeerManager_disconnect_all_peers(&this_arg_conv);
33659 }
33660
33661 void  __attribute__((export_name("TS_PeerManager_timer_tick_occurred"))) TS_PeerManager_timer_tick_occurred(uint64_t this_arg) {
33662         LDKPeerManager this_arg_conv;
33663         this_arg_conv.inner = untag_ptr(this_arg);
33664         this_arg_conv.is_owned = ptr_is_owned(this_arg);
33665         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33666         this_arg_conv.is_owned = false;
33667         PeerManager_timer_tick_occurred(&this_arg_conv);
33668 }
33669
33670 int64_t  __attribute__((export_name("TS_htlc_success_tx_weight"))) TS_htlc_success_tx_weight(jboolean opt_anchors) {
33671         int64_t ret_conv = htlc_success_tx_weight(opt_anchors);
33672         return ret_conv;
33673 }
33674
33675 int64_t  __attribute__((export_name("TS_htlc_timeout_tx_weight"))) TS_htlc_timeout_tx_weight(jboolean opt_anchors) {
33676         int64_t ret_conv = htlc_timeout_tx_weight(opt_anchors);
33677         return ret_conv;
33678 }
33679
33680 int8_tArray  __attribute__((export_name("TS_build_commitment_secret"))) TS_build_commitment_secret(int8_tArray commitment_seed, int64_t idx) {
33681         unsigned char commitment_seed_arr[32];
33682         CHECK(commitment_seed->arr_len == 32);
33683         memcpy(commitment_seed_arr, commitment_seed->elems, 32); FREE(commitment_seed);
33684         unsigned char (*commitment_seed_ref)[32] = &commitment_seed_arr;
33685         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
33686         memcpy(ret_arr->elems, build_commitment_secret(commitment_seed_ref, idx).data, 32);
33687         return ret_arr;
33688 }
33689
33690 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) {
33691         LDKCVec_u8Z to_holder_script_ref;
33692         to_holder_script_ref.datalen = to_holder_script->arr_len;
33693         to_holder_script_ref.data = MALLOC(to_holder_script_ref.datalen, "LDKCVec_u8Z Bytes");
33694         memcpy(to_holder_script_ref.data, to_holder_script->elems, to_holder_script_ref.datalen); FREE(to_holder_script);
33695         LDKCVec_u8Z to_counterparty_script_ref;
33696         to_counterparty_script_ref.datalen = to_counterparty_script->arr_len;
33697         to_counterparty_script_ref.data = MALLOC(to_counterparty_script_ref.datalen, "LDKCVec_u8Z Bytes");
33698         memcpy(to_counterparty_script_ref.data, to_counterparty_script->elems, to_counterparty_script_ref.datalen); FREE(to_counterparty_script);
33699         LDKOutPoint funding_outpoint_conv;
33700         funding_outpoint_conv.inner = untag_ptr(funding_outpoint);
33701         funding_outpoint_conv.is_owned = ptr_is_owned(funding_outpoint);
33702         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_conv);
33703         funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
33704         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);
33705         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
33706         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
33707         Transaction_free(ret_var);
33708         return ret_arr;
33709 }
33710
33711 void  __attribute__((export_name("TS_CounterpartyCommitmentSecrets_free"))) TS_CounterpartyCommitmentSecrets_free(uint64_t this_obj) {
33712         LDKCounterpartyCommitmentSecrets this_obj_conv;
33713         this_obj_conv.inner = untag_ptr(this_obj);
33714         this_obj_conv.is_owned = ptr_is_owned(this_obj);
33715         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33716         CounterpartyCommitmentSecrets_free(this_obj_conv);
33717 }
33718
33719 static inline uint64_t CounterpartyCommitmentSecrets_clone_ptr(LDKCounterpartyCommitmentSecrets *NONNULL_PTR arg) {
33720         LDKCounterpartyCommitmentSecrets ret_var = CounterpartyCommitmentSecrets_clone(arg);
33721         uint64_t ret_ref = 0;
33722         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33723         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33724         return ret_ref;
33725 }
33726 int64_t  __attribute__((export_name("TS_CounterpartyCommitmentSecrets_clone_ptr"))) TS_CounterpartyCommitmentSecrets_clone_ptr(uint64_t arg) {
33727         LDKCounterpartyCommitmentSecrets arg_conv;
33728         arg_conv.inner = untag_ptr(arg);
33729         arg_conv.is_owned = ptr_is_owned(arg);
33730         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
33731         arg_conv.is_owned = false;
33732         int64_t ret_conv = CounterpartyCommitmentSecrets_clone_ptr(&arg_conv);
33733         return ret_conv;
33734 }
33735
33736 uint64_t  __attribute__((export_name("TS_CounterpartyCommitmentSecrets_clone"))) TS_CounterpartyCommitmentSecrets_clone(uint64_t orig) {
33737         LDKCounterpartyCommitmentSecrets orig_conv;
33738         orig_conv.inner = untag_ptr(orig);
33739         orig_conv.is_owned = ptr_is_owned(orig);
33740         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33741         orig_conv.is_owned = false;
33742         LDKCounterpartyCommitmentSecrets ret_var = CounterpartyCommitmentSecrets_clone(&orig_conv);
33743         uint64_t ret_ref = 0;
33744         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33745         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33746         return ret_ref;
33747 }
33748
33749 uint64_t  __attribute__((export_name("TS_CounterpartyCommitmentSecrets_new"))) TS_CounterpartyCommitmentSecrets_new() {
33750         LDKCounterpartyCommitmentSecrets ret_var = CounterpartyCommitmentSecrets_new();
33751         uint64_t ret_ref = 0;
33752         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33753         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33754         return ret_ref;
33755 }
33756
33757 int64_t  __attribute__((export_name("TS_CounterpartyCommitmentSecrets_get_min_seen_secret"))) TS_CounterpartyCommitmentSecrets_get_min_seen_secret(uint64_t this_arg) {
33758         LDKCounterpartyCommitmentSecrets this_arg_conv;
33759         this_arg_conv.inner = untag_ptr(this_arg);
33760         this_arg_conv.is_owned = ptr_is_owned(this_arg);
33761         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33762         this_arg_conv.is_owned = false;
33763         int64_t ret_conv = CounterpartyCommitmentSecrets_get_min_seen_secret(&this_arg_conv);
33764         return ret_conv;
33765 }
33766
33767 uint64_t  __attribute__((export_name("TS_CounterpartyCommitmentSecrets_provide_secret"))) TS_CounterpartyCommitmentSecrets_provide_secret(uint64_t this_arg, int64_t idx, int8_tArray secret) {
33768         LDKCounterpartyCommitmentSecrets this_arg_conv;
33769         this_arg_conv.inner = untag_ptr(this_arg);
33770         this_arg_conv.is_owned = ptr_is_owned(this_arg);
33771         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33772         this_arg_conv.is_owned = false;
33773         LDKThirtyTwoBytes secret_ref;
33774         CHECK(secret->arr_len == 32);
33775         memcpy(secret_ref.data, secret->elems, 32); FREE(secret);
33776         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
33777         *ret_conv = CounterpartyCommitmentSecrets_provide_secret(&this_arg_conv, idx, secret_ref);
33778         return tag_ptr(ret_conv, true);
33779 }
33780
33781 int8_tArray  __attribute__((export_name("TS_CounterpartyCommitmentSecrets_get_secret"))) TS_CounterpartyCommitmentSecrets_get_secret(uint64_t this_arg, int64_t idx) {
33782         LDKCounterpartyCommitmentSecrets this_arg_conv;
33783         this_arg_conv.inner = untag_ptr(this_arg);
33784         this_arg_conv.is_owned = ptr_is_owned(this_arg);
33785         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33786         this_arg_conv.is_owned = false;
33787         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
33788         memcpy(ret_arr->elems, CounterpartyCommitmentSecrets_get_secret(&this_arg_conv, idx).data, 32);
33789         return ret_arr;
33790 }
33791
33792 int8_tArray  __attribute__((export_name("TS_CounterpartyCommitmentSecrets_write"))) TS_CounterpartyCommitmentSecrets_write(uint64_t obj) {
33793         LDKCounterpartyCommitmentSecrets obj_conv;
33794         obj_conv.inner = untag_ptr(obj);
33795         obj_conv.is_owned = ptr_is_owned(obj);
33796         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
33797         obj_conv.is_owned = false;
33798         LDKCVec_u8Z ret_var = CounterpartyCommitmentSecrets_write(&obj_conv);
33799         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
33800         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
33801         CVec_u8Z_free(ret_var);
33802         return ret_arr;
33803 }
33804
33805 uint64_t  __attribute__((export_name("TS_CounterpartyCommitmentSecrets_read"))) TS_CounterpartyCommitmentSecrets_read(int8_tArray ser) {
33806         LDKu8slice ser_ref;
33807         ser_ref.datalen = ser->arr_len;
33808         ser_ref.data = ser->elems;
33809         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
33810         *ret_conv = CounterpartyCommitmentSecrets_read(ser_ref);
33811         FREE(ser);
33812         return tag_ptr(ret_conv, true);
33813 }
33814
33815 uint64_t  __attribute__((export_name("TS_derive_private_key"))) TS_derive_private_key(int8_tArray per_commitment_point, int8_tArray base_secret) {
33816         LDKPublicKey per_commitment_point_ref;
33817         CHECK(per_commitment_point->arr_len == 33);
33818         memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33); FREE(per_commitment_point);
33819         unsigned char base_secret_arr[32];
33820         CHECK(base_secret->arr_len == 32);
33821         memcpy(base_secret_arr, base_secret->elems, 32); FREE(base_secret);
33822         unsigned char (*base_secret_ref)[32] = &base_secret_arr;
33823         LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
33824         *ret_conv = derive_private_key(per_commitment_point_ref, base_secret_ref);
33825         return tag_ptr(ret_conv, true);
33826 }
33827
33828 uint64_t  __attribute__((export_name("TS_derive_public_key"))) TS_derive_public_key(int8_tArray per_commitment_point, int8_tArray base_point) {
33829         LDKPublicKey per_commitment_point_ref;
33830         CHECK(per_commitment_point->arr_len == 33);
33831         memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33); FREE(per_commitment_point);
33832         LDKPublicKey base_point_ref;
33833         CHECK(base_point->arr_len == 33);
33834         memcpy(base_point_ref.compressed_form, base_point->elems, 33); FREE(base_point);
33835         LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
33836         *ret_conv = derive_public_key(per_commitment_point_ref, base_point_ref);
33837         return tag_ptr(ret_conv, true);
33838 }
33839
33840 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) {
33841         unsigned char per_commitment_secret_arr[32];
33842         CHECK(per_commitment_secret->arr_len == 32);
33843         memcpy(per_commitment_secret_arr, per_commitment_secret->elems, 32); FREE(per_commitment_secret);
33844         unsigned char (*per_commitment_secret_ref)[32] = &per_commitment_secret_arr;
33845         unsigned char countersignatory_revocation_base_secret_arr[32];
33846         CHECK(countersignatory_revocation_base_secret->arr_len == 32);
33847         memcpy(countersignatory_revocation_base_secret_arr, countersignatory_revocation_base_secret->elems, 32); FREE(countersignatory_revocation_base_secret);
33848         unsigned char (*countersignatory_revocation_base_secret_ref)[32] = &countersignatory_revocation_base_secret_arr;
33849         LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
33850         *ret_conv = derive_private_revocation_key(per_commitment_secret_ref, countersignatory_revocation_base_secret_ref);
33851         return tag_ptr(ret_conv, true);
33852 }
33853
33854 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) {
33855         LDKPublicKey per_commitment_point_ref;
33856         CHECK(per_commitment_point->arr_len == 33);
33857         memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33); FREE(per_commitment_point);
33858         LDKPublicKey countersignatory_revocation_base_point_ref;
33859         CHECK(countersignatory_revocation_base_point->arr_len == 33);
33860         memcpy(countersignatory_revocation_base_point_ref.compressed_form, countersignatory_revocation_base_point->elems, 33); FREE(countersignatory_revocation_base_point);
33861         LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
33862         *ret_conv = derive_public_revocation_key(per_commitment_point_ref, countersignatory_revocation_base_point_ref);
33863         return tag_ptr(ret_conv, true);
33864 }
33865
33866 void  __attribute__((export_name("TS_TxCreationKeys_free"))) TS_TxCreationKeys_free(uint64_t this_obj) {
33867         LDKTxCreationKeys this_obj_conv;
33868         this_obj_conv.inner = untag_ptr(this_obj);
33869         this_obj_conv.is_owned = ptr_is_owned(this_obj);
33870         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33871         TxCreationKeys_free(this_obj_conv);
33872 }
33873
33874 int8_tArray  __attribute__((export_name("TS_TxCreationKeys_get_per_commitment_point"))) TS_TxCreationKeys_get_per_commitment_point(uint64_t this_ptr) {
33875         LDKTxCreationKeys this_ptr_conv;
33876         this_ptr_conv.inner = untag_ptr(this_ptr);
33877         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33878         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33879         this_ptr_conv.is_owned = false;
33880         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
33881         memcpy(ret_arr->elems, TxCreationKeys_get_per_commitment_point(&this_ptr_conv).compressed_form, 33);
33882         return ret_arr;
33883 }
33884
33885 void  __attribute__((export_name("TS_TxCreationKeys_set_per_commitment_point"))) TS_TxCreationKeys_set_per_commitment_point(uint64_t this_ptr, int8_tArray val) {
33886         LDKTxCreationKeys this_ptr_conv;
33887         this_ptr_conv.inner = untag_ptr(this_ptr);
33888         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33889         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33890         this_ptr_conv.is_owned = false;
33891         LDKPublicKey val_ref;
33892         CHECK(val->arr_len == 33);
33893         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
33894         TxCreationKeys_set_per_commitment_point(&this_ptr_conv, val_ref);
33895 }
33896
33897 int8_tArray  __attribute__((export_name("TS_TxCreationKeys_get_revocation_key"))) TS_TxCreationKeys_get_revocation_key(uint64_t this_ptr) {
33898         LDKTxCreationKeys this_ptr_conv;
33899         this_ptr_conv.inner = untag_ptr(this_ptr);
33900         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33901         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33902         this_ptr_conv.is_owned = false;
33903         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
33904         memcpy(ret_arr->elems, TxCreationKeys_get_revocation_key(&this_ptr_conv).compressed_form, 33);
33905         return ret_arr;
33906 }
33907
33908 void  __attribute__((export_name("TS_TxCreationKeys_set_revocation_key"))) TS_TxCreationKeys_set_revocation_key(uint64_t this_ptr, int8_tArray val) {
33909         LDKTxCreationKeys this_ptr_conv;
33910         this_ptr_conv.inner = untag_ptr(this_ptr);
33911         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33912         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33913         this_ptr_conv.is_owned = false;
33914         LDKPublicKey val_ref;
33915         CHECK(val->arr_len == 33);
33916         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
33917         TxCreationKeys_set_revocation_key(&this_ptr_conv, val_ref);
33918 }
33919
33920 int8_tArray  __attribute__((export_name("TS_TxCreationKeys_get_broadcaster_htlc_key"))) TS_TxCreationKeys_get_broadcaster_htlc_key(uint64_t this_ptr) {
33921         LDKTxCreationKeys this_ptr_conv;
33922         this_ptr_conv.inner = untag_ptr(this_ptr);
33923         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33924         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33925         this_ptr_conv.is_owned = false;
33926         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
33927         memcpy(ret_arr->elems, TxCreationKeys_get_broadcaster_htlc_key(&this_ptr_conv).compressed_form, 33);
33928         return ret_arr;
33929 }
33930
33931 void  __attribute__((export_name("TS_TxCreationKeys_set_broadcaster_htlc_key"))) TS_TxCreationKeys_set_broadcaster_htlc_key(uint64_t this_ptr, int8_tArray val) {
33932         LDKTxCreationKeys this_ptr_conv;
33933         this_ptr_conv.inner = untag_ptr(this_ptr);
33934         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33935         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33936         this_ptr_conv.is_owned = false;
33937         LDKPublicKey val_ref;
33938         CHECK(val->arr_len == 33);
33939         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
33940         TxCreationKeys_set_broadcaster_htlc_key(&this_ptr_conv, val_ref);
33941 }
33942
33943 int8_tArray  __attribute__((export_name("TS_TxCreationKeys_get_countersignatory_htlc_key"))) TS_TxCreationKeys_get_countersignatory_htlc_key(uint64_t this_ptr) {
33944         LDKTxCreationKeys this_ptr_conv;
33945         this_ptr_conv.inner = untag_ptr(this_ptr);
33946         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33947         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33948         this_ptr_conv.is_owned = false;
33949         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
33950         memcpy(ret_arr->elems, TxCreationKeys_get_countersignatory_htlc_key(&this_ptr_conv).compressed_form, 33);
33951         return ret_arr;
33952 }
33953
33954 void  __attribute__((export_name("TS_TxCreationKeys_set_countersignatory_htlc_key"))) TS_TxCreationKeys_set_countersignatory_htlc_key(uint64_t this_ptr, int8_tArray val) {
33955         LDKTxCreationKeys this_ptr_conv;
33956         this_ptr_conv.inner = untag_ptr(this_ptr);
33957         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33958         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33959         this_ptr_conv.is_owned = false;
33960         LDKPublicKey val_ref;
33961         CHECK(val->arr_len == 33);
33962         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
33963         TxCreationKeys_set_countersignatory_htlc_key(&this_ptr_conv, val_ref);
33964 }
33965
33966 int8_tArray  __attribute__((export_name("TS_TxCreationKeys_get_broadcaster_delayed_payment_key"))) TS_TxCreationKeys_get_broadcaster_delayed_payment_key(uint64_t this_ptr) {
33967         LDKTxCreationKeys this_ptr_conv;
33968         this_ptr_conv.inner = untag_ptr(this_ptr);
33969         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33970         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33971         this_ptr_conv.is_owned = false;
33972         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
33973         memcpy(ret_arr->elems, TxCreationKeys_get_broadcaster_delayed_payment_key(&this_ptr_conv).compressed_form, 33);
33974         return ret_arr;
33975 }
33976
33977 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) {
33978         LDKTxCreationKeys this_ptr_conv;
33979         this_ptr_conv.inner = untag_ptr(this_ptr);
33980         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33981         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33982         this_ptr_conv.is_owned = false;
33983         LDKPublicKey val_ref;
33984         CHECK(val->arr_len == 33);
33985         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
33986         TxCreationKeys_set_broadcaster_delayed_payment_key(&this_ptr_conv, val_ref);
33987 }
33988
33989 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) {
33990         LDKPublicKey per_commitment_point_arg_ref;
33991         CHECK(per_commitment_point_arg->arr_len == 33);
33992         memcpy(per_commitment_point_arg_ref.compressed_form, per_commitment_point_arg->elems, 33); FREE(per_commitment_point_arg);
33993         LDKPublicKey revocation_key_arg_ref;
33994         CHECK(revocation_key_arg->arr_len == 33);
33995         memcpy(revocation_key_arg_ref.compressed_form, revocation_key_arg->elems, 33); FREE(revocation_key_arg);
33996         LDKPublicKey broadcaster_htlc_key_arg_ref;
33997         CHECK(broadcaster_htlc_key_arg->arr_len == 33);
33998         memcpy(broadcaster_htlc_key_arg_ref.compressed_form, broadcaster_htlc_key_arg->elems, 33); FREE(broadcaster_htlc_key_arg);
33999         LDKPublicKey countersignatory_htlc_key_arg_ref;
34000         CHECK(countersignatory_htlc_key_arg->arr_len == 33);
34001         memcpy(countersignatory_htlc_key_arg_ref.compressed_form, countersignatory_htlc_key_arg->elems, 33); FREE(countersignatory_htlc_key_arg);
34002         LDKPublicKey broadcaster_delayed_payment_key_arg_ref;
34003         CHECK(broadcaster_delayed_payment_key_arg->arr_len == 33);
34004         memcpy(broadcaster_delayed_payment_key_arg_ref.compressed_form, broadcaster_delayed_payment_key_arg->elems, 33); FREE(broadcaster_delayed_payment_key_arg);
34005         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);
34006         uint64_t ret_ref = 0;
34007         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34008         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34009         return ret_ref;
34010 }
34011
34012 static inline uint64_t TxCreationKeys_clone_ptr(LDKTxCreationKeys *NONNULL_PTR arg) {
34013         LDKTxCreationKeys ret_var = TxCreationKeys_clone(arg);
34014         uint64_t ret_ref = 0;
34015         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34016         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34017         return ret_ref;
34018 }
34019 int64_t  __attribute__((export_name("TS_TxCreationKeys_clone_ptr"))) TS_TxCreationKeys_clone_ptr(uint64_t arg) {
34020         LDKTxCreationKeys arg_conv;
34021         arg_conv.inner = untag_ptr(arg);
34022         arg_conv.is_owned = ptr_is_owned(arg);
34023         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34024         arg_conv.is_owned = false;
34025         int64_t ret_conv = TxCreationKeys_clone_ptr(&arg_conv);
34026         return ret_conv;
34027 }
34028
34029 uint64_t  __attribute__((export_name("TS_TxCreationKeys_clone"))) TS_TxCreationKeys_clone(uint64_t orig) {
34030         LDKTxCreationKeys orig_conv;
34031         orig_conv.inner = untag_ptr(orig);
34032         orig_conv.is_owned = ptr_is_owned(orig);
34033         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34034         orig_conv.is_owned = false;
34035         LDKTxCreationKeys ret_var = TxCreationKeys_clone(&orig_conv);
34036         uint64_t ret_ref = 0;
34037         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34038         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34039         return ret_ref;
34040 }
34041
34042 int8_tArray  __attribute__((export_name("TS_TxCreationKeys_write"))) TS_TxCreationKeys_write(uint64_t obj) {
34043         LDKTxCreationKeys obj_conv;
34044         obj_conv.inner = untag_ptr(obj);
34045         obj_conv.is_owned = ptr_is_owned(obj);
34046         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
34047         obj_conv.is_owned = false;
34048         LDKCVec_u8Z ret_var = TxCreationKeys_write(&obj_conv);
34049         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
34050         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
34051         CVec_u8Z_free(ret_var);
34052         return ret_arr;
34053 }
34054
34055 uint64_t  __attribute__((export_name("TS_TxCreationKeys_read"))) TS_TxCreationKeys_read(int8_tArray ser) {
34056         LDKu8slice ser_ref;
34057         ser_ref.datalen = ser->arr_len;
34058         ser_ref.data = ser->elems;
34059         LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
34060         *ret_conv = TxCreationKeys_read(ser_ref);
34061         FREE(ser);
34062         return tag_ptr(ret_conv, true);
34063 }
34064
34065 void  __attribute__((export_name("TS_ChannelPublicKeys_free"))) TS_ChannelPublicKeys_free(uint64_t this_obj) {
34066         LDKChannelPublicKeys this_obj_conv;
34067         this_obj_conv.inner = untag_ptr(this_obj);
34068         this_obj_conv.is_owned = ptr_is_owned(this_obj);
34069         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34070         ChannelPublicKeys_free(this_obj_conv);
34071 }
34072
34073 int8_tArray  __attribute__((export_name("TS_ChannelPublicKeys_get_funding_pubkey"))) TS_ChannelPublicKeys_get_funding_pubkey(uint64_t this_ptr) {
34074         LDKChannelPublicKeys this_ptr_conv;
34075         this_ptr_conv.inner = untag_ptr(this_ptr);
34076         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34077         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34078         this_ptr_conv.is_owned = false;
34079         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
34080         memcpy(ret_arr->elems, ChannelPublicKeys_get_funding_pubkey(&this_ptr_conv).compressed_form, 33);
34081         return ret_arr;
34082 }
34083
34084 void  __attribute__((export_name("TS_ChannelPublicKeys_set_funding_pubkey"))) TS_ChannelPublicKeys_set_funding_pubkey(uint64_t this_ptr, int8_tArray val) {
34085         LDKChannelPublicKeys this_ptr_conv;
34086         this_ptr_conv.inner = untag_ptr(this_ptr);
34087         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34088         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34089         this_ptr_conv.is_owned = false;
34090         LDKPublicKey val_ref;
34091         CHECK(val->arr_len == 33);
34092         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
34093         ChannelPublicKeys_set_funding_pubkey(&this_ptr_conv, val_ref);
34094 }
34095
34096 int8_tArray  __attribute__((export_name("TS_ChannelPublicKeys_get_revocation_basepoint"))) TS_ChannelPublicKeys_get_revocation_basepoint(uint64_t this_ptr) {
34097         LDKChannelPublicKeys this_ptr_conv;
34098         this_ptr_conv.inner = untag_ptr(this_ptr);
34099         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34100         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34101         this_ptr_conv.is_owned = false;
34102         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
34103         memcpy(ret_arr->elems, ChannelPublicKeys_get_revocation_basepoint(&this_ptr_conv).compressed_form, 33);
34104         return ret_arr;
34105 }
34106
34107 void  __attribute__((export_name("TS_ChannelPublicKeys_set_revocation_basepoint"))) TS_ChannelPublicKeys_set_revocation_basepoint(uint64_t this_ptr, int8_tArray val) {
34108         LDKChannelPublicKeys this_ptr_conv;
34109         this_ptr_conv.inner = untag_ptr(this_ptr);
34110         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34111         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34112         this_ptr_conv.is_owned = false;
34113         LDKPublicKey val_ref;
34114         CHECK(val->arr_len == 33);
34115         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
34116         ChannelPublicKeys_set_revocation_basepoint(&this_ptr_conv, val_ref);
34117 }
34118
34119 int8_tArray  __attribute__((export_name("TS_ChannelPublicKeys_get_payment_point"))) TS_ChannelPublicKeys_get_payment_point(uint64_t this_ptr) {
34120         LDKChannelPublicKeys this_ptr_conv;
34121         this_ptr_conv.inner = untag_ptr(this_ptr);
34122         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34123         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34124         this_ptr_conv.is_owned = false;
34125         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
34126         memcpy(ret_arr->elems, ChannelPublicKeys_get_payment_point(&this_ptr_conv).compressed_form, 33);
34127         return ret_arr;
34128 }
34129
34130 void  __attribute__((export_name("TS_ChannelPublicKeys_set_payment_point"))) TS_ChannelPublicKeys_set_payment_point(uint64_t this_ptr, int8_tArray val) {
34131         LDKChannelPublicKeys this_ptr_conv;
34132         this_ptr_conv.inner = untag_ptr(this_ptr);
34133         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34134         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34135         this_ptr_conv.is_owned = false;
34136         LDKPublicKey val_ref;
34137         CHECK(val->arr_len == 33);
34138         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
34139         ChannelPublicKeys_set_payment_point(&this_ptr_conv, val_ref);
34140 }
34141
34142 int8_tArray  __attribute__((export_name("TS_ChannelPublicKeys_get_delayed_payment_basepoint"))) TS_ChannelPublicKeys_get_delayed_payment_basepoint(uint64_t this_ptr) {
34143         LDKChannelPublicKeys this_ptr_conv;
34144         this_ptr_conv.inner = untag_ptr(this_ptr);
34145         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34146         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34147         this_ptr_conv.is_owned = false;
34148         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
34149         memcpy(ret_arr->elems, ChannelPublicKeys_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form, 33);
34150         return ret_arr;
34151 }
34152
34153 void  __attribute__((export_name("TS_ChannelPublicKeys_set_delayed_payment_basepoint"))) TS_ChannelPublicKeys_set_delayed_payment_basepoint(uint64_t this_ptr, int8_tArray val) {
34154         LDKChannelPublicKeys this_ptr_conv;
34155         this_ptr_conv.inner = untag_ptr(this_ptr);
34156         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34157         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34158         this_ptr_conv.is_owned = false;
34159         LDKPublicKey val_ref;
34160         CHECK(val->arr_len == 33);
34161         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
34162         ChannelPublicKeys_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
34163 }
34164
34165 int8_tArray  __attribute__((export_name("TS_ChannelPublicKeys_get_htlc_basepoint"))) TS_ChannelPublicKeys_get_htlc_basepoint(uint64_t this_ptr) {
34166         LDKChannelPublicKeys this_ptr_conv;
34167         this_ptr_conv.inner = untag_ptr(this_ptr);
34168         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34169         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34170         this_ptr_conv.is_owned = false;
34171         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
34172         memcpy(ret_arr->elems, ChannelPublicKeys_get_htlc_basepoint(&this_ptr_conv).compressed_form, 33);
34173         return ret_arr;
34174 }
34175
34176 void  __attribute__((export_name("TS_ChannelPublicKeys_set_htlc_basepoint"))) TS_ChannelPublicKeys_set_htlc_basepoint(uint64_t this_ptr, int8_tArray val) {
34177         LDKChannelPublicKeys this_ptr_conv;
34178         this_ptr_conv.inner = untag_ptr(this_ptr);
34179         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34180         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34181         this_ptr_conv.is_owned = false;
34182         LDKPublicKey val_ref;
34183         CHECK(val->arr_len == 33);
34184         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
34185         ChannelPublicKeys_set_htlc_basepoint(&this_ptr_conv, val_ref);
34186 }
34187
34188 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) {
34189         LDKPublicKey funding_pubkey_arg_ref;
34190         CHECK(funding_pubkey_arg->arr_len == 33);
34191         memcpy(funding_pubkey_arg_ref.compressed_form, funding_pubkey_arg->elems, 33); FREE(funding_pubkey_arg);
34192         LDKPublicKey revocation_basepoint_arg_ref;
34193         CHECK(revocation_basepoint_arg->arr_len == 33);
34194         memcpy(revocation_basepoint_arg_ref.compressed_form, revocation_basepoint_arg->elems, 33); FREE(revocation_basepoint_arg);
34195         LDKPublicKey payment_point_arg_ref;
34196         CHECK(payment_point_arg->arr_len == 33);
34197         memcpy(payment_point_arg_ref.compressed_form, payment_point_arg->elems, 33); FREE(payment_point_arg);
34198         LDKPublicKey delayed_payment_basepoint_arg_ref;
34199         CHECK(delayed_payment_basepoint_arg->arr_len == 33);
34200         memcpy(delayed_payment_basepoint_arg_ref.compressed_form, delayed_payment_basepoint_arg->elems, 33); FREE(delayed_payment_basepoint_arg);
34201         LDKPublicKey htlc_basepoint_arg_ref;
34202         CHECK(htlc_basepoint_arg->arr_len == 33);
34203         memcpy(htlc_basepoint_arg_ref.compressed_form, htlc_basepoint_arg->elems, 33); FREE(htlc_basepoint_arg);
34204         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);
34205         uint64_t ret_ref = 0;
34206         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34207         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34208         return ret_ref;
34209 }
34210
34211 static inline uint64_t ChannelPublicKeys_clone_ptr(LDKChannelPublicKeys *NONNULL_PTR arg) {
34212         LDKChannelPublicKeys ret_var = ChannelPublicKeys_clone(arg);
34213         uint64_t ret_ref = 0;
34214         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34215         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34216         return ret_ref;
34217 }
34218 int64_t  __attribute__((export_name("TS_ChannelPublicKeys_clone_ptr"))) TS_ChannelPublicKeys_clone_ptr(uint64_t arg) {
34219         LDKChannelPublicKeys arg_conv;
34220         arg_conv.inner = untag_ptr(arg);
34221         arg_conv.is_owned = ptr_is_owned(arg);
34222         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34223         arg_conv.is_owned = false;
34224         int64_t ret_conv = ChannelPublicKeys_clone_ptr(&arg_conv);
34225         return ret_conv;
34226 }
34227
34228 uint64_t  __attribute__((export_name("TS_ChannelPublicKeys_clone"))) TS_ChannelPublicKeys_clone(uint64_t orig) {
34229         LDKChannelPublicKeys orig_conv;
34230         orig_conv.inner = untag_ptr(orig);
34231         orig_conv.is_owned = ptr_is_owned(orig);
34232         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34233         orig_conv.is_owned = false;
34234         LDKChannelPublicKeys ret_var = ChannelPublicKeys_clone(&orig_conv);
34235         uint64_t ret_ref = 0;
34236         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34237         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34238         return ret_ref;
34239 }
34240
34241 int8_tArray  __attribute__((export_name("TS_ChannelPublicKeys_write"))) TS_ChannelPublicKeys_write(uint64_t obj) {
34242         LDKChannelPublicKeys obj_conv;
34243         obj_conv.inner = untag_ptr(obj);
34244         obj_conv.is_owned = ptr_is_owned(obj);
34245         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
34246         obj_conv.is_owned = false;
34247         LDKCVec_u8Z ret_var = ChannelPublicKeys_write(&obj_conv);
34248         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
34249         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
34250         CVec_u8Z_free(ret_var);
34251         return ret_arr;
34252 }
34253
34254 uint64_t  __attribute__((export_name("TS_ChannelPublicKeys_read"))) TS_ChannelPublicKeys_read(int8_tArray ser) {
34255         LDKu8slice ser_ref;
34256         ser_ref.datalen = ser->arr_len;
34257         ser_ref.data = ser->elems;
34258         LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
34259         *ret_conv = ChannelPublicKeys_read(ser_ref);
34260         FREE(ser);
34261         return tag_ptr(ret_conv, true);
34262 }
34263
34264 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) {
34265         LDKPublicKey per_commitment_point_ref;
34266         CHECK(per_commitment_point->arr_len == 33);
34267         memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33); FREE(per_commitment_point);
34268         LDKPublicKey broadcaster_delayed_payment_base_ref;
34269         CHECK(broadcaster_delayed_payment_base->arr_len == 33);
34270         memcpy(broadcaster_delayed_payment_base_ref.compressed_form, broadcaster_delayed_payment_base->elems, 33); FREE(broadcaster_delayed_payment_base);
34271         LDKPublicKey broadcaster_htlc_base_ref;
34272         CHECK(broadcaster_htlc_base->arr_len == 33);
34273         memcpy(broadcaster_htlc_base_ref.compressed_form, broadcaster_htlc_base->elems, 33); FREE(broadcaster_htlc_base);
34274         LDKPublicKey countersignatory_revocation_base_ref;
34275         CHECK(countersignatory_revocation_base->arr_len == 33);
34276         memcpy(countersignatory_revocation_base_ref.compressed_form, countersignatory_revocation_base->elems, 33); FREE(countersignatory_revocation_base);
34277         LDKPublicKey countersignatory_htlc_base_ref;
34278         CHECK(countersignatory_htlc_base->arr_len == 33);
34279         memcpy(countersignatory_htlc_base_ref.compressed_form, countersignatory_htlc_base->elems, 33); FREE(countersignatory_htlc_base);
34280         LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
34281         *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);
34282         return tag_ptr(ret_conv, true);
34283 }
34284
34285 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) {
34286         LDKPublicKey per_commitment_point_ref;
34287         CHECK(per_commitment_point->arr_len == 33);
34288         memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33); FREE(per_commitment_point);
34289         LDKChannelPublicKeys broadcaster_keys_conv;
34290         broadcaster_keys_conv.inner = untag_ptr(broadcaster_keys);
34291         broadcaster_keys_conv.is_owned = ptr_is_owned(broadcaster_keys);
34292         CHECK_INNER_FIELD_ACCESS_OR_NULL(broadcaster_keys_conv);
34293         broadcaster_keys_conv.is_owned = false;
34294         LDKChannelPublicKeys countersignatory_keys_conv;
34295         countersignatory_keys_conv.inner = untag_ptr(countersignatory_keys);
34296         countersignatory_keys_conv.is_owned = ptr_is_owned(countersignatory_keys);
34297         CHECK_INNER_FIELD_ACCESS_OR_NULL(countersignatory_keys_conv);
34298         countersignatory_keys_conv.is_owned = false;
34299         LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
34300         *ret_conv = TxCreationKeys_from_channel_static_keys(per_commitment_point_ref, &broadcaster_keys_conv, &countersignatory_keys_conv);
34301         return tag_ptr(ret_conv, true);
34302 }
34303
34304 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) {
34305         LDKPublicKey revocation_key_ref;
34306         CHECK(revocation_key->arr_len == 33);
34307         memcpy(revocation_key_ref.compressed_form, revocation_key->elems, 33); FREE(revocation_key);
34308         LDKPublicKey broadcaster_delayed_payment_key_ref;
34309         CHECK(broadcaster_delayed_payment_key->arr_len == 33);
34310         memcpy(broadcaster_delayed_payment_key_ref.compressed_form, broadcaster_delayed_payment_key->elems, 33); FREE(broadcaster_delayed_payment_key);
34311         LDKCVec_u8Z ret_var = get_revokeable_redeemscript(revocation_key_ref, contest_delay, broadcaster_delayed_payment_key_ref);
34312         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
34313         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
34314         CVec_u8Z_free(ret_var);
34315         return ret_arr;
34316 }
34317
34318 void  __attribute__((export_name("TS_HTLCOutputInCommitment_free"))) TS_HTLCOutputInCommitment_free(uint64_t this_obj) {
34319         LDKHTLCOutputInCommitment this_obj_conv;
34320         this_obj_conv.inner = untag_ptr(this_obj);
34321         this_obj_conv.is_owned = ptr_is_owned(this_obj);
34322         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34323         HTLCOutputInCommitment_free(this_obj_conv);
34324 }
34325
34326 jboolean  __attribute__((export_name("TS_HTLCOutputInCommitment_get_offered"))) TS_HTLCOutputInCommitment_get_offered(uint64_t this_ptr) {
34327         LDKHTLCOutputInCommitment this_ptr_conv;
34328         this_ptr_conv.inner = untag_ptr(this_ptr);
34329         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34330         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34331         this_ptr_conv.is_owned = false;
34332         jboolean ret_conv = HTLCOutputInCommitment_get_offered(&this_ptr_conv);
34333         return ret_conv;
34334 }
34335
34336 void  __attribute__((export_name("TS_HTLCOutputInCommitment_set_offered"))) TS_HTLCOutputInCommitment_set_offered(uint64_t this_ptr, jboolean val) {
34337         LDKHTLCOutputInCommitment this_ptr_conv;
34338         this_ptr_conv.inner = untag_ptr(this_ptr);
34339         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34340         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34341         this_ptr_conv.is_owned = false;
34342         HTLCOutputInCommitment_set_offered(&this_ptr_conv, val);
34343 }
34344
34345 int64_t  __attribute__((export_name("TS_HTLCOutputInCommitment_get_amount_msat"))) TS_HTLCOutputInCommitment_get_amount_msat(uint64_t this_ptr) {
34346         LDKHTLCOutputInCommitment this_ptr_conv;
34347         this_ptr_conv.inner = untag_ptr(this_ptr);
34348         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34349         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34350         this_ptr_conv.is_owned = false;
34351         int64_t ret_conv = HTLCOutputInCommitment_get_amount_msat(&this_ptr_conv);
34352         return ret_conv;
34353 }
34354
34355 void  __attribute__((export_name("TS_HTLCOutputInCommitment_set_amount_msat"))) TS_HTLCOutputInCommitment_set_amount_msat(uint64_t this_ptr, int64_t val) {
34356         LDKHTLCOutputInCommitment this_ptr_conv;
34357         this_ptr_conv.inner = untag_ptr(this_ptr);
34358         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34359         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34360         this_ptr_conv.is_owned = false;
34361         HTLCOutputInCommitment_set_amount_msat(&this_ptr_conv, val);
34362 }
34363
34364 int32_t  __attribute__((export_name("TS_HTLCOutputInCommitment_get_cltv_expiry"))) TS_HTLCOutputInCommitment_get_cltv_expiry(uint64_t this_ptr) {
34365         LDKHTLCOutputInCommitment this_ptr_conv;
34366         this_ptr_conv.inner = untag_ptr(this_ptr);
34367         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34368         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34369         this_ptr_conv.is_owned = false;
34370         int32_t ret_conv = HTLCOutputInCommitment_get_cltv_expiry(&this_ptr_conv);
34371         return ret_conv;
34372 }
34373
34374 void  __attribute__((export_name("TS_HTLCOutputInCommitment_set_cltv_expiry"))) TS_HTLCOutputInCommitment_set_cltv_expiry(uint64_t this_ptr, int32_t val) {
34375         LDKHTLCOutputInCommitment this_ptr_conv;
34376         this_ptr_conv.inner = untag_ptr(this_ptr);
34377         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34378         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34379         this_ptr_conv.is_owned = false;
34380         HTLCOutputInCommitment_set_cltv_expiry(&this_ptr_conv, val);
34381 }
34382
34383 int8_tArray  __attribute__((export_name("TS_HTLCOutputInCommitment_get_payment_hash"))) TS_HTLCOutputInCommitment_get_payment_hash(uint64_t this_ptr) {
34384         LDKHTLCOutputInCommitment this_ptr_conv;
34385         this_ptr_conv.inner = untag_ptr(this_ptr);
34386         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34387         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34388         this_ptr_conv.is_owned = false;
34389         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
34390         memcpy(ret_arr->elems, *HTLCOutputInCommitment_get_payment_hash(&this_ptr_conv), 32);
34391         return ret_arr;
34392 }
34393
34394 void  __attribute__((export_name("TS_HTLCOutputInCommitment_set_payment_hash"))) TS_HTLCOutputInCommitment_set_payment_hash(uint64_t this_ptr, int8_tArray val) {
34395         LDKHTLCOutputInCommitment this_ptr_conv;
34396         this_ptr_conv.inner = untag_ptr(this_ptr);
34397         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34398         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34399         this_ptr_conv.is_owned = false;
34400         LDKThirtyTwoBytes val_ref;
34401         CHECK(val->arr_len == 32);
34402         memcpy(val_ref.data, val->elems, 32); FREE(val);
34403         HTLCOutputInCommitment_set_payment_hash(&this_ptr_conv, val_ref);
34404 }
34405
34406 uint64_t  __attribute__((export_name("TS_HTLCOutputInCommitment_get_transaction_output_index"))) TS_HTLCOutputInCommitment_get_transaction_output_index(uint64_t this_ptr) {
34407         LDKHTLCOutputInCommitment this_ptr_conv;
34408         this_ptr_conv.inner = untag_ptr(this_ptr);
34409         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34410         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34411         this_ptr_conv.is_owned = false;
34412         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
34413         *ret_copy = HTLCOutputInCommitment_get_transaction_output_index(&this_ptr_conv);
34414         uint64_t ret_ref = tag_ptr(ret_copy, true);
34415         return ret_ref;
34416 }
34417
34418 void  __attribute__((export_name("TS_HTLCOutputInCommitment_set_transaction_output_index"))) TS_HTLCOutputInCommitment_set_transaction_output_index(uint64_t this_ptr, uint64_t val) {
34419         LDKHTLCOutputInCommitment this_ptr_conv;
34420         this_ptr_conv.inner = untag_ptr(this_ptr);
34421         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34422         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34423         this_ptr_conv.is_owned = false;
34424         void* val_ptr = untag_ptr(val);
34425         CHECK_ACCESS(val_ptr);
34426         LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
34427         val_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(val));
34428         HTLCOutputInCommitment_set_transaction_output_index(&this_ptr_conv, val_conv);
34429 }
34430
34431 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) {
34432         LDKThirtyTwoBytes payment_hash_arg_ref;
34433         CHECK(payment_hash_arg->arr_len == 32);
34434         memcpy(payment_hash_arg_ref.data, payment_hash_arg->elems, 32); FREE(payment_hash_arg);
34435         void* transaction_output_index_arg_ptr = untag_ptr(transaction_output_index_arg);
34436         CHECK_ACCESS(transaction_output_index_arg_ptr);
34437         LDKCOption_u32Z transaction_output_index_arg_conv = *(LDKCOption_u32Z*)(transaction_output_index_arg_ptr);
34438         transaction_output_index_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(transaction_output_index_arg));
34439         LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_new(offered_arg, amount_msat_arg, cltv_expiry_arg, payment_hash_arg_ref, transaction_output_index_arg_conv);
34440         uint64_t ret_ref = 0;
34441         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34442         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34443         return ret_ref;
34444 }
34445
34446 static inline uint64_t HTLCOutputInCommitment_clone_ptr(LDKHTLCOutputInCommitment *NONNULL_PTR arg) {
34447         LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_clone(arg);
34448         uint64_t ret_ref = 0;
34449         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34450         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34451         return ret_ref;
34452 }
34453 int64_t  __attribute__((export_name("TS_HTLCOutputInCommitment_clone_ptr"))) TS_HTLCOutputInCommitment_clone_ptr(uint64_t arg) {
34454         LDKHTLCOutputInCommitment arg_conv;
34455         arg_conv.inner = untag_ptr(arg);
34456         arg_conv.is_owned = ptr_is_owned(arg);
34457         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34458         arg_conv.is_owned = false;
34459         int64_t ret_conv = HTLCOutputInCommitment_clone_ptr(&arg_conv);
34460         return ret_conv;
34461 }
34462
34463 uint64_t  __attribute__((export_name("TS_HTLCOutputInCommitment_clone"))) TS_HTLCOutputInCommitment_clone(uint64_t orig) {
34464         LDKHTLCOutputInCommitment orig_conv;
34465         orig_conv.inner = untag_ptr(orig);
34466         orig_conv.is_owned = ptr_is_owned(orig);
34467         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34468         orig_conv.is_owned = false;
34469         LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_clone(&orig_conv);
34470         uint64_t ret_ref = 0;
34471         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34472         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34473         return ret_ref;
34474 }
34475
34476 int8_tArray  __attribute__((export_name("TS_HTLCOutputInCommitment_write"))) TS_HTLCOutputInCommitment_write(uint64_t obj) {
34477         LDKHTLCOutputInCommitment obj_conv;
34478         obj_conv.inner = untag_ptr(obj);
34479         obj_conv.is_owned = ptr_is_owned(obj);
34480         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
34481         obj_conv.is_owned = false;
34482         LDKCVec_u8Z ret_var = HTLCOutputInCommitment_write(&obj_conv);
34483         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
34484         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
34485         CVec_u8Z_free(ret_var);
34486         return ret_arr;
34487 }
34488
34489 uint64_t  __attribute__((export_name("TS_HTLCOutputInCommitment_read"))) TS_HTLCOutputInCommitment_read(int8_tArray ser) {
34490         LDKu8slice ser_ref;
34491         ser_ref.datalen = ser->arr_len;
34492         ser_ref.data = ser->elems;
34493         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
34494         *ret_conv = HTLCOutputInCommitment_read(ser_ref);
34495         FREE(ser);
34496         return tag_ptr(ret_conv, true);
34497 }
34498
34499 int8_tArray  __attribute__((export_name("TS_get_htlc_redeemscript"))) TS_get_htlc_redeemscript(uint64_t htlc, jboolean opt_anchors, uint64_t keys) {
34500         LDKHTLCOutputInCommitment htlc_conv;
34501         htlc_conv.inner = untag_ptr(htlc);
34502         htlc_conv.is_owned = ptr_is_owned(htlc);
34503         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
34504         htlc_conv.is_owned = false;
34505         LDKTxCreationKeys keys_conv;
34506         keys_conv.inner = untag_ptr(keys);
34507         keys_conv.is_owned = ptr_is_owned(keys);
34508         CHECK_INNER_FIELD_ACCESS_OR_NULL(keys_conv);
34509         keys_conv.is_owned = false;
34510         LDKCVec_u8Z ret_var = get_htlc_redeemscript(&htlc_conv, opt_anchors, &keys_conv);
34511         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
34512         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
34513         CVec_u8Z_free(ret_var);
34514         return ret_arr;
34515 }
34516
34517 int8_tArray  __attribute__((export_name("TS_make_funding_redeemscript"))) TS_make_funding_redeemscript(int8_tArray broadcaster, int8_tArray countersignatory) {
34518         LDKPublicKey broadcaster_ref;
34519         CHECK(broadcaster->arr_len == 33);
34520         memcpy(broadcaster_ref.compressed_form, broadcaster->elems, 33); FREE(broadcaster);
34521         LDKPublicKey countersignatory_ref;
34522         CHECK(countersignatory->arr_len == 33);
34523         memcpy(countersignatory_ref.compressed_form, countersignatory->elems, 33); FREE(countersignatory);
34524         LDKCVec_u8Z ret_var = make_funding_redeemscript(broadcaster_ref, countersignatory_ref);
34525         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
34526         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
34527         CVec_u8Z_free(ret_var);
34528         return ret_arr;
34529 }
34530
34531 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) {
34532         unsigned char commitment_txid_arr[32];
34533         CHECK(commitment_txid->arr_len == 32);
34534         memcpy(commitment_txid_arr, commitment_txid->elems, 32); FREE(commitment_txid);
34535         unsigned char (*commitment_txid_ref)[32] = &commitment_txid_arr;
34536         LDKHTLCOutputInCommitment htlc_conv;
34537         htlc_conv.inner = untag_ptr(htlc);
34538         htlc_conv.is_owned = ptr_is_owned(htlc);
34539         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
34540         htlc_conv.is_owned = false;
34541         LDKPublicKey broadcaster_delayed_payment_key_ref;
34542         CHECK(broadcaster_delayed_payment_key->arr_len == 33);
34543         memcpy(broadcaster_delayed_payment_key_ref.compressed_form, broadcaster_delayed_payment_key->elems, 33); FREE(broadcaster_delayed_payment_key);
34544         LDKPublicKey revocation_key_ref;
34545         CHECK(revocation_key->arr_len == 33);
34546         memcpy(revocation_key_ref.compressed_form, revocation_key->elems, 33); FREE(revocation_key);
34547         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);
34548         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
34549         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
34550         Transaction_free(ret_var);
34551         return ret_arr;
34552 }
34553
34554 int8_tArray  __attribute__((export_name("TS_get_anchor_redeemscript"))) TS_get_anchor_redeemscript(int8_tArray funding_pubkey) {
34555         LDKPublicKey funding_pubkey_ref;
34556         CHECK(funding_pubkey->arr_len == 33);
34557         memcpy(funding_pubkey_ref.compressed_form, funding_pubkey->elems, 33); FREE(funding_pubkey);
34558         LDKCVec_u8Z ret_var = get_anchor_redeemscript(funding_pubkey_ref);
34559         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
34560         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
34561         CVec_u8Z_free(ret_var);
34562         return ret_arr;
34563 }
34564
34565 void  __attribute__((export_name("TS_ChannelTransactionParameters_free"))) TS_ChannelTransactionParameters_free(uint64_t this_obj) {
34566         LDKChannelTransactionParameters this_obj_conv;
34567         this_obj_conv.inner = untag_ptr(this_obj);
34568         this_obj_conv.is_owned = ptr_is_owned(this_obj);
34569         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34570         ChannelTransactionParameters_free(this_obj_conv);
34571 }
34572
34573 uint64_t  __attribute__((export_name("TS_ChannelTransactionParameters_get_holder_pubkeys"))) TS_ChannelTransactionParameters_get_holder_pubkeys(uint64_t this_ptr) {
34574         LDKChannelTransactionParameters this_ptr_conv;
34575         this_ptr_conv.inner = untag_ptr(this_ptr);
34576         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34577         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34578         this_ptr_conv.is_owned = false;
34579         LDKChannelPublicKeys ret_var = ChannelTransactionParameters_get_holder_pubkeys(&this_ptr_conv);
34580         uint64_t ret_ref = 0;
34581         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34582         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34583         return ret_ref;
34584 }
34585
34586 void  __attribute__((export_name("TS_ChannelTransactionParameters_set_holder_pubkeys"))) TS_ChannelTransactionParameters_set_holder_pubkeys(uint64_t this_ptr, uint64_t val) {
34587         LDKChannelTransactionParameters this_ptr_conv;
34588         this_ptr_conv.inner = untag_ptr(this_ptr);
34589         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34590         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34591         this_ptr_conv.is_owned = false;
34592         LDKChannelPublicKeys val_conv;
34593         val_conv.inner = untag_ptr(val);
34594         val_conv.is_owned = ptr_is_owned(val);
34595         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
34596         val_conv = ChannelPublicKeys_clone(&val_conv);
34597         ChannelTransactionParameters_set_holder_pubkeys(&this_ptr_conv, val_conv);
34598 }
34599
34600 int16_t  __attribute__((export_name("TS_ChannelTransactionParameters_get_holder_selected_contest_delay"))) TS_ChannelTransactionParameters_get_holder_selected_contest_delay(uint64_t this_ptr) {
34601         LDKChannelTransactionParameters this_ptr_conv;
34602         this_ptr_conv.inner = untag_ptr(this_ptr);
34603         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34604         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34605         this_ptr_conv.is_owned = false;
34606         int16_t ret_conv = ChannelTransactionParameters_get_holder_selected_contest_delay(&this_ptr_conv);
34607         return ret_conv;
34608 }
34609
34610 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) {
34611         LDKChannelTransactionParameters this_ptr_conv;
34612         this_ptr_conv.inner = untag_ptr(this_ptr);
34613         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34614         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34615         this_ptr_conv.is_owned = false;
34616         ChannelTransactionParameters_set_holder_selected_contest_delay(&this_ptr_conv, val);
34617 }
34618
34619 jboolean  __attribute__((export_name("TS_ChannelTransactionParameters_get_is_outbound_from_holder"))) TS_ChannelTransactionParameters_get_is_outbound_from_holder(uint64_t this_ptr) {
34620         LDKChannelTransactionParameters this_ptr_conv;
34621         this_ptr_conv.inner = untag_ptr(this_ptr);
34622         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34623         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34624         this_ptr_conv.is_owned = false;
34625         jboolean ret_conv = ChannelTransactionParameters_get_is_outbound_from_holder(&this_ptr_conv);
34626         return ret_conv;
34627 }
34628
34629 void  __attribute__((export_name("TS_ChannelTransactionParameters_set_is_outbound_from_holder"))) TS_ChannelTransactionParameters_set_is_outbound_from_holder(uint64_t this_ptr, jboolean val) {
34630         LDKChannelTransactionParameters this_ptr_conv;
34631         this_ptr_conv.inner = untag_ptr(this_ptr);
34632         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34633         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34634         this_ptr_conv.is_owned = false;
34635         ChannelTransactionParameters_set_is_outbound_from_holder(&this_ptr_conv, val);
34636 }
34637
34638 uint64_t  __attribute__((export_name("TS_ChannelTransactionParameters_get_counterparty_parameters"))) TS_ChannelTransactionParameters_get_counterparty_parameters(uint64_t this_ptr) {
34639         LDKChannelTransactionParameters this_ptr_conv;
34640         this_ptr_conv.inner = untag_ptr(this_ptr);
34641         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34642         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34643         this_ptr_conv.is_owned = false;
34644         LDKCounterpartyChannelTransactionParameters ret_var = ChannelTransactionParameters_get_counterparty_parameters(&this_ptr_conv);
34645         uint64_t ret_ref = 0;
34646         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34647         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34648         return ret_ref;
34649 }
34650
34651 void  __attribute__((export_name("TS_ChannelTransactionParameters_set_counterparty_parameters"))) TS_ChannelTransactionParameters_set_counterparty_parameters(uint64_t this_ptr, uint64_t val) {
34652         LDKChannelTransactionParameters this_ptr_conv;
34653         this_ptr_conv.inner = untag_ptr(this_ptr);
34654         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34655         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34656         this_ptr_conv.is_owned = false;
34657         LDKCounterpartyChannelTransactionParameters val_conv;
34658         val_conv.inner = untag_ptr(val);
34659         val_conv.is_owned = ptr_is_owned(val);
34660         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
34661         val_conv = CounterpartyChannelTransactionParameters_clone(&val_conv);
34662         ChannelTransactionParameters_set_counterparty_parameters(&this_ptr_conv, val_conv);
34663 }
34664
34665 uint64_t  __attribute__((export_name("TS_ChannelTransactionParameters_get_funding_outpoint"))) TS_ChannelTransactionParameters_get_funding_outpoint(uint64_t this_ptr) {
34666         LDKChannelTransactionParameters this_ptr_conv;
34667         this_ptr_conv.inner = untag_ptr(this_ptr);
34668         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34669         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34670         this_ptr_conv.is_owned = false;
34671         LDKOutPoint ret_var = ChannelTransactionParameters_get_funding_outpoint(&this_ptr_conv);
34672         uint64_t ret_ref = 0;
34673         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34674         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34675         return ret_ref;
34676 }
34677
34678 void  __attribute__((export_name("TS_ChannelTransactionParameters_set_funding_outpoint"))) TS_ChannelTransactionParameters_set_funding_outpoint(uint64_t this_ptr, uint64_t val) {
34679         LDKChannelTransactionParameters this_ptr_conv;
34680         this_ptr_conv.inner = untag_ptr(this_ptr);
34681         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34682         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34683         this_ptr_conv.is_owned = false;
34684         LDKOutPoint val_conv;
34685         val_conv.inner = untag_ptr(val);
34686         val_conv.is_owned = ptr_is_owned(val);
34687         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
34688         val_conv = OutPoint_clone(&val_conv);
34689         ChannelTransactionParameters_set_funding_outpoint(&this_ptr_conv, val_conv);
34690 }
34691
34692 uint32_t  __attribute__((export_name("TS_ChannelTransactionParameters_get_opt_anchors"))) TS_ChannelTransactionParameters_get_opt_anchors(uint64_t this_ptr) {
34693         LDKChannelTransactionParameters this_ptr_conv;
34694         this_ptr_conv.inner = untag_ptr(this_ptr);
34695         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34696         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34697         this_ptr_conv.is_owned = false;
34698         uint32_t ret_conv = LDKCOption_NoneZ_to_js(ChannelTransactionParameters_get_opt_anchors(&this_ptr_conv));
34699         return ret_conv;
34700 }
34701
34702 void  __attribute__((export_name("TS_ChannelTransactionParameters_set_opt_anchors"))) TS_ChannelTransactionParameters_set_opt_anchors(uint64_t this_ptr, uint32_t val) {
34703         LDKChannelTransactionParameters this_ptr_conv;
34704         this_ptr_conv.inner = untag_ptr(this_ptr);
34705         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34706         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34707         this_ptr_conv.is_owned = false;
34708         LDKCOption_NoneZ val_conv = LDKCOption_NoneZ_from_js(val);
34709         ChannelTransactionParameters_set_opt_anchors(&this_ptr_conv, val_conv);
34710 }
34711
34712 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) {
34713         LDKChannelPublicKeys holder_pubkeys_arg_conv;
34714         holder_pubkeys_arg_conv.inner = untag_ptr(holder_pubkeys_arg);
34715         holder_pubkeys_arg_conv.is_owned = ptr_is_owned(holder_pubkeys_arg);
34716         CHECK_INNER_FIELD_ACCESS_OR_NULL(holder_pubkeys_arg_conv);
34717         holder_pubkeys_arg_conv = ChannelPublicKeys_clone(&holder_pubkeys_arg_conv);
34718         LDKCounterpartyChannelTransactionParameters counterparty_parameters_arg_conv;
34719         counterparty_parameters_arg_conv.inner = untag_ptr(counterparty_parameters_arg);
34720         counterparty_parameters_arg_conv.is_owned = ptr_is_owned(counterparty_parameters_arg);
34721         CHECK_INNER_FIELD_ACCESS_OR_NULL(counterparty_parameters_arg_conv);
34722         counterparty_parameters_arg_conv = CounterpartyChannelTransactionParameters_clone(&counterparty_parameters_arg_conv);
34723         LDKOutPoint funding_outpoint_arg_conv;
34724         funding_outpoint_arg_conv.inner = untag_ptr(funding_outpoint_arg);
34725         funding_outpoint_arg_conv.is_owned = ptr_is_owned(funding_outpoint_arg);
34726         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_arg_conv);
34727         funding_outpoint_arg_conv = OutPoint_clone(&funding_outpoint_arg_conv);
34728         LDKCOption_NoneZ opt_anchors_arg_conv = LDKCOption_NoneZ_from_js(opt_anchors_arg);
34729         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);
34730         uint64_t ret_ref = 0;
34731         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34732         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34733         return ret_ref;
34734 }
34735
34736 static inline uint64_t ChannelTransactionParameters_clone_ptr(LDKChannelTransactionParameters *NONNULL_PTR arg) {
34737         LDKChannelTransactionParameters ret_var = ChannelTransactionParameters_clone(arg);
34738         uint64_t ret_ref = 0;
34739         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34740         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34741         return ret_ref;
34742 }
34743 int64_t  __attribute__((export_name("TS_ChannelTransactionParameters_clone_ptr"))) TS_ChannelTransactionParameters_clone_ptr(uint64_t arg) {
34744         LDKChannelTransactionParameters arg_conv;
34745         arg_conv.inner = untag_ptr(arg);
34746         arg_conv.is_owned = ptr_is_owned(arg);
34747         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34748         arg_conv.is_owned = false;
34749         int64_t ret_conv = ChannelTransactionParameters_clone_ptr(&arg_conv);
34750         return ret_conv;
34751 }
34752
34753 uint64_t  __attribute__((export_name("TS_ChannelTransactionParameters_clone"))) TS_ChannelTransactionParameters_clone(uint64_t orig) {
34754         LDKChannelTransactionParameters orig_conv;
34755         orig_conv.inner = untag_ptr(orig);
34756         orig_conv.is_owned = ptr_is_owned(orig);
34757         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34758         orig_conv.is_owned = false;
34759         LDKChannelTransactionParameters ret_var = ChannelTransactionParameters_clone(&orig_conv);
34760         uint64_t ret_ref = 0;
34761         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34762         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34763         return ret_ref;
34764 }
34765
34766 void  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_free"))) TS_CounterpartyChannelTransactionParameters_free(uint64_t this_obj) {
34767         LDKCounterpartyChannelTransactionParameters this_obj_conv;
34768         this_obj_conv.inner = untag_ptr(this_obj);
34769         this_obj_conv.is_owned = ptr_is_owned(this_obj);
34770         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34771         CounterpartyChannelTransactionParameters_free(this_obj_conv);
34772 }
34773
34774 uint64_t  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_get_pubkeys"))) TS_CounterpartyChannelTransactionParameters_get_pubkeys(uint64_t this_ptr) {
34775         LDKCounterpartyChannelTransactionParameters this_ptr_conv;
34776         this_ptr_conv.inner = untag_ptr(this_ptr);
34777         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34778         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34779         this_ptr_conv.is_owned = false;
34780         LDKChannelPublicKeys ret_var = CounterpartyChannelTransactionParameters_get_pubkeys(&this_ptr_conv);
34781         uint64_t ret_ref = 0;
34782         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34783         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34784         return ret_ref;
34785 }
34786
34787 void  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_set_pubkeys"))) TS_CounterpartyChannelTransactionParameters_set_pubkeys(uint64_t this_ptr, uint64_t val) {
34788         LDKCounterpartyChannelTransactionParameters this_ptr_conv;
34789         this_ptr_conv.inner = untag_ptr(this_ptr);
34790         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34791         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34792         this_ptr_conv.is_owned = false;
34793         LDKChannelPublicKeys val_conv;
34794         val_conv.inner = untag_ptr(val);
34795         val_conv.is_owned = ptr_is_owned(val);
34796         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
34797         val_conv = ChannelPublicKeys_clone(&val_conv);
34798         CounterpartyChannelTransactionParameters_set_pubkeys(&this_ptr_conv, val_conv);
34799 }
34800
34801 int16_t  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_get_selected_contest_delay"))) TS_CounterpartyChannelTransactionParameters_get_selected_contest_delay(uint64_t this_ptr) {
34802         LDKCounterpartyChannelTransactionParameters this_ptr_conv;
34803         this_ptr_conv.inner = untag_ptr(this_ptr);
34804         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34805         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34806         this_ptr_conv.is_owned = false;
34807         int16_t ret_conv = CounterpartyChannelTransactionParameters_get_selected_contest_delay(&this_ptr_conv);
34808         return ret_conv;
34809 }
34810
34811 void  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_set_selected_contest_delay"))) TS_CounterpartyChannelTransactionParameters_set_selected_contest_delay(uint64_t this_ptr, int16_t val) {
34812         LDKCounterpartyChannelTransactionParameters this_ptr_conv;
34813         this_ptr_conv.inner = untag_ptr(this_ptr);
34814         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34815         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34816         this_ptr_conv.is_owned = false;
34817         CounterpartyChannelTransactionParameters_set_selected_contest_delay(&this_ptr_conv, val);
34818 }
34819
34820 uint64_t  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_new"))) TS_CounterpartyChannelTransactionParameters_new(uint64_t pubkeys_arg, int16_t selected_contest_delay_arg) {
34821         LDKChannelPublicKeys pubkeys_arg_conv;
34822         pubkeys_arg_conv.inner = untag_ptr(pubkeys_arg);
34823         pubkeys_arg_conv.is_owned = ptr_is_owned(pubkeys_arg);
34824         CHECK_INNER_FIELD_ACCESS_OR_NULL(pubkeys_arg_conv);
34825         pubkeys_arg_conv = ChannelPublicKeys_clone(&pubkeys_arg_conv);
34826         LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_new(pubkeys_arg_conv, selected_contest_delay_arg);
34827         uint64_t ret_ref = 0;
34828         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34829         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34830         return ret_ref;
34831 }
34832
34833 static inline uint64_t CounterpartyChannelTransactionParameters_clone_ptr(LDKCounterpartyChannelTransactionParameters *NONNULL_PTR arg) {
34834         LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_clone(arg);
34835         uint64_t ret_ref = 0;
34836         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34837         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34838         return ret_ref;
34839 }
34840 int64_t  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_clone_ptr"))) TS_CounterpartyChannelTransactionParameters_clone_ptr(uint64_t arg) {
34841         LDKCounterpartyChannelTransactionParameters arg_conv;
34842         arg_conv.inner = untag_ptr(arg);
34843         arg_conv.is_owned = ptr_is_owned(arg);
34844         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34845         arg_conv.is_owned = false;
34846         int64_t ret_conv = CounterpartyChannelTransactionParameters_clone_ptr(&arg_conv);
34847         return ret_conv;
34848 }
34849
34850 uint64_t  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_clone"))) TS_CounterpartyChannelTransactionParameters_clone(uint64_t orig) {
34851         LDKCounterpartyChannelTransactionParameters orig_conv;
34852         orig_conv.inner = untag_ptr(orig);
34853         orig_conv.is_owned = ptr_is_owned(orig);
34854         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34855         orig_conv.is_owned = false;
34856         LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_clone(&orig_conv);
34857         uint64_t ret_ref = 0;
34858         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34859         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34860         return ret_ref;
34861 }
34862
34863 jboolean  __attribute__((export_name("TS_ChannelTransactionParameters_is_populated"))) TS_ChannelTransactionParameters_is_populated(uint64_t this_arg) {
34864         LDKChannelTransactionParameters this_arg_conv;
34865         this_arg_conv.inner = untag_ptr(this_arg);
34866         this_arg_conv.is_owned = ptr_is_owned(this_arg);
34867         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34868         this_arg_conv.is_owned = false;
34869         jboolean ret_conv = ChannelTransactionParameters_is_populated(&this_arg_conv);
34870         return ret_conv;
34871 }
34872
34873 uint64_t  __attribute__((export_name("TS_ChannelTransactionParameters_as_holder_broadcastable"))) TS_ChannelTransactionParameters_as_holder_broadcastable(uint64_t this_arg) {
34874         LDKChannelTransactionParameters this_arg_conv;
34875         this_arg_conv.inner = untag_ptr(this_arg);
34876         this_arg_conv.is_owned = ptr_is_owned(this_arg);
34877         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34878         this_arg_conv.is_owned = false;
34879         LDKDirectedChannelTransactionParameters ret_var = ChannelTransactionParameters_as_holder_broadcastable(&this_arg_conv);
34880         uint64_t ret_ref = 0;
34881         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34882         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34883         return ret_ref;
34884 }
34885
34886 uint64_t  __attribute__((export_name("TS_ChannelTransactionParameters_as_counterparty_broadcastable"))) TS_ChannelTransactionParameters_as_counterparty_broadcastable(uint64_t this_arg) {
34887         LDKChannelTransactionParameters this_arg_conv;
34888         this_arg_conv.inner = untag_ptr(this_arg);
34889         this_arg_conv.is_owned = ptr_is_owned(this_arg);
34890         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34891         this_arg_conv.is_owned = false;
34892         LDKDirectedChannelTransactionParameters ret_var = ChannelTransactionParameters_as_counterparty_broadcastable(&this_arg_conv);
34893         uint64_t ret_ref = 0;
34894         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34895         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34896         return ret_ref;
34897 }
34898
34899 int8_tArray  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_write"))) TS_CounterpartyChannelTransactionParameters_write(uint64_t obj) {
34900         LDKCounterpartyChannelTransactionParameters obj_conv;
34901         obj_conv.inner = untag_ptr(obj);
34902         obj_conv.is_owned = ptr_is_owned(obj);
34903         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
34904         obj_conv.is_owned = false;
34905         LDKCVec_u8Z ret_var = CounterpartyChannelTransactionParameters_write(&obj_conv);
34906         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
34907         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
34908         CVec_u8Z_free(ret_var);
34909         return ret_arr;
34910 }
34911
34912 uint64_t  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_read"))) TS_CounterpartyChannelTransactionParameters_read(int8_tArray ser) {
34913         LDKu8slice ser_ref;
34914         ser_ref.datalen = ser->arr_len;
34915         ser_ref.data = ser->elems;
34916         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
34917         *ret_conv = CounterpartyChannelTransactionParameters_read(ser_ref);
34918         FREE(ser);
34919         return tag_ptr(ret_conv, true);
34920 }
34921
34922 int8_tArray  __attribute__((export_name("TS_ChannelTransactionParameters_write"))) TS_ChannelTransactionParameters_write(uint64_t obj) {
34923         LDKChannelTransactionParameters obj_conv;
34924         obj_conv.inner = untag_ptr(obj);
34925         obj_conv.is_owned = ptr_is_owned(obj);
34926         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
34927         obj_conv.is_owned = false;
34928         LDKCVec_u8Z ret_var = ChannelTransactionParameters_write(&obj_conv);
34929         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
34930         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
34931         CVec_u8Z_free(ret_var);
34932         return ret_arr;
34933 }
34934
34935 uint64_t  __attribute__((export_name("TS_ChannelTransactionParameters_read"))) TS_ChannelTransactionParameters_read(int8_tArray ser) {
34936         LDKu8slice ser_ref;
34937         ser_ref.datalen = ser->arr_len;
34938         ser_ref.data = ser->elems;
34939         LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
34940         *ret_conv = ChannelTransactionParameters_read(ser_ref);
34941         FREE(ser);
34942         return tag_ptr(ret_conv, true);
34943 }
34944
34945 void  __attribute__((export_name("TS_DirectedChannelTransactionParameters_free"))) TS_DirectedChannelTransactionParameters_free(uint64_t this_obj) {
34946         LDKDirectedChannelTransactionParameters this_obj_conv;
34947         this_obj_conv.inner = untag_ptr(this_obj);
34948         this_obj_conv.is_owned = ptr_is_owned(this_obj);
34949         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34950         DirectedChannelTransactionParameters_free(this_obj_conv);
34951 }
34952
34953 uint64_t  __attribute__((export_name("TS_DirectedChannelTransactionParameters_broadcaster_pubkeys"))) TS_DirectedChannelTransactionParameters_broadcaster_pubkeys(uint64_t this_arg) {
34954         LDKDirectedChannelTransactionParameters this_arg_conv;
34955         this_arg_conv.inner = untag_ptr(this_arg);
34956         this_arg_conv.is_owned = ptr_is_owned(this_arg);
34957         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34958         this_arg_conv.is_owned = false;
34959         LDKChannelPublicKeys ret_var = DirectedChannelTransactionParameters_broadcaster_pubkeys(&this_arg_conv);
34960         uint64_t ret_ref = 0;
34961         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34962         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34963         return ret_ref;
34964 }
34965
34966 uint64_t  __attribute__((export_name("TS_DirectedChannelTransactionParameters_countersignatory_pubkeys"))) TS_DirectedChannelTransactionParameters_countersignatory_pubkeys(uint64_t this_arg) {
34967         LDKDirectedChannelTransactionParameters this_arg_conv;
34968         this_arg_conv.inner = untag_ptr(this_arg);
34969         this_arg_conv.is_owned = ptr_is_owned(this_arg);
34970         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34971         this_arg_conv.is_owned = false;
34972         LDKChannelPublicKeys ret_var = DirectedChannelTransactionParameters_countersignatory_pubkeys(&this_arg_conv);
34973         uint64_t ret_ref = 0;
34974         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34975         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34976         return ret_ref;
34977 }
34978
34979 int16_t  __attribute__((export_name("TS_DirectedChannelTransactionParameters_contest_delay"))) TS_DirectedChannelTransactionParameters_contest_delay(uint64_t this_arg) {
34980         LDKDirectedChannelTransactionParameters this_arg_conv;
34981         this_arg_conv.inner = untag_ptr(this_arg);
34982         this_arg_conv.is_owned = ptr_is_owned(this_arg);
34983         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34984         this_arg_conv.is_owned = false;
34985         int16_t ret_conv = DirectedChannelTransactionParameters_contest_delay(&this_arg_conv);
34986         return ret_conv;
34987 }
34988
34989 jboolean  __attribute__((export_name("TS_DirectedChannelTransactionParameters_is_outbound"))) TS_DirectedChannelTransactionParameters_is_outbound(uint64_t this_arg) {
34990         LDKDirectedChannelTransactionParameters this_arg_conv;
34991         this_arg_conv.inner = untag_ptr(this_arg);
34992         this_arg_conv.is_owned = ptr_is_owned(this_arg);
34993         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34994         this_arg_conv.is_owned = false;
34995         jboolean ret_conv = DirectedChannelTransactionParameters_is_outbound(&this_arg_conv);
34996         return ret_conv;
34997 }
34998
34999 uint64_t  __attribute__((export_name("TS_DirectedChannelTransactionParameters_funding_outpoint"))) TS_DirectedChannelTransactionParameters_funding_outpoint(uint64_t this_arg) {
35000         LDKDirectedChannelTransactionParameters this_arg_conv;
35001         this_arg_conv.inner = untag_ptr(this_arg);
35002         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35003         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35004         this_arg_conv.is_owned = false;
35005         LDKOutPoint ret_var = DirectedChannelTransactionParameters_funding_outpoint(&this_arg_conv);
35006         uint64_t ret_ref = 0;
35007         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35008         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35009         return ret_ref;
35010 }
35011
35012 jboolean  __attribute__((export_name("TS_DirectedChannelTransactionParameters_opt_anchors"))) TS_DirectedChannelTransactionParameters_opt_anchors(uint64_t this_arg) {
35013         LDKDirectedChannelTransactionParameters this_arg_conv;
35014         this_arg_conv.inner = untag_ptr(this_arg);
35015         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35016         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35017         this_arg_conv.is_owned = false;
35018         jboolean ret_conv = DirectedChannelTransactionParameters_opt_anchors(&this_arg_conv);
35019         return ret_conv;
35020 }
35021
35022 void  __attribute__((export_name("TS_HolderCommitmentTransaction_free"))) TS_HolderCommitmentTransaction_free(uint64_t this_obj) {
35023         LDKHolderCommitmentTransaction this_obj_conv;
35024         this_obj_conv.inner = untag_ptr(this_obj);
35025         this_obj_conv.is_owned = ptr_is_owned(this_obj);
35026         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35027         HolderCommitmentTransaction_free(this_obj_conv);
35028 }
35029
35030 int8_tArray  __attribute__((export_name("TS_HolderCommitmentTransaction_get_counterparty_sig"))) TS_HolderCommitmentTransaction_get_counterparty_sig(uint64_t this_ptr) {
35031         LDKHolderCommitmentTransaction this_ptr_conv;
35032         this_ptr_conv.inner = untag_ptr(this_ptr);
35033         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35034         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35035         this_ptr_conv.is_owned = false;
35036         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
35037         memcpy(ret_arr->elems, HolderCommitmentTransaction_get_counterparty_sig(&this_ptr_conv).compact_form, 64);
35038         return ret_arr;
35039 }
35040
35041 void  __attribute__((export_name("TS_HolderCommitmentTransaction_set_counterparty_sig"))) TS_HolderCommitmentTransaction_set_counterparty_sig(uint64_t this_ptr, int8_tArray val) {
35042         LDKHolderCommitmentTransaction this_ptr_conv;
35043         this_ptr_conv.inner = untag_ptr(this_ptr);
35044         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35045         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35046         this_ptr_conv.is_owned = false;
35047         LDKSignature val_ref;
35048         CHECK(val->arr_len == 64);
35049         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
35050         HolderCommitmentTransaction_set_counterparty_sig(&this_ptr_conv, val_ref);
35051 }
35052
35053 ptrArray  __attribute__((export_name("TS_HolderCommitmentTransaction_get_counterparty_htlc_sigs"))) TS_HolderCommitmentTransaction_get_counterparty_htlc_sigs(uint64_t this_ptr) {
35054         LDKHolderCommitmentTransaction this_ptr_conv;
35055         this_ptr_conv.inner = untag_ptr(this_ptr);
35056         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35057         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35058         this_ptr_conv.is_owned = false;
35059         LDKCVec_SignatureZ ret_var = HolderCommitmentTransaction_get_counterparty_htlc_sigs(&this_ptr_conv);
35060         ptrArray ret_arr = NULL;
35061         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
35062         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
35063         for (size_t m = 0; m < ret_var.datalen; m++) {
35064                 int8_tArray ret_conv_12_arr = init_int8_tArray(64, __LINE__);
35065                 memcpy(ret_conv_12_arr->elems, ret_var.data[m].compact_form, 64);
35066                 ret_arr_ptr[m] = ret_conv_12_arr;
35067         }
35068         
35069         FREE(ret_var.data);
35070         return ret_arr;
35071 }
35072
35073 void  __attribute__((export_name("TS_HolderCommitmentTransaction_set_counterparty_htlc_sigs"))) TS_HolderCommitmentTransaction_set_counterparty_htlc_sigs(uint64_t this_ptr, ptrArray val) {
35074         LDKHolderCommitmentTransaction this_ptr_conv;
35075         this_ptr_conv.inner = untag_ptr(this_ptr);
35076         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35077         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35078         this_ptr_conv.is_owned = false;
35079         LDKCVec_SignatureZ val_constr;
35080         val_constr.datalen = val->arr_len;
35081         if (val_constr.datalen > 0)
35082                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
35083         else
35084                 val_constr.data = NULL;
35085         int8_tArray* val_vals = (void*) val->elems;
35086         for (size_t m = 0; m < val_constr.datalen; m++) {
35087                 int8_tArray val_conv_12 = val_vals[m];
35088                 LDKSignature val_conv_12_ref;
35089                 CHECK(val_conv_12->arr_len == 64);
35090                 memcpy(val_conv_12_ref.compact_form, val_conv_12->elems, 64); FREE(val_conv_12);
35091                 val_constr.data[m] = val_conv_12_ref;
35092         }
35093         FREE(val);
35094         HolderCommitmentTransaction_set_counterparty_htlc_sigs(&this_ptr_conv, val_constr);
35095 }
35096
35097 static inline uint64_t HolderCommitmentTransaction_clone_ptr(LDKHolderCommitmentTransaction *NONNULL_PTR arg) {
35098         LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_clone(arg);
35099         uint64_t ret_ref = 0;
35100         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35101         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35102         return ret_ref;
35103 }
35104 int64_t  __attribute__((export_name("TS_HolderCommitmentTransaction_clone_ptr"))) TS_HolderCommitmentTransaction_clone_ptr(uint64_t arg) {
35105         LDKHolderCommitmentTransaction arg_conv;
35106         arg_conv.inner = untag_ptr(arg);
35107         arg_conv.is_owned = ptr_is_owned(arg);
35108         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35109         arg_conv.is_owned = false;
35110         int64_t ret_conv = HolderCommitmentTransaction_clone_ptr(&arg_conv);
35111         return ret_conv;
35112 }
35113
35114 uint64_t  __attribute__((export_name("TS_HolderCommitmentTransaction_clone"))) TS_HolderCommitmentTransaction_clone(uint64_t orig) {
35115         LDKHolderCommitmentTransaction orig_conv;
35116         orig_conv.inner = untag_ptr(orig);
35117         orig_conv.is_owned = ptr_is_owned(orig);
35118         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35119         orig_conv.is_owned = false;
35120         LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_clone(&orig_conv);
35121         uint64_t ret_ref = 0;
35122         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35123         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35124         return ret_ref;
35125 }
35126
35127 int8_tArray  __attribute__((export_name("TS_HolderCommitmentTransaction_write"))) TS_HolderCommitmentTransaction_write(uint64_t obj) {
35128         LDKHolderCommitmentTransaction obj_conv;
35129         obj_conv.inner = untag_ptr(obj);
35130         obj_conv.is_owned = ptr_is_owned(obj);
35131         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35132         obj_conv.is_owned = false;
35133         LDKCVec_u8Z ret_var = HolderCommitmentTransaction_write(&obj_conv);
35134         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
35135         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
35136         CVec_u8Z_free(ret_var);
35137         return ret_arr;
35138 }
35139
35140 uint64_t  __attribute__((export_name("TS_HolderCommitmentTransaction_read"))) TS_HolderCommitmentTransaction_read(int8_tArray ser) {
35141         LDKu8slice ser_ref;
35142         ser_ref.datalen = ser->arr_len;
35143         ser_ref.data = ser->elems;
35144         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
35145         *ret_conv = HolderCommitmentTransaction_read(ser_ref);
35146         FREE(ser);
35147         return tag_ptr(ret_conv, true);
35148 }
35149
35150 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) {
35151         LDKCommitmentTransaction commitment_tx_conv;
35152         commitment_tx_conv.inner = untag_ptr(commitment_tx);
35153         commitment_tx_conv.is_owned = ptr_is_owned(commitment_tx);
35154         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_conv);
35155         commitment_tx_conv = CommitmentTransaction_clone(&commitment_tx_conv);
35156         LDKSignature counterparty_sig_ref;
35157         CHECK(counterparty_sig->arr_len == 64);
35158         memcpy(counterparty_sig_ref.compact_form, counterparty_sig->elems, 64); FREE(counterparty_sig);
35159         LDKCVec_SignatureZ counterparty_htlc_sigs_constr;
35160         counterparty_htlc_sigs_constr.datalen = counterparty_htlc_sigs->arr_len;
35161         if (counterparty_htlc_sigs_constr.datalen > 0)
35162                 counterparty_htlc_sigs_constr.data = MALLOC(counterparty_htlc_sigs_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
35163         else
35164                 counterparty_htlc_sigs_constr.data = NULL;
35165         int8_tArray* counterparty_htlc_sigs_vals = (void*) counterparty_htlc_sigs->elems;
35166         for (size_t m = 0; m < counterparty_htlc_sigs_constr.datalen; m++) {
35167                 int8_tArray counterparty_htlc_sigs_conv_12 = counterparty_htlc_sigs_vals[m];
35168                 LDKSignature counterparty_htlc_sigs_conv_12_ref;
35169                 CHECK(counterparty_htlc_sigs_conv_12->arr_len == 64);
35170                 memcpy(counterparty_htlc_sigs_conv_12_ref.compact_form, counterparty_htlc_sigs_conv_12->elems, 64); FREE(counterparty_htlc_sigs_conv_12);
35171                 counterparty_htlc_sigs_constr.data[m] = counterparty_htlc_sigs_conv_12_ref;
35172         }
35173         FREE(counterparty_htlc_sigs);
35174         LDKPublicKey holder_funding_key_ref;
35175         CHECK(holder_funding_key->arr_len == 33);
35176         memcpy(holder_funding_key_ref.compressed_form, holder_funding_key->elems, 33); FREE(holder_funding_key);
35177         LDKPublicKey counterparty_funding_key_ref;
35178         CHECK(counterparty_funding_key->arr_len == 33);
35179         memcpy(counterparty_funding_key_ref.compressed_form, counterparty_funding_key->elems, 33); FREE(counterparty_funding_key);
35180         LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_new(commitment_tx_conv, counterparty_sig_ref, counterparty_htlc_sigs_constr, holder_funding_key_ref, counterparty_funding_key_ref);
35181         uint64_t ret_ref = 0;
35182         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35183         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35184         return ret_ref;
35185 }
35186
35187 void  __attribute__((export_name("TS_BuiltCommitmentTransaction_free"))) TS_BuiltCommitmentTransaction_free(uint64_t this_obj) {
35188         LDKBuiltCommitmentTransaction this_obj_conv;
35189         this_obj_conv.inner = untag_ptr(this_obj);
35190         this_obj_conv.is_owned = ptr_is_owned(this_obj);
35191         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35192         BuiltCommitmentTransaction_free(this_obj_conv);
35193 }
35194
35195 int8_tArray  __attribute__((export_name("TS_BuiltCommitmentTransaction_get_transaction"))) TS_BuiltCommitmentTransaction_get_transaction(uint64_t this_ptr) {
35196         LDKBuiltCommitmentTransaction this_ptr_conv;
35197         this_ptr_conv.inner = untag_ptr(this_ptr);
35198         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35199         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35200         this_ptr_conv.is_owned = false;
35201         LDKTransaction ret_var = BuiltCommitmentTransaction_get_transaction(&this_ptr_conv);
35202         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
35203         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
35204         Transaction_free(ret_var);
35205         return ret_arr;
35206 }
35207
35208 void  __attribute__((export_name("TS_BuiltCommitmentTransaction_set_transaction"))) TS_BuiltCommitmentTransaction_set_transaction(uint64_t this_ptr, int8_tArray val) {
35209         LDKBuiltCommitmentTransaction this_ptr_conv;
35210         this_ptr_conv.inner = untag_ptr(this_ptr);
35211         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35212         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35213         this_ptr_conv.is_owned = false;
35214         LDKTransaction val_ref;
35215         val_ref.datalen = val->arr_len;
35216         val_ref.data = MALLOC(val_ref.datalen, "LDKTransaction Bytes");
35217         memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
35218         val_ref.data_is_owned = true;
35219         BuiltCommitmentTransaction_set_transaction(&this_ptr_conv, val_ref);
35220 }
35221
35222 int8_tArray  __attribute__((export_name("TS_BuiltCommitmentTransaction_get_txid"))) TS_BuiltCommitmentTransaction_get_txid(uint64_t this_ptr) {
35223         LDKBuiltCommitmentTransaction this_ptr_conv;
35224         this_ptr_conv.inner = untag_ptr(this_ptr);
35225         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35226         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35227         this_ptr_conv.is_owned = false;
35228         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
35229         memcpy(ret_arr->elems, *BuiltCommitmentTransaction_get_txid(&this_ptr_conv), 32);
35230         return ret_arr;
35231 }
35232
35233 void  __attribute__((export_name("TS_BuiltCommitmentTransaction_set_txid"))) TS_BuiltCommitmentTransaction_set_txid(uint64_t this_ptr, int8_tArray val) {
35234         LDKBuiltCommitmentTransaction this_ptr_conv;
35235         this_ptr_conv.inner = untag_ptr(this_ptr);
35236         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35237         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35238         this_ptr_conv.is_owned = false;
35239         LDKThirtyTwoBytes val_ref;
35240         CHECK(val->arr_len == 32);
35241         memcpy(val_ref.data, val->elems, 32); FREE(val);
35242         BuiltCommitmentTransaction_set_txid(&this_ptr_conv, val_ref);
35243 }
35244
35245 uint64_t  __attribute__((export_name("TS_BuiltCommitmentTransaction_new"))) TS_BuiltCommitmentTransaction_new(int8_tArray transaction_arg, int8_tArray txid_arg) {
35246         LDKTransaction transaction_arg_ref;
35247         transaction_arg_ref.datalen = transaction_arg->arr_len;
35248         transaction_arg_ref.data = MALLOC(transaction_arg_ref.datalen, "LDKTransaction Bytes");
35249         memcpy(transaction_arg_ref.data, transaction_arg->elems, transaction_arg_ref.datalen); FREE(transaction_arg);
35250         transaction_arg_ref.data_is_owned = true;
35251         LDKThirtyTwoBytes txid_arg_ref;
35252         CHECK(txid_arg->arr_len == 32);
35253         memcpy(txid_arg_ref.data, txid_arg->elems, 32); FREE(txid_arg);
35254         LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_new(transaction_arg_ref, txid_arg_ref);
35255         uint64_t ret_ref = 0;
35256         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35257         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35258         return ret_ref;
35259 }
35260
35261 static inline uint64_t BuiltCommitmentTransaction_clone_ptr(LDKBuiltCommitmentTransaction *NONNULL_PTR arg) {
35262         LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_clone(arg);
35263         uint64_t ret_ref = 0;
35264         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35265         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35266         return ret_ref;
35267 }
35268 int64_t  __attribute__((export_name("TS_BuiltCommitmentTransaction_clone_ptr"))) TS_BuiltCommitmentTransaction_clone_ptr(uint64_t arg) {
35269         LDKBuiltCommitmentTransaction arg_conv;
35270         arg_conv.inner = untag_ptr(arg);
35271         arg_conv.is_owned = ptr_is_owned(arg);
35272         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35273         arg_conv.is_owned = false;
35274         int64_t ret_conv = BuiltCommitmentTransaction_clone_ptr(&arg_conv);
35275         return ret_conv;
35276 }
35277
35278 uint64_t  __attribute__((export_name("TS_BuiltCommitmentTransaction_clone"))) TS_BuiltCommitmentTransaction_clone(uint64_t orig) {
35279         LDKBuiltCommitmentTransaction orig_conv;
35280         orig_conv.inner = untag_ptr(orig);
35281         orig_conv.is_owned = ptr_is_owned(orig);
35282         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35283         orig_conv.is_owned = false;
35284         LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_clone(&orig_conv);
35285         uint64_t ret_ref = 0;
35286         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35287         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35288         return ret_ref;
35289 }
35290
35291 int8_tArray  __attribute__((export_name("TS_BuiltCommitmentTransaction_write"))) TS_BuiltCommitmentTransaction_write(uint64_t obj) {
35292         LDKBuiltCommitmentTransaction obj_conv;
35293         obj_conv.inner = untag_ptr(obj);
35294         obj_conv.is_owned = ptr_is_owned(obj);
35295         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35296         obj_conv.is_owned = false;
35297         LDKCVec_u8Z ret_var = BuiltCommitmentTransaction_write(&obj_conv);
35298         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
35299         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
35300         CVec_u8Z_free(ret_var);
35301         return ret_arr;
35302 }
35303
35304 uint64_t  __attribute__((export_name("TS_BuiltCommitmentTransaction_read"))) TS_BuiltCommitmentTransaction_read(int8_tArray ser) {
35305         LDKu8slice ser_ref;
35306         ser_ref.datalen = ser->arr_len;
35307         ser_ref.data = ser->elems;
35308         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
35309         *ret_conv = BuiltCommitmentTransaction_read(ser_ref);
35310         FREE(ser);
35311         return tag_ptr(ret_conv, true);
35312 }
35313
35314 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) {
35315         LDKBuiltCommitmentTransaction this_arg_conv;
35316         this_arg_conv.inner = untag_ptr(this_arg);
35317         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35318         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35319         this_arg_conv.is_owned = false;
35320         LDKu8slice funding_redeemscript_ref;
35321         funding_redeemscript_ref.datalen = funding_redeemscript->arr_len;
35322         funding_redeemscript_ref.data = funding_redeemscript->elems;
35323         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
35324         memcpy(ret_arr->elems, BuiltCommitmentTransaction_get_sighash_all(&this_arg_conv, funding_redeemscript_ref, channel_value_satoshis).data, 32);
35325         FREE(funding_redeemscript);
35326         return ret_arr;
35327 }
35328
35329 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) {
35330         LDKBuiltCommitmentTransaction this_arg_conv;
35331         this_arg_conv.inner = untag_ptr(this_arg);
35332         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35333         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35334         this_arg_conv.is_owned = false;
35335         unsigned char funding_key_arr[32];
35336         CHECK(funding_key->arr_len == 32);
35337         memcpy(funding_key_arr, funding_key->elems, 32); FREE(funding_key);
35338         unsigned char (*funding_key_ref)[32] = &funding_key_arr;
35339         LDKu8slice funding_redeemscript_ref;
35340         funding_redeemscript_ref.datalen = funding_redeemscript->arr_len;
35341         funding_redeemscript_ref.data = funding_redeemscript->elems;
35342         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
35343         memcpy(ret_arr->elems, BuiltCommitmentTransaction_sign(&this_arg_conv, funding_key_ref, funding_redeemscript_ref, channel_value_satoshis).compact_form, 64);
35344         FREE(funding_redeemscript);
35345         return ret_arr;
35346 }
35347
35348 void  __attribute__((export_name("TS_ClosingTransaction_free"))) TS_ClosingTransaction_free(uint64_t this_obj) {
35349         LDKClosingTransaction this_obj_conv;
35350         this_obj_conv.inner = untag_ptr(this_obj);
35351         this_obj_conv.is_owned = ptr_is_owned(this_obj);
35352         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35353         ClosingTransaction_free(this_obj_conv);
35354 }
35355
35356 static inline uint64_t ClosingTransaction_clone_ptr(LDKClosingTransaction *NONNULL_PTR arg) {
35357         LDKClosingTransaction ret_var = ClosingTransaction_clone(arg);
35358         uint64_t ret_ref = 0;
35359         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35360         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35361         return ret_ref;
35362 }
35363 int64_t  __attribute__((export_name("TS_ClosingTransaction_clone_ptr"))) TS_ClosingTransaction_clone_ptr(uint64_t arg) {
35364         LDKClosingTransaction arg_conv;
35365         arg_conv.inner = untag_ptr(arg);
35366         arg_conv.is_owned = ptr_is_owned(arg);
35367         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35368         arg_conv.is_owned = false;
35369         int64_t ret_conv = ClosingTransaction_clone_ptr(&arg_conv);
35370         return ret_conv;
35371 }
35372
35373 uint64_t  __attribute__((export_name("TS_ClosingTransaction_clone"))) TS_ClosingTransaction_clone(uint64_t orig) {
35374         LDKClosingTransaction orig_conv;
35375         orig_conv.inner = untag_ptr(orig);
35376         orig_conv.is_owned = ptr_is_owned(orig);
35377         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35378         orig_conv.is_owned = false;
35379         LDKClosingTransaction ret_var = ClosingTransaction_clone(&orig_conv);
35380         uint64_t ret_ref = 0;
35381         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35382         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35383         return ret_ref;
35384 }
35385
35386 int64_t  __attribute__((export_name("TS_ClosingTransaction_hash"))) TS_ClosingTransaction_hash(uint64_t o) {
35387         LDKClosingTransaction o_conv;
35388         o_conv.inner = untag_ptr(o);
35389         o_conv.is_owned = ptr_is_owned(o);
35390         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
35391         o_conv.is_owned = false;
35392         int64_t ret_conv = ClosingTransaction_hash(&o_conv);
35393         return ret_conv;
35394 }
35395
35396 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) {
35397         LDKCVec_u8Z to_holder_script_ref;
35398         to_holder_script_ref.datalen = to_holder_script->arr_len;
35399         to_holder_script_ref.data = MALLOC(to_holder_script_ref.datalen, "LDKCVec_u8Z Bytes");
35400         memcpy(to_holder_script_ref.data, to_holder_script->elems, to_holder_script_ref.datalen); FREE(to_holder_script);
35401         LDKCVec_u8Z to_counterparty_script_ref;
35402         to_counterparty_script_ref.datalen = to_counterparty_script->arr_len;
35403         to_counterparty_script_ref.data = MALLOC(to_counterparty_script_ref.datalen, "LDKCVec_u8Z Bytes");
35404         memcpy(to_counterparty_script_ref.data, to_counterparty_script->elems, to_counterparty_script_ref.datalen); FREE(to_counterparty_script);
35405         LDKOutPoint funding_outpoint_conv;
35406         funding_outpoint_conv.inner = untag_ptr(funding_outpoint);
35407         funding_outpoint_conv.is_owned = ptr_is_owned(funding_outpoint);
35408         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_conv);
35409         funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
35410         LDKClosingTransaction ret_var = ClosingTransaction_new(to_holder_value_sat, to_counterparty_value_sat, to_holder_script_ref, to_counterparty_script_ref, funding_outpoint_conv);
35411         uint64_t ret_ref = 0;
35412         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35413         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35414         return ret_ref;
35415 }
35416
35417 uint64_t  __attribute__((export_name("TS_ClosingTransaction_trust"))) TS_ClosingTransaction_trust(uint64_t this_arg) {
35418         LDKClosingTransaction this_arg_conv;
35419         this_arg_conv.inner = untag_ptr(this_arg);
35420         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35421         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35422         this_arg_conv.is_owned = false;
35423         LDKTrustedClosingTransaction ret_var = ClosingTransaction_trust(&this_arg_conv);
35424         uint64_t ret_ref = 0;
35425         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35426         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35427         return ret_ref;
35428 }
35429
35430 uint64_t  __attribute__((export_name("TS_ClosingTransaction_verify"))) TS_ClosingTransaction_verify(uint64_t this_arg, uint64_t funding_outpoint) {
35431         LDKClosingTransaction this_arg_conv;
35432         this_arg_conv.inner = untag_ptr(this_arg);
35433         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35434         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35435         this_arg_conv.is_owned = false;
35436         LDKOutPoint funding_outpoint_conv;
35437         funding_outpoint_conv.inner = untag_ptr(funding_outpoint);
35438         funding_outpoint_conv.is_owned = ptr_is_owned(funding_outpoint);
35439         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_conv);
35440         funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
35441         LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
35442         *ret_conv = ClosingTransaction_verify(&this_arg_conv, funding_outpoint_conv);
35443         return tag_ptr(ret_conv, true);
35444 }
35445
35446 int64_t  __attribute__((export_name("TS_ClosingTransaction_to_holder_value_sat"))) TS_ClosingTransaction_to_holder_value_sat(uint64_t this_arg) {
35447         LDKClosingTransaction this_arg_conv;
35448         this_arg_conv.inner = untag_ptr(this_arg);
35449         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35450         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35451         this_arg_conv.is_owned = false;
35452         int64_t ret_conv = ClosingTransaction_to_holder_value_sat(&this_arg_conv);
35453         return ret_conv;
35454 }
35455
35456 int64_t  __attribute__((export_name("TS_ClosingTransaction_to_counterparty_value_sat"))) TS_ClosingTransaction_to_counterparty_value_sat(uint64_t this_arg) {
35457         LDKClosingTransaction this_arg_conv;
35458         this_arg_conv.inner = untag_ptr(this_arg);
35459         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35460         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35461         this_arg_conv.is_owned = false;
35462         int64_t ret_conv = ClosingTransaction_to_counterparty_value_sat(&this_arg_conv);
35463         return ret_conv;
35464 }
35465
35466 int8_tArray  __attribute__((export_name("TS_ClosingTransaction_to_holder_script"))) TS_ClosingTransaction_to_holder_script(uint64_t this_arg) {
35467         LDKClosingTransaction this_arg_conv;
35468         this_arg_conv.inner = untag_ptr(this_arg);
35469         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35470         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35471         this_arg_conv.is_owned = false;
35472         LDKu8slice ret_var = ClosingTransaction_to_holder_script(&this_arg_conv);
35473         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
35474         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
35475         return ret_arr;
35476 }
35477
35478 int8_tArray  __attribute__((export_name("TS_ClosingTransaction_to_counterparty_script"))) TS_ClosingTransaction_to_counterparty_script(uint64_t this_arg) {
35479         LDKClosingTransaction this_arg_conv;
35480         this_arg_conv.inner = untag_ptr(this_arg);
35481         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35482         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35483         this_arg_conv.is_owned = false;
35484         LDKu8slice ret_var = ClosingTransaction_to_counterparty_script(&this_arg_conv);
35485         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
35486         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
35487         return ret_arr;
35488 }
35489
35490 void  __attribute__((export_name("TS_TrustedClosingTransaction_free"))) TS_TrustedClosingTransaction_free(uint64_t this_obj) {
35491         LDKTrustedClosingTransaction this_obj_conv;
35492         this_obj_conv.inner = untag_ptr(this_obj);
35493         this_obj_conv.is_owned = ptr_is_owned(this_obj);
35494         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35495         TrustedClosingTransaction_free(this_obj_conv);
35496 }
35497
35498 int8_tArray  __attribute__((export_name("TS_TrustedClosingTransaction_built_transaction"))) TS_TrustedClosingTransaction_built_transaction(uint64_t this_arg) {
35499         LDKTrustedClosingTransaction this_arg_conv;
35500         this_arg_conv.inner = untag_ptr(this_arg);
35501         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35502         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35503         this_arg_conv.is_owned = false;
35504         LDKTransaction ret_var = TrustedClosingTransaction_built_transaction(&this_arg_conv);
35505         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
35506         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
35507         Transaction_free(ret_var);
35508         return ret_arr;
35509 }
35510
35511 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) {
35512         LDKTrustedClosingTransaction this_arg_conv;
35513         this_arg_conv.inner = untag_ptr(this_arg);
35514         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35515         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35516         this_arg_conv.is_owned = false;
35517         LDKu8slice funding_redeemscript_ref;
35518         funding_redeemscript_ref.datalen = funding_redeemscript->arr_len;
35519         funding_redeemscript_ref.data = funding_redeemscript->elems;
35520         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
35521         memcpy(ret_arr->elems, TrustedClosingTransaction_get_sighash_all(&this_arg_conv, funding_redeemscript_ref, channel_value_satoshis).data, 32);
35522         FREE(funding_redeemscript);
35523         return ret_arr;
35524 }
35525
35526 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) {
35527         LDKTrustedClosingTransaction this_arg_conv;
35528         this_arg_conv.inner = untag_ptr(this_arg);
35529         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35530         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35531         this_arg_conv.is_owned = false;
35532         unsigned char funding_key_arr[32];
35533         CHECK(funding_key->arr_len == 32);
35534         memcpy(funding_key_arr, funding_key->elems, 32); FREE(funding_key);
35535         unsigned char (*funding_key_ref)[32] = &funding_key_arr;
35536         LDKu8slice funding_redeemscript_ref;
35537         funding_redeemscript_ref.datalen = funding_redeemscript->arr_len;
35538         funding_redeemscript_ref.data = funding_redeemscript->elems;
35539         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
35540         memcpy(ret_arr->elems, TrustedClosingTransaction_sign(&this_arg_conv, funding_key_ref, funding_redeemscript_ref, channel_value_satoshis).compact_form, 64);
35541         FREE(funding_redeemscript);
35542         return ret_arr;
35543 }
35544
35545 void  __attribute__((export_name("TS_CommitmentTransaction_free"))) TS_CommitmentTransaction_free(uint64_t this_obj) {
35546         LDKCommitmentTransaction this_obj_conv;
35547         this_obj_conv.inner = untag_ptr(this_obj);
35548         this_obj_conv.is_owned = ptr_is_owned(this_obj);
35549         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35550         CommitmentTransaction_free(this_obj_conv);
35551 }
35552
35553 static inline uint64_t CommitmentTransaction_clone_ptr(LDKCommitmentTransaction *NONNULL_PTR arg) {
35554         LDKCommitmentTransaction ret_var = CommitmentTransaction_clone(arg);
35555         uint64_t ret_ref = 0;
35556         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35557         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35558         return ret_ref;
35559 }
35560 int64_t  __attribute__((export_name("TS_CommitmentTransaction_clone_ptr"))) TS_CommitmentTransaction_clone_ptr(uint64_t arg) {
35561         LDKCommitmentTransaction arg_conv;
35562         arg_conv.inner = untag_ptr(arg);
35563         arg_conv.is_owned = ptr_is_owned(arg);
35564         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35565         arg_conv.is_owned = false;
35566         int64_t ret_conv = CommitmentTransaction_clone_ptr(&arg_conv);
35567         return ret_conv;
35568 }
35569
35570 uint64_t  __attribute__((export_name("TS_CommitmentTransaction_clone"))) TS_CommitmentTransaction_clone(uint64_t orig) {
35571         LDKCommitmentTransaction orig_conv;
35572         orig_conv.inner = untag_ptr(orig);
35573         orig_conv.is_owned = ptr_is_owned(orig);
35574         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35575         orig_conv.is_owned = false;
35576         LDKCommitmentTransaction ret_var = CommitmentTransaction_clone(&orig_conv);
35577         uint64_t ret_ref = 0;
35578         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35579         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35580         return ret_ref;
35581 }
35582
35583 int8_tArray  __attribute__((export_name("TS_CommitmentTransaction_write"))) TS_CommitmentTransaction_write(uint64_t obj) {
35584         LDKCommitmentTransaction obj_conv;
35585         obj_conv.inner = untag_ptr(obj);
35586         obj_conv.is_owned = ptr_is_owned(obj);
35587         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35588         obj_conv.is_owned = false;
35589         LDKCVec_u8Z ret_var = CommitmentTransaction_write(&obj_conv);
35590         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
35591         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
35592         CVec_u8Z_free(ret_var);
35593         return ret_arr;
35594 }
35595
35596 uint64_t  __attribute__((export_name("TS_CommitmentTransaction_read"))) TS_CommitmentTransaction_read(int8_tArray ser) {
35597         LDKu8slice ser_ref;
35598         ser_ref.datalen = ser->arr_len;
35599         ser_ref.data = ser->elems;
35600         LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
35601         *ret_conv = CommitmentTransaction_read(ser_ref);
35602         FREE(ser);
35603         return tag_ptr(ret_conv, true);
35604 }
35605
35606 int64_t  __attribute__((export_name("TS_CommitmentTransaction_commitment_number"))) TS_CommitmentTransaction_commitment_number(uint64_t this_arg) {
35607         LDKCommitmentTransaction this_arg_conv;
35608         this_arg_conv.inner = untag_ptr(this_arg);
35609         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35610         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35611         this_arg_conv.is_owned = false;
35612         int64_t ret_conv = CommitmentTransaction_commitment_number(&this_arg_conv);
35613         return ret_conv;
35614 }
35615
35616 int64_t  __attribute__((export_name("TS_CommitmentTransaction_to_broadcaster_value_sat"))) TS_CommitmentTransaction_to_broadcaster_value_sat(uint64_t this_arg) {
35617         LDKCommitmentTransaction this_arg_conv;
35618         this_arg_conv.inner = untag_ptr(this_arg);
35619         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35620         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35621         this_arg_conv.is_owned = false;
35622         int64_t ret_conv = CommitmentTransaction_to_broadcaster_value_sat(&this_arg_conv);
35623         return ret_conv;
35624 }
35625
35626 int64_t  __attribute__((export_name("TS_CommitmentTransaction_to_countersignatory_value_sat"))) TS_CommitmentTransaction_to_countersignatory_value_sat(uint64_t this_arg) {
35627         LDKCommitmentTransaction this_arg_conv;
35628         this_arg_conv.inner = untag_ptr(this_arg);
35629         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35630         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35631         this_arg_conv.is_owned = false;
35632         int64_t ret_conv = CommitmentTransaction_to_countersignatory_value_sat(&this_arg_conv);
35633         return ret_conv;
35634 }
35635
35636 int32_t  __attribute__((export_name("TS_CommitmentTransaction_feerate_per_kw"))) TS_CommitmentTransaction_feerate_per_kw(uint64_t this_arg) {
35637         LDKCommitmentTransaction this_arg_conv;
35638         this_arg_conv.inner = untag_ptr(this_arg);
35639         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35640         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35641         this_arg_conv.is_owned = false;
35642         int32_t ret_conv = CommitmentTransaction_feerate_per_kw(&this_arg_conv);
35643         return ret_conv;
35644 }
35645
35646 uint64_t  __attribute__((export_name("TS_CommitmentTransaction_trust"))) TS_CommitmentTransaction_trust(uint64_t this_arg) {
35647         LDKCommitmentTransaction this_arg_conv;
35648         this_arg_conv.inner = untag_ptr(this_arg);
35649         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35650         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35651         this_arg_conv.is_owned = false;
35652         LDKTrustedCommitmentTransaction ret_var = CommitmentTransaction_trust(&this_arg_conv);
35653         uint64_t ret_ref = 0;
35654         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35655         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35656         return ret_ref;
35657 }
35658
35659 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) {
35660         LDKCommitmentTransaction this_arg_conv;
35661         this_arg_conv.inner = untag_ptr(this_arg);
35662         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35663         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35664         this_arg_conv.is_owned = false;
35665         LDKDirectedChannelTransactionParameters channel_parameters_conv;
35666         channel_parameters_conv.inner = untag_ptr(channel_parameters);
35667         channel_parameters_conv.is_owned = ptr_is_owned(channel_parameters);
35668         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_conv);
35669         channel_parameters_conv.is_owned = false;
35670         LDKChannelPublicKeys broadcaster_keys_conv;
35671         broadcaster_keys_conv.inner = untag_ptr(broadcaster_keys);
35672         broadcaster_keys_conv.is_owned = ptr_is_owned(broadcaster_keys);
35673         CHECK_INNER_FIELD_ACCESS_OR_NULL(broadcaster_keys_conv);
35674         broadcaster_keys_conv.is_owned = false;
35675         LDKChannelPublicKeys countersignatory_keys_conv;
35676         countersignatory_keys_conv.inner = untag_ptr(countersignatory_keys);
35677         countersignatory_keys_conv.is_owned = ptr_is_owned(countersignatory_keys);
35678         CHECK_INNER_FIELD_ACCESS_OR_NULL(countersignatory_keys_conv);
35679         countersignatory_keys_conv.is_owned = false;
35680         LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
35681         *ret_conv = CommitmentTransaction_verify(&this_arg_conv, &channel_parameters_conv, &broadcaster_keys_conv, &countersignatory_keys_conv);
35682         return tag_ptr(ret_conv, true);
35683 }
35684
35685 void  __attribute__((export_name("TS_TrustedCommitmentTransaction_free"))) TS_TrustedCommitmentTransaction_free(uint64_t this_obj) {
35686         LDKTrustedCommitmentTransaction this_obj_conv;
35687         this_obj_conv.inner = untag_ptr(this_obj);
35688         this_obj_conv.is_owned = ptr_is_owned(this_obj);
35689         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35690         TrustedCommitmentTransaction_free(this_obj_conv);
35691 }
35692
35693 int8_tArray  __attribute__((export_name("TS_TrustedCommitmentTransaction_txid"))) TS_TrustedCommitmentTransaction_txid(uint64_t this_arg) {
35694         LDKTrustedCommitmentTransaction this_arg_conv;
35695         this_arg_conv.inner = untag_ptr(this_arg);
35696         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35697         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35698         this_arg_conv.is_owned = false;
35699         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
35700         memcpy(ret_arr->elems, TrustedCommitmentTransaction_txid(&this_arg_conv).data, 32);
35701         return ret_arr;
35702 }
35703
35704 uint64_t  __attribute__((export_name("TS_TrustedCommitmentTransaction_built_transaction"))) TS_TrustedCommitmentTransaction_built_transaction(uint64_t this_arg) {
35705         LDKTrustedCommitmentTransaction this_arg_conv;
35706         this_arg_conv.inner = untag_ptr(this_arg);
35707         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35708         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35709         this_arg_conv.is_owned = false;
35710         LDKBuiltCommitmentTransaction ret_var = TrustedCommitmentTransaction_built_transaction(&this_arg_conv);
35711         uint64_t ret_ref = 0;
35712         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35713         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35714         return ret_ref;
35715 }
35716
35717 uint64_t  __attribute__((export_name("TS_TrustedCommitmentTransaction_keys"))) TS_TrustedCommitmentTransaction_keys(uint64_t this_arg) {
35718         LDKTrustedCommitmentTransaction this_arg_conv;
35719         this_arg_conv.inner = untag_ptr(this_arg);
35720         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35721         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35722         this_arg_conv.is_owned = false;
35723         LDKTxCreationKeys ret_var = TrustedCommitmentTransaction_keys(&this_arg_conv);
35724         uint64_t ret_ref = 0;
35725         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35726         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35727         return ret_ref;
35728 }
35729
35730 jboolean  __attribute__((export_name("TS_TrustedCommitmentTransaction_opt_anchors"))) TS_TrustedCommitmentTransaction_opt_anchors(uint64_t this_arg) {
35731         LDKTrustedCommitmentTransaction this_arg_conv;
35732         this_arg_conv.inner = untag_ptr(this_arg);
35733         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35734         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35735         this_arg_conv.is_owned = false;
35736         jboolean ret_conv = TrustedCommitmentTransaction_opt_anchors(&this_arg_conv);
35737         return ret_conv;
35738 }
35739
35740 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) {
35741         LDKTrustedCommitmentTransaction this_arg_conv;
35742         this_arg_conv.inner = untag_ptr(this_arg);
35743         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35744         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35745         this_arg_conv.is_owned = false;
35746         unsigned char htlc_base_key_arr[32];
35747         CHECK(htlc_base_key->arr_len == 32);
35748         memcpy(htlc_base_key_arr, htlc_base_key->elems, 32); FREE(htlc_base_key);
35749         unsigned char (*htlc_base_key_ref)[32] = &htlc_base_key_arr;
35750         LDKDirectedChannelTransactionParameters channel_parameters_conv;
35751         channel_parameters_conv.inner = untag_ptr(channel_parameters);
35752         channel_parameters_conv.is_owned = ptr_is_owned(channel_parameters);
35753         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_conv);
35754         channel_parameters_conv.is_owned = false;
35755         LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
35756         *ret_conv = TrustedCommitmentTransaction_get_htlc_sigs(&this_arg_conv, htlc_base_key_ref, &channel_parameters_conv);
35757         return tag_ptr(ret_conv, true);
35758 }
35759
35760 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) {
35761         LDKPublicKey broadcaster_payment_basepoint_ref;
35762         CHECK(broadcaster_payment_basepoint->arr_len == 33);
35763         memcpy(broadcaster_payment_basepoint_ref.compressed_form, broadcaster_payment_basepoint->elems, 33); FREE(broadcaster_payment_basepoint);
35764         LDKPublicKey countersignatory_payment_basepoint_ref;
35765         CHECK(countersignatory_payment_basepoint->arr_len == 33);
35766         memcpy(countersignatory_payment_basepoint_ref.compressed_form, countersignatory_payment_basepoint->elems, 33); FREE(countersignatory_payment_basepoint);
35767         int64_t ret_conv = get_commitment_transaction_number_obscure_factor(broadcaster_payment_basepoint_ref, countersignatory_payment_basepoint_ref, outbound_from_broadcaster);
35768         return ret_conv;
35769 }
35770
35771 jboolean  __attribute__((export_name("TS_InitFeatures_eq"))) TS_InitFeatures_eq(uint64_t a, uint64_t b) {
35772         LDKInitFeatures a_conv;
35773         a_conv.inner = untag_ptr(a);
35774         a_conv.is_owned = ptr_is_owned(a);
35775         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
35776         a_conv.is_owned = false;
35777         LDKInitFeatures b_conv;
35778         b_conv.inner = untag_ptr(b);
35779         b_conv.is_owned = ptr_is_owned(b);
35780         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
35781         b_conv.is_owned = false;
35782         jboolean ret_conv = InitFeatures_eq(&a_conv, &b_conv);
35783         return ret_conv;
35784 }
35785
35786 jboolean  __attribute__((export_name("TS_NodeFeatures_eq"))) TS_NodeFeatures_eq(uint64_t a, uint64_t b) {
35787         LDKNodeFeatures a_conv;
35788         a_conv.inner = untag_ptr(a);
35789         a_conv.is_owned = ptr_is_owned(a);
35790         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
35791         a_conv.is_owned = false;
35792         LDKNodeFeatures b_conv;
35793         b_conv.inner = untag_ptr(b);
35794         b_conv.is_owned = ptr_is_owned(b);
35795         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
35796         b_conv.is_owned = false;
35797         jboolean ret_conv = NodeFeatures_eq(&a_conv, &b_conv);
35798         return ret_conv;
35799 }
35800
35801 jboolean  __attribute__((export_name("TS_ChannelFeatures_eq"))) TS_ChannelFeatures_eq(uint64_t a, uint64_t b) {
35802         LDKChannelFeatures a_conv;
35803         a_conv.inner = untag_ptr(a);
35804         a_conv.is_owned = ptr_is_owned(a);
35805         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
35806         a_conv.is_owned = false;
35807         LDKChannelFeatures b_conv;
35808         b_conv.inner = untag_ptr(b);
35809         b_conv.is_owned = ptr_is_owned(b);
35810         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
35811         b_conv.is_owned = false;
35812         jboolean ret_conv = ChannelFeatures_eq(&a_conv, &b_conv);
35813         return ret_conv;
35814 }
35815
35816 jboolean  __attribute__((export_name("TS_InvoiceFeatures_eq"))) TS_InvoiceFeatures_eq(uint64_t a, uint64_t b) {
35817         LDKInvoiceFeatures a_conv;
35818         a_conv.inner = untag_ptr(a);
35819         a_conv.is_owned = ptr_is_owned(a);
35820         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
35821         a_conv.is_owned = false;
35822         LDKInvoiceFeatures b_conv;
35823         b_conv.inner = untag_ptr(b);
35824         b_conv.is_owned = ptr_is_owned(b);
35825         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
35826         b_conv.is_owned = false;
35827         jboolean ret_conv = InvoiceFeatures_eq(&a_conv, &b_conv);
35828         return ret_conv;
35829 }
35830
35831 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_eq"))) TS_ChannelTypeFeatures_eq(uint64_t a, uint64_t b) {
35832         LDKChannelTypeFeatures a_conv;
35833         a_conv.inner = untag_ptr(a);
35834         a_conv.is_owned = ptr_is_owned(a);
35835         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
35836         a_conv.is_owned = false;
35837         LDKChannelTypeFeatures b_conv;
35838         b_conv.inner = untag_ptr(b);
35839         b_conv.is_owned = ptr_is_owned(b);
35840         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
35841         b_conv.is_owned = false;
35842         jboolean ret_conv = ChannelTypeFeatures_eq(&a_conv, &b_conv);
35843         return ret_conv;
35844 }
35845
35846 static inline uint64_t InitFeatures_clone_ptr(LDKInitFeatures *NONNULL_PTR arg) {
35847         LDKInitFeatures ret_var = InitFeatures_clone(arg);
35848         uint64_t ret_ref = 0;
35849         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35850         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35851         return ret_ref;
35852 }
35853 int64_t  __attribute__((export_name("TS_InitFeatures_clone_ptr"))) TS_InitFeatures_clone_ptr(uint64_t arg) {
35854         LDKInitFeatures arg_conv;
35855         arg_conv.inner = untag_ptr(arg);
35856         arg_conv.is_owned = ptr_is_owned(arg);
35857         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35858         arg_conv.is_owned = false;
35859         int64_t ret_conv = InitFeatures_clone_ptr(&arg_conv);
35860         return ret_conv;
35861 }
35862
35863 uint64_t  __attribute__((export_name("TS_InitFeatures_clone"))) TS_InitFeatures_clone(uint64_t orig) {
35864         LDKInitFeatures orig_conv;
35865         orig_conv.inner = untag_ptr(orig);
35866         orig_conv.is_owned = ptr_is_owned(orig);
35867         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35868         orig_conv.is_owned = false;
35869         LDKInitFeatures ret_var = InitFeatures_clone(&orig_conv);
35870         uint64_t ret_ref = 0;
35871         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35872         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35873         return ret_ref;
35874 }
35875
35876 static inline uint64_t NodeFeatures_clone_ptr(LDKNodeFeatures *NONNULL_PTR arg) {
35877         LDKNodeFeatures ret_var = NodeFeatures_clone(arg);
35878         uint64_t ret_ref = 0;
35879         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35880         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35881         return ret_ref;
35882 }
35883 int64_t  __attribute__((export_name("TS_NodeFeatures_clone_ptr"))) TS_NodeFeatures_clone_ptr(uint64_t arg) {
35884         LDKNodeFeatures arg_conv;
35885         arg_conv.inner = untag_ptr(arg);
35886         arg_conv.is_owned = ptr_is_owned(arg);
35887         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35888         arg_conv.is_owned = false;
35889         int64_t ret_conv = NodeFeatures_clone_ptr(&arg_conv);
35890         return ret_conv;
35891 }
35892
35893 uint64_t  __attribute__((export_name("TS_NodeFeatures_clone"))) TS_NodeFeatures_clone(uint64_t orig) {
35894         LDKNodeFeatures orig_conv;
35895         orig_conv.inner = untag_ptr(orig);
35896         orig_conv.is_owned = ptr_is_owned(orig);
35897         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35898         orig_conv.is_owned = false;
35899         LDKNodeFeatures ret_var = NodeFeatures_clone(&orig_conv);
35900         uint64_t ret_ref = 0;
35901         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35902         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35903         return ret_ref;
35904 }
35905
35906 static inline uint64_t ChannelFeatures_clone_ptr(LDKChannelFeatures *NONNULL_PTR arg) {
35907         LDKChannelFeatures ret_var = ChannelFeatures_clone(arg);
35908         uint64_t ret_ref = 0;
35909         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35910         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35911         return ret_ref;
35912 }
35913 int64_t  __attribute__((export_name("TS_ChannelFeatures_clone_ptr"))) TS_ChannelFeatures_clone_ptr(uint64_t arg) {
35914         LDKChannelFeatures arg_conv;
35915         arg_conv.inner = untag_ptr(arg);
35916         arg_conv.is_owned = ptr_is_owned(arg);
35917         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35918         arg_conv.is_owned = false;
35919         int64_t ret_conv = ChannelFeatures_clone_ptr(&arg_conv);
35920         return ret_conv;
35921 }
35922
35923 uint64_t  __attribute__((export_name("TS_ChannelFeatures_clone"))) TS_ChannelFeatures_clone(uint64_t orig) {
35924         LDKChannelFeatures orig_conv;
35925         orig_conv.inner = untag_ptr(orig);
35926         orig_conv.is_owned = ptr_is_owned(orig);
35927         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35928         orig_conv.is_owned = false;
35929         LDKChannelFeatures ret_var = ChannelFeatures_clone(&orig_conv);
35930         uint64_t ret_ref = 0;
35931         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35932         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35933         return ret_ref;
35934 }
35935
35936 static inline uint64_t InvoiceFeatures_clone_ptr(LDKInvoiceFeatures *NONNULL_PTR arg) {
35937         LDKInvoiceFeatures ret_var = InvoiceFeatures_clone(arg);
35938         uint64_t ret_ref = 0;
35939         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35940         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35941         return ret_ref;
35942 }
35943 int64_t  __attribute__((export_name("TS_InvoiceFeatures_clone_ptr"))) TS_InvoiceFeatures_clone_ptr(uint64_t arg) {
35944         LDKInvoiceFeatures arg_conv;
35945         arg_conv.inner = untag_ptr(arg);
35946         arg_conv.is_owned = ptr_is_owned(arg);
35947         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35948         arg_conv.is_owned = false;
35949         int64_t ret_conv = InvoiceFeatures_clone_ptr(&arg_conv);
35950         return ret_conv;
35951 }
35952
35953 uint64_t  __attribute__((export_name("TS_InvoiceFeatures_clone"))) TS_InvoiceFeatures_clone(uint64_t orig) {
35954         LDKInvoiceFeatures orig_conv;
35955         orig_conv.inner = untag_ptr(orig);
35956         orig_conv.is_owned = ptr_is_owned(orig);
35957         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35958         orig_conv.is_owned = false;
35959         LDKInvoiceFeatures ret_var = InvoiceFeatures_clone(&orig_conv);
35960         uint64_t ret_ref = 0;
35961         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35962         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35963         return ret_ref;
35964 }
35965
35966 static inline uint64_t ChannelTypeFeatures_clone_ptr(LDKChannelTypeFeatures *NONNULL_PTR arg) {
35967         LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_clone(arg);
35968         uint64_t ret_ref = 0;
35969         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35970         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35971         return ret_ref;
35972 }
35973 int64_t  __attribute__((export_name("TS_ChannelTypeFeatures_clone_ptr"))) TS_ChannelTypeFeatures_clone_ptr(uint64_t arg) {
35974         LDKChannelTypeFeatures arg_conv;
35975         arg_conv.inner = untag_ptr(arg);
35976         arg_conv.is_owned = ptr_is_owned(arg);
35977         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35978         arg_conv.is_owned = false;
35979         int64_t ret_conv = ChannelTypeFeatures_clone_ptr(&arg_conv);
35980         return ret_conv;
35981 }
35982
35983 uint64_t  __attribute__((export_name("TS_ChannelTypeFeatures_clone"))) TS_ChannelTypeFeatures_clone(uint64_t orig) {
35984         LDKChannelTypeFeatures orig_conv;
35985         orig_conv.inner = untag_ptr(orig);
35986         orig_conv.is_owned = ptr_is_owned(orig);
35987         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35988         orig_conv.is_owned = false;
35989         LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_clone(&orig_conv);
35990         uint64_t ret_ref = 0;
35991         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35992         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35993         return ret_ref;
35994 }
35995
35996 void  __attribute__((export_name("TS_InitFeatures_free"))) TS_InitFeatures_free(uint64_t this_obj) {
35997         LDKInitFeatures this_obj_conv;
35998         this_obj_conv.inner = untag_ptr(this_obj);
35999         this_obj_conv.is_owned = ptr_is_owned(this_obj);
36000         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36001         InitFeatures_free(this_obj_conv);
36002 }
36003
36004 void  __attribute__((export_name("TS_NodeFeatures_free"))) TS_NodeFeatures_free(uint64_t this_obj) {
36005         LDKNodeFeatures this_obj_conv;
36006         this_obj_conv.inner = untag_ptr(this_obj);
36007         this_obj_conv.is_owned = ptr_is_owned(this_obj);
36008         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36009         NodeFeatures_free(this_obj_conv);
36010 }
36011
36012 void  __attribute__((export_name("TS_ChannelFeatures_free"))) TS_ChannelFeatures_free(uint64_t this_obj) {
36013         LDKChannelFeatures this_obj_conv;
36014         this_obj_conv.inner = untag_ptr(this_obj);
36015         this_obj_conv.is_owned = ptr_is_owned(this_obj);
36016         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36017         ChannelFeatures_free(this_obj_conv);
36018 }
36019
36020 void  __attribute__((export_name("TS_InvoiceFeatures_free"))) TS_InvoiceFeatures_free(uint64_t this_obj) {
36021         LDKInvoiceFeatures this_obj_conv;
36022         this_obj_conv.inner = untag_ptr(this_obj);
36023         this_obj_conv.is_owned = ptr_is_owned(this_obj);
36024         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36025         InvoiceFeatures_free(this_obj_conv);
36026 }
36027
36028 void  __attribute__((export_name("TS_ChannelTypeFeatures_free"))) TS_ChannelTypeFeatures_free(uint64_t this_obj) {
36029         LDKChannelTypeFeatures this_obj_conv;
36030         this_obj_conv.inner = untag_ptr(this_obj);
36031         this_obj_conv.is_owned = ptr_is_owned(this_obj);
36032         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36033         ChannelTypeFeatures_free(this_obj_conv);
36034 }
36035
36036 uint64_t  __attribute__((export_name("TS_InitFeatures_empty"))) TS_InitFeatures_empty() {
36037         LDKInitFeatures ret_var = InitFeatures_empty();
36038         uint64_t ret_ref = 0;
36039         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36040         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36041         return ret_ref;
36042 }
36043
36044 uint64_t  __attribute__((export_name("TS_InitFeatures_known"))) TS_InitFeatures_known() {
36045         LDKInitFeatures ret_var = InitFeatures_known();
36046         uint64_t ret_ref = 0;
36047         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36048         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36049         return ret_ref;
36050 }
36051
36052 jboolean  __attribute__((export_name("TS_InitFeatures_requires_unknown_bits"))) TS_InitFeatures_requires_unknown_bits(uint64_t this_arg) {
36053         LDKInitFeatures this_arg_conv;
36054         this_arg_conv.inner = untag_ptr(this_arg);
36055         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36056         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36057         this_arg_conv.is_owned = false;
36058         jboolean ret_conv = InitFeatures_requires_unknown_bits(&this_arg_conv);
36059         return ret_conv;
36060 }
36061
36062 uint64_t  __attribute__((export_name("TS_NodeFeatures_empty"))) TS_NodeFeatures_empty() {
36063         LDKNodeFeatures ret_var = NodeFeatures_empty();
36064         uint64_t ret_ref = 0;
36065         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36066         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36067         return ret_ref;
36068 }
36069
36070 uint64_t  __attribute__((export_name("TS_NodeFeatures_known"))) TS_NodeFeatures_known() {
36071         LDKNodeFeatures ret_var = NodeFeatures_known();
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 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_unknown_bits"))) TS_NodeFeatures_requires_unknown_bits(uint64_t this_arg) {
36079         LDKNodeFeatures this_arg_conv;
36080         this_arg_conv.inner = untag_ptr(this_arg);
36081         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36082         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36083         this_arg_conv.is_owned = false;
36084         jboolean ret_conv = NodeFeatures_requires_unknown_bits(&this_arg_conv);
36085         return ret_conv;
36086 }
36087
36088 uint64_t  __attribute__((export_name("TS_ChannelFeatures_empty"))) TS_ChannelFeatures_empty() {
36089         LDKChannelFeatures ret_var = ChannelFeatures_empty();
36090         uint64_t ret_ref = 0;
36091         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36092         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36093         return ret_ref;
36094 }
36095
36096 uint64_t  __attribute__((export_name("TS_ChannelFeatures_known"))) TS_ChannelFeatures_known() {
36097         LDKChannelFeatures ret_var = ChannelFeatures_known();
36098         uint64_t ret_ref = 0;
36099         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36100         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36101         return ret_ref;
36102 }
36103
36104 jboolean  __attribute__((export_name("TS_ChannelFeatures_requires_unknown_bits"))) TS_ChannelFeatures_requires_unknown_bits(uint64_t this_arg) {
36105         LDKChannelFeatures this_arg_conv;
36106         this_arg_conv.inner = untag_ptr(this_arg);
36107         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36108         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36109         this_arg_conv.is_owned = false;
36110         jboolean ret_conv = ChannelFeatures_requires_unknown_bits(&this_arg_conv);
36111         return ret_conv;
36112 }
36113
36114 uint64_t  __attribute__((export_name("TS_InvoiceFeatures_empty"))) TS_InvoiceFeatures_empty() {
36115         LDKInvoiceFeatures ret_var = InvoiceFeatures_empty();
36116         uint64_t ret_ref = 0;
36117         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36118         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36119         return ret_ref;
36120 }
36121
36122 uint64_t  __attribute__((export_name("TS_InvoiceFeatures_known"))) TS_InvoiceFeatures_known() {
36123         LDKInvoiceFeatures ret_var = InvoiceFeatures_known();
36124         uint64_t ret_ref = 0;
36125         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36126         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36127         return ret_ref;
36128 }
36129
36130 jboolean  __attribute__((export_name("TS_InvoiceFeatures_requires_unknown_bits"))) TS_InvoiceFeatures_requires_unknown_bits(uint64_t this_arg) {
36131         LDKInvoiceFeatures this_arg_conv;
36132         this_arg_conv.inner = untag_ptr(this_arg);
36133         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36134         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36135         this_arg_conv.is_owned = false;
36136         jboolean ret_conv = InvoiceFeatures_requires_unknown_bits(&this_arg_conv);
36137         return ret_conv;
36138 }
36139
36140 uint64_t  __attribute__((export_name("TS_ChannelTypeFeatures_empty"))) TS_ChannelTypeFeatures_empty() {
36141         LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_empty();
36142         uint64_t ret_ref = 0;
36143         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36144         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36145         return ret_ref;
36146 }
36147
36148 uint64_t  __attribute__((export_name("TS_ChannelTypeFeatures_known"))) TS_ChannelTypeFeatures_known() {
36149         LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_known();
36150         uint64_t ret_ref = 0;
36151         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36152         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36153         return ret_ref;
36154 }
36155
36156 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_requires_unknown_bits"))) TS_ChannelTypeFeatures_requires_unknown_bits(uint64_t this_arg) {
36157         LDKChannelTypeFeatures this_arg_conv;
36158         this_arg_conv.inner = untag_ptr(this_arg);
36159         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36160         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36161         this_arg_conv.is_owned = false;
36162         jboolean ret_conv = ChannelTypeFeatures_requires_unknown_bits(&this_arg_conv);
36163         return ret_conv;
36164 }
36165
36166 int8_tArray  __attribute__((export_name("TS_InitFeatures_write"))) TS_InitFeatures_write(uint64_t obj) {
36167         LDKInitFeatures obj_conv;
36168         obj_conv.inner = untag_ptr(obj);
36169         obj_conv.is_owned = ptr_is_owned(obj);
36170         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36171         obj_conv.is_owned = false;
36172         LDKCVec_u8Z ret_var = InitFeatures_write(&obj_conv);
36173         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36174         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36175         CVec_u8Z_free(ret_var);
36176         return ret_arr;
36177 }
36178
36179 uint64_t  __attribute__((export_name("TS_InitFeatures_read"))) TS_InitFeatures_read(int8_tArray ser) {
36180         LDKu8slice ser_ref;
36181         ser_ref.datalen = ser->arr_len;
36182         ser_ref.data = ser->elems;
36183         LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
36184         *ret_conv = InitFeatures_read(ser_ref);
36185         FREE(ser);
36186         return tag_ptr(ret_conv, true);
36187 }
36188
36189 int8_tArray  __attribute__((export_name("TS_ChannelFeatures_write"))) TS_ChannelFeatures_write(uint64_t obj) {
36190         LDKChannelFeatures obj_conv;
36191         obj_conv.inner = untag_ptr(obj);
36192         obj_conv.is_owned = ptr_is_owned(obj);
36193         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36194         obj_conv.is_owned = false;
36195         LDKCVec_u8Z ret_var = ChannelFeatures_write(&obj_conv);
36196         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36197         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36198         CVec_u8Z_free(ret_var);
36199         return ret_arr;
36200 }
36201
36202 uint64_t  __attribute__((export_name("TS_ChannelFeatures_read"))) TS_ChannelFeatures_read(int8_tArray ser) {
36203         LDKu8slice ser_ref;
36204         ser_ref.datalen = ser->arr_len;
36205         ser_ref.data = ser->elems;
36206         LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
36207         *ret_conv = ChannelFeatures_read(ser_ref);
36208         FREE(ser);
36209         return tag_ptr(ret_conv, true);
36210 }
36211
36212 int8_tArray  __attribute__((export_name("TS_NodeFeatures_write"))) TS_NodeFeatures_write(uint64_t obj) {
36213         LDKNodeFeatures obj_conv;
36214         obj_conv.inner = untag_ptr(obj);
36215         obj_conv.is_owned = ptr_is_owned(obj);
36216         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36217         obj_conv.is_owned = false;
36218         LDKCVec_u8Z ret_var = NodeFeatures_write(&obj_conv);
36219         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36220         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36221         CVec_u8Z_free(ret_var);
36222         return ret_arr;
36223 }
36224
36225 uint64_t  __attribute__((export_name("TS_NodeFeatures_read"))) TS_NodeFeatures_read(int8_tArray ser) {
36226         LDKu8slice ser_ref;
36227         ser_ref.datalen = ser->arr_len;
36228         ser_ref.data = ser->elems;
36229         LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
36230         *ret_conv = NodeFeatures_read(ser_ref);
36231         FREE(ser);
36232         return tag_ptr(ret_conv, true);
36233 }
36234
36235 int8_tArray  __attribute__((export_name("TS_InvoiceFeatures_write"))) TS_InvoiceFeatures_write(uint64_t obj) {
36236         LDKInvoiceFeatures obj_conv;
36237         obj_conv.inner = untag_ptr(obj);
36238         obj_conv.is_owned = ptr_is_owned(obj);
36239         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36240         obj_conv.is_owned = false;
36241         LDKCVec_u8Z ret_var = InvoiceFeatures_write(&obj_conv);
36242         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36243         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36244         CVec_u8Z_free(ret_var);
36245         return ret_arr;
36246 }
36247
36248 uint64_t  __attribute__((export_name("TS_InvoiceFeatures_read"))) TS_InvoiceFeatures_read(int8_tArray ser) {
36249         LDKu8slice ser_ref;
36250         ser_ref.datalen = ser->arr_len;
36251         ser_ref.data = ser->elems;
36252         LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
36253         *ret_conv = InvoiceFeatures_read(ser_ref);
36254         FREE(ser);
36255         return tag_ptr(ret_conv, true);
36256 }
36257
36258 int8_tArray  __attribute__((export_name("TS_ChannelTypeFeatures_write"))) TS_ChannelTypeFeatures_write(uint64_t obj) {
36259         LDKChannelTypeFeatures obj_conv;
36260         obj_conv.inner = untag_ptr(obj);
36261         obj_conv.is_owned = ptr_is_owned(obj);
36262         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36263         obj_conv.is_owned = false;
36264         LDKCVec_u8Z ret_var = ChannelTypeFeatures_write(&obj_conv);
36265         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36266         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36267         CVec_u8Z_free(ret_var);
36268         return ret_arr;
36269 }
36270
36271 uint64_t  __attribute__((export_name("TS_ChannelTypeFeatures_read"))) TS_ChannelTypeFeatures_read(int8_tArray ser) {
36272         LDKu8slice ser_ref;
36273         ser_ref.datalen = ser->arr_len;
36274         ser_ref.data = ser->elems;
36275         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
36276         *ret_conv = ChannelTypeFeatures_read(ser_ref);
36277         FREE(ser);
36278         return tag_ptr(ret_conv, true);
36279 }
36280
36281 void  __attribute__((export_name("TS_InitFeatures_set_data_loss_protect_optional"))) TS_InitFeatures_set_data_loss_protect_optional(uint64_t this_arg) {
36282         LDKInitFeatures this_arg_conv;
36283         this_arg_conv.inner = untag_ptr(this_arg);
36284         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36285         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36286         this_arg_conv.is_owned = false;
36287         InitFeatures_set_data_loss_protect_optional(&this_arg_conv);
36288 }
36289
36290 void  __attribute__((export_name("TS_InitFeatures_set_data_loss_protect_required"))) TS_InitFeatures_set_data_loss_protect_required(uint64_t this_arg) {
36291         LDKInitFeatures 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         InitFeatures_set_data_loss_protect_required(&this_arg_conv);
36297 }
36298
36299 jboolean  __attribute__((export_name("TS_InitFeatures_supports_data_loss_protect"))) TS_InitFeatures_supports_data_loss_protect(uint64_t this_arg) {
36300         LDKInitFeatures this_arg_conv;
36301         this_arg_conv.inner = untag_ptr(this_arg);
36302         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36303         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36304         this_arg_conv.is_owned = false;
36305         jboolean ret_conv = InitFeatures_supports_data_loss_protect(&this_arg_conv);
36306         return ret_conv;
36307 }
36308
36309 void  __attribute__((export_name("TS_NodeFeatures_set_data_loss_protect_optional"))) TS_NodeFeatures_set_data_loss_protect_optional(uint64_t this_arg) {
36310         LDKNodeFeatures this_arg_conv;
36311         this_arg_conv.inner = untag_ptr(this_arg);
36312         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36313         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36314         this_arg_conv.is_owned = false;
36315         NodeFeatures_set_data_loss_protect_optional(&this_arg_conv);
36316 }
36317
36318 void  __attribute__((export_name("TS_NodeFeatures_set_data_loss_protect_required"))) TS_NodeFeatures_set_data_loss_protect_required(uint64_t this_arg) {
36319         LDKNodeFeatures this_arg_conv;
36320         this_arg_conv.inner = untag_ptr(this_arg);
36321         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36322         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36323         this_arg_conv.is_owned = false;
36324         NodeFeatures_set_data_loss_protect_required(&this_arg_conv);
36325 }
36326
36327 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_data_loss_protect"))) TS_NodeFeatures_supports_data_loss_protect(uint64_t this_arg) {
36328         LDKNodeFeatures this_arg_conv;
36329         this_arg_conv.inner = untag_ptr(this_arg);
36330         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36331         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36332         this_arg_conv.is_owned = false;
36333         jboolean ret_conv = NodeFeatures_supports_data_loss_protect(&this_arg_conv);
36334         return ret_conv;
36335 }
36336
36337 jboolean  __attribute__((export_name("TS_InitFeatures_requires_data_loss_protect"))) TS_InitFeatures_requires_data_loss_protect(uint64_t this_arg) {
36338         LDKInitFeatures this_arg_conv;
36339         this_arg_conv.inner = untag_ptr(this_arg);
36340         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36341         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36342         this_arg_conv.is_owned = false;
36343         jboolean ret_conv = InitFeatures_requires_data_loss_protect(&this_arg_conv);
36344         return ret_conv;
36345 }
36346
36347 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_data_loss_protect"))) TS_NodeFeatures_requires_data_loss_protect(uint64_t this_arg) {
36348         LDKNodeFeatures this_arg_conv;
36349         this_arg_conv.inner = untag_ptr(this_arg);
36350         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36351         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36352         this_arg_conv.is_owned = false;
36353         jboolean ret_conv = NodeFeatures_requires_data_loss_protect(&this_arg_conv);
36354         return ret_conv;
36355 }
36356
36357 void  __attribute__((export_name("TS_InitFeatures_set_initial_routing_sync_optional"))) TS_InitFeatures_set_initial_routing_sync_optional(uint64_t this_arg) {
36358         LDKInitFeatures this_arg_conv;
36359         this_arg_conv.inner = untag_ptr(this_arg);
36360         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36361         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36362         this_arg_conv.is_owned = false;
36363         InitFeatures_set_initial_routing_sync_optional(&this_arg_conv);
36364 }
36365
36366 void  __attribute__((export_name("TS_InitFeatures_set_initial_routing_sync_required"))) TS_InitFeatures_set_initial_routing_sync_required(uint64_t this_arg) {
36367         LDKInitFeatures this_arg_conv;
36368         this_arg_conv.inner = untag_ptr(this_arg);
36369         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36370         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36371         this_arg_conv.is_owned = false;
36372         InitFeatures_set_initial_routing_sync_required(&this_arg_conv);
36373 }
36374
36375 jboolean  __attribute__((export_name("TS_InitFeatures_initial_routing_sync"))) TS_InitFeatures_initial_routing_sync(uint64_t this_arg) {
36376         LDKInitFeatures this_arg_conv;
36377         this_arg_conv.inner = untag_ptr(this_arg);
36378         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36379         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36380         this_arg_conv.is_owned = false;
36381         jboolean ret_conv = InitFeatures_initial_routing_sync(&this_arg_conv);
36382         return ret_conv;
36383 }
36384
36385 void  __attribute__((export_name("TS_InitFeatures_set_upfront_shutdown_script_optional"))) TS_InitFeatures_set_upfront_shutdown_script_optional(uint64_t this_arg) {
36386         LDKInitFeatures this_arg_conv;
36387         this_arg_conv.inner = untag_ptr(this_arg);
36388         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36389         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36390         this_arg_conv.is_owned = false;
36391         InitFeatures_set_upfront_shutdown_script_optional(&this_arg_conv);
36392 }
36393
36394 void  __attribute__((export_name("TS_InitFeatures_set_upfront_shutdown_script_required"))) TS_InitFeatures_set_upfront_shutdown_script_required(uint64_t this_arg) {
36395         LDKInitFeatures this_arg_conv;
36396         this_arg_conv.inner = untag_ptr(this_arg);
36397         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36398         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36399         this_arg_conv.is_owned = false;
36400         InitFeatures_set_upfront_shutdown_script_required(&this_arg_conv);
36401 }
36402
36403 jboolean  __attribute__((export_name("TS_InitFeatures_supports_upfront_shutdown_script"))) TS_InitFeatures_supports_upfront_shutdown_script(uint64_t this_arg) {
36404         LDKInitFeatures this_arg_conv;
36405         this_arg_conv.inner = untag_ptr(this_arg);
36406         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36407         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36408         this_arg_conv.is_owned = false;
36409         jboolean ret_conv = InitFeatures_supports_upfront_shutdown_script(&this_arg_conv);
36410         return ret_conv;
36411 }
36412
36413 void  __attribute__((export_name("TS_NodeFeatures_set_upfront_shutdown_script_optional"))) TS_NodeFeatures_set_upfront_shutdown_script_optional(uint64_t this_arg) {
36414         LDKNodeFeatures this_arg_conv;
36415         this_arg_conv.inner = untag_ptr(this_arg);
36416         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36417         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36418         this_arg_conv.is_owned = false;
36419         NodeFeatures_set_upfront_shutdown_script_optional(&this_arg_conv);
36420 }
36421
36422 void  __attribute__((export_name("TS_NodeFeatures_set_upfront_shutdown_script_required"))) TS_NodeFeatures_set_upfront_shutdown_script_required(uint64_t this_arg) {
36423         LDKNodeFeatures this_arg_conv;
36424         this_arg_conv.inner = untag_ptr(this_arg);
36425         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36426         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36427         this_arg_conv.is_owned = false;
36428         NodeFeatures_set_upfront_shutdown_script_required(&this_arg_conv);
36429 }
36430
36431 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_upfront_shutdown_script"))) TS_NodeFeatures_supports_upfront_shutdown_script(uint64_t this_arg) {
36432         LDKNodeFeatures this_arg_conv;
36433         this_arg_conv.inner = untag_ptr(this_arg);
36434         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36435         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36436         this_arg_conv.is_owned = false;
36437         jboolean ret_conv = NodeFeatures_supports_upfront_shutdown_script(&this_arg_conv);
36438         return ret_conv;
36439 }
36440
36441 jboolean  __attribute__((export_name("TS_InitFeatures_requires_upfront_shutdown_script"))) TS_InitFeatures_requires_upfront_shutdown_script(uint64_t this_arg) {
36442         LDKInitFeatures this_arg_conv;
36443         this_arg_conv.inner = untag_ptr(this_arg);
36444         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36445         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36446         this_arg_conv.is_owned = false;
36447         jboolean ret_conv = InitFeatures_requires_upfront_shutdown_script(&this_arg_conv);
36448         return ret_conv;
36449 }
36450
36451 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_upfront_shutdown_script"))) TS_NodeFeatures_requires_upfront_shutdown_script(uint64_t this_arg) {
36452         LDKNodeFeatures this_arg_conv;
36453         this_arg_conv.inner = untag_ptr(this_arg);
36454         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36455         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36456         this_arg_conv.is_owned = false;
36457         jboolean ret_conv = NodeFeatures_requires_upfront_shutdown_script(&this_arg_conv);
36458         return ret_conv;
36459 }
36460
36461 void  __attribute__((export_name("TS_InitFeatures_set_gossip_queries_optional"))) TS_InitFeatures_set_gossip_queries_optional(uint64_t this_arg) {
36462         LDKInitFeatures this_arg_conv;
36463         this_arg_conv.inner = untag_ptr(this_arg);
36464         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36465         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36466         this_arg_conv.is_owned = false;
36467         InitFeatures_set_gossip_queries_optional(&this_arg_conv);
36468 }
36469
36470 void  __attribute__((export_name("TS_InitFeatures_set_gossip_queries_required"))) TS_InitFeatures_set_gossip_queries_required(uint64_t this_arg) {
36471         LDKInitFeatures this_arg_conv;
36472         this_arg_conv.inner = untag_ptr(this_arg);
36473         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36474         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36475         this_arg_conv.is_owned = false;
36476         InitFeatures_set_gossip_queries_required(&this_arg_conv);
36477 }
36478
36479 jboolean  __attribute__((export_name("TS_InitFeatures_supports_gossip_queries"))) TS_InitFeatures_supports_gossip_queries(uint64_t this_arg) {
36480         LDKInitFeatures this_arg_conv;
36481         this_arg_conv.inner = untag_ptr(this_arg);
36482         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36483         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36484         this_arg_conv.is_owned = false;
36485         jboolean ret_conv = InitFeatures_supports_gossip_queries(&this_arg_conv);
36486         return ret_conv;
36487 }
36488
36489 void  __attribute__((export_name("TS_NodeFeatures_set_gossip_queries_optional"))) TS_NodeFeatures_set_gossip_queries_optional(uint64_t this_arg) {
36490         LDKNodeFeatures this_arg_conv;
36491         this_arg_conv.inner = untag_ptr(this_arg);
36492         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36493         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36494         this_arg_conv.is_owned = false;
36495         NodeFeatures_set_gossip_queries_optional(&this_arg_conv);
36496 }
36497
36498 void  __attribute__((export_name("TS_NodeFeatures_set_gossip_queries_required"))) TS_NodeFeatures_set_gossip_queries_required(uint64_t this_arg) {
36499         LDKNodeFeatures this_arg_conv;
36500         this_arg_conv.inner = untag_ptr(this_arg);
36501         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36502         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36503         this_arg_conv.is_owned = false;
36504         NodeFeatures_set_gossip_queries_required(&this_arg_conv);
36505 }
36506
36507 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_gossip_queries"))) TS_NodeFeatures_supports_gossip_queries(uint64_t this_arg) {
36508         LDKNodeFeatures this_arg_conv;
36509         this_arg_conv.inner = untag_ptr(this_arg);
36510         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36511         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36512         this_arg_conv.is_owned = false;
36513         jboolean ret_conv = NodeFeatures_supports_gossip_queries(&this_arg_conv);
36514         return ret_conv;
36515 }
36516
36517 jboolean  __attribute__((export_name("TS_InitFeatures_requires_gossip_queries"))) TS_InitFeatures_requires_gossip_queries(uint64_t this_arg) {
36518         LDKInitFeatures this_arg_conv;
36519         this_arg_conv.inner = untag_ptr(this_arg);
36520         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36521         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36522         this_arg_conv.is_owned = false;
36523         jboolean ret_conv = InitFeatures_requires_gossip_queries(&this_arg_conv);
36524         return ret_conv;
36525 }
36526
36527 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_gossip_queries"))) TS_NodeFeatures_requires_gossip_queries(uint64_t this_arg) {
36528         LDKNodeFeatures this_arg_conv;
36529         this_arg_conv.inner = untag_ptr(this_arg);
36530         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36531         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36532         this_arg_conv.is_owned = false;
36533         jboolean ret_conv = NodeFeatures_requires_gossip_queries(&this_arg_conv);
36534         return ret_conv;
36535 }
36536
36537 void  __attribute__((export_name("TS_InitFeatures_set_variable_length_onion_optional"))) TS_InitFeatures_set_variable_length_onion_optional(uint64_t this_arg) {
36538         LDKInitFeatures this_arg_conv;
36539         this_arg_conv.inner = untag_ptr(this_arg);
36540         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36541         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36542         this_arg_conv.is_owned = false;
36543         InitFeatures_set_variable_length_onion_optional(&this_arg_conv);
36544 }
36545
36546 void  __attribute__((export_name("TS_InitFeatures_set_variable_length_onion_required"))) TS_InitFeatures_set_variable_length_onion_required(uint64_t this_arg) {
36547         LDKInitFeatures this_arg_conv;
36548         this_arg_conv.inner = untag_ptr(this_arg);
36549         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36550         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36551         this_arg_conv.is_owned = false;
36552         InitFeatures_set_variable_length_onion_required(&this_arg_conv);
36553 }
36554
36555 jboolean  __attribute__((export_name("TS_InitFeatures_supports_variable_length_onion"))) TS_InitFeatures_supports_variable_length_onion(uint64_t this_arg) {
36556         LDKInitFeatures this_arg_conv;
36557         this_arg_conv.inner = untag_ptr(this_arg);
36558         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36559         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36560         this_arg_conv.is_owned = false;
36561         jboolean ret_conv = InitFeatures_supports_variable_length_onion(&this_arg_conv);
36562         return ret_conv;
36563 }
36564
36565 void  __attribute__((export_name("TS_NodeFeatures_set_variable_length_onion_optional"))) TS_NodeFeatures_set_variable_length_onion_optional(uint64_t this_arg) {
36566         LDKNodeFeatures this_arg_conv;
36567         this_arg_conv.inner = untag_ptr(this_arg);
36568         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36569         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36570         this_arg_conv.is_owned = false;
36571         NodeFeatures_set_variable_length_onion_optional(&this_arg_conv);
36572 }
36573
36574 void  __attribute__((export_name("TS_NodeFeatures_set_variable_length_onion_required"))) TS_NodeFeatures_set_variable_length_onion_required(uint64_t this_arg) {
36575         LDKNodeFeatures this_arg_conv;
36576         this_arg_conv.inner = untag_ptr(this_arg);
36577         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36578         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36579         this_arg_conv.is_owned = false;
36580         NodeFeatures_set_variable_length_onion_required(&this_arg_conv);
36581 }
36582
36583 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_variable_length_onion"))) TS_NodeFeatures_supports_variable_length_onion(uint64_t this_arg) {
36584         LDKNodeFeatures this_arg_conv;
36585         this_arg_conv.inner = untag_ptr(this_arg);
36586         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36587         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36588         this_arg_conv.is_owned = false;
36589         jboolean ret_conv = NodeFeatures_supports_variable_length_onion(&this_arg_conv);
36590         return ret_conv;
36591 }
36592
36593 void  __attribute__((export_name("TS_InvoiceFeatures_set_variable_length_onion_optional"))) TS_InvoiceFeatures_set_variable_length_onion_optional(uint64_t this_arg) {
36594         LDKInvoiceFeatures this_arg_conv;
36595         this_arg_conv.inner = untag_ptr(this_arg);
36596         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36597         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36598         this_arg_conv.is_owned = false;
36599         InvoiceFeatures_set_variable_length_onion_optional(&this_arg_conv);
36600 }
36601
36602 void  __attribute__((export_name("TS_InvoiceFeatures_set_variable_length_onion_required"))) TS_InvoiceFeatures_set_variable_length_onion_required(uint64_t this_arg) {
36603         LDKInvoiceFeatures this_arg_conv;
36604         this_arg_conv.inner = untag_ptr(this_arg);
36605         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36606         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36607         this_arg_conv.is_owned = false;
36608         InvoiceFeatures_set_variable_length_onion_required(&this_arg_conv);
36609 }
36610
36611 jboolean  __attribute__((export_name("TS_InvoiceFeatures_supports_variable_length_onion"))) TS_InvoiceFeatures_supports_variable_length_onion(uint64_t this_arg) {
36612         LDKInvoiceFeatures this_arg_conv;
36613         this_arg_conv.inner = untag_ptr(this_arg);
36614         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36615         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36616         this_arg_conv.is_owned = false;
36617         jboolean ret_conv = InvoiceFeatures_supports_variable_length_onion(&this_arg_conv);
36618         return ret_conv;
36619 }
36620
36621 jboolean  __attribute__((export_name("TS_InitFeatures_requires_variable_length_onion"))) TS_InitFeatures_requires_variable_length_onion(uint64_t this_arg) {
36622         LDKInitFeatures this_arg_conv;
36623         this_arg_conv.inner = untag_ptr(this_arg);
36624         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36625         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36626         this_arg_conv.is_owned = false;
36627         jboolean ret_conv = InitFeatures_requires_variable_length_onion(&this_arg_conv);
36628         return ret_conv;
36629 }
36630
36631 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_variable_length_onion"))) TS_NodeFeatures_requires_variable_length_onion(uint64_t this_arg) {
36632         LDKNodeFeatures this_arg_conv;
36633         this_arg_conv.inner = untag_ptr(this_arg);
36634         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36635         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36636         this_arg_conv.is_owned = false;
36637         jboolean ret_conv = NodeFeatures_requires_variable_length_onion(&this_arg_conv);
36638         return ret_conv;
36639 }
36640
36641 jboolean  __attribute__((export_name("TS_InvoiceFeatures_requires_variable_length_onion"))) TS_InvoiceFeatures_requires_variable_length_onion(uint64_t this_arg) {
36642         LDKInvoiceFeatures this_arg_conv;
36643         this_arg_conv.inner = untag_ptr(this_arg);
36644         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36645         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36646         this_arg_conv.is_owned = false;
36647         jboolean ret_conv = InvoiceFeatures_requires_variable_length_onion(&this_arg_conv);
36648         return ret_conv;
36649 }
36650
36651 void  __attribute__((export_name("TS_InitFeatures_set_static_remote_key_optional"))) TS_InitFeatures_set_static_remote_key_optional(uint64_t this_arg) {
36652         LDKInitFeatures this_arg_conv;
36653         this_arg_conv.inner = untag_ptr(this_arg);
36654         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36655         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36656         this_arg_conv.is_owned = false;
36657         InitFeatures_set_static_remote_key_optional(&this_arg_conv);
36658 }
36659
36660 void  __attribute__((export_name("TS_InitFeatures_set_static_remote_key_required"))) TS_InitFeatures_set_static_remote_key_required(uint64_t this_arg) {
36661         LDKInitFeatures this_arg_conv;
36662         this_arg_conv.inner = untag_ptr(this_arg);
36663         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36664         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36665         this_arg_conv.is_owned = false;
36666         InitFeatures_set_static_remote_key_required(&this_arg_conv);
36667 }
36668
36669 jboolean  __attribute__((export_name("TS_InitFeatures_supports_static_remote_key"))) TS_InitFeatures_supports_static_remote_key(uint64_t this_arg) {
36670         LDKInitFeatures this_arg_conv;
36671         this_arg_conv.inner = untag_ptr(this_arg);
36672         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36673         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36674         this_arg_conv.is_owned = false;
36675         jboolean ret_conv = InitFeatures_supports_static_remote_key(&this_arg_conv);
36676         return ret_conv;
36677 }
36678
36679 void  __attribute__((export_name("TS_NodeFeatures_set_static_remote_key_optional"))) TS_NodeFeatures_set_static_remote_key_optional(uint64_t this_arg) {
36680         LDKNodeFeatures this_arg_conv;
36681         this_arg_conv.inner = untag_ptr(this_arg);
36682         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36683         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36684         this_arg_conv.is_owned = false;
36685         NodeFeatures_set_static_remote_key_optional(&this_arg_conv);
36686 }
36687
36688 void  __attribute__((export_name("TS_NodeFeatures_set_static_remote_key_required"))) TS_NodeFeatures_set_static_remote_key_required(uint64_t this_arg) {
36689         LDKNodeFeatures this_arg_conv;
36690         this_arg_conv.inner = untag_ptr(this_arg);
36691         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36692         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36693         this_arg_conv.is_owned = false;
36694         NodeFeatures_set_static_remote_key_required(&this_arg_conv);
36695 }
36696
36697 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_static_remote_key"))) TS_NodeFeatures_supports_static_remote_key(uint64_t this_arg) {
36698         LDKNodeFeatures this_arg_conv;
36699         this_arg_conv.inner = untag_ptr(this_arg);
36700         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36701         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36702         this_arg_conv.is_owned = false;
36703         jboolean ret_conv = NodeFeatures_supports_static_remote_key(&this_arg_conv);
36704         return ret_conv;
36705 }
36706
36707 void  __attribute__((export_name("TS_ChannelTypeFeatures_set_static_remote_key_optional"))) TS_ChannelTypeFeatures_set_static_remote_key_optional(uint64_t this_arg) {
36708         LDKChannelTypeFeatures this_arg_conv;
36709         this_arg_conv.inner = untag_ptr(this_arg);
36710         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36711         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36712         this_arg_conv.is_owned = false;
36713         ChannelTypeFeatures_set_static_remote_key_optional(&this_arg_conv);
36714 }
36715
36716 void  __attribute__((export_name("TS_ChannelTypeFeatures_set_static_remote_key_required"))) TS_ChannelTypeFeatures_set_static_remote_key_required(uint64_t this_arg) {
36717         LDKChannelTypeFeatures this_arg_conv;
36718         this_arg_conv.inner = untag_ptr(this_arg);
36719         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36720         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36721         this_arg_conv.is_owned = false;
36722         ChannelTypeFeatures_set_static_remote_key_required(&this_arg_conv);
36723 }
36724
36725 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_supports_static_remote_key"))) TS_ChannelTypeFeatures_supports_static_remote_key(uint64_t this_arg) {
36726         LDKChannelTypeFeatures this_arg_conv;
36727         this_arg_conv.inner = untag_ptr(this_arg);
36728         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36729         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36730         this_arg_conv.is_owned = false;
36731         jboolean ret_conv = ChannelTypeFeatures_supports_static_remote_key(&this_arg_conv);
36732         return ret_conv;
36733 }
36734
36735 jboolean  __attribute__((export_name("TS_InitFeatures_requires_static_remote_key"))) TS_InitFeatures_requires_static_remote_key(uint64_t this_arg) {
36736         LDKInitFeatures this_arg_conv;
36737         this_arg_conv.inner = untag_ptr(this_arg);
36738         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36739         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36740         this_arg_conv.is_owned = false;
36741         jboolean ret_conv = InitFeatures_requires_static_remote_key(&this_arg_conv);
36742         return ret_conv;
36743 }
36744
36745 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_static_remote_key"))) TS_NodeFeatures_requires_static_remote_key(uint64_t this_arg) {
36746         LDKNodeFeatures this_arg_conv;
36747         this_arg_conv.inner = untag_ptr(this_arg);
36748         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36749         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36750         this_arg_conv.is_owned = false;
36751         jboolean ret_conv = NodeFeatures_requires_static_remote_key(&this_arg_conv);
36752         return ret_conv;
36753 }
36754
36755 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_requires_static_remote_key"))) TS_ChannelTypeFeatures_requires_static_remote_key(uint64_t this_arg) {
36756         LDKChannelTypeFeatures this_arg_conv;
36757         this_arg_conv.inner = untag_ptr(this_arg);
36758         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36759         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36760         this_arg_conv.is_owned = false;
36761         jboolean ret_conv = ChannelTypeFeatures_requires_static_remote_key(&this_arg_conv);
36762         return ret_conv;
36763 }
36764
36765 void  __attribute__((export_name("TS_InitFeatures_set_payment_secret_optional"))) TS_InitFeatures_set_payment_secret_optional(uint64_t this_arg) {
36766         LDKInitFeatures this_arg_conv;
36767         this_arg_conv.inner = untag_ptr(this_arg);
36768         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36769         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36770         this_arg_conv.is_owned = false;
36771         InitFeatures_set_payment_secret_optional(&this_arg_conv);
36772 }
36773
36774 void  __attribute__((export_name("TS_InitFeatures_set_payment_secret_required"))) TS_InitFeatures_set_payment_secret_required(uint64_t this_arg) {
36775         LDKInitFeatures this_arg_conv;
36776         this_arg_conv.inner = untag_ptr(this_arg);
36777         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36778         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36779         this_arg_conv.is_owned = false;
36780         InitFeatures_set_payment_secret_required(&this_arg_conv);
36781 }
36782
36783 jboolean  __attribute__((export_name("TS_InitFeatures_supports_payment_secret"))) TS_InitFeatures_supports_payment_secret(uint64_t this_arg) {
36784         LDKInitFeatures this_arg_conv;
36785         this_arg_conv.inner = untag_ptr(this_arg);
36786         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36787         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36788         this_arg_conv.is_owned = false;
36789         jboolean ret_conv = InitFeatures_supports_payment_secret(&this_arg_conv);
36790         return ret_conv;
36791 }
36792
36793 void  __attribute__((export_name("TS_NodeFeatures_set_payment_secret_optional"))) TS_NodeFeatures_set_payment_secret_optional(uint64_t this_arg) {
36794         LDKNodeFeatures this_arg_conv;
36795         this_arg_conv.inner = untag_ptr(this_arg);
36796         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36797         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36798         this_arg_conv.is_owned = false;
36799         NodeFeatures_set_payment_secret_optional(&this_arg_conv);
36800 }
36801
36802 void  __attribute__((export_name("TS_NodeFeatures_set_payment_secret_required"))) TS_NodeFeatures_set_payment_secret_required(uint64_t this_arg) {
36803         LDKNodeFeatures this_arg_conv;
36804         this_arg_conv.inner = untag_ptr(this_arg);
36805         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36806         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36807         this_arg_conv.is_owned = false;
36808         NodeFeatures_set_payment_secret_required(&this_arg_conv);
36809 }
36810
36811 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_payment_secret"))) TS_NodeFeatures_supports_payment_secret(uint64_t this_arg) {
36812         LDKNodeFeatures this_arg_conv;
36813         this_arg_conv.inner = untag_ptr(this_arg);
36814         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36815         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36816         this_arg_conv.is_owned = false;
36817         jboolean ret_conv = NodeFeatures_supports_payment_secret(&this_arg_conv);
36818         return ret_conv;
36819 }
36820
36821 void  __attribute__((export_name("TS_InvoiceFeatures_set_payment_secret_optional"))) TS_InvoiceFeatures_set_payment_secret_optional(uint64_t this_arg) {
36822         LDKInvoiceFeatures this_arg_conv;
36823         this_arg_conv.inner = untag_ptr(this_arg);
36824         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36825         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36826         this_arg_conv.is_owned = false;
36827         InvoiceFeatures_set_payment_secret_optional(&this_arg_conv);
36828 }
36829
36830 void  __attribute__((export_name("TS_InvoiceFeatures_set_payment_secret_required"))) TS_InvoiceFeatures_set_payment_secret_required(uint64_t this_arg) {
36831         LDKInvoiceFeatures this_arg_conv;
36832         this_arg_conv.inner = untag_ptr(this_arg);
36833         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36834         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36835         this_arg_conv.is_owned = false;
36836         InvoiceFeatures_set_payment_secret_required(&this_arg_conv);
36837 }
36838
36839 jboolean  __attribute__((export_name("TS_InvoiceFeatures_supports_payment_secret"))) TS_InvoiceFeatures_supports_payment_secret(uint64_t this_arg) {
36840         LDKInvoiceFeatures this_arg_conv;
36841         this_arg_conv.inner = untag_ptr(this_arg);
36842         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36843         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36844         this_arg_conv.is_owned = false;
36845         jboolean ret_conv = InvoiceFeatures_supports_payment_secret(&this_arg_conv);
36846         return ret_conv;
36847 }
36848
36849 jboolean  __attribute__((export_name("TS_InitFeatures_requires_payment_secret"))) TS_InitFeatures_requires_payment_secret(uint64_t this_arg) {
36850         LDKInitFeatures this_arg_conv;
36851         this_arg_conv.inner = untag_ptr(this_arg);
36852         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36853         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36854         this_arg_conv.is_owned = false;
36855         jboolean ret_conv = InitFeatures_requires_payment_secret(&this_arg_conv);
36856         return ret_conv;
36857 }
36858
36859 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_payment_secret"))) TS_NodeFeatures_requires_payment_secret(uint64_t this_arg) {
36860         LDKNodeFeatures this_arg_conv;
36861         this_arg_conv.inner = untag_ptr(this_arg);
36862         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36863         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36864         this_arg_conv.is_owned = false;
36865         jboolean ret_conv = NodeFeatures_requires_payment_secret(&this_arg_conv);
36866         return ret_conv;
36867 }
36868
36869 jboolean  __attribute__((export_name("TS_InvoiceFeatures_requires_payment_secret"))) TS_InvoiceFeatures_requires_payment_secret(uint64_t this_arg) {
36870         LDKInvoiceFeatures this_arg_conv;
36871         this_arg_conv.inner = untag_ptr(this_arg);
36872         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36873         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36874         this_arg_conv.is_owned = false;
36875         jboolean ret_conv = InvoiceFeatures_requires_payment_secret(&this_arg_conv);
36876         return ret_conv;
36877 }
36878
36879 void  __attribute__((export_name("TS_InitFeatures_set_basic_mpp_optional"))) TS_InitFeatures_set_basic_mpp_optional(uint64_t this_arg) {
36880         LDKInitFeatures this_arg_conv;
36881         this_arg_conv.inner = untag_ptr(this_arg);
36882         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36883         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36884         this_arg_conv.is_owned = false;
36885         InitFeatures_set_basic_mpp_optional(&this_arg_conv);
36886 }
36887
36888 void  __attribute__((export_name("TS_InitFeatures_set_basic_mpp_required"))) TS_InitFeatures_set_basic_mpp_required(uint64_t this_arg) {
36889         LDKInitFeatures this_arg_conv;
36890         this_arg_conv.inner = untag_ptr(this_arg);
36891         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36892         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36893         this_arg_conv.is_owned = false;
36894         InitFeatures_set_basic_mpp_required(&this_arg_conv);
36895 }
36896
36897 jboolean  __attribute__((export_name("TS_InitFeatures_supports_basic_mpp"))) TS_InitFeatures_supports_basic_mpp(uint64_t this_arg) {
36898         LDKInitFeatures this_arg_conv;
36899         this_arg_conv.inner = untag_ptr(this_arg);
36900         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36901         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36902         this_arg_conv.is_owned = false;
36903         jboolean ret_conv = InitFeatures_supports_basic_mpp(&this_arg_conv);
36904         return ret_conv;
36905 }
36906
36907 void  __attribute__((export_name("TS_NodeFeatures_set_basic_mpp_optional"))) TS_NodeFeatures_set_basic_mpp_optional(uint64_t this_arg) {
36908         LDKNodeFeatures this_arg_conv;
36909         this_arg_conv.inner = untag_ptr(this_arg);
36910         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36911         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36912         this_arg_conv.is_owned = false;
36913         NodeFeatures_set_basic_mpp_optional(&this_arg_conv);
36914 }
36915
36916 void  __attribute__((export_name("TS_NodeFeatures_set_basic_mpp_required"))) TS_NodeFeatures_set_basic_mpp_required(uint64_t this_arg) {
36917         LDKNodeFeatures this_arg_conv;
36918         this_arg_conv.inner = untag_ptr(this_arg);
36919         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36920         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36921         this_arg_conv.is_owned = false;
36922         NodeFeatures_set_basic_mpp_required(&this_arg_conv);
36923 }
36924
36925 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_basic_mpp"))) TS_NodeFeatures_supports_basic_mpp(uint64_t this_arg) {
36926         LDKNodeFeatures 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         jboolean ret_conv = NodeFeatures_supports_basic_mpp(&this_arg_conv);
36932         return ret_conv;
36933 }
36934
36935 void  __attribute__((export_name("TS_InvoiceFeatures_set_basic_mpp_optional"))) TS_InvoiceFeatures_set_basic_mpp_optional(uint64_t this_arg) {
36936         LDKInvoiceFeatures this_arg_conv;
36937         this_arg_conv.inner = untag_ptr(this_arg);
36938         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36939         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36940         this_arg_conv.is_owned = false;
36941         InvoiceFeatures_set_basic_mpp_optional(&this_arg_conv);
36942 }
36943
36944 void  __attribute__((export_name("TS_InvoiceFeatures_set_basic_mpp_required"))) TS_InvoiceFeatures_set_basic_mpp_required(uint64_t this_arg) {
36945         LDKInvoiceFeatures this_arg_conv;
36946         this_arg_conv.inner = untag_ptr(this_arg);
36947         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36948         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36949         this_arg_conv.is_owned = false;
36950         InvoiceFeatures_set_basic_mpp_required(&this_arg_conv);
36951 }
36952
36953 jboolean  __attribute__((export_name("TS_InvoiceFeatures_supports_basic_mpp"))) TS_InvoiceFeatures_supports_basic_mpp(uint64_t this_arg) {
36954         LDKInvoiceFeatures 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         jboolean ret_conv = InvoiceFeatures_supports_basic_mpp(&this_arg_conv);
36960         return ret_conv;
36961 }
36962
36963 jboolean  __attribute__((export_name("TS_InitFeatures_requires_basic_mpp"))) TS_InitFeatures_requires_basic_mpp(uint64_t this_arg) {
36964         LDKInitFeatures this_arg_conv;
36965         this_arg_conv.inner = untag_ptr(this_arg);
36966         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36967         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36968         this_arg_conv.is_owned = false;
36969         jboolean ret_conv = InitFeatures_requires_basic_mpp(&this_arg_conv);
36970         return ret_conv;
36971 }
36972
36973 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_basic_mpp"))) TS_NodeFeatures_requires_basic_mpp(uint64_t this_arg) {
36974         LDKNodeFeatures this_arg_conv;
36975         this_arg_conv.inner = untag_ptr(this_arg);
36976         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36977         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36978         this_arg_conv.is_owned = false;
36979         jboolean ret_conv = NodeFeatures_requires_basic_mpp(&this_arg_conv);
36980         return ret_conv;
36981 }
36982
36983 jboolean  __attribute__((export_name("TS_InvoiceFeatures_requires_basic_mpp"))) TS_InvoiceFeatures_requires_basic_mpp(uint64_t this_arg) {
36984         LDKInvoiceFeatures this_arg_conv;
36985         this_arg_conv.inner = untag_ptr(this_arg);
36986         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36987         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36988         this_arg_conv.is_owned = false;
36989         jboolean ret_conv = InvoiceFeatures_requires_basic_mpp(&this_arg_conv);
36990         return ret_conv;
36991 }
36992
36993 void  __attribute__((export_name("TS_InitFeatures_set_wumbo_optional"))) TS_InitFeatures_set_wumbo_optional(uint64_t this_arg) {
36994         LDKInitFeatures this_arg_conv;
36995         this_arg_conv.inner = untag_ptr(this_arg);
36996         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36997         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36998         this_arg_conv.is_owned = false;
36999         InitFeatures_set_wumbo_optional(&this_arg_conv);
37000 }
37001
37002 void  __attribute__((export_name("TS_InitFeatures_set_wumbo_required"))) TS_InitFeatures_set_wumbo_required(uint64_t this_arg) {
37003         LDKInitFeatures this_arg_conv;
37004         this_arg_conv.inner = untag_ptr(this_arg);
37005         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37006         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37007         this_arg_conv.is_owned = false;
37008         InitFeatures_set_wumbo_required(&this_arg_conv);
37009 }
37010
37011 jboolean  __attribute__((export_name("TS_InitFeatures_supports_wumbo"))) TS_InitFeatures_supports_wumbo(uint64_t this_arg) {
37012         LDKInitFeatures this_arg_conv;
37013         this_arg_conv.inner = untag_ptr(this_arg);
37014         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37015         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37016         this_arg_conv.is_owned = false;
37017         jboolean ret_conv = InitFeatures_supports_wumbo(&this_arg_conv);
37018         return ret_conv;
37019 }
37020
37021 void  __attribute__((export_name("TS_NodeFeatures_set_wumbo_optional"))) TS_NodeFeatures_set_wumbo_optional(uint64_t this_arg) {
37022         LDKNodeFeatures this_arg_conv;
37023         this_arg_conv.inner = untag_ptr(this_arg);
37024         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37025         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37026         this_arg_conv.is_owned = false;
37027         NodeFeatures_set_wumbo_optional(&this_arg_conv);
37028 }
37029
37030 void  __attribute__((export_name("TS_NodeFeatures_set_wumbo_required"))) TS_NodeFeatures_set_wumbo_required(uint64_t this_arg) {
37031         LDKNodeFeatures this_arg_conv;
37032         this_arg_conv.inner = untag_ptr(this_arg);
37033         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37034         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37035         this_arg_conv.is_owned = false;
37036         NodeFeatures_set_wumbo_required(&this_arg_conv);
37037 }
37038
37039 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_wumbo"))) TS_NodeFeatures_supports_wumbo(uint64_t this_arg) {
37040         LDKNodeFeatures this_arg_conv;
37041         this_arg_conv.inner = untag_ptr(this_arg);
37042         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37043         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37044         this_arg_conv.is_owned = false;
37045         jboolean ret_conv = NodeFeatures_supports_wumbo(&this_arg_conv);
37046         return ret_conv;
37047 }
37048
37049 jboolean  __attribute__((export_name("TS_InitFeatures_requires_wumbo"))) TS_InitFeatures_requires_wumbo(uint64_t this_arg) {
37050         LDKInitFeatures this_arg_conv;
37051         this_arg_conv.inner = untag_ptr(this_arg);
37052         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37053         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37054         this_arg_conv.is_owned = false;
37055         jboolean ret_conv = InitFeatures_requires_wumbo(&this_arg_conv);
37056         return ret_conv;
37057 }
37058
37059 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_wumbo"))) TS_NodeFeatures_requires_wumbo(uint64_t this_arg) {
37060         LDKNodeFeatures this_arg_conv;
37061         this_arg_conv.inner = untag_ptr(this_arg);
37062         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37063         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37064         this_arg_conv.is_owned = false;
37065         jboolean ret_conv = NodeFeatures_requires_wumbo(&this_arg_conv);
37066         return ret_conv;
37067 }
37068
37069 void  __attribute__((export_name("TS_InitFeatures_set_shutdown_any_segwit_optional"))) TS_InitFeatures_set_shutdown_any_segwit_optional(uint64_t this_arg) {
37070         LDKInitFeatures this_arg_conv;
37071         this_arg_conv.inner = untag_ptr(this_arg);
37072         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37073         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37074         this_arg_conv.is_owned = false;
37075         InitFeatures_set_shutdown_any_segwit_optional(&this_arg_conv);
37076 }
37077
37078 void  __attribute__((export_name("TS_InitFeatures_set_shutdown_any_segwit_required"))) TS_InitFeatures_set_shutdown_any_segwit_required(uint64_t this_arg) {
37079         LDKInitFeatures this_arg_conv;
37080         this_arg_conv.inner = untag_ptr(this_arg);
37081         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37082         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37083         this_arg_conv.is_owned = false;
37084         InitFeatures_set_shutdown_any_segwit_required(&this_arg_conv);
37085 }
37086
37087 jboolean  __attribute__((export_name("TS_InitFeatures_supports_shutdown_anysegwit"))) TS_InitFeatures_supports_shutdown_anysegwit(uint64_t this_arg) {
37088         LDKInitFeatures this_arg_conv;
37089         this_arg_conv.inner = untag_ptr(this_arg);
37090         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37091         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37092         this_arg_conv.is_owned = false;
37093         jboolean ret_conv = InitFeatures_supports_shutdown_anysegwit(&this_arg_conv);
37094         return ret_conv;
37095 }
37096
37097 void  __attribute__((export_name("TS_NodeFeatures_set_shutdown_any_segwit_optional"))) TS_NodeFeatures_set_shutdown_any_segwit_optional(uint64_t this_arg) {
37098         LDKNodeFeatures this_arg_conv;
37099         this_arg_conv.inner = untag_ptr(this_arg);
37100         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37101         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37102         this_arg_conv.is_owned = false;
37103         NodeFeatures_set_shutdown_any_segwit_optional(&this_arg_conv);
37104 }
37105
37106 void  __attribute__((export_name("TS_NodeFeatures_set_shutdown_any_segwit_required"))) TS_NodeFeatures_set_shutdown_any_segwit_required(uint64_t this_arg) {
37107         LDKNodeFeatures this_arg_conv;
37108         this_arg_conv.inner = untag_ptr(this_arg);
37109         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37110         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37111         this_arg_conv.is_owned = false;
37112         NodeFeatures_set_shutdown_any_segwit_required(&this_arg_conv);
37113 }
37114
37115 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_shutdown_anysegwit"))) TS_NodeFeatures_supports_shutdown_anysegwit(uint64_t this_arg) {
37116         LDKNodeFeatures this_arg_conv;
37117         this_arg_conv.inner = untag_ptr(this_arg);
37118         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37119         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37120         this_arg_conv.is_owned = false;
37121         jboolean ret_conv = NodeFeatures_supports_shutdown_anysegwit(&this_arg_conv);
37122         return ret_conv;
37123 }
37124
37125 jboolean  __attribute__((export_name("TS_InitFeatures_requires_shutdown_anysegwit"))) TS_InitFeatures_requires_shutdown_anysegwit(uint64_t this_arg) {
37126         LDKInitFeatures this_arg_conv;
37127         this_arg_conv.inner = untag_ptr(this_arg);
37128         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37129         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37130         this_arg_conv.is_owned = false;
37131         jboolean ret_conv = InitFeatures_requires_shutdown_anysegwit(&this_arg_conv);
37132         return ret_conv;
37133 }
37134
37135 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_shutdown_anysegwit"))) TS_NodeFeatures_requires_shutdown_anysegwit(uint64_t this_arg) {
37136         LDKNodeFeatures this_arg_conv;
37137         this_arg_conv.inner = untag_ptr(this_arg);
37138         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37139         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37140         this_arg_conv.is_owned = false;
37141         jboolean ret_conv = NodeFeatures_requires_shutdown_anysegwit(&this_arg_conv);
37142         return ret_conv;
37143 }
37144
37145 void  __attribute__((export_name("TS_InitFeatures_set_channel_type_optional"))) TS_InitFeatures_set_channel_type_optional(uint64_t this_arg) {
37146         LDKInitFeatures this_arg_conv;
37147         this_arg_conv.inner = untag_ptr(this_arg);
37148         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37149         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37150         this_arg_conv.is_owned = false;
37151         InitFeatures_set_channel_type_optional(&this_arg_conv);
37152 }
37153
37154 void  __attribute__((export_name("TS_InitFeatures_set_channel_type_required"))) TS_InitFeatures_set_channel_type_required(uint64_t this_arg) {
37155         LDKInitFeatures this_arg_conv;
37156         this_arg_conv.inner = untag_ptr(this_arg);
37157         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37158         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37159         this_arg_conv.is_owned = false;
37160         InitFeatures_set_channel_type_required(&this_arg_conv);
37161 }
37162
37163 jboolean  __attribute__((export_name("TS_InitFeatures_supports_channel_type"))) TS_InitFeatures_supports_channel_type(uint64_t this_arg) {
37164         LDKInitFeatures this_arg_conv;
37165         this_arg_conv.inner = untag_ptr(this_arg);
37166         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37167         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37168         this_arg_conv.is_owned = false;
37169         jboolean ret_conv = InitFeatures_supports_channel_type(&this_arg_conv);
37170         return ret_conv;
37171 }
37172
37173 void  __attribute__((export_name("TS_NodeFeatures_set_channel_type_optional"))) TS_NodeFeatures_set_channel_type_optional(uint64_t this_arg) {
37174         LDKNodeFeatures this_arg_conv;
37175         this_arg_conv.inner = untag_ptr(this_arg);
37176         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37177         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37178         this_arg_conv.is_owned = false;
37179         NodeFeatures_set_channel_type_optional(&this_arg_conv);
37180 }
37181
37182 void  __attribute__((export_name("TS_NodeFeatures_set_channel_type_required"))) TS_NodeFeatures_set_channel_type_required(uint64_t this_arg) {
37183         LDKNodeFeatures this_arg_conv;
37184         this_arg_conv.inner = untag_ptr(this_arg);
37185         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37186         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37187         this_arg_conv.is_owned = false;
37188         NodeFeatures_set_channel_type_required(&this_arg_conv);
37189 }
37190
37191 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_channel_type"))) TS_NodeFeatures_supports_channel_type(uint64_t this_arg) {
37192         LDKNodeFeatures this_arg_conv;
37193         this_arg_conv.inner = untag_ptr(this_arg);
37194         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37195         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37196         this_arg_conv.is_owned = false;
37197         jboolean ret_conv = NodeFeatures_supports_channel_type(&this_arg_conv);
37198         return ret_conv;
37199 }
37200
37201 jboolean  __attribute__((export_name("TS_InitFeatures_requires_channel_type"))) TS_InitFeatures_requires_channel_type(uint64_t this_arg) {
37202         LDKInitFeatures this_arg_conv;
37203         this_arg_conv.inner = untag_ptr(this_arg);
37204         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37205         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37206         this_arg_conv.is_owned = false;
37207         jboolean ret_conv = InitFeatures_requires_channel_type(&this_arg_conv);
37208         return ret_conv;
37209 }
37210
37211 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_channel_type"))) TS_NodeFeatures_requires_channel_type(uint64_t this_arg) {
37212         LDKNodeFeatures this_arg_conv;
37213         this_arg_conv.inner = untag_ptr(this_arg);
37214         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37215         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37216         this_arg_conv.is_owned = false;
37217         jboolean ret_conv = NodeFeatures_requires_channel_type(&this_arg_conv);
37218         return ret_conv;
37219 }
37220
37221 void  __attribute__((export_name("TS_InitFeatures_set_scid_privacy_optional"))) TS_InitFeatures_set_scid_privacy_optional(uint64_t this_arg) {
37222         LDKInitFeatures this_arg_conv;
37223         this_arg_conv.inner = untag_ptr(this_arg);
37224         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37225         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37226         this_arg_conv.is_owned = false;
37227         InitFeatures_set_scid_privacy_optional(&this_arg_conv);
37228 }
37229
37230 void  __attribute__((export_name("TS_InitFeatures_set_scid_privacy_required"))) TS_InitFeatures_set_scid_privacy_required(uint64_t this_arg) {
37231         LDKInitFeatures this_arg_conv;
37232         this_arg_conv.inner = untag_ptr(this_arg);
37233         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37234         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37235         this_arg_conv.is_owned = false;
37236         InitFeatures_set_scid_privacy_required(&this_arg_conv);
37237 }
37238
37239 jboolean  __attribute__((export_name("TS_InitFeatures_supports_scid_privacy"))) TS_InitFeatures_supports_scid_privacy(uint64_t this_arg) {
37240         LDKInitFeatures this_arg_conv;
37241         this_arg_conv.inner = untag_ptr(this_arg);
37242         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37243         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37244         this_arg_conv.is_owned = false;
37245         jboolean ret_conv = InitFeatures_supports_scid_privacy(&this_arg_conv);
37246         return ret_conv;
37247 }
37248
37249 void  __attribute__((export_name("TS_NodeFeatures_set_scid_privacy_optional"))) TS_NodeFeatures_set_scid_privacy_optional(uint64_t this_arg) {
37250         LDKNodeFeatures this_arg_conv;
37251         this_arg_conv.inner = untag_ptr(this_arg);
37252         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37253         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37254         this_arg_conv.is_owned = false;
37255         NodeFeatures_set_scid_privacy_optional(&this_arg_conv);
37256 }
37257
37258 void  __attribute__((export_name("TS_NodeFeatures_set_scid_privacy_required"))) TS_NodeFeatures_set_scid_privacy_required(uint64_t this_arg) {
37259         LDKNodeFeatures this_arg_conv;
37260         this_arg_conv.inner = untag_ptr(this_arg);
37261         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37262         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37263         this_arg_conv.is_owned = false;
37264         NodeFeatures_set_scid_privacy_required(&this_arg_conv);
37265 }
37266
37267 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_scid_privacy"))) TS_NodeFeatures_supports_scid_privacy(uint64_t this_arg) {
37268         LDKNodeFeatures this_arg_conv;
37269         this_arg_conv.inner = untag_ptr(this_arg);
37270         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37271         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37272         this_arg_conv.is_owned = false;
37273         jboolean ret_conv = NodeFeatures_supports_scid_privacy(&this_arg_conv);
37274         return ret_conv;
37275 }
37276
37277 void  __attribute__((export_name("TS_ChannelTypeFeatures_set_scid_privacy_optional"))) TS_ChannelTypeFeatures_set_scid_privacy_optional(uint64_t this_arg) {
37278         LDKChannelTypeFeatures this_arg_conv;
37279         this_arg_conv.inner = untag_ptr(this_arg);
37280         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37281         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37282         this_arg_conv.is_owned = false;
37283         ChannelTypeFeatures_set_scid_privacy_optional(&this_arg_conv);
37284 }
37285
37286 void  __attribute__((export_name("TS_ChannelTypeFeatures_set_scid_privacy_required"))) TS_ChannelTypeFeatures_set_scid_privacy_required(uint64_t this_arg) {
37287         LDKChannelTypeFeatures this_arg_conv;
37288         this_arg_conv.inner = untag_ptr(this_arg);
37289         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37290         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37291         this_arg_conv.is_owned = false;
37292         ChannelTypeFeatures_set_scid_privacy_required(&this_arg_conv);
37293 }
37294
37295 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_supports_scid_privacy"))) TS_ChannelTypeFeatures_supports_scid_privacy(uint64_t this_arg) {
37296         LDKChannelTypeFeatures this_arg_conv;
37297         this_arg_conv.inner = untag_ptr(this_arg);
37298         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37299         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37300         this_arg_conv.is_owned = false;
37301         jboolean ret_conv = ChannelTypeFeatures_supports_scid_privacy(&this_arg_conv);
37302         return ret_conv;
37303 }
37304
37305 jboolean  __attribute__((export_name("TS_InitFeatures_requires_scid_privacy"))) TS_InitFeatures_requires_scid_privacy(uint64_t this_arg) {
37306         LDKInitFeatures this_arg_conv;
37307         this_arg_conv.inner = untag_ptr(this_arg);
37308         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37309         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37310         this_arg_conv.is_owned = false;
37311         jboolean ret_conv = InitFeatures_requires_scid_privacy(&this_arg_conv);
37312         return ret_conv;
37313 }
37314
37315 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_scid_privacy"))) TS_NodeFeatures_requires_scid_privacy(uint64_t this_arg) {
37316         LDKNodeFeatures this_arg_conv;
37317         this_arg_conv.inner = untag_ptr(this_arg);
37318         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37319         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37320         this_arg_conv.is_owned = false;
37321         jboolean ret_conv = NodeFeatures_requires_scid_privacy(&this_arg_conv);
37322         return ret_conv;
37323 }
37324
37325 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_requires_scid_privacy"))) TS_ChannelTypeFeatures_requires_scid_privacy(uint64_t this_arg) {
37326         LDKChannelTypeFeatures this_arg_conv;
37327         this_arg_conv.inner = untag_ptr(this_arg);
37328         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37329         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37330         this_arg_conv.is_owned = false;
37331         jboolean ret_conv = ChannelTypeFeatures_requires_scid_privacy(&this_arg_conv);
37332         return ret_conv;
37333 }
37334
37335 void  __attribute__((export_name("TS_InitFeatures_set_zero_conf_optional"))) TS_InitFeatures_set_zero_conf_optional(uint64_t this_arg) {
37336         LDKInitFeatures this_arg_conv;
37337         this_arg_conv.inner = untag_ptr(this_arg);
37338         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37339         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37340         this_arg_conv.is_owned = false;
37341         InitFeatures_set_zero_conf_optional(&this_arg_conv);
37342 }
37343
37344 void  __attribute__((export_name("TS_InitFeatures_set_zero_conf_required"))) TS_InitFeatures_set_zero_conf_required(uint64_t this_arg) {
37345         LDKInitFeatures this_arg_conv;
37346         this_arg_conv.inner = untag_ptr(this_arg);
37347         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37348         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37349         this_arg_conv.is_owned = false;
37350         InitFeatures_set_zero_conf_required(&this_arg_conv);
37351 }
37352
37353 jboolean  __attribute__((export_name("TS_InitFeatures_supports_zero_conf"))) TS_InitFeatures_supports_zero_conf(uint64_t this_arg) {
37354         LDKInitFeatures this_arg_conv;
37355         this_arg_conv.inner = untag_ptr(this_arg);
37356         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37357         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37358         this_arg_conv.is_owned = false;
37359         jboolean ret_conv = InitFeatures_supports_zero_conf(&this_arg_conv);
37360         return ret_conv;
37361 }
37362
37363 void  __attribute__((export_name("TS_NodeFeatures_set_zero_conf_optional"))) TS_NodeFeatures_set_zero_conf_optional(uint64_t this_arg) {
37364         LDKNodeFeatures this_arg_conv;
37365         this_arg_conv.inner = untag_ptr(this_arg);
37366         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37367         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37368         this_arg_conv.is_owned = false;
37369         NodeFeatures_set_zero_conf_optional(&this_arg_conv);
37370 }
37371
37372 void  __attribute__((export_name("TS_NodeFeatures_set_zero_conf_required"))) TS_NodeFeatures_set_zero_conf_required(uint64_t this_arg) {
37373         LDKNodeFeatures this_arg_conv;
37374         this_arg_conv.inner = untag_ptr(this_arg);
37375         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37376         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37377         this_arg_conv.is_owned = false;
37378         NodeFeatures_set_zero_conf_required(&this_arg_conv);
37379 }
37380
37381 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_zero_conf"))) TS_NodeFeatures_supports_zero_conf(uint64_t this_arg) {
37382         LDKNodeFeatures this_arg_conv;
37383         this_arg_conv.inner = untag_ptr(this_arg);
37384         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37385         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37386         this_arg_conv.is_owned = false;
37387         jboolean ret_conv = NodeFeatures_supports_zero_conf(&this_arg_conv);
37388         return ret_conv;
37389 }
37390
37391 void  __attribute__((export_name("TS_ChannelTypeFeatures_set_zero_conf_optional"))) TS_ChannelTypeFeatures_set_zero_conf_optional(uint64_t this_arg) {
37392         LDKChannelTypeFeatures this_arg_conv;
37393         this_arg_conv.inner = untag_ptr(this_arg);
37394         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37395         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37396         this_arg_conv.is_owned = false;
37397         ChannelTypeFeatures_set_zero_conf_optional(&this_arg_conv);
37398 }
37399
37400 void  __attribute__((export_name("TS_ChannelTypeFeatures_set_zero_conf_required"))) TS_ChannelTypeFeatures_set_zero_conf_required(uint64_t this_arg) {
37401         LDKChannelTypeFeatures this_arg_conv;
37402         this_arg_conv.inner = untag_ptr(this_arg);
37403         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37404         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37405         this_arg_conv.is_owned = false;
37406         ChannelTypeFeatures_set_zero_conf_required(&this_arg_conv);
37407 }
37408
37409 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_supports_zero_conf"))) TS_ChannelTypeFeatures_supports_zero_conf(uint64_t this_arg) {
37410         LDKChannelTypeFeatures this_arg_conv;
37411         this_arg_conv.inner = untag_ptr(this_arg);
37412         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37413         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37414         this_arg_conv.is_owned = false;
37415         jboolean ret_conv = ChannelTypeFeatures_supports_zero_conf(&this_arg_conv);
37416         return ret_conv;
37417 }
37418
37419 jboolean  __attribute__((export_name("TS_InitFeatures_requires_zero_conf"))) TS_InitFeatures_requires_zero_conf(uint64_t this_arg) {
37420         LDKInitFeatures this_arg_conv;
37421         this_arg_conv.inner = untag_ptr(this_arg);
37422         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37423         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37424         this_arg_conv.is_owned = false;
37425         jboolean ret_conv = InitFeatures_requires_zero_conf(&this_arg_conv);
37426         return ret_conv;
37427 }
37428
37429 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_zero_conf"))) TS_NodeFeatures_requires_zero_conf(uint64_t this_arg) {
37430         LDKNodeFeatures this_arg_conv;
37431         this_arg_conv.inner = untag_ptr(this_arg);
37432         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37433         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37434         this_arg_conv.is_owned = false;
37435         jboolean ret_conv = NodeFeatures_requires_zero_conf(&this_arg_conv);
37436         return ret_conv;
37437 }
37438
37439 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_requires_zero_conf"))) TS_ChannelTypeFeatures_requires_zero_conf(uint64_t this_arg) {
37440         LDKChannelTypeFeatures this_arg_conv;
37441         this_arg_conv.inner = untag_ptr(this_arg);
37442         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37443         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37444         this_arg_conv.is_owned = false;
37445         jboolean ret_conv = ChannelTypeFeatures_requires_zero_conf(&this_arg_conv);
37446         return ret_conv;
37447 }
37448
37449 void  __attribute__((export_name("TS_NodeFeatures_set_keysend_optional"))) TS_NodeFeatures_set_keysend_optional(uint64_t this_arg) {
37450         LDKNodeFeatures this_arg_conv;
37451         this_arg_conv.inner = untag_ptr(this_arg);
37452         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37453         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37454         this_arg_conv.is_owned = false;
37455         NodeFeatures_set_keysend_optional(&this_arg_conv);
37456 }
37457
37458 void  __attribute__((export_name("TS_NodeFeatures_set_keysend_required"))) TS_NodeFeatures_set_keysend_required(uint64_t this_arg) {
37459         LDKNodeFeatures this_arg_conv;
37460         this_arg_conv.inner = untag_ptr(this_arg);
37461         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37462         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37463         this_arg_conv.is_owned = false;
37464         NodeFeatures_set_keysend_required(&this_arg_conv);
37465 }
37466
37467 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_keysend"))) TS_NodeFeatures_supports_keysend(uint64_t this_arg) {
37468         LDKNodeFeatures this_arg_conv;
37469         this_arg_conv.inner = untag_ptr(this_arg);
37470         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37471         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37472         this_arg_conv.is_owned = false;
37473         jboolean ret_conv = NodeFeatures_supports_keysend(&this_arg_conv);
37474         return ret_conv;
37475 }
37476
37477 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_keysend"))) TS_NodeFeatures_requires_keysend(uint64_t this_arg) {
37478         LDKNodeFeatures this_arg_conv;
37479         this_arg_conv.inner = untag_ptr(this_arg);
37480         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37481         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37482         this_arg_conv.is_owned = false;
37483         jboolean ret_conv = NodeFeatures_requires_keysend(&this_arg_conv);
37484         return ret_conv;
37485 }
37486
37487 void  __attribute__((export_name("TS_ShutdownScript_free"))) TS_ShutdownScript_free(uint64_t this_obj) {
37488         LDKShutdownScript this_obj_conv;
37489         this_obj_conv.inner = untag_ptr(this_obj);
37490         this_obj_conv.is_owned = ptr_is_owned(this_obj);
37491         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37492         ShutdownScript_free(this_obj_conv);
37493 }
37494
37495 static inline uint64_t ShutdownScript_clone_ptr(LDKShutdownScript *NONNULL_PTR arg) {
37496         LDKShutdownScript ret_var = ShutdownScript_clone(arg);
37497         uint64_t ret_ref = 0;
37498         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37499         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37500         return ret_ref;
37501 }
37502 int64_t  __attribute__((export_name("TS_ShutdownScript_clone_ptr"))) TS_ShutdownScript_clone_ptr(uint64_t arg) {
37503         LDKShutdownScript arg_conv;
37504         arg_conv.inner = untag_ptr(arg);
37505         arg_conv.is_owned = ptr_is_owned(arg);
37506         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
37507         arg_conv.is_owned = false;
37508         int64_t ret_conv = ShutdownScript_clone_ptr(&arg_conv);
37509         return ret_conv;
37510 }
37511
37512 uint64_t  __attribute__((export_name("TS_ShutdownScript_clone"))) TS_ShutdownScript_clone(uint64_t orig) {
37513         LDKShutdownScript orig_conv;
37514         orig_conv.inner = untag_ptr(orig);
37515         orig_conv.is_owned = ptr_is_owned(orig);
37516         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
37517         orig_conv.is_owned = false;
37518         LDKShutdownScript ret_var = ShutdownScript_clone(&orig_conv);
37519         uint64_t ret_ref = 0;
37520         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37521         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37522         return ret_ref;
37523 }
37524
37525 void  __attribute__((export_name("TS_InvalidShutdownScript_free"))) TS_InvalidShutdownScript_free(uint64_t this_obj) {
37526         LDKInvalidShutdownScript this_obj_conv;
37527         this_obj_conv.inner = untag_ptr(this_obj);
37528         this_obj_conv.is_owned = ptr_is_owned(this_obj);
37529         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37530         InvalidShutdownScript_free(this_obj_conv);
37531 }
37532
37533 int8_tArray  __attribute__((export_name("TS_InvalidShutdownScript_get_script"))) TS_InvalidShutdownScript_get_script(uint64_t this_ptr) {
37534         LDKInvalidShutdownScript this_ptr_conv;
37535         this_ptr_conv.inner = untag_ptr(this_ptr);
37536         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37537         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37538         this_ptr_conv.is_owned = false;
37539         LDKu8slice ret_var = InvalidShutdownScript_get_script(&this_ptr_conv);
37540         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
37541         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
37542         return ret_arr;
37543 }
37544
37545 void  __attribute__((export_name("TS_InvalidShutdownScript_set_script"))) TS_InvalidShutdownScript_set_script(uint64_t this_ptr, int8_tArray val) {
37546         LDKInvalidShutdownScript this_ptr_conv;
37547         this_ptr_conv.inner = untag_ptr(this_ptr);
37548         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37549         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37550         this_ptr_conv.is_owned = false;
37551         LDKCVec_u8Z val_ref;
37552         val_ref.datalen = val->arr_len;
37553         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
37554         memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
37555         InvalidShutdownScript_set_script(&this_ptr_conv, val_ref);
37556 }
37557
37558 uint64_t  __attribute__((export_name("TS_InvalidShutdownScript_new"))) TS_InvalidShutdownScript_new(int8_tArray script_arg) {
37559         LDKCVec_u8Z script_arg_ref;
37560         script_arg_ref.datalen = script_arg->arr_len;
37561         script_arg_ref.data = MALLOC(script_arg_ref.datalen, "LDKCVec_u8Z Bytes");
37562         memcpy(script_arg_ref.data, script_arg->elems, script_arg_ref.datalen); FREE(script_arg);
37563         LDKInvalidShutdownScript ret_var = InvalidShutdownScript_new(script_arg_ref);
37564         uint64_t ret_ref = 0;
37565         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37566         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37567         return ret_ref;
37568 }
37569
37570 static inline uint64_t InvalidShutdownScript_clone_ptr(LDKInvalidShutdownScript *NONNULL_PTR arg) {
37571         LDKInvalidShutdownScript ret_var = InvalidShutdownScript_clone(arg);
37572         uint64_t ret_ref = 0;
37573         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37574         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37575         return ret_ref;
37576 }
37577 int64_t  __attribute__((export_name("TS_InvalidShutdownScript_clone_ptr"))) TS_InvalidShutdownScript_clone_ptr(uint64_t arg) {
37578         LDKInvalidShutdownScript arg_conv;
37579         arg_conv.inner = untag_ptr(arg);
37580         arg_conv.is_owned = ptr_is_owned(arg);
37581         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
37582         arg_conv.is_owned = false;
37583         int64_t ret_conv = InvalidShutdownScript_clone_ptr(&arg_conv);
37584         return ret_conv;
37585 }
37586
37587 uint64_t  __attribute__((export_name("TS_InvalidShutdownScript_clone"))) TS_InvalidShutdownScript_clone(uint64_t orig) {
37588         LDKInvalidShutdownScript orig_conv;
37589         orig_conv.inner = untag_ptr(orig);
37590         orig_conv.is_owned = ptr_is_owned(orig);
37591         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
37592         orig_conv.is_owned = false;
37593         LDKInvalidShutdownScript ret_var = InvalidShutdownScript_clone(&orig_conv);
37594         uint64_t ret_ref = 0;
37595         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37596         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37597         return ret_ref;
37598 }
37599
37600 int8_tArray  __attribute__((export_name("TS_ShutdownScript_write"))) TS_ShutdownScript_write(uint64_t obj) {
37601         LDKShutdownScript obj_conv;
37602         obj_conv.inner = untag_ptr(obj);
37603         obj_conv.is_owned = ptr_is_owned(obj);
37604         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
37605         obj_conv.is_owned = false;
37606         LDKCVec_u8Z ret_var = ShutdownScript_write(&obj_conv);
37607         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
37608         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
37609         CVec_u8Z_free(ret_var);
37610         return ret_arr;
37611 }
37612
37613 uint64_t  __attribute__((export_name("TS_ShutdownScript_read"))) TS_ShutdownScript_read(int8_tArray ser) {
37614         LDKu8slice ser_ref;
37615         ser_ref.datalen = ser->arr_len;
37616         ser_ref.data = ser->elems;
37617         LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
37618         *ret_conv = ShutdownScript_read(ser_ref);
37619         FREE(ser);
37620         return tag_ptr(ret_conv, true);
37621 }
37622
37623 uint64_t  __attribute__((export_name("TS_ShutdownScript_new_p2wpkh"))) TS_ShutdownScript_new_p2wpkh(int8_tArray pubkey_hash) {
37624         unsigned char pubkey_hash_arr[20];
37625         CHECK(pubkey_hash->arr_len == 20);
37626         memcpy(pubkey_hash_arr, pubkey_hash->elems, 20); FREE(pubkey_hash);
37627         unsigned char (*pubkey_hash_ref)[20] = &pubkey_hash_arr;
37628         LDKShutdownScript ret_var = ShutdownScript_new_p2wpkh(pubkey_hash_ref);
37629         uint64_t ret_ref = 0;
37630         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37631         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37632         return ret_ref;
37633 }
37634
37635 uint64_t  __attribute__((export_name("TS_ShutdownScript_new_p2wsh"))) TS_ShutdownScript_new_p2wsh(int8_tArray script_hash) {
37636         unsigned char script_hash_arr[32];
37637         CHECK(script_hash->arr_len == 32);
37638         memcpy(script_hash_arr, script_hash->elems, 32); FREE(script_hash);
37639         unsigned char (*script_hash_ref)[32] = &script_hash_arr;
37640         LDKShutdownScript ret_var = ShutdownScript_new_p2wsh(script_hash_ref);
37641         uint64_t ret_ref = 0;
37642         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37643         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37644         return ret_ref;
37645 }
37646
37647 uint64_t  __attribute__((export_name("TS_ShutdownScript_new_witness_program"))) TS_ShutdownScript_new_witness_program(int8_t version, int8_tArray program) {
37648         
37649         LDKu8slice program_ref;
37650         program_ref.datalen = program->arr_len;
37651         program_ref.data = program->elems;
37652         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
37653         *ret_conv = ShutdownScript_new_witness_program((LDKWitnessVersion){ ._0 = version }, program_ref);
37654         FREE(program);
37655         return tag_ptr(ret_conv, true);
37656 }
37657
37658 int8_tArray  __attribute__((export_name("TS_ShutdownScript_into_inner"))) TS_ShutdownScript_into_inner(uint64_t this_arg) {
37659         LDKShutdownScript this_arg_conv;
37660         this_arg_conv.inner = untag_ptr(this_arg);
37661         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37662         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37663         this_arg_conv = ShutdownScript_clone(&this_arg_conv);
37664         LDKCVec_u8Z ret_var = ShutdownScript_into_inner(this_arg_conv);
37665         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
37666         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
37667         CVec_u8Z_free(ret_var);
37668         return ret_arr;
37669 }
37670
37671 int8_tArray  __attribute__((export_name("TS_ShutdownScript_as_legacy_pubkey"))) TS_ShutdownScript_as_legacy_pubkey(uint64_t this_arg) {
37672         LDKShutdownScript this_arg_conv;
37673         this_arg_conv.inner = untag_ptr(this_arg);
37674         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37675         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37676         this_arg_conv.is_owned = false;
37677         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
37678         memcpy(ret_arr->elems, ShutdownScript_as_legacy_pubkey(&this_arg_conv).compressed_form, 33);
37679         return ret_arr;
37680 }
37681
37682 jboolean  __attribute__((export_name("TS_ShutdownScript_is_compatible"))) TS_ShutdownScript_is_compatible(uint64_t this_arg, uint64_t features) {
37683         LDKShutdownScript this_arg_conv;
37684         this_arg_conv.inner = untag_ptr(this_arg);
37685         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37686         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37687         this_arg_conv.is_owned = false;
37688         LDKInitFeatures features_conv;
37689         features_conv.inner = untag_ptr(features);
37690         features_conv.is_owned = ptr_is_owned(features);
37691         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_conv);
37692         features_conv.is_owned = false;
37693         jboolean ret_conv = ShutdownScript_is_compatible(&this_arg_conv, &features_conv);
37694         return ret_conv;
37695 }
37696
37697 void  __attribute__((export_name("TS_CustomMessageReader_free"))) TS_CustomMessageReader_free(uint64_t this_ptr) {
37698         if (!ptr_is_owned(this_ptr)) return;
37699         void* this_ptr_ptr = untag_ptr(this_ptr);
37700         CHECK_ACCESS(this_ptr_ptr);
37701         LDKCustomMessageReader this_ptr_conv = *(LDKCustomMessageReader*)(this_ptr_ptr);
37702         FREE(untag_ptr(this_ptr));
37703         CustomMessageReader_free(this_ptr_conv);
37704 }
37705
37706 static inline uint64_t Type_clone_ptr(LDKType *NONNULL_PTR arg) {
37707         LDKType* ret_ret = MALLOC(sizeof(LDKType), "LDKType");
37708         *ret_ret = Type_clone(arg);
37709         return tag_ptr(ret_ret, true);
37710 }
37711 int64_t  __attribute__((export_name("TS_Type_clone_ptr"))) TS_Type_clone_ptr(uint64_t arg) {
37712         void* arg_ptr = untag_ptr(arg);
37713         if (ptr_is_owned(arg)) { CHECK_ACCESS(arg_ptr); }
37714         LDKType* arg_conv = (LDKType*)arg_ptr;
37715         int64_t ret_conv = Type_clone_ptr(arg_conv);
37716         return ret_conv;
37717 }
37718
37719 uint64_t  __attribute__((export_name("TS_Type_clone"))) TS_Type_clone(uint64_t orig) {
37720         void* orig_ptr = untag_ptr(orig);
37721         if (ptr_is_owned(orig)) { CHECK_ACCESS(orig_ptr); }
37722         LDKType* orig_conv = (LDKType*)orig_ptr;
37723         LDKType* ret_ret = MALLOC(sizeof(LDKType), "LDKType");
37724         *ret_ret = Type_clone(orig_conv);
37725         return tag_ptr(ret_ret, true);
37726 }
37727
37728 void  __attribute__((export_name("TS_Type_free"))) TS_Type_free(uint64_t this_ptr) {
37729         if (!ptr_is_owned(this_ptr)) return;
37730         void* this_ptr_ptr = untag_ptr(this_ptr);
37731         CHECK_ACCESS(this_ptr_ptr);
37732         LDKType this_ptr_conv = *(LDKType*)(this_ptr_ptr);
37733         FREE(untag_ptr(this_ptr));
37734         Type_free(this_ptr_conv);
37735 }
37736
37737 void  __attribute__((export_name("TS_NodeId_free"))) TS_NodeId_free(uint64_t this_obj) {
37738         LDKNodeId this_obj_conv;
37739         this_obj_conv.inner = untag_ptr(this_obj);
37740         this_obj_conv.is_owned = ptr_is_owned(this_obj);
37741         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37742         NodeId_free(this_obj_conv);
37743 }
37744
37745 static inline uint64_t NodeId_clone_ptr(LDKNodeId *NONNULL_PTR arg) {
37746         LDKNodeId ret_var = NodeId_clone(arg);
37747         uint64_t ret_ref = 0;
37748         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37749         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37750         return ret_ref;
37751 }
37752 int64_t  __attribute__((export_name("TS_NodeId_clone_ptr"))) TS_NodeId_clone_ptr(uint64_t arg) {
37753         LDKNodeId arg_conv;
37754         arg_conv.inner = untag_ptr(arg);
37755         arg_conv.is_owned = ptr_is_owned(arg);
37756         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
37757         arg_conv.is_owned = false;
37758         int64_t ret_conv = NodeId_clone_ptr(&arg_conv);
37759         return ret_conv;
37760 }
37761
37762 uint64_t  __attribute__((export_name("TS_NodeId_clone"))) TS_NodeId_clone(uint64_t orig) {
37763         LDKNodeId orig_conv;
37764         orig_conv.inner = untag_ptr(orig);
37765         orig_conv.is_owned = ptr_is_owned(orig);
37766         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
37767         orig_conv.is_owned = false;
37768         LDKNodeId ret_var = NodeId_clone(&orig_conv);
37769         uint64_t ret_ref = 0;
37770         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37771         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37772         return ret_ref;
37773 }
37774
37775 uint64_t  __attribute__((export_name("TS_NodeId_from_pubkey"))) TS_NodeId_from_pubkey(int8_tArray pubkey) {
37776         LDKPublicKey pubkey_ref;
37777         CHECK(pubkey->arr_len == 33);
37778         memcpy(pubkey_ref.compressed_form, pubkey->elems, 33); FREE(pubkey);
37779         LDKNodeId ret_var = NodeId_from_pubkey(pubkey_ref);
37780         uint64_t ret_ref = 0;
37781         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37782         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37783         return ret_ref;
37784 }
37785
37786 int8_tArray  __attribute__((export_name("TS_NodeId_as_slice"))) TS_NodeId_as_slice(uint64_t this_arg) {
37787         LDKNodeId this_arg_conv;
37788         this_arg_conv.inner = untag_ptr(this_arg);
37789         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37790         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37791         this_arg_conv.is_owned = false;
37792         LDKu8slice ret_var = NodeId_as_slice(&this_arg_conv);
37793         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
37794         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
37795         return ret_arr;
37796 }
37797
37798 int64_t  __attribute__((export_name("TS_NodeId_hash"))) TS_NodeId_hash(uint64_t o) {
37799         LDKNodeId o_conv;
37800         o_conv.inner = untag_ptr(o);
37801         o_conv.is_owned = ptr_is_owned(o);
37802         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
37803         o_conv.is_owned = false;
37804         int64_t ret_conv = NodeId_hash(&o_conv);
37805         return ret_conv;
37806 }
37807
37808 int8_tArray  __attribute__((export_name("TS_NodeId_write"))) TS_NodeId_write(uint64_t obj) {
37809         LDKNodeId obj_conv;
37810         obj_conv.inner = untag_ptr(obj);
37811         obj_conv.is_owned = ptr_is_owned(obj);
37812         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
37813         obj_conv.is_owned = false;
37814         LDKCVec_u8Z ret_var = NodeId_write(&obj_conv);
37815         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
37816         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
37817         CVec_u8Z_free(ret_var);
37818         return ret_arr;
37819 }
37820
37821 uint64_t  __attribute__((export_name("TS_NodeId_read"))) TS_NodeId_read(int8_tArray ser) {
37822         LDKu8slice ser_ref;
37823         ser_ref.datalen = ser->arr_len;
37824         ser_ref.data = ser->elems;
37825         LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
37826         *ret_conv = NodeId_read(ser_ref);
37827         FREE(ser);
37828         return tag_ptr(ret_conv, true);
37829 }
37830
37831 void  __attribute__((export_name("TS_NetworkGraph_free"))) TS_NetworkGraph_free(uint64_t this_obj) {
37832         LDKNetworkGraph this_obj_conv;
37833         this_obj_conv.inner = untag_ptr(this_obj);
37834         this_obj_conv.is_owned = ptr_is_owned(this_obj);
37835         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37836         NetworkGraph_free(this_obj_conv);
37837 }
37838
37839 void  __attribute__((export_name("TS_ReadOnlyNetworkGraph_free"))) TS_ReadOnlyNetworkGraph_free(uint64_t this_obj) {
37840         LDKReadOnlyNetworkGraph this_obj_conv;
37841         this_obj_conv.inner = untag_ptr(this_obj);
37842         this_obj_conv.is_owned = ptr_is_owned(this_obj);
37843         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37844         ReadOnlyNetworkGraph_free(this_obj_conv);
37845 }
37846
37847 void  __attribute__((export_name("TS_NetworkUpdate_free"))) TS_NetworkUpdate_free(uint64_t this_ptr) {
37848         if (!ptr_is_owned(this_ptr)) return;
37849         void* this_ptr_ptr = untag_ptr(this_ptr);
37850         CHECK_ACCESS(this_ptr_ptr);
37851         LDKNetworkUpdate this_ptr_conv = *(LDKNetworkUpdate*)(this_ptr_ptr);
37852         FREE(untag_ptr(this_ptr));
37853         NetworkUpdate_free(this_ptr_conv);
37854 }
37855
37856 static inline uint64_t NetworkUpdate_clone_ptr(LDKNetworkUpdate *NONNULL_PTR arg) {
37857         LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
37858         *ret_copy = NetworkUpdate_clone(arg);
37859         uint64_t ret_ref = tag_ptr(ret_copy, true);
37860         return ret_ref;
37861 }
37862 int64_t  __attribute__((export_name("TS_NetworkUpdate_clone_ptr"))) TS_NetworkUpdate_clone_ptr(uint64_t arg) {
37863         LDKNetworkUpdate* arg_conv = (LDKNetworkUpdate*)untag_ptr(arg);
37864         int64_t ret_conv = NetworkUpdate_clone_ptr(arg_conv);
37865         return ret_conv;
37866 }
37867
37868 uint64_t  __attribute__((export_name("TS_NetworkUpdate_clone"))) TS_NetworkUpdate_clone(uint64_t orig) {
37869         LDKNetworkUpdate* orig_conv = (LDKNetworkUpdate*)untag_ptr(orig);
37870         LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
37871         *ret_copy = NetworkUpdate_clone(orig_conv);
37872         uint64_t ret_ref = tag_ptr(ret_copy, true);
37873         return ret_ref;
37874 }
37875
37876 uint64_t  __attribute__((export_name("TS_NetworkUpdate_channel_update_message"))) TS_NetworkUpdate_channel_update_message(uint64_t msg) {
37877         LDKChannelUpdate msg_conv;
37878         msg_conv.inner = untag_ptr(msg);
37879         msg_conv.is_owned = ptr_is_owned(msg);
37880         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
37881         msg_conv = ChannelUpdate_clone(&msg_conv);
37882         LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
37883         *ret_copy = NetworkUpdate_channel_update_message(msg_conv);
37884         uint64_t ret_ref = tag_ptr(ret_copy, true);
37885         return ret_ref;
37886 }
37887
37888 uint64_t  __attribute__((export_name("TS_NetworkUpdate_channel_failure"))) TS_NetworkUpdate_channel_failure(int64_t short_channel_id, jboolean is_permanent) {
37889         LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
37890         *ret_copy = NetworkUpdate_channel_failure(short_channel_id, is_permanent);
37891         uint64_t ret_ref = tag_ptr(ret_copy, true);
37892         return ret_ref;
37893 }
37894
37895 uint64_t  __attribute__((export_name("TS_NetworkUpdate_node_failure"))) TS_NetworkUpdate_node_failure(int8_tArray node_id, jboolean is_permanent) {
37896         LDKPublicKey node_id_ref;
37897         CHECK(node_id->arr_len == 33);
37898         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
37899         LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
37900         *ret_copy = NetworkUpdate_node_failure(node_id_ref, is_permanent);
37901         uint64_t ret_ref = tag_ptr(ret_copy, true);
37902         return ret_ref;
37903 }
37904
37905 int8_tArray  __attribute__((export_name("TS_NetworkUpdate_write"))) TS_NetworkUpdate_write(uint64_t obj) {
37906         LDKNetworkUpdate* obj_conv = (LDKNetworkUpdate*)untag_ptr(obj);
37907         LDKCVec_u8Z ret_var = NetworkUpdate_write(obj_conv);
37908         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
37909         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
37910         CVec_u8Z_free(ret_var);
37911         return ret_arr;
37912 }
37913
37914 uint64_t  __attribute__((export_name("TS_NetworkUpdate_read"))) TS_NetworkUpdate_read(int8_tArray ser) {
37915         LDKu8slice ser_ref;
37916         ser_ref.datalen = ser->arr_len;
37917         ser_ref.data = ser->elems;
37918         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
37919         *ret_conv = NetworkUpdate_read(ser_ref);
37920         FREE(ser);
37921         return tag_ptr(ret_conv, true);
37922 }
37923
37924 void  __attribute__((export_name("TS_P2PGossipSync_free"))) TS_P2PGossipSync_free(uint64_t this_obj) {
37925         LDKP2PGossipSync this_obj_conv;
37926         this_obj_conv.inner = untag_ptr(this_obj);
37927         this_obj_conv.is_owned = ptr_is_owned(this_obj);
37928         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37929         P2PGossipSync_free(this_obj_conv);
37930 }
37931
37932 uint64_t  __attribute__((export_name("TS_P2PGossipSync_new"))) TS_P2PGossipSync_new(uint64_t network_graph, uint64_t chain_access, uint64_t logger) {
37933         LDKNetworkGraph network_graph_conv;
37934         network_graph_conv.inner = untag_ptr(network_graph);
37935         network_graph_conv.is_owned = ptr_is_owned(network_graph);
37936         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
37937         network_graph_conv.is_owned = false;
37938         void* chain_access_ptr = untag_ptr(chain_access);
37939         CHECK_ACCESS(chain_access_ptr);
37940         LDKCOption_AccessZ chain_access_conv = *(LDKCOption_AccessZ*)(chain_access_ptr);
37941         // WARNING: we may need a move here but no clone is available for LDKCOption_AccessZ
37942         if (chain_access_conv.tag == LDKCOption_AccessZ_Some) {
37943                 // Manually implement clone for Java trait instances
37944                 if (chain_access_conv.some.free == LDKAccess_JCalls_free) {
37945                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
37946                         LDKAccess_JCalls_cloned(&chain_access_conv.some);
37947                 }
37948         }
37949         void* logger_ptr = untag_ptr(logger);
37950         CHECK_ACCESS(logger_ptr);
37951         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
37952         if (logger_conv.free == LDKLogger_JCalls_free) {
37953                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
37954                 LDKLogger_JCalls_cloned(&logger_conv);
37955         }
37956         LDKP2PGossipSync ret_var = P2PGossipSync_new(&network_graph_conv, chain_access_conv, logger_conv);
37957         uint64_t ret_ref = 0;
37958         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37959         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37960         return ret_ref;
37961 }
37962
37963 void  __attribute__((export_name("TS_P2PGossipSync_add_chain_access"))) TS_P2PGossipSync_add_chain_access(uint64_t this_arg, uint64_t chain_access) {
37964         LDKP2PGossipSync this_arg_conv;
37965         this_arg_conv.inner = untag_ptr(this_arg);
37966         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37967         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37968         this_arg_conv.is_owned = false;
37969         void* chain_access_ptr = untag_ptr(chain_access);
37970         CHECK_ACCESS(chain_access_ptr);
37971         LDKCOption_AccessZ chain_access_conv = *(LDKCOption_AccessZ*)(chain_access_ptr);
37972         // WARNING: we may need a move here but no clone is available for LDKCOption_AccessZ
37973         if (chain_access_conv.tag == LDKCOption_AccessZ_Some) {
37974                 // Manually implement clone for Java trait instances
37975                 if (chain_access_conv.some.free == LDKAccess_JCalls_free) {
37976                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
37977                         LDKAccess_JCalls_cloned(&chain_access_conv.some);
37978                 }
37979         }
37980         P2PGossipSync_add_chain_access(&this_arg_conv, chain_access_conv);
37981 }
37982
37983 uint64_t  __attribute__((export_name("TS_NetworkGraph_as_EventHandler"))) TS_NetworkGraph_as_EventHandler(uint64_t this_arg) {
37984         LDKNetworkGraph this_arg_conv;
37985         this_arg_conv.inner = untag_ptr(this_arg);
37986         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37987         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37988         this_arg_conv.is_owned = false;
37989         LDKEventHandler* ret_ret = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
37990         *ret_ret = NetworkGraph_as_EventHandler(&this_arg_conv);
37991         return tag_ptr(ret_ret, true);
37992 }
37993
37994 uint64_t  __attribute__((export_name("TS_P2PGossipSync_as_RoutingMessageHandler"))) TS_P2PGossipSync_as_RoutingMessageHandler(uint64_t this_arg) {
37995         LDKP2PGossipSync this_arg_conv;
37996         this_arg_conv.inner = untag_ptr(this_arg);
37997         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37998         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37999         this_arg_conv.is_owned = false;
38000         LDKRoutingMessageHandler* ret_ret = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
38001         *ret_ret = P2PGossipSync_as_RoutingMessageHandler(&this_arg_conv);
38002         return tag_ptr(ret_ret, true);
38003 }
38004
38005 uint64_t  __attribute__((export_name("TS_P2PGossipSync_as_MessageSendEventsProvider"))) TS_P2PGossipSync_as_MessageSendEventsProvider(uint64_t this_arg) {
38006         LDKP2PGossipSync this_arg_conv;
38007         this_arg_conv.inner = untag_ptr(this_arg);
38008         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38009         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38010         this_arg_conv.is_owned = false;
38011         LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
38012         *ret_ret = P2PGossipSync_as_MessageSendEventsProvider(&this_arg_conv);
38013         return tag_ptr(ret_ret, true);
38014 }
38015
38016 void  __attribute__((export_name("TS_ChannelUpdateInfo_free"))) TS_ChannelUpdateInfo_free(uint64_t this_obj) {
38017         LDKChannelUpdateInfo this_obj_conv;
38018         this_obj_conv.inner = untag_ptr(this_obj);
38019         this_obj_conv.is_owned = ptr_is_owned(this_obj);
38020         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38021         ChannelUpdateInfo_free(this_obj_conv);
38022 }
38023
38024 int32_t  __attribute__((export_name("TS_ChannelUpdateInfo_get_last_update"))) TS_ChannelUpdateInfo_get_last_update(uint64_t this_ptr) {
38025         LDKChannelUpdateInfo this_ptr_conv;
38026         this_ptr_conv.inner = untag_ptr(this_ptr);
38027         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38028         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38029         this_ptr_conv.is_owned = false;
38030         int32_t ret_conv = ChannelUpdateInfo_get_last_update(&this_ptr_conv);
38031         return ret_conv;
38032 }
38033
38034 void  __attribute__((export_name("TS_ChannelUpdateInfo_set_last_update"))) TS_ChannelUpdateInfo_set_last_update(uint64_t this_ptr, int32_t val) {
38035         LDKChannelUpdateInfo this_ptr_conv;
38036         this_ptr_conv.inner = untag_ptr(this_ptr);
38037         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38038         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38039         this_ptr_conv.is_owned = false;
38040         ChannelUpdateInfo_set_last_update(&this_ptr_conv, val);
38041 }
38042
38043 jboolean  __attribute__((export_name("TS_ChannelUpdateInfo_get_enabled"))) TS_ChannelUpdateInfo_get_enabled(uint64_t this_ptr) {
38044         LDKChannelUpdateInfo this_ptr_conv;
38045         this_ptr_conv.inner = untag_ptr(this_ptr);
38046         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38047         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38048         this_ptr_conv.is_owned = false;
38049         jboolean ret_conv = ChannelUpdateInfo_get_enabled(&this_ptr_conv);
38050         return ret_conv;
38051 }
38052
38053 void  __attribute__((export_name("TS_ChannelUpdateInfo_set_enabled"))) TS_ChannelUpdateInfo_set_enabled(uint64_t this_ptr, jboolean val) {
38054         LDKChannelUpdateInfo this_ptr_conv;
38055         this_ptr_conv.inner = untag_ptr(this_ptr);
38056         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38057         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38058         this_ptr_conv.is_owned = false;
38059         ChannelUpdateInfo_set_enabled(&this_ptr_conv, val);
38060 }
38061
38062 int16_t  __attribute__((export_name("TS_ChannelUpdateInfo_get_cltv_expiry_delta"))) TS_ChannelUpdateInfo_get_cltv_expiry_delta(uint64_t this_ptr) {
38063         LDKChannelUpdateInfo this_ptr_conv;
38064         this_ptr_conv.inner = untag_ptr(this_ptr);
38065         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38066         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38067         this_ptr_conv.is_owned = false;
38068         int16_t ret_conv = ChannelUpdateInfo_get_cltv_expiry_delta(&this_ptr_conv);
38069         return ret_conv;
38070 }
38071
38072 void  __attribute__((export_name("TS_ChannelUpdateInfo_set_cltv_expiry_delta"))) TS_ChannelUpdateInfo_set_cltv_expiry_delta(uint64_t this_ptr, int16_t val) {
38073         LDKChannelUpdateInfo this_ptr_conv;
38074         this_ptr_conv.inner = untag_ptr(this_ptr);
38075         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38076         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38077         this_ptr_conv.is_owned = false;
38078         ChannelUpdateInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
38079 }
38080
38081 int64_t  __attribute__((export_name("TS_ChannelUpdateInfo_get_htlc_minimum_msat"))) TS_ChannelUpdateInfo_get_htlc_minimum_msat(uint64_t this_ptr) {
38082         LDKChannelUpdateInfo this_ptr_conv;
38083         this_ptr_conv.inner = untag_ptr(this_ptr);
38084         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38085         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38086         this_ptr_conv.is_owned = false;
38087         int64_t ret_conv = ChannelUpdateInfo_get_htlc_minimum_msat(&this_ptr_conv);
38088         return ret_conv;
38089 }
38090
38091 void  __attribute__((export_name("TS_ChannelUpdateInfo_set_htlc_minimum_msat"))) TS_ChannelUpdateInfo_set_htlc_minimum_msat(uint64_t this_ptr, int64_t val) {
38092         LDKChannelUpdateInfo this_ptr_conv;
38093         this_ptr_conv.inner = untag_ptr(this_ptr);
38094         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38095         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38096         this_ptr_conv.is_owned = false;
38097         ChannelUpdateInfo_set_htlc_minimum_msat(&this_ptr_conv, val);
38098 }
38099
38100 int64_t  __attribute__((export_name("TS_ChannelUpdateInfo_get_htlc_maximum_msat"))) TS_ChannelUpdateInfo_get_htlc_maximum_msat(uint64_t this_ptr) {
38101         LDKChannelUpdateInfo this_ptr_conv;
38102         this_ptr_conv.inner = untag_ptr(this_ptr);
38103         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38104         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38105         this_ptr_conv.is_owned = false;
38106         int64_t ret_conv = ChannelUpdateInfo_get_htlc_maximum_msat(&this_ptr_conv);
38107         return ret_conv;
38108 }
38109
38110 void  __attribute__((export_name("TS_ChannelUpdateInfo_set_htlc_maximum_msat"))) TS_ChannelUpdateInfo_set_htlc_maximum_msat(uint64_t this_ptr, int64_t val) {
38111         LDKChannelUpdateInfo this_ptr_conv;
38112         this_ptr_conv.inner = untag_ptr(this_ptr);
38113         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38114         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38115         this_ptr_conv.is_owned = false;
38116         ChannelUpdateInfo_set_htlc_maximum_msat(&this_ptr_conv, val);
38117 }
38118
38119 uint64_t  __attribute__((export_name("TS_ChannelUpdateInfo_get_fees"))) TS_ChannelUpdateInfo_get_fees(uint64_t this_ptr) {
38120         LDKChannelUpdateInfo this_ptr_conv;
38121         this_ptr_conv.inner = untag_ptr(this_ptr);
38122         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38123         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38124         this_ptr_conv.is_owned = false;
38125         LDKRoutingFees ret_var = ChannelUpdateInfo_get_fees(&this_ptr_conv);
38126         uint64_t ret_ref = 0;
38127         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38128         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38129         return ret_ref;
38130 }
38131
38132 void  __attribute__((export_name("TS_ChannelUpdateInfo_set_fees"))) TS_ChannelUpdateInfo_set_fees(uint64_t this_ptr, uint64_t val) {
38133         LDKChannelUpdateInfo this_ptr_conv;
38134         this_ptr_conv.inner = untag_ptr(this_ptr);
38135         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38136         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38137         this_ptr_conv.is_owned = false;
38138         LDKRoutingFees val_conv;
38139         val_conv.inner = untag_ptr(val);
38140         val_conv.is_owned = ptr_is_owned(val);
38141         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
38142         val_conv = RoutingFees_clone(&val_conv);
38143         ChannelUpdateInfo_set_fees(&this_ptr_conv, val_conv);
38144 }
38145
38146 uint64_t  __attribute__((export_name("TS_ChannelUpdateInfo_get_last_update_message"))) TS_ChannelUpdateInfo_get_last_update_message(uint64_t this_ptr) {
38147         LDKChannelUpdateInfo this_ptr_conv;
38148         this_ptr_conv.inner = untag_ptr(this_ptr);
38149         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38150         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38151         this_ptr_conv.is_owned = false;
38152         LDKChannelUpdate ret_var = ChannelUpdateInfo_get_last_update_message(&this_ptr_conv);
38153         uint64_t ret_ref = 0;
38154         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38155         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38156         return ret_ref;
38157 }
38158
38159 void  __attribute__((export_name("TS_ChannelUpdateInfo_set_last_update_message"))) TS_ChannelUpdateInfo_set_last_update_message(uint64_t this_ptr, uint64_t val) {
38160         LDKChannelUpdateInfo this_ptr_conv;
38161         this_ptr_conv.inner = untag_ptr(this_ptr);
38162         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38163         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38164         this_ptr_conv.is_owned = false;
38165         LDKChannelUpdate val_conv;
38166         val_conv.inner = untag_ptr(val);
38167         val_conv.is_owned = ptr_is_owned(val);
38168         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
38169         val_conv = ChannelUpdate_clone(&val_conv);
38170         ChannelUpdateInfo_set_last_update_message(&this_ptr_conv, val_conv);
38171 }
38172
38173 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) {
38174         LDKRoutingFees fees_arg_conv;
38175         fees_arg_conv.inner = untag_ptr(fees_arg);
38176         fees_arg_conv.is_owned = ptr_is_owned(fees_arg);
38177         CHECK_INNER_FIELD_ACCESS_OR_NULL(fees_arg_conv);
38178         fees_arg_conv = RoutingFees_clone(&fees_arg_conv);
38179         LDKChannelUpdate last_update_message_arg_conv;
38180         last_update_message_arg_conv.inner = untag_ptr(last_update_message_arg);
38181         last_update_message_arg_conv.is_owned = ptr_is_owned(last_update_message_arg);
38182         CHECK_INNER_FIELD_ACCESS_OR_NULL(last_update_message_arg_conv);
38183         last_update_message_arg_conv = ChannelUpdate_clone(&last_update_message_arg_conv);
38184         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);
38185         uint64_t ret_ref = 0;
38186         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38187         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38188         return ret_ref;
38189 }
38190
38191 static inline uint64_t ChannelUpdateInfo_clone_ptr(LDKChannelUpdateInfo *NONNULL_PTR arg) {
38192         LDKChannelUpdateInfo ret_var = ChannelUpdateInfo_clone(arg);
38193         uint64_t ret_ref = 0;
38194         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38195         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38196         return ret_ref;
38197 }
38198 int64_t  __attribute__((export_name("TS_ChannelUpdateInfo_clone_ptr"))) TS_ChannelUpdateInfo_clone_ptr(uint64_t arg) {
38199         LDKChannelUpdateInfo arg_conv;
38200         arg_conv.inner = untag_ptr(arg);
38201         arg_conv.is_owned = ptr_is_owned(arg);
38202         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
38203         arg_conv.is_owned = false;
38204         int64_t ret_conv = ChannelUpdateInfo_clone_ptr(&arg_conv);
38205         return ret_conv;
38206 }
38207
38208 uint64_t  __attribute__((export_name("TS_ChannelUpdateInfo_clone"))) TS_ChannelUpdateInfo_clone(uint64_t orig) {
38209         LDKChannelUpdateInfo orig_conv;
38210         orig_conv.inner = untag_ptr(orig);
38211         orig_conv.is_owned = ptr_is_owned(orig);
38212         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
38213         orig_conv.is_owned = false;
38214         LDKChannelUpdateInfo ret_var = ChannelUpdateInfo_clone(&orig_conv);
38215         uint64_t ret_ref = 0;
38216         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38217         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38218         return ret_ref;
38219 }
38220
38221 int8_tArray  __attribute__((export_name("TS_ChannelUpdateInfo_write"))) TS_ChannelUpdateInfo_write(uint64_t obj) {
38222         LDKChannelUpdateInfo obj_conv;
38223         obj_conv.inner = untag_ptr(obj);
38224         obj_conv.is_owned = ptr_is_owned(obj);
38225         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
38226         obj_conv.is_owned = false;
38227         LDKCVec_u8Z ret_var = ChannelUpdateInfo_write(&obj_conv);
38228         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
38229         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
38230         CVec_u8Z_free(ret_var);
38231         return ret_arr;
38232 }
38233
38234 uint64_t  __attribute__((export_name("TS_ChannelUpdateInfo_read"))) TS_ChannelUpdateInfo_read(int8_tArray ser) {
38235         LDKu8slice ser_ref;
38236         ser_ref.datalen = ser->arr_len;
38237         ser_ref.data = ser->elems;
38238         LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
38239         *ret_conv = ChannelUpdateInfo_read(ser_ref);
38240         FREE(ser);
38241         return tag_ptr(ret_conv, true);
38242 }
38243
38244 void  __attribute__((export_name("TS_ChannelInfo_free"))) TS_ChannelInfo_free(uint64_t this_obj) {
38245         LDKChannelInfo this_obj_conv;
38246         this_obj_conv.inner = untag_ptr(this_obj);
38247         this_obj_conv.is_owned = ptr_is_owned(this_obj);
38248         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38249         ChannelInfo_free(this_obj_conv);
38250 }
38251
38252 uint64_t  __attribute__((export_name("TS_ChannelInfo_get_features"))) TS_ChannelInfo_get_features(uint64_t this_ptr) {
38253         LDKChannelInfo this_ptr_conv;
38254         this_ptr_conv.inner = untag_ptr(this_ptr);
38255         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38256         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38257         this_ptr_conv.is_owned = false;
38258         LDKChannelFeatures ret_var = ChannelInfo_get_features(&this_ptr_conv);
38259         uint64_t ret_ref = 0;
38260         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38261         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38262         return ret_ref;
38263 }
38264
38265 void  __attribute__((export_name("TS_ChannelInfo_set_features"))) TS_ChannelInfo_set_features(uint64_t this_ptr, uint64_t val) {
38266         LDKChannelInfo this_ptr_conv;
38267         this_ptr_conv.inner = untag_ptr(this_ptr);
38268         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38269         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38270         this_ptr_conv.is_owned = false;
38271         LDKChannelFeatures val_conv;
38272         val_conv.inner = untag_ptr(val);
38273         val_conv.is_owned = ptr_is_owned(val);
38274         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
38275         val_conv = ChannelFeatures_clone(&val_conv);
38276         ChannelInfo_set_features(&this_ptr_conv, val_conv);
38277 }
38278
38279 uint64_t  __attribute__((export_name("TS_ChannelInfo_get_node_one"))) TS_ChannelInfo_get_node_one(uint64_t this_ptr) {
38280         LDKChannelInfo this_ptr_conv;
38281         this_ptr_conv.inner = untag_ptr(this_ptr);
38282         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38283         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38284         this_ptr_conv.is_owned = false;
38285         LDKNodeId ret_var = ChannelInfo_get_node_one(&this_ptr_conv);
38286         uint64_t ret_ref = 0;
38287         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38288         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38289         return ret_ref;
38290 }
38291
38292 void  __attribute__((export_name("TS_ChannelInfo_set_node_one"))) TS_ChannelInfo_set_node_one(uint64_t this_ptr, uint64_t val) {
38293         LDKChannelInfo this_ptr_conv;
38294         this_ptr_conv.inner = untag_ptr(this_ptr);
38295         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38296         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38297         this_ptr_conv.is_owned = false;
38298         LDKNodeId val_conv;
38299         val_conv.inner = untag_ptr(val);
38300         val_conv.is_owned = ptr_is_owned(val);
38301         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
38302         val_conv = NodeId_clone(&val_conv);
38303         ChannelInfo_set_node_one(&this_ptr_conv, val_conv);
38304 }
38305
38306 uint64_t  __attribute__((export_name("TS_ChannelInfo_get_one_to_two"))) TS_ChannelInfo_get_one_to_two(uint64_t this_ptr) {
38307         LDKChannelInfo this_ptr_conv;
38308         this_ptr_conv.inner = untag_ptr(this_ptr);
38309         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38310         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38311         this_ptr_conv.is_owned = false;
38312         LDKChannelUpdateInfo ret_var = ChannelInfo_get_one_to_two(&this_ptr_conv);
38313         uint64_t ret_ref = 0;
38314         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38315         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38316         return ret_ref;
38317 }
38318
38319 void  __attribute__((export_name("TS_ChannelInfo_set_one_to_two"))) TS_ChannelInfo_set_one_to_two(uint64_t this_ptr, uint64_t val) {
38320         LDKChannelInfo this_ptr_conv;
38321         this_ptr_conv.inner = untag_ptr(this_ptr);
38322         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38323         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38324         this_ptr_conv.is_owned = false;
38325         LDKChannelUpdateInfo val_conv;
38326         val_conv.inner = untag_ptr(val);
38327         val_conv.is_owned = ptr_is_owned(val);
38328         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
38329         val_conv = ChannelUpdateInfo_clone(&val_conv);
38330         ChannelInfo_set_one_to_two(&this_ptr_conv, val_conv);
38331 }
38332
38333 uint64_t  __attribute__((export_name("TS_ChannelInfo_get_node_two"))) TS_ChannelInfo_get_node_two(uint64_t this_ptr) {
38334         LDKChannelInfo this_ptr_conv;
38335         this_ptr_conv.inner = untag_ptr(this_ptr);
38336         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38337         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38338         this_ptr_conv.is_owned = false;
38339         LDKNodeId ret_var = ChannelInfo_get_node_two(&this_ptr_conv);
38340         uint64_t ret_ref = 0;
38341         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38342         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38343         return ret_ref;
38344 }
38345
38346 void  __attribute__((export_name("TS_ChannelInfo_set_node_two"))) TS_ChannelInfo_set_node_two(uint64_t this_ptr, uint64_t val) {
38347         LDKChannelInfo this_ptr_conv;
38348         this_ptr_conv.inner = untag_ptr(this_ptr);
38349         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38350         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38351         this_ptr_conv.is_owned = false;
38352         LDKNodeId val_conv;
38353         val_conv.inner = untag_ptr(val);
38354         val_conv.is_owned = ptr_is_owned(val);
38355         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
38356         val_conv = NodeId_clone(&val_conv);
38357         ChannelInfo_set_node_two(&this_ptr_conv, val_conv);
38358 }
38359
38360 uint64_t  __attribute__((export_name("TS_ChannelInfo_get_two_to_one"))) TS_ChannelInfo_get_two_to_one(uint64_t this_ptr) {
38361         LDKChannelInfo this_ptr_conv;
38362         this_ptr_conv.inner = untag_ptr(this_ptr);
38363         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38364         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38365         this_ptr_conv.is_owned = false;
38366         LDKChannelUpdateInfo ret_var = ChannelInfo_get_two_to_one(&this_ptr_conv);
38367         uint64_t ret_ref = 0;
38368         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38369         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38370         return ret_ref;
38371 }
38372
38373 void  __attribute__((export_name("TS_ChannelInfo_set_two_to_one"))) TS_ChannelInfo_set_two_to_one(uint64_t this_ptr, uint64_t val) {
38374         LDKChannelInfo this_ptr_conv;
38375         this_ptr_conv.inner = untag_ptr(this_ptr);
38376         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38377         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38378         this_ptr_conv.is_owned = false;
38379         LDKChannelUpdateInfo val_conv;
38380         val_conv.inner = untag_ptr(val);
38381         val_conv.is_owned = ptr_is_owned(val);
38382         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
38383         val_conv = ChannelUpdateInfo_clone(&val_conv);
38384         ChannelInfo_set_two_to_one(&this_ptr_conv, val_conv);
38385 }
38386
38387 uint64_t  __attribute__((export_name("TS_ChannelInfo_get_capacity_sats"))) TS_ChannelInfo_get_capacity_sats(uint64_t this_ptr) {
38388         LDKChannelInfo this_ptr_conv;
38389         this_ptr_conv.inner = untag_ptr(this_ptr);
38390         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38391         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38392         this_ptr_conv.is_owned = false;
38393         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
38394         *ret_copy = ChannelInfo_get_capacity_sats(&this_ptr_conv);
38395         uint64_t ret_ref = tag_ptr(ret_copy, true);
38396         return ret_ref;
38397 }
38398
38399 void  __attribute__((export_name("TS_ChannelInfo_set_capacity_sats"))) TS_ChannelInfo_set_capacity_sats(uint64_t this_ptr, uint64_t val) {
38400         LDKChannelInfo this_ptr_conv;
38401         this_ptr_conv.inner = untag_ptr(this_ptr);
38402         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38403         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38404         this_ptr_conv.is_owned = false;
38405         void* val_ptr = untag_ptr(val);
38406         CHECK_ACCESS(val_ptr);
38407         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
38408         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
38409         ChannelInfo_set_capacity_sats(&this_ptr_conv, val_conv);
38410 }
38411
38412 uint64_t  __attribute__((export_name("TS_ChannelInfo_get_announcement_message"))) TS_ChannelInfo_get_announcement_message(uint64_t this_ptr) {
38413         LDKChannelInfo this_ptr_conv;
38414         this_ptr_conv.inner = untag_ptr(this_ptr);
38415         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38416         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38417         this_ptr_conv.is_owned = false;
38418         LDKChannelAnnouncement ret_var = ChannelInfo_get_announcement_message(&this_ptr_conv);
38419         uint64_t ret_ref = 0;
38420         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38421         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38422         return ret_ref;
38423 }
38424
38425 void  __attribute__((export_name("TS_ChannelInfo_set_announcement_message"))) TS_ChannelInfo_set_announcement_message(uint64_t this_ptr, uint64_t val) {
38426         LDKChannelInfo this_ptr_conv;
38427         this_ptr_conv.inner = untag_ptr(this_ptr);
38428         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38429         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38430         this_ptr_conv.is_owned = false;
38431         LDKChannelAnnouncement val_conv;
38432         val_conv.inner = untag_ptr(val);
38433         val_conv.is_owned = ptr_is_owned(val);
38434         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
38435         val_conv = ChannelAnnouncement_clone(&val_conv);
38436         ChannelInfo_set_announcement_message(&this_ptr_conv, val_conv);
38437 }
38438
38439 static inline uint64_t ChannelInfo_clone_ptr(LDKChannelInfo *NONNULL_PTR arg) {
38440         LDKChannelInfo ret_var = ChannelInfo_clone(arg);
38441         uint64_t ret_ref = 0;
38442         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38443         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38444         return ret_ref;
38445 }
38446 int64_t  __attribute__((export_name("TS_ChannelInfo_clone_ptr"))) TS_ChannelInfo_clone_ptr(uint64_t arg) {
38447         LDKChannelInfo arg_conv;
38448         arg_conv.inner = untag_ptr(arg);
38449         arg_conv.is_owned = ptr_is_owned(arg);
38450         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
38451         arg_conv.is_owned = false;
38452         int64_t ret_conv = ChannelInfo_clone_ptr(&arg_conv);
38453         return ret_conv;
38454 }
38455
38456 uint64_t  __attribute__((export_name("TS_ChannelInfo_clone"))) TS_ChannelInfo_clone(uint64_t orig) {
38457         LDKChannelInfo orig_conv;
38458         orig_conv.inner = untag_ptr(orig);
38459         orig_conv.is_owned = ptr_is_owned(orig);
38460         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
38461         orig_conv.is_owned = false;
38462         LDKChannelInfo ret_var = ChannelInfo_clone(&orig_conv);
38463         uint64_t ret_ref = 0;
38464         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38465         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38466         return ret_ref;
38467 }
38468
38469 uint64_t  __attribute__((export_name("TS_ChannelInfo_get_directional_info"))) TS_ChannelInfo_get_directional_info(uint64_t this_arg, int8_t channel_flags) {
38470         LDKChannelInfo this_arg_conv;
38471         this_arg_conv.inner = untag_ptr(this_arg);
38472         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38473         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38474         this_arg_conv.is_owned = false;
38475         LDKChannelUpdateInfo ret_var = ChannelInfo_get_directional_info(&this_arg_conv, channel_flags);
38476         uint64_t ret_ref = 0;
38477         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38478         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38479         return ret_ref;
38480 }
38481
38482 int8_tArray  __attribute__((export_name("TS_ChannelInfo_write"))) TS_ChannelInfo_write(uint64_t obj) {
38483         LDKChannelInfo obj_conv;
38484         obj_conv.inner = untag_ptr(obj);
38485         obj_conv.is_owned = ptr_is_owned(obj);
38486         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
38487         obj_conv.is_owned = false;
38488         LDKCVec_u8Z ret_var = ChannelInfo_write(&obj_conv);
38489         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
38490         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
38491         CVec_u8Z_free(ret_var);
38492         return ret_arr;
38493 }
38494
38495 uint64_t  __attribute__((export_name("TS_ChannelInfo_read"))) TS_ChannelInfo_read(int8_tArray ser) {
38496         LDKu8slice ser_ref;
38497         ser_ref.datalen = ser->arr_len;
38498         ser_ref.data = ser->elems;
38499         LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
38500         *ret_conv = ChannelInfo_read(ser_ref);
38501         FREE(ser);
38502         return tag_ptr(ret_conv, true);
38503 }
38504
38505 void  __attribute__((export_name("TS_DirectedChannelInfo_free"))) TS_DirectedChannelInfo_free(uint64_t this_obj) {
38506         LDKDirectedChannelInfo this_obj_conv;
38507         this_obj_conv.inner = untag_ptr(this_obj);
38508         this_obj_conv.is_owned = ptr_is_owned(this_obj);
38509         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38510         DirectedChannelInfo_free(this_obj_conv);
38511 }
38512
38513 static inline uint64_t DirectedChannelInfo_clone_ptr(LDKDirectedChannelInfo *NONNULL_PTR arg) {
38514         LDKDirectedChannelInfo ret_var = DirectedChannelInfo_clone(arg);
38515         uint64_t ret_ref = 0;
38516         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38517         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38518         return ret_ref;
38519 }
38520 int64_t  __attribute__((export_name("TS_DirectedChannelInfo_clone_ptr"))) TS_DirectedChannelInfo_clone_ptr(uint64_t arg) {
38521         LDKDirectedChannelInfo arg_conv;
38522         arg_conv.inner = untag_ptr(arg);
38523         arg_conv.is_owned = ptr_is_owned(arg);
38524         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
38525         arg_conv.is_owned = false;
38526         int64_t ret_conv = DirectedChannelInfo_clone_ptr(&arg_conv);
38527         return ret_conv;
38528 }
38529
38530 uint64_t  __attribute__((export_name("TS_DirectedChannelInfo_clone"))) TS_DirectedChannelInfo_clone(uint64_t orig) {
38531         LDKDirectedChannelInfo orig_conv;
38532         orig_conv.inner = untag_ptr(orig);
38533         orig_conv.is_owned = ptr_is_owned(orig);
38534         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
38535         orig_conv.is_owned = false;
38536         LDKDirectedChannelInfo ret_var = DirectedChannelInfo_clone(&orig_conv);
38537         uint64_t ret_ref = 0;
38538         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38539         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38540         return ret_ref;
38541 }
38542
38543 uint64_t  __attribute__((export_name("TS_DirectedChannelInfo_channel"))) TS_DirectedChannelInfo_channel(uint64_t this_arg) {
38544         LDKDirectedChannelInfo this_arg_conv;
38545         this_arg_conv.inner = untag_ptr(this_arg);
38546         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38547         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38548         this_arg_conv.is_owned = false;
38549         LDKChannelInfo ret_var = DirectedChannelInfo_channel(&this_arg_conv);
38550         uint64_t ret_ref = 0;
38551         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38552         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38553         return ret_ref;
38554 }
38555
38556 uint64_t  __attribute__((export_name("TS_DirectedChannelInfo_direction"))) TS_DirectedChannelInfo_direction(uint64_t this_arg) {
38557         LDKDirectedChannelInfo this_arg_conv;
38558         this_arg_conv.inner = untag_ptr(this_arg);
38559         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38560         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38561         this_arg_conv.is_owned = false;
38562         LDKChannelUpdateInfo ret_var = DirectedChannelInfo_direction(&this_arg_conv);
38563         uint64_t ret_ref = 0;
38564         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38565         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38566         return ret_ref;
38567 }
38568
38569 int64_t  __attribute__((export_name("TS_DirectedChannelInfo_htlc_maximum_msat"))) TS_DirectedChannelInfo_htlc_maximum_msat(uint64_t this_arg) {
38570         LDKDirectedChannelInfo this_arg_conv;
38571         this_arg_conv.inner = untag_ptr(this_arg);
38572         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38573         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38574         this_arg_conv.is_owned = false;
38575         int64_t ret_conv = DirectedChannelInfo_htlc_maximum_msat(&this_arg_conv);
38576         return ret_conv;
38577 }
38578
38579 uint64_t  __attribute__((export_name("TS_DirectedChannelInfo_effective_capacity"))) TS_DirectedChannelInfo_effective_capacity(uint64_t this_arg) {
38580         LDKDirectedChannelInfo this_arg_conv;
38581         this_arg_conv.inner = untag_ptr(this_arg);
38582         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38583         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38584         this_arg_conv.is_owned = false;
38585         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
38586         *ret_copy = DirectedChannelInfo_effective_capacity(&this_arg_conv);
38587         uint64_t ret_ref = tag_ptr(ret_copy, true);
38588         return ret_ref;
38589 }
38590
38591 void  __attribute__((export_name("TS_EffectiveCapacity_free"))) TS_EffectiveCapacity_free(uint64_t this_ptr) {
38592         if (!ptr_is_owned(this_ptr)) return;
38593         void* this_ptr_ptr = untag_ptr(this_ptr);
38594         CHECK_ACCESS(this_ptr_ptr);
38595         LDKEffectiveCapacity this_ptr_conv = *(LDKEffectiveCapacity*)(this_ptr_ptr);
38596         FREE(untag_ptr(this_ptr));
38597         EffectiveCapacity_free(this_ptr_conv);
38598 }
38599
38600 static inline uint64_t EffectiveCapacity_clone_ptr(LDKEffectiveCapacity *NONNULL_PTR arg) {
38601         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
38602         *ret_copy = EffectiveCapacity_clone(arg);
38603         uint64_t ret_ref = tag_ptr(ret_copy, true);
38604         return ret_ref;
38605 }
38606 int64_t  __attribute__((export_name("TS_EffectiveCapacity_clone_ptr"))) TS_EffectiveCapacity_clone_ptr(uint64_t arg) {
38607         LDKEffectiveCapacity* arg_conv = (LDKEffectiveCapacity*)untag_ptr(arg);
38608         int64_t ret_conv = EffectiveCapacity_clone_ptr(arg_conv);
38609         return ret_conv;
38610 }
38611
38612 uint64_t  __attribute__((export_name("TS_EffectiveCapacity_clone"))) TS_EffectiveCapacity_clone(uint64_t orig) {
38613         LDKEffectiveCapacity* orig_conv = (LDKEffectiveCapacity*)untag_ptr(orig);
38614         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
38615         *ret_copy = EffectiveCapacity_clone(orig_conv);
38616         uint64_t ret_ref = tag_ptr(ret_copy, true);
38617         return ret_ref;
38618 }
38619
38620 uint64_t  __attribute__((export_name("TS_EffectiveCapacity_exact_liquidity"))) TS_EffectiveCapacity_exact_liquidity(int64_t liquidity_msat) {
38621         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
38622         *ret_copy = EffectiveCapacity_exact_liquidity(liquidity_msat);
38623         uint64_t ret_ref = tag_ptr(ret_copy, true);
38624         return ret_ref;
38625 }
38626
38627 uint64_t  __attribute__((export_name("TS_EffectiveCapacity_maximum_htlc"))) TS_EffectiveCapacity_maximum_htlc(int64_t amount_msat) {
38628         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
38629         *ret_copy = EffectiveCapacity_maximum_htlc(amount_msat);
38630         uint64_t ret_ref = tag_ptr(ret_copy, true);
38631         return ret_ref;
38632 }
38633
38634 uint64_t  __attribute__((export_name("TS_EffectiveCapacity_total"))) TS_EffectiveCapacity_total(int64_t capacity_msat, uint64_t htlc_maximum_msat) {
38635         void* htlc_maximum_msat_ptr = untag_ptr(htlc_maximum_msat);
38636         CHECK_ACCESS(htlc_maximum_msat_ptr);
38637         LDKCOption_u64Z htlc_maximum_msat_conv = *(LDKCOption_u64Z*)(htlc_maximum_msat_ptr);
38638         htlc_maximum_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(htlc_maximum_msat));
38639         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
38640         *ret_copy = EffectiveCapacity_total(capacity_msat, htlc_maximum_msat_conv);
38641         uint64_t ret_ref = tag_ptr(ret_copy, true);
38642         return ret_ref;
38643 }
38644
38645 uint64_t  __attribute__((export_name("TS_EffectiveCapacity_infinite"))) TS_EffectiveCapacity_infinite() {
38646         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
38647         *ret_copy = EffectiveCapacity_infinite();
38648         uint64_t ret_ref = tag_ptr(ret_copy, true);
38649         return ret_ref;
38650 }
38651
38652 uint64_t  __attribute__((export_name("TS_EffectiveCapacity_unknown"))) TS_EffectiveCapacity_unknown() {
38653         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
38654         *ret_copy = EffectiveCapacity_unknown();
38655         uint64_t ret_ref = tag_ptr(ret_copy, true);
38656         return ret_ref;
38657 }
38658
38659 int64_t  __attribute__((export_name("TS_EffectiveCapacity_as_msat"))) TS_EffectiveCapacity_as_msat(uint64_t this_arg) {
38660         LDKEffectiveCapacity* this_arg_conv = (LDKEffectiveCapacity*)untag_ptr(this_arg);
38661         int64_t ret_conv = EffectiveCapacity_as_msat(this_arg_conv);
38662         return ret_conv;
38663 }
38664
38665 void  __attribute__((export_name("TS_RoutingFees_free"))) TS_RoutingFees_free(uint64_t this_obj) {
38666         LDKRoutingFees this_obj_conv;
38667         this_obj_conv.inner = untag_ptr(this_obj);
38668         this_obj_conv.is_owned = ptr_is_owned(this_obj);
38669         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38670         RoutingFees_free(this_obj_conv);
38671 }
38672
38673 int32_t  __attribute__((export_name("TS_RoutingFees_get_base_msat"))) TS_RoutingFees_get_base_msat(uint64_t this_ptr) {
38674         LDKRoutingFees this_ptr_conv;
38675         this_ptr_conv.inner = untag_ptr(this_ptr);
38676         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38677         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38678         this_ptr_conv.is_owned = false;
38679         int32_t ret_conv = RoutingFees_get_base_msat(&this_ptr_conv);
38680         return ret_conv;
38681 }
38682
38683 void  __attribute__((export_name("TS_RoutingFees_set_base_msat"))) TS_RoutingFees_set_base_msat(uint64_t this_ptr, int32_t val) {
38684         LDKRoutingFees this_ptr_conv;
38685         this_ptr_conv.inner = untag_ptr(this_ptr);
38686         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38687         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38688         this_ptr_conv.is_owned = false;
38689         RoutingFees_set_base_msat(&this_ptr_conv, val);
38690 }
38691
38692 int32_t  __attribute__((export_name("TS_RoutingFees_get_proportional_millionths"))) TS_RoutingFees_get_proportional_millionths(uint64_t this_ptr) {
38693         LDKRoutingFees this_ptr_conv;
38694         this_ptr_conv.inner = untag_ptr(this_ptr);
38695         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38696         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38697         this_ptr_conv.is_owned = false;
38698         int32_t ret_conv = RoutingFees_get_proportional_millionths(&this_ptr_conv);
38699         return ret_conv;
38700 }
38701
38702 void  __attribute__((export_name("TS_RoutingFees_set_proportional_millionths"))) TS_RoutingFees_set_proportional_millionths(uint64_t this_ptr, int32_t val) {
38703         LDKRoutingFees this_ptr_conv;
38704         this_ptr_conv.inner = untag_ptr(this_ptr);
38705         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38706         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38707         this_ptr_conv.is_owned = false;
38708         RoutingFees_set_proportional_millionths(&this_ptr_conv, val);
38709 }
38710
38711 uint64_t  __attribute__((export_name("TS_RoutingFees_new"))) TS_RoutingFees_new(int32_t base_msat_arg, int32_t proportional_millionths_arg) {
38712         LDKRoutingFees ret_var = RoutingFees_new(base_msat_arg, proportional_millionths_arg);
38713         uint64_t ret_ref = 0;
38714         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38715         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38716         return ret_ref;
38717 }
38718
38719 jboolean  __attribute__((export_name("TS_RoutingFees_eq"))) TS_RoutingFees_eq(uint64_t a, uint64_t b) {
38720         LDKRoutingFees a_conv;
38721         a_conv.inner = untag_ptr(a);
38722         a_conv.is_owned = ptr_is_owned(a);
38723         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
38724         a_conv.is_owned = false;
38725         LDKRoutingFees b_conv;
38726         b_conv.inner = untag_ptr(b);
38727         b_conv.is_owned = ptr_is_owned(b);
38728         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
38729         b_conv.is_owned = false;
38730         jboolean ret_conv = RoutingFees_eq(&a_conv, &b_conv);
38731         return ret_conv;
38732 }
38733
38734 static inline uint64_t RoutingFees_clone_ptr(LDKRoutingFees *NONNULL_PTR arg) {
38735         LDKRoutingFees ret_var = RoutingFees_clone(arg);
38736         uint64_t ret_ref = 0;
38737         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38738         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38739         return ret_ref;
38740 }
38741 int64_t  __attribute__((export_name("TS_RoutingFees_clone_ptr"))) TS_RoutingFees_clone_ptr(uint64_t arg) {
38742         LDKRoutingFees arg_conv;
38743         arg_conv.inner = untag_ptr(arg);
38744         arg_conv.is_owned = ptr_is_owned(arg);
38745         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
38746         arg_conv.is_owned = false;
38747         int64_t ret_conv = RoutingFees_clone_ptr(&arg_conv);
38748         return ret_conv;
38749 }
38750
38751 uint64_t  __attribute__((export_name("TS_RoutingFees_clone"))) TS_RoutingFees_clone(uint64_t orig) {
38752         LDKRoutingFees orig_conv;
38753         orig_conv.inner = untag_ptr(orig);
38754         orig_conv.is_owned = ptr_is_owned(orig);
38755         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
38756         orig_conv.is_owned = false;
38757         LDKRoutingFees ret_var = RoutingFees_clone(&orig_conv);
38758         uint64_t ret_ref = 0;
38759         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38760         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38761         return ret_ref;
38762 }
38763
38764 int64_t  __attribute__((export_name("TS_RoutingFees_hash"))) TS_RoutingFees_hash(uint64_t o) {
38765         LDKRoutingFees o_conv;
38766         o_conv.inner = untag_ptr(o);
38767         o_conv.is_owned = ptr_is_owned(o);
38768         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
38769         o_conv.is_owned = false;
38770         int64_t ret_conv = RoutingFees_hash(&o_conv);
38771         return ret_conv;
38772 }
38773
38774 int8_tArray  __attribute__((export_name("TS_RoutingFees_write"))) TS_RoutingFees_write(uint64_t obj) {
38775         LDKRoutingFees obj_conv;
38776         obj_conv.inner = untag_ptr(obj);
38777         obj_conv.is_owned = ptr_is_owned(obj);
38778         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
38779         obj_conv.is_owned = false;
38780         LDKCVec_u8Z ret_var = RoutingFees_write(&obj_conv);
38781         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
38782         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
38783         CVec_u8Z_free(ret_var);
38784         return ret_arr;
38785 }
38786
38787 uint64_t  __attribute__((export_name("TS_RoutingFees_read"))) TS_RoutingFees_read(int8_tArray ser) {
38788         LDKu8slice ser_ref;
38789         ser_ref.datalen = ser->arr_len;
38790         ser_ref.data = ser->elems;
38791         LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
38792         *ret_conv = RoutingFees_read(ser_ref);
38793         FREE(ser);
38794         return tag_ptr(ret_conv, true);
38795 }
38796
38797 void  __attribute__((export_name("TS_NodeAnnouncementInfo_free"))) TS_NodeAnnouncementInfo_free(uint64_t this_obj) {
38798         LDKNodeAnnouncementInfo this_obj_conv;
38799         this_obj_conv.inner = untag_ptr(this_obj);
38800         this_obj_conv.is_owned = ptr_is_owned(this_obj);
38801         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38802         NodeAnnouncementInfo_free(this_obj_conv);
38803 }
38804
38805 uint64_t  __attribute__((export_name("TS_NodeAnnouncementInfo_get_features"))) TS_NodeAnnouncementInfo_get_features(uint64_t this_ptr) {
38806         LDKNodeAnnouncementInfo this_ptr_conv;
38807         this_ptr_conv.inner = untag_ptr(this_ptr);
38808         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38809         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38810         this_ptr_conv.is_owned = false;
38811         LDKNodeFeatures ret_var = NodeAnnouncementInfo_get_features(&this_ptr_conv);
38812         uint64_t ret_ref = 0;
38813         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38814         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38815         return ret_ref;
38816 }
38817
38818 void  __attribute__((export_name("TS_NodeAnnouncementInfo_set_features"))) TS_NodeAnnouncementInfo_set_features(uint64_t this_ptr, uint64_t val) {
38819         LDKNodeAnnouncementInfo this_ptr_conv;
38820         this_ptr_conv.inner = untag_ptr(this_ptr);
38821         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38822         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38823         this_ptr_conv.is_owned = false;
38824         LDKNodeFeatures val_conv;
38825         val_conv.inner = untag_ptr(val);
38826         val_conv.is_owned = ptr_is_owned(val);
38827         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
38828         val_conv = NodeFeatures_clone(&val_conv);
38829         NodeAnnouncementInfo_set_features(&this_ptr_conv, val_conv);
38830 }
38831
38832 int32_t  __attribute__((export_name("TS_NodeAnnouncementInfo_get_last_update"))) TS_NodeAnnouncementInfo_get_last_update(uint64_t this_ptr) {
38833         LDKNodeAnnouncementInfo this_ptr_conv;
38834         this_ptr_conv.inner = untag_ptr(this_ptr);
38835         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38836         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38837         this_ptr_conv.is_owned = false;
38838         int32_t ret_conv = NodeAnnouncementInfo_get_last_update(&this_ptr_conv);
38839         return ret_conv;
38840 }
38841
38842 void  __attribute__((export_name("TS_NodeAnnouncementInfo_set_last_update"))) TS_NodeAnnouncementInfo_set_last_update(uint64_t this_ptr, int32_t val) {
38843         LDKNodeAnnouncementInfo this_ptr_conv;
38844         this_ptr_conv.inner = untag_ptr(this_ptr);
38845         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38846         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38847         this_ptr_conv.is_owned = false;
38848         NodeAnnouncementInfo_set_last_update(&this_ptr_conv, val);
38849 }
38850
38851 int8_tArray  __attribute__((export_name("TS_NodeAnnouncementInfo_get_rgb"))) TS_NodeAnnouncementInfo_get_rgb(uint64_t this_ptr) {
38852         LDKNodeAnnouncementInfo this_ptr_conv;
38853         this_ptr_conv.inner = untag_ptr(this_ptr);
38854         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38855         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38856         this_ptr_conv.is_owned = false;
38857         int8_tArray ret_arr = init_int8_tArray(3, __LINE__);
38858         memcpy(ret_arr->elems, *NodeAnnouncementInfo_get_rgb(&this_ptr_conv), 3);
38859         return ret_arr;
38860 }
38861
38862 void  __attribute__((export_name("TS_NodeAnnouncementInfo_set_rgb"))) TS_NodeAnnouncementInfo_set_rgb(uint64_t this_ptr, int8_tArray val) {
38863         LDKNodeAnnouncementInfo this_ptr_conv;
38864         this_ptr_conv.inner = untag_ptr(this_ptr);
38865         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38866         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38867         this_ptr_conv.is_owned = false;
38868         LDKThreeBytes val_ref;
38869         CHECK(val->arr_len == 3);
38870         memcpy(val_ref.data, val->elems, 3); FREE(val);
38871         NodeAnnouncementInfo_set_rgb(&this_ptr_conv, val_ref);
38872 }
38873
38874 uint64_t  __attribute__((export_name("TS_NodeAnnouncementInfo_get_alias"))) TS_NodeAnnouncementInfo_get_alias(uint64_t this_ptr) {
38875         LDKNodeAnnouncementInfo this_ptr_conv;
38876         this_ptr_conv.inner = untag_ptr(this_ptr);
38877         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38878         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38879         this_ptr_conv.is_owned = false;
38880         LDKNodeAlias ret_var = NodeAnnouncementInfo_get_alias(&this_ptr_conv);
38881         uint64_t ret_ref = 0;
38882         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38883         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38884         return ret_ref;
38885 }
38886
38887 void  __attribute__((export_name("TS_NodeAnnouncementInfo_set_alias"))) TS_NodeAnnouncementInfo_set_alias(uint64_t this_ptr, uint64_t val) {
38888         LDKNodeAnnouncementInfo this_ptr_conv;
38889         this_ptr_conv.inner = untag_ptr(this_ptr);
38890         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38891         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38892         this_ptr_conv.is_owned = false;
38893         LDKNodeAlias val_conv;
38894         val_conv.inner = untag_ptr(val);
38895         val_conv.is_owned = ptr_is_owned(val);
38896         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
38897         val_conv = NodeAlias_clone(&val_conv);
38898         NodeAnnouncementInfo_set_alias(&this_ptr_conv, val_conv);
38899 }
38900
38901 uint64_tArray  __attribute__((export_name("TS_NodeAnnouncementInfo_get_addresses"))) TS_NodeAnnouncementInfo_get_addresses(uint64_t this_ptr) {
38902         LDKNodeAnnouncementInfo this_ptr_conv;
38903         this_ptr_conv.inner = untag_ptr(this_ptr);
38904         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38905         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38906         this_ptr_conv.is_owned = false;
38907         LDKCVec_NetAddressZ ret_var = NodeAnnouncementInfo_get_addresses(&this_ptr_conv);
38908         uint64_tArray ret_arr = NULL;
38909         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
38910         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
38911         for (size_t m = 0; m < ret_var.datalen; m++) {
38912                 LDKNetAddress *ret_conv_12_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
38913                 *ret_conv_12_copy = ret_var.data[m];
38914                 uint64_t ret_conv_12_ref = tag_ptr(ret_conv_12_copy, true);
38915                 ret_arr_ptr[m] = ret_conv_12_ref;
38916         }
38917         
38918         FREE(ret_var.data);
38919         return ret_arr;
38920 }
38921
38922 void  __attribute__((export_name("TS_NodeAnnouncementInfo_set_addresses"))) TS_NodeAnnouncementInfo_set_addresses(uint64_t this_ptr, uint64_tArray val) {
38923         LDKNodeAnnouncementInfo this_ptr_conv;
38924         this_ptr_conv.inner = untag_ptr(this_ptr);
38925         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38926         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38927         this_ptr_conv.is_owned = false;
38928         LDKCVec_NetAddressZ val_constr;
38929         val_constr.datalen = val->arr_len;
38930         if (val_constr.datalen > 0)
38931                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
38932         else
38933                 val_constr.data = NULL;
38934         uint64_t* val_vals = val->elems;
38935         for (size_t m = 0; m < val_constr.datalen; m++) {
38936                 uint64_t val_conv_12 = val_vals[m];
38937                 void* val_conv_12_ptr = untag_ptr(val_conv_12);
38938                 CHECK_ACCESS(val_conv_12_ptr);
38939                 LDKNetAddress val_conv_12_conv = *(LDKNetAddress*)(val_conv_12_ptr);
38940                 val_conv_12_conv = NetAddress_clone((LDKNetAddress*)untag_ptr(val_conv_12));
38941                 val_constr.data[m] = val_conv_12_conv;
38942         }
38943         FREE(val);
38944         NodeAnnouncementInfo_set_addresses(&this_ptr_conv, val_constr);
38945 }
38946
38947 uint64_t  __attribute__((export_name("TS_NodeAnnouncementInfo_get_announcement_message"))) TS_NodeAnnouncementInfo_get_announcement_message(uint64_t this_ptr) {
38948         LDKNodeAnnouncementInfo this_ptr_conv;
38949         this_ptr_conv.inner = untag_ptr(this_ptr);
38950         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38951         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38952         this_ptr_conv.is_owned = false;
38953         LDKNodeAnnouncement ret_var = NodeAnnouncementInfo_get_announcement_message(&this_ptr_conv);
38954         uint64_t ret_ref = 0;
38955         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38956         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38957         return ret_ref;
38958 }
38959
38960 void  __attribute__((export_name("TS_NodeAnnouncementInfo_set_announcement_message"))) TS_NodeAnnouncementInfo_set_announcement_message(uint64_t this_ptr, uint64_t val) {
38961         LDKNodeAnnouncementInfo this_ptr_conv;
38962         this_ptr_conv.inner = untag_ptr(this_ptr);
38963         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38964         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38965         this_ptr_conv.is_owned = false;
38966         LDKNodeAnnouncement val_conv;
38967         val_conv.inner = untag_ptr(val);
38968         val_conv.is_owned = ptr_is_owned(val);
38969         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
38970         val_conv = NodeAnnouncement_clone(&val_conv);
38971         NodeAnnouncementInfo_set_announcement_message(&this_ptr_conv, val_conv);
38972 }
38973
38974 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) {
38975         LDKNodeFeatures features_arg_conv;
38976         features_arg_conv.inner = untag_ptr(features_arg);
38977         features_arg_conv.is_owned = ptr_is_owned(features_arg);
38978         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
38979         features_arg_conv = NodeFeatures_clone(&features_arg_conv);
38980         LDKThreeBytes rgb_arg_ref;
38981         CHECK(rgb_arg->arr_len == 3);
38982         memcpy(rgb_arg_ref.data, rgb_arg->elems, 3); FREE(rgb_arg);
38983         LDKNodeAlias alias_arg_conv;
38984         alias_arg_conv.inner = untag_ptr(alias_arg);
38985         alias_arg_conv.is_owned = ptr_is_owned(alias_arg);
38986         CHECK_INNER_FIELD_ACCESS_OR_NULL(alias_arg_conv);
38987         alias_arg_conv = NodeAlias_clone(&alias_arg_conv);
38988         LDKCVec_NetAddressZ addresses_arg_constr;
38989         addresses_arg_constr.datalen = addresses_arg->arr_len;
38990         if (addresses_arg_constr.datalen > 0)
38991                 addresses_arg_constr.data = MALLOC(addresses_arg_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
38992         else
38993                 addresses_arg_constr.data = NULL;
38994         uint64_t* addresses_arg_vals = addresses_arg->elems;
38995         for (size_t m = 0; m < addresses_arg_constr.datalen; m++) {
38996                 uint64_t addresses_arg_conv_12 = addresses_arg_vals[m];
38997                 void* addresses_arg_conv_12_ptr = untag_ptr(addresses_arg_conv_12);
38998                 CHECK_ACCESS(addresses_arg_conv_12_ptr);
38999                 LDKNetAddress addresses_arg_conv_12_conv = *(LDKNetAddress*)(addresses_arg_conv_12_ptr);
39000                 addresses_arg_constr.data[m] = addresses_arg_conv_12_conv;
39001         }
39002         FREE(addresses_arg);
39003         LDKNodeAnnouncement announcement_message_arg_conv;
39004         announcement_message_arg_conv.inner = untag_ptr(announcement_message_arg);
39005         announcement_message_arg_conv.is_owned = ptr_is_owned(announcement_message_arg);
39006         CHECK_INNER_FIELD_ACCESS_OR_NULL(announcement_message_arg_conv);
39007         announcement_message_arg_conv = NodeAnnouncement_clone(&announcement_message_arg_conv);
39008         LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_new(features_arg_conv, last_update_arg, rgb_arg_ref, alias_arg_conv, addresses_arg_constr, announcement_message_arg_conv);
39009         uint64_t ret_ref = 0;
39010         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39011         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39012         return ret_ref;
39013 }
39014
39015 static inline uint64_t NodeAnnouncementInfo_clone_ptr(LDKNodeAnnouncementInfo *NONNULL_PTR arg) {
39016         LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_clone(arg);
39017         uint64_t ret_ref = 0;
39018         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39019         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39020         return ret_ref;
39021 }
39022 int64_t  __attribute__((export_name("TS_NodeAnnouncementInfo_clone_ptr"))) TS_NodeAnnouncementInfo_clone_ptr(uint64_t arg) {
39023         LDKNodeAnnouncementInfo arg_conv;
39024         arg_conv.inner = untag_ptr(arg);
39025         arg_conv.is_owned = ptr_is_owned(arg);
39026         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39027         arg_conv.is_owned = false;
39028         int64_t ret_conv = NodeAnnouncementInfo_clone_ptr(&arg_conv);
39029         return ret_conv;
39030 }
39031
39032 uint64_t  __attribute__((export_name("TS_NodeAnnouncementInfo_clone"))) TS_NodeAnnouncementInfo_clone(uint64_t orig) {
39033         LDKNodeAnnouncementInfo orig_conv;
39034         orig_conv.inner = untag_ptr(orig);
39035         orig_conv.is_owned = ptr_is_owned(orig);
39036         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39037         orig_conv.is_owned = false;
39038         LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_clone(&orig_conv);
39039         uint64_t ret_ref = 0;
39040         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39041         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39042         return ret_ref;
39043 }
39044
39045 int8_tArray  __attribute__((export_name("TS_NodeAnnouncementInfo_write"))) TS_NodeAnnouncementInfo_write(uint64_t obj) {
39046         LDKNodeAnnouncementInfo obj_conv;
39047         obj_conv.inner = untag_ptr(obj);
39048         obj_conv.is_owned = ptr_is_owned(obj);
39049         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
39050         obj_conv.is_owned = false;
39051         LDKCVec_u8Z ret_var = NodeAnnouncementInfo_write(&obj_conv);
39052         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
39053         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
39054         CVec_u8Z_free(ret_var);
39055         return ret_arr;
39056 }
39057
39058 uint64_t  __attribute__((export_name("TS_NodeAnnouncementInfo_read"))) TS_NodeAnnouncementInfo_read(int8_tArray ser) {
39059         LDKu8slice ser_ref;
39060         ser_ref.datalen = ser->arr_len;
39061         ser_ref.data = ser->elems;
39062         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
39063         *ret_conv = NodeAnnouncementInfo_read(ser_ref);
39064         FREE(ser);
39065         return tag_ptr(ret_conv, true);
39066 }
39067
39068 void  __attribute__((export_name("TS_NodeAlias_free"))) TS_NodeAlias_free(uint64_t this_obj) {
39069         LDKNodeAlias this_obj_conv;
39070         this_obj_conv.inner = untag_ptr(this_obj);
39071         this_obj_conv.is_owned = ptr_is_owned(this_obj);
39072         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39073         NodeAlias_free(this_obj_conv);
39074 }
39075
39076 int8_tArray  __attribute__((export_name("TS_NodeAlias_get_a"))) TS_NodeAlias_get_a(uint64_t this_ptr) {
39077         LDKNodeAlias this_ptr_conv;
39078         this_ptr_conv.inner = untag_ptr(this_ptr);
39079         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39080         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39081         this_ptr_conv.is_owned = false;
39082         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
39083         memcpy(ret_arr->elems, *NodeAlias_get_a(&this_ptr_conv), 32);
39084         return ret_arr;
39085 }
39086
39087 void  __attribute__((export_name("TS_NodeAlias_set_a"))) TS_NodeAlias_set_a(uint64_t this_ptr, int8_tArray val) {
39088         LDKNodeAlias this_ptr_conv;
39089         this_ptr_conv.inner = untag_ptr(this_ptr);
39090         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39091         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39092         this_ptr_conv.is_owned = false;
39093         LDKThirtyTwoBytes val_ref;
39094         CHECK(val->arr_len == 32);
39095         memcpy(val_ref.data, val->elems, 32); FREE(val);
39096         NodeAlias_set_a(&this_ptr_conv, val_ref);
39097 }
39098
39099 uint64_t  __attribute__((export_name("TS_NodeAlias_new"))) TS_NodeAlias_new(int8_tArray a_arg) {
39100         LDKThirtyTwoBytes a_arg_ref;
39101         CHECK(a_arg->arr_len == 32);
39102         memcpy(a_arg_ref.data, a_arg->elems, 32); FREE(a_arg);
39103         LDKNodeAlias ret_var = NodeAlias_new(a_arg_ref);
39104         uint64_t ret_ref = 0;
39105         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39106         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39107         return ret_ref;
39108 }
39109
39110 static inline uint64_t NodeAlias_clone_ptr(LDKNodeAlias *NONNULL_PTR arg) {
39111         LDKNodeAlias ret_var = NodeAlias_clone(arg);
39112         uint64_t ret_ref = 0;
39113         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39114         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39115         return ret_ref;
39116 }
39117 int64_t  __attribute__((export_name("TS_NodeAlias_clone_ptr"))) TS_NodeAlias_clone_ptr(uint64_t arg) {
39118         LDKNodeAlias arg_conv;
39119         arg_conv.inner = untag_ptr(arg);
39120         arg_conv.is_owned = ptr_is_owned(arg);
39121         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39122         arg_conv.is_owned = false;
39123         int64_t ret_conv = NodeAlias_clone_ptr(&arg_conv);
39124         return ret_conv;
39125 }
39126
39127 uint64_t  __attribute__((export_name("TS_NodeAlias_clone"))) TS_NodeAlias_clone(uint64_t orig) {
39128         LDKNodeAlias orig_conv;
39129         orig_conv.inner = untag_ptr(orig);
39130         orig_conv.is_owned = ptr_is_owned(orig);
39131         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39132         orig_conv.is_owned = false;
39133         LDKNodeAlias ret_var = NodeAlias_clone(&orig_conv);
39134         uint64_t ret_ref = 0;
39135         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39136         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39137         return ret_ref;
39138 }
39139
39140 int8_tArray  __attribute__((export_name("TS_NodeAlias_write"))) TS_NodeAlias_write(uint64_t obj) {
39141         LDKNodeAlias obj_conv;
39142         obj_conv.inner = untag_ptr(obj);
39143         obj_conv.is_owned = ptr_is_owned(obj);
39144         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
39145         obj_conv.is_owned = false;
39146         LDKCVec_u8Z ret_var = NodeAlias_write(&obj_conv);
39147         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
39148         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
39149         CVec_u8Z_free(ret_var);
39150         return ret_arr;
39151 }
39152
39153 uint64_t  __attribute__((export_name("TS_NodeAlias_read"))) TS_NodeAlias_read(int8_tArray ser) {
39154         LDKu8slice ser_ref;
39155         ser_ref.datalen = ser->arr_len;
39156         ser_ref.data = ser->elems;
39157         LDKCResult_NodeAliasDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAliasDecodeErrorZ), "LDKCResult_NodeAliasDecodeErrorZ");
39158         *ret_conv = NodeAlias_read(ser_ref);
39159         FREE(ser);
39160         return tag_ptr(ret_conv, true);
39161 }
39162
39163 void  __attribute__((export_name("TS_NodeInfo_free"))) TS_NodeInfo_free(uint64_t this_obj) {
39164         LDKNodeInfo this_obj_conv;
39165         this_obj_conv.inner = untag_ptr(this_obj);
39166         this_obj_conv.is_owned = ptr_is_owned(this_obj);
39167         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39168         NodeInfo_free(this_obj_conv);
39169 }
39170
39171 int64_tArray  __attribute__((export_name("TS_NodeInfo_get_channels"))) TS_NodeInfo_get_channels(uint64_t this_ptr) {
39172         LDKNodeInfo this_ptr_conv;
39173         this_ptr_conv.inner = untag_ptr(this_ptr);
39174         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39175         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39176         this_ptr_conv.is_owned = false;
39177         LDKCVec_u64Z ret_var = NodeInfo_get_channels(&this_ptr_conv);
39178         int64_tArray ret_arr = NULL;
39179         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
39180         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
39181         for (size_t i = 0; i < ret_var.datalen; i++) {
39182                 int64_t ret_conv_8_conv = ret_var.data[i];
39183                 ret_arr_ptr[i] = ret_conv_8_conv;
39184         }
39185         
39186         FREE(ret_var.data);
39187         return ret_arr;
39188 }
39189
39190 void  __attribute__((export_name("TS_NodeInfo_set_channels"))) TS_NodeInfo_set_channels(uint64_t this_ptr, int64_tArray val) {
39191         LDKNodeInfo this_ptr_conv;
39192         this_ptr_conv.inner = untag_ptr(this_ptr);
39193         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39194         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39195         this_ptr_conv.is_owned = false;
39196         LDKCVec_u64Z val_constr;
39197         val_constr.datalen = val->arr_len;
39198         if (val_constr.datalen > 0)
39199                 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
39200         else
39201                 val_constr.data = NULL;
39202         int64_t* val_vals = val->elems;
39203         for (size_t i = 0; i < val_constr.datalen; i++) {
39204                 int64_t val_conv_8 = val_vals[i];
39205                 val_constr.data[i] = val_conv_8;
39206         }
39207         FREE(val);
39208         NodeInfo_set_channels(&this_ptr_conv, val_constr);
39209 }
39210
39211 uint64_t  __attribute__((export_name("TS_NodeInfo_get_lowest_inbound_channel_fees"))) TS_NodeInfo_get_lowest_inbound_channel_fees(uint64_t this_ptr) {
39212         LDKNodeInfo this_ptr_conv;
39213         this_ptr_conv.inner = untag_ptr(this_ptr);
39214         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39215         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39216         this_ptr_conv.is_owned = false;
39217         LDKRoutingFees ret_var = NodeInfo_get_lowest_inbound_channel_fees(&this_ptr_conv);
39218         uint64_t ret_ref = 0;
39219         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39220         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39221         return ret_ref;
39222 }
39223
39224 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) {
39225         LDKNodeInfo this_ptr_conv;
39226         this_ptr_conv.inner = untag_ptr(this_ptr);
39227         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39228         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39229         this_ptr_conv.is_owned = false;
39230         LDKRoutingFees val_conv;
39231         val_conv.inner = untag_ptr(val);
39232         val_conv.is_owned = ptr_is_owned(val);
39233         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
39234         val_conv = RoutingFees_clone(&val_conv);
39235         NodeInfo_set_lowest_inbound_channel_fees(&this_ptr_conv, val_conv);
39236 }
39237
39238 uint64_t  __attribute__((export_name("TS_NodeInfo_get_announcement_info"))) TS_NodeInfo_get_announcement_info(uint64_t this_ptr) {
39239         LDKNodeInfo this_ptr_conv;
39240         this_ptr_conv.inner = untag_ptr(this_ptr);
39241         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39242         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39243         this_ptr_conv.is_owned = false;
39244         LDKNodeAnnouncementInfo ret_var = NodeInfo_get_announcement_info(&this_ptr_conv);
39245         uint64_t ret_ref = 0;
39246         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39247         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39248         return ret_ref;
39249 }
39250
39251 void  __attribute__((export_name("TS_NodeInfo_set_announcement_info"))) TS_NodeInfo_set_announcement_info(uint64_t this_ptr, uint64_t val) {
39252         LDKNodeInfo this_ptr_conv;
39253         this_ptr_conv.inner = untag_ptr(this_ptr);
39254         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39255         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39256         this_ptr_conv.is_owned = false;
39257         LDKNodeAnnouncementInfo val_conv;
39258         val_conv.inner = untag_ptr(val);
39259         val_conv.is_owned = ptr_is_owned(val);
39260         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
39261         val_conv = NodeAnnouncementInfo_clone(&val_conv);
39262         NodeInfo_set_announcement_info(&this_ptr_conv, val_conv);
39263 }
39264
39265 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) {
39266         LDKCVec_u64Z channels_arg_constr;
39267         channels_arg_constr.datalen = channels_arg->arr_len;
39268         if (channels_arg_constr.datalen > 0)
39269                 channels_arg_constr.data = MALLOC(channels_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
39270         else
39271                 channels_arg_constr.data = NULL;
39272         int64_t* channels_arg_vals = channels_arg->elems;
39273         for (size_t i = 0; i < channels_arg_constr.datalen; i++) {
39274                 int64_t channels_arg_conv_8 = channels_arg_vals[i];
39275                 channels_arg_constr.data[i] = channels_arg_conv_8;
39276         }
39277         FREE(channels_arg);
39278         LDKRoutingFees lowest_inbound_channel_fees_arg_conv;
39279         lowest_inbound_channel_fees_arg_conv.inner = untag_ptr(lowest_inbound_channel_fees_arg);
39280         lowest_inbound_channel_fees_arg_conv.is_owned = ptr_is_owned(lowest_inbound_channel_fees_arg);
39281         CHECK_INNER_FIELD_ACCESS_OR_NULL(lowest_inbound_channel_fees_arg_conv);
39282         lowest_inbound_channel_fees_arg_conv = RoutingFees_clone(&lowest_inbound_channel_fees_arg_conv);
39283         LDKNodeAnnouncementInfo announcement_info_arg_conv;
39284         announcement_info_arg_conv.inner = untag_ptr(announcement_info_arg);
39285         announcement_info_arg_conv.is_owned = ptr_is_owned(announcement_info_arg);
39286         CHECK_INNER_FIELD_ACCESS_OR_NULL(announcement_info_arg_conv);
39287         announcement_info_arg_conv = NodeAnnouncementInfo_clone(&announcement_info_arg_conv);
39288         LDKNodeInfo ret_var = NodeInfo_new(channels_arg_constr, lowest_inbound_channel_fees_arg_conv, announcement_info_arg_conv);
39289         uint64_t ret_ref = 0;
39290         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39291         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39292         return ret_ref;
39293 }
39294
39295 static inline uint64_t NodeInfo_clone_ptr(LDKNodeInfo *NONNULL_PTR arg) {
39296         LDKNodeInfo ret_var = NodeInfo_clone(arg);
39297         uint64_t ret_ref = 0;
39298         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39299         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39300         return ret_ref;
39301 }
39302 int64_t  __attribute__((export_name("TS_NodeInfo_clone_ptr"))) TS_NodeInfo_clone_ptr(uint64_t arg) {
39303         LDKNodeInfo arg_conv;
39304         arg_conv.inner = untag_ptr(arg);
39305         arg_conv.is_owned = ptr_is_owned(arg);
39306         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39307         arg_conv.is_owned = false;
39308         int64_t ret_conv = NodeInfo_clone_ptr(&arg_conv);
39309         return ret_conv;
39310 }
39311
39312 uint64_t  __attribute__((export_name("TS_NodeInfo_clone"))) TS_NodeInfo_clone(uint64_t orig) {
39313         LDKNodeInfo orig_conv;
39314         orig_conv.inner = untag_ptr(orig);
39315         orig_conv.is_owned = ptr_is_owned(orig);
39316         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39317         orig_conv.is_owned = false;
39318         LDKNodeInfo ret_var = NodeInfo_clone(&orig_conv);
39319         uint64_t ret_ref = 0;
39320         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39321         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39322         return ret_ref;
39323 }
39324
39325 int8_tArray  __attribute__((export_name("TS_NodeInfo_write"))) TS_NodeInfo_write(uint64_t obj) {
39326         LDKNodeInfo obj_conv;
39327         obj_conv.inner = untag_ptr(obj);
39328         obj_conv.is_owned = ptr_is_owned(obj);
39329         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
39330         obj_conv.is_owned = false;
39331         LDKCVec_u8Z ret_var = NodeInfo_write(&obj_conv);
39332         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
39333         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
39334         CVec_u8Z_free(ret_var);
39335         return ret_arr;
39336 }
39337
39338 uint64_t  __attribute__((export_name("TS_NodeInfo_read"))) TS_NodeInfo_read(int8_tArray ser) {
39339         LDKu8slice ser_ref;
39340         ser_ref.datalen = ser->arr_len;
39341         ser_ref.data = ser->elems;
39342         LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
39343         *ret_conv = NodeInfo_read(ser_ref);
39344         FREE(ser);
39345         return tag_ptr(ret_conv, true);
39346 }
39347
39348 int8_tArray  __attribute__((export_name("TS_NetworkGraph_write"))) TS_NetworkGraph_write(uint64_t obj) {
39349         LDKNetworkGraph obj_conv;
39350         obj_conv.inner = untag_ptr(obj);
39351         obj_conv.is_owned = ptr_is_owned(obj);
39352         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
39353         obj_conv.is_owned = false;
39354         LDKCVec_u8Z ret_var = NetworkGraph_write(&obj_conv);
39355         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
39356         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
39357         CVec_u8Z_free(ret_var);
39358         return ret_arr;
39359 }
39360
39361 uint64_t  __attribute__((export_name("TS_NetworkGraph_read"))) TS_NetworkGraph_read(int8_tArray ser, uint64_t arg) {
39362         LDKu8slice ser_ref;
39363         ser_ref.datalen = ser->arr_len;
39364         ser_ref.data = ser->elems;
39365         void* arg_ptr = untag_ptr(arg);
39366         CHECK_ACCESS(arg_ptr);
39367         LDKLogger arg_conv = *(LDKLogger*)(arg_ptr);
39368         if (arg_conv.free == LDKLogger_JCalls_free) {
39369                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
39370                 LDKLogger_JCalls_cloned(&arg_conv);
39371         }
39372         LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
39373         *ret_conv = NetworkGraph_read(ser_ref, arg_conv);
39374         FREE(ser);
39375         return tag_ptr(ret_conv, true);
39376 }
39377
39378 uint64_t  __attribute__((export_name("TS_NetworkGraph_new"))) TS_NetworkGraph_new(int8_tArray genesis_hash, uint64_t logger) {
39379         LDKThirtyTwoBytes genesis_hash_ref;
39380         CHECK(genesis_hash->arr_len == 32);
39381         memcpy(genesis_hash_ref.data, genesis_hash->elems, 32); FREE(genesis_hash);
39382         void* logger_ptr = untag_ptr(logger);
39383         CHECK_ACCESS(logger_ptr);
39384         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
39385         if (logger_conv.free == LDKLogger_JCalls_free) {
39386                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
39387                 LDKLogger_JCalls_cloned(&logger_conv);
39388         }
39389         LDKNetworkGraph ret_var = NetworkGraph_new(genesis_hash_ref, logger_conv);
39390         uint64_t ret_ref = 0;
39391         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39392         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39393         return ret_ref;
39394 }
39395
39396 uint64_t  __attribute__((export_name("TS_NetworkGraph_read_only"))) TS_NetworkGraph_read_only(uint64_t this_arg) {
39397         LDKNetworkGraph this_arg_conv;
39398         this_arg_conv.inner = untag_ptr(this_arg);
39399         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39400         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39401         this_arg_conv.is_owned = false;
39402         LDKReadOnlyNetworkGraph ret_var = NetworkGraph_read_only(&this_arg_conv);
39403         uint64_t ret_ref = 0;
39404         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39405         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39406         return ret_ref;
39407 }
39408
39409 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) {
39410         LDKNetworkGraph this_arg_conv;
39411         this_arg_conv.inner = untag_ptr(this_arg);
39412         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39413         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39414         this_arg_conv.is_owned = false;
39415         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
39416         *ret_copy = NetworkGraph_get_last_rapid_gossip_sync_timestamp(&this_arg_conv);
39417         uint64_t ret_ref = tag_ptr(ret_copy, true);
39418         return ret_ref;
39419 }
39420
39421 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) {
39422         LDKNetworkGraph this_arg_conv;
39423         this_arg_conv.inner = untag_ptr(this_arg);
39424         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39425         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39426         this_arg_conv.is_owned = false;
39427         NetworkGraph_set_last_rapid_gossip_sync_timestamp(&this_arg_conv, last_rapid_gossip_sync_timestamp);
39428 }
39429
39430 uint64_t  __attribute__((export_name("TS_NetworkGraph_update_node_from_announcement"))) TS_NetworkGraph_update_node_from_announcement(uint64_t this_arg, uint64_t msg) {
39431         LDKNetworkGraph this_arg_conv;
39432         this_arg_conv.inner = untag_ptr(this_arg);
39433         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39434         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39435         this_arg_conv.is_owned = false;
39436         LDKNodeAnnouncement msg_conv;
39437         msg_conv.inner = untag_ptr(msg);
39438         msg_conv.is_owned = ptr_is_owned(msg);
39439         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
39440         msg_conv.is_owned = false;
39441         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
39442         *ret_conv = NetworkGraph_update_node_from_announcement(&this_arg_conv, &msg_conv);
39443         return tag_ptr(ret_conv, true);
39444 }
39445
39446 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) {
39447         LDKNetworkGraph this_arg_conv;
39448         this_arg_conv.inner = untag_ptr(this_arg);
39449         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39450         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39451         this_arg_conv.is_owned = false;
39452         LDKUnsignedNodeAnnouncement msg_conv;
39453         msg_conv.inner = untag_ptr(msg);
39454         msg_conv.is_owned = ptr_is_owned(msg);
39455         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
39456         msg_conv.is_owned = false;
39457         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
39458         *ret_conv = NetworkGraph_update_node_from_unsigned_announcement(&this_arg_conv, &msg_conv);
39459         return tag_ptr(ret_conv, true);
39460 }
39461
39462 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) {
39463         LDKNetworkGraph this_arg_conv;
39464         this_arg_conv.inner = untag_ptr(this_arg);
39465         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39466         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39467         this_arg_conv.is_owned = false;
39468         LDKChannelAnnouncement msg_conv;
39469         msg_conv.inner = untag_ptr(msg);
39470         msg_conv.is_owned = ptr_is_owned(msg);
39471         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
39472         msg_conv.is_owned = false;
39473         void* chain_access_ptr = untag_ptr(chain_access);
39474         CHECK_ACCESS(chain_access_ptr);
39475         LDKCOption_AccessZ chain_access_conv = *(LDKCOption_AccessZ*)(chain_access_ptr);
39476         // WARNING: we may need a move here but no clone is available for LDKCOption_AccessZ
39477         if (chain_access_conv.tag == LDKCOption_AccessZ_Some) {
39478                 // Manually implement clone for Java trait instances
39479                 if (chain_access_conv.some.free == LDKAccess_JCalls_free) {
39480                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
39481                         LDKAccess_JCalls_cloned(&chain_access_conv.some);
39482                 }
39483         }
39484         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
39485         *ret_conv = NetworkGraph_update_channel_from_announcement(&this_arg_conv, &msg_conv, chain_access_conv);
39486         return tag_ptr(ret_conv, true);
39487 }
39488
39489 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) {
39490         LDKNetworkGraph this_arg_conv;
39491         this_arg_conv.inner = untag_ptr(this_arg);
39492         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39493         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39494         this_arg_conv.is_owned = false;
39495         LDKUnsignedChannelAnnouncement msg_conv;
39496         msg_conv.inner = untag_ptr(msg);
39497         msg_conv.is_owned = ptr_is_owned(msg);
39498         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
39499         msg_conv.is_owned = false;
39500         void* chain_access_ptr = untag_ptr(chain_access);
39501         CHECK_ACCESS(chain_access_ptr);
39502         LDKCOption_AccessZ chain_access_conv = *(LDKCOption_AccessZ*)(chain_access_ptr);
39503         // WARNING: we may need a move here but no clone is available for LDKCOption_AccessZ
39504         if (chain_access_conv.tag == LDKCOption_AccessZ_Some) {
39505                 // Manually implement clone for Java trait instances
39506                 if (chain_access_conv.some.free == LDKAccess_JCalls_free) {
39507                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
39508                         LDKAccess_JCalls_cloned(&chain_access_conv.some);
39509                 }
39510         }
39511         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
39512         *ret_conv = NetworkGraph_update_channel_from_unsigned_announcement(&this_arg_conv, &msg_conv, chain_access_conv);
39513         return tag_ptr(ret_conv, true);
39514 }
39515
39516 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) {
39517         LDKNetworkGraph this_arg_conv;
39518         this_arg_conv.inner = untag_ptr(this_arg);
39519         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39520         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39521         this_arg_conv.is_owned = false;
39522         LDKChannelFeatures features_conv;
39523         features_conv.inner = untag_ptr(features);
39524         features_conv.is_owned = ptr_is_owned(features);
39525         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_conv);
39526         features_conv = ChannelFeatures_clone(&features_conv);
39527         LDKPublicKey node_id_1_ref;
39528         CHECK(node_id_1->arr_len == 33);
39529         memcpy(node_id_1_ref.compressed_form, node_id_1->elems, 33); FREE(node_id_1);
39530         LDKPublicKey node_id_2_ref;
39531         CHECK(node_id_2->arr_len == 33);
39532         memcpy(node_id_2_ref.compressed_form, node_id_2->elems, 33); FREE(node_id_2);
39533         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
39534         *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);
39535         return tag_ptr(ret_conv, true);
39536 }
39537
39538 void  __attribute__((export_name("TS_NetworkGraph_channel_failed"))) TS_NetworkGraph_channel_failed(uint64_t this_arg, int64_t short_channel_id, jboolean is_permanent) {
39539         LDKNetworkGraph this_arg_conv;
39540         this_arg_conv.inner = untag_ptr(this_arg);
39541         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39542         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39543         this_arg_conv.is_owned = false;
39544         NetworkGraph_channel_failed(&this_arg_conv, short_channel_id, is_permanent);
39545 }
39546
39547 void  __attribute__((export_name("TS_NetworkGraph_node_failed"))) TS_NetworkGraph_node_failed(uint64_t this_arg, int8_tArray _node_id, jboolean is_permanent) {
39548         LDKNetworkGraph this_arg_conv;
39549         this_arg_conv.inner = untag_ptr(this_arg);
39550         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39551         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39552         this_arg_conv.is_owned = false;
39553         LDKPublicKey _node_id_ref;
39554         CHECK(_node_id->arr_len == 33);
39555         memcpy(_node_id_ref.compressed_form, _node_id->elems, 33); FREE(_node_id);
39556         NetworkGraph_node_failed(&this_arg_conv, _node_id_ref, is_permanent);
39557 }
39558
39559 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) {
39560         LDKNetworkGraph this_arg_conv;
39561         this_arg_conv.inner = untag_ptr(this_arg);
39562         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39563         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39564         this_arg_conv.is_owned = false;
39565         NetworkGraph_remove_stale_channels_with_time(&this_arg_conv, current_time_unix);
39566 }
39567
39568 uint64_t  __attribute__((export_name("TS_NetworkGraph_update_channel"))) TS_NetworkGraph_update_channel(uint64_t this_arg, uint64_t msg) {
39569         LDKNetworkGraph this_arg_conv;
39570         this_arg_conv.inner = untag_ptr(this_arg);
39571         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39572         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39573         this_arg_conv.is_owned = false;
39574         LDKChannelUpdate msg_conv;
39575         msg_conv.inner = untag_ptr(msg);
39576         msg_conv.is_owned = ptr_is_owned(msg);
39577         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
39578         msg_conv.is_owned = false;
39579         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
39580         *ret_conv = NetworkGraph_update_channel(&this_arg_conv, &msg_conv);
39581         return tag_ptr(ret_conv, true);
39582 }
39583
39584 uint64_t  __attribute__((export_name("TS_NetworkGraph_update_channel_unsigned"))) TS_NetworkGraph_update_channel_unsigned(uint64_t this_arg, uint64_t msg) {
39585         LDKNetworkGraph this_arg_conv;
39586         this_arg_conv.inner = untag_ptr(this_arg);
39587         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39588         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39589         this_arg_conv.is_owned = false;
39590         LDKUnsignedChannelUpdate msg_conv;
39591         msg_conv.inner = untag_ptr(msg);
39592         msg_conv.is_owned = ptr_is_owned(msg);
39593         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
39594         msg_conv.is_owned = false;
39595         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
39596         *ret_conv = NetworkGraph_update_channel_unsigned(&this_arg_conv, &msg_conv);
39597         return tag_ptr(ret_conv, true);
39598 }
39599
39600 uint64_t  __attribute__((export_name("TS_ReadOnlyNetworkGraph_channel"))) TS_ReadOnlyNetworkGraph_channel(uint64_t this_arg, int64_t short_channel_id) {
39601         LDKReadOnlyNetworkGraph this_arg_conv;
39602         this_arg_conv.inner = untag_ptr(this_arg);
39603         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39604         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39605         this_arg_conv.is_owned = false;
39606         LDKChannelInfo ret_var = ReadOnlyNetworkGraph_channel(&this_arg_conv, short_channel_id);
39607         uint64_t ret_ref = 0;
39608         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39609         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39610         return ret_ref;
39611 }
39612
39613 int64_tArray  __attribute__((export_name("TS_ReadOnlyNetworkGraph_list_channels"))) TS_ReadOnlyNetworkGraph_list_channels(uint64_t this_arg) {
39614         LDKReadOnlyNetworkGraph this_arg_conv;
39615         this_arg_conv.inner = untag_ptr(this_arg);
39616         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39617         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39618         this_arg_conv.is_owned = false;
39619         LDKCVec_u64Z ret_var = ReadOnlyNetworkGraph_list_channels(&this_arg_conv);
39620         int64_tArray ret_arr = NULL;
39621         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
39622         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
39623         for (size_t i = 0; i < ret_var.datalen; i++) {
39624                 int64_t ret_conv_8_conv = ret_var.data[i];
39625                 ret_arr_ptr[i] = ret_conv_8_conv;
39626         }
39627         
39628         FREE(ret_var.data);
39629         return ret_arr;
39630 }
39631
39632 uint64_t  __attribute__((export_name("TS_ReadOnlyNetworkGraph_node"))) TS_ReadOnlyNetworkGraph_node(uint64_t this_arg, uint64_t node_id) {
39633         LDKReadOnlyNetworkGraph this_arg_conv;
39634         this_arg_conv.inner = untag_ptr(this_arg);
39635         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39636         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39637         this_arg_conv.is_owned = false;
39638         LDKNodeId node_id_conv;
39639         node_id_conv.inner = untag_ptr(node_id);
39640         node_id_conv.is_owned = ptr_is_owned(node_id);
39641         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv);
39642         node_id_conv.is_owned = false;
39643         LDKNodeInfo ret_var = ReadOnlyNetworkGraph_node(&this_arg_conv, &node_id_conv);
39644         uint64_t ret_ref = 0;
39645         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39646         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39647         return ret_ref;
39648 }
39649
39650 uint64_tArray  __attribute__((export_name("TS_ReadOnlyNetworkGraph_list_nodes"))) TS_ReadOnlyNetworkGraph_list_nodes(uint64_t this_arg) {
39651         LDKReadOnlyNetworkGraph this_arg_conv;
39652         this_arg_conv.inner = untag_ptr(this_arg);
39653         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39654         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39655         this_arg_conv.is_owned = false;
39656         LDKCVec_NodeIdZ ret_var = ReadOnlyNetworkGraph_list_nodes(&this_arg_conv);
39657         uint64_tArray ret_arr = NULL;
39658         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
39659         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
39660         for (size_t i = 0; i < ret_var.datalen; i++) {
39661                 LDKNodeId ret_conv_8_var = ret_var.data[i];
39662                 uint64_t ret_conv_8_ref = 0;
39663                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_8_var);
39664                 ret_conv_8_ref = tag_ptr(ret_conv_8_var.inner, ret_conv_8_var.is_owned);
39665                 ret_arr_ptr[i] = ret_conv_8_ref;
39666         }
39667         
39668         FREE(ret_var.data);
39669         return ret_arr;
39670 }
39671
39672 uint64_t  __attribute__((export_name("TS_ReadOnlyNetworkGraph_get_addresses"))) TS_ReadOnlyNetworkGraph_get_addresses(uint64_t this_arg, int8_tArray pubkey) {
39673         LDKReadOnlyNetworkGraph this_arg_conv;
39674         this_arg_conv.inner = untag_ptr(this_arg);
39675         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39676         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39677         this_arg_conv.is_owned = false;
39678         LDKPublicKey pubkey_ref;
39679         CHECK(pubkey->arr_len == 33);
39680         memcpy(pubkey_ref.compressed_form, pubkey->elems, 33); FREE(pubkey);
39681         LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
39682         *ret_copy = ReadOnlyNetworkGraph_get_addresses(&this_arg_conv, pubkey_ref);
39683         uint64_t ret_ref = tag_ptr(ret_copy, true);
39684         return ret_ref;
39685 }
39686
39687 void  __attribute__((export_name("TS_RouteHop_free"))) TS_RouteHop_free(uint64_t this_obj) {
39688         LDKRouteHop this_obj_conv;
39689         this_obj_conv.inner = untag_ptr(this_obj);
39690         this_obj_conv.is_owned = ptr_is_owned(this_obj);
39691         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39692         RouteHop_free(this_obj_conv);
39693 }
39694
39695 int8_tArray  __attribute__((export_name("TS_RouteHop_get_pubkey"))) TS_RouteHop_get_pubkey(uint64_t this_ptr) {
39696         LDKRouteHop this_ptr_conv;
39697         this_ptr_conv.inner = untag_ptr(this_ptr);
39698         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39699         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39700         this_ptr_conv.is_owned = false;
39701         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
39702         memcpy(ret_arr->elems, RouteHop_get_pubkey(&this_ptr_conv).compressed_form, 33);
39703         return ret_arr;
39704 }
39705
39706 void  __attribute__((export_name("TS_RouteHop_set_pubkey"))) TS_RouteHop_set_pubkey(uint64_t this_ptr, int8_tArray val) {
39707         LDKRouteHop this_ptr_conv;
39708         this_ptr_conv.inner = untag_ptr(this_ptr);
39709         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39710         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39711         this_ptr_conv.is_owned = false;
39712         LDKPublicKey val_ref;
39713         CHECK(val->arr_len == 33);
39714         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
39715         RouteHop_set_pubkey(&this_ptr_conv, val_ref);
39716 }
39717
39718 uint64_t  __attribute__((export_name("TS_RouteHop_get_node_features"))) TS_RouteHop_get_node_features(uint64_t this_ptr) {
39719         LDKRouteHop this_ptr_conv;
39720         this_ptr_conv.inner = untag_ptr(this_ptr);
39721         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39722         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39723         this_ptr_conv.is_owned = false;
39724         LDKNodeFeatures ret_var = RouteHop_get_node_features(&this_ptr_conv);
39725         uint64_t ret_ref = 0;
39726         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39727         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39728         return ret_ref;
39729 }
39730
39731 void  __attribute__((export_name("TS_RouteHop_set_node_features"))) TS_RouteHop_set_node_features(uint64_t this_ptr, uint64_t val) {
39732         LDKRouteHop this_ptr_conv;
39733         this_ptr_conv.inner = untag_ptr(this_ptr);
39734         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39735         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39736         this_ptr_conv.is_owned = false;
39737         LDKNodeFeatures val_conv;
39738         val_conv.inner = untag_ptr(val);
39739         val_conv.is_owned = ptr_is_owned(val);
39740         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
39741         val_conv = NodeFeatures_clone(&val_conv);
39742         RouteHop_set_node_features(&this_ptr_conv, val_conv);
39743 }
39744
39745 int64_t  __attribute__((export_name("TS_RouteHop_get_short_channel_id"))) TS_RouteHop_get_short_channel_id(uint64_t this_ptr) {
39746         LDKRouteHop this_ptr_conv;
39747         this_ptr_conv.inner = untag_ptr(this_ptr);
39748         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39749         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39750         this_ptr_conv.is_owned = false;
39751         int64_t ret_conv = RouteHop_get_short_channel_id(&this_ptr_conv);
39752         return ret_conv;
39753 }
39754
39755 void  __attribute__((export_name("TS_RouteHop_set_short_channel_id"))) TS_RouteHop_set_short_channel_id(uint64_t this_ptr, int64_t val) {
39756         LDKRouteHop this_ptr_conv;
39757         this_ptr_conv.inner = untag_ptr(this_ptr);
39758         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39759         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39760         this_ptr_conv.is_owned = false;
39761         RouteHop_set_short_channel_id(&this_ptr_conv, val);
39762 }
39763
39764 uint64_t  __attribute__((export_name("TS_RouteHop_get_channel_features"))) TS_RouteHop_get_channel_features(uint64_t this_ptr) {
39765         LDKRouteHop this_ptr_conv;
39766         this_ptr_conv.inner = untag_ptr(this_ptr);
39767         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39768         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39769         this_ptr_conv.is_owned = false;
39770         LDKChannelFeatures ret_var = RouteHop_get_channel_features(&this_ptr_conv);
39771         uint64_t ret_ref = 0;
39772         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39773         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39774         return ret_ref;
39775 }
39776
39777 void  __attribute__((export_name("TS_RouteHop_set_channel_features"))) TS_RouteHop_set_channel_features(uint64_t this_ptr, uint64_t val) {
39778         LDKRouteHop this_ptr_conv;
39779         this_ptr_conv.inner = untag_ptr(this_ptr);
39780         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39781         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39782         this_ptr_conv.is_owned = false;
39783         LDKChannelFeatures val_conv;
39784         val_conv.inner = untag_ptr(val);
39785         val_conv.is_owned = ptr_is_owned(val);
39786         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
39787         val_conv = ChannelFeatures_clone(&val_conv);
39788         RouteHop_set_channel_features(&this_ptr_conv, val_conv);
39789 }
39790
39791 int64_t  __attribute__((export_name("TS_RouteHop_get_fee_msat"))) TS_RouteHop_get_fee_msat(uint64_t this_ptr) {
39792         LDKRouteHop this_ptr_conv;
39793         this_ptr_conv.inner = untag_ptr(this_ptr);
39794         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39795         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39796         this_ptr_conv.is_owned = false;
39797         int64_t ret_conv = RouteHop_get_fee_msat(&this_ptr_conv);
39798         return ret_conv;
39799 }
39800
39801 void  __attribute__((export_name("TS_RouteHop_set_fee_msat"))) TS_RouteHop_set_fee_msat(uint64_t this_ptr, int64_t val) {
39802         LDKRouteHop this_ptr_conv;
39803         this_ptr_conv.inner = untag_ptr(this_ptr);
39804         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39805         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39806         this_ptr_conv.is_owned = false;
39807         RouteHop_set_fee_msat(&this_ptr_conv, val);
39808 }
39809
39810 int32_t  __attribute__((export_name("TS_RouteHop_get_cltv_expiry_delta"))) TS_RouteHop_get_cltv_expiry_delta(uint64_t this_ptr) {
39811         LDKRouteHop this_ptr_conv;
39812         this_ptr_conv.inner = untag_ptr(this_ptr);
39813         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39814         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39815         this_ptr_conv.is_owned = false;
39816         int32_t ret_conv = RouteHop_get_cltv_expiry_delta(&this_ptr_conv);
39817         return ret_conv;
39818 }
39819
39820 void  __attribute__((export_name("TS_RouteHop_set_cltv_expiry_delta"))) TS_RouteHop_set_cltv_expiry_delta(uint64_t this_ptr, int32_t val) {
39821         LDKRouteHop this_ptr_conv;
39822         this_ptr_conv.inner = untag_ptr(this_ptr);
39823         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39824         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39825         this_ptr_conv.is_owned = false;
39826         RouteHop_set_cltv_expiry_delta(&this_ptr_conv, val);
39827 }
39828
39829 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) {
39830         LDKPublicKey pubkey_arg_ref;
39831         CHECK(pubkey_arg->arr_len == 33);
39832         memcpy(pubkey_arg_ref.compressed_form, pubkey_arg->elems, 33); FREE(pubkey_arg);
39833         LDKNodeFeatures node_features_arg_conv;
39834         node_features_arg_conv.inner = untag_ptr(node_features_arg);
39835         node_features_arg_conv.is_owned = ptr_is_owned(node_features_arg);
39836         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_features_arg_conv);
39837         node_features_arg_conv = NodeFeatures_clone(&node_features_arg_conv);
39838         LDKChannelFeatures channel_features_arg_conv;
39839         channel_features_arg_conv.inner = untag_ptr(channel_features_arg);
39840         channel_features_arg_conv.is_owned = ptr_is_owned(channel_features_arg);
39841         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_features_arg_conv);
39842         channel_features_arg_conv = ChannelFeatures_clone(&channel_features_arg_conv);
39843         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);
39844         uint64_t ret_ref = 0;
39845         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39846         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39847         return ret_ref;
39848 }
39849
39850 static inline uint64_t RouteHop_clone_ptr(LDKRouteHop *NONNULL_PTR arg) {
39851         LDKRouteHop ret_var = RouteHop_clone(arg);
39852         uint64_t ret_ref = 0;
39853         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39854         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39855         return ret_ref;
39856 }
39857 int64_t  __attribute__((export_name("TS_RouteHop_clone_ptr"))) TS_RouteHop_clone_ptr(uint64_t arg) {
39858         LDKRouteHop arg_conv;
39859         arg_conv.inner = untag_ptr(arg);
39860         arg_conv.is_owned = ptr_is_owned(arg);
39861         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39862         arg_conv.is_owned = false;
39863         int64_t ret_conv = RouteHop_clone_ptr(&arg_conv);
39864         return ret_conv;
39865 }
39866
39867 uint64_t  __attribute__((export_name("TS_RouteHop_clone"))) TS_RouteHop_clone(uint64_t orig) {
39868         LDKRouteHop orig_conv;
39869         orig_conv.inner = untag_ptr(orig);
39870         orig_conv.is_owned = ptr_is_owned(orig);
39871         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39872         orig_conv.is_owned = false;
39873         LDKRouteHop ret_var = RouteHop_clone(&orig_conv);
39874         uint64_t ret_ref = 0;
39875         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39876         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39877         return ret_ref;
39878 }
39879
39880 int64_t  __attribute__((export_name("TS_RouteHop_hash"))) TS_RouteHop_hash(uint64_t o) {
39881         LDKRouteHop o_conv;
39882         o_conv.inner = untag_ptr(o);
39883         o_conv.is_owned = ptr_is_owned(o);
39884         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
39885         o_conv.is_owned = false;
39886         int64_t ret_conv = RouteHop_hash(&o_conv);
39887         return ret_conv;
39888 }
39889
39890 jboolean  __attribute__((export_name("TS_RouteHop_eq"))) TS_RouteHop_eq(uint64_t a, uint64_t b) {
39891         LDKRouteHop a_conv;
39892         a_conv.inner = untag_ptr(a);
39893         a_conv.is_owned = ptr_is_owned(a);
39894         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
39895         a_conv.is_owned = false;
39896         LDKRouteHop b_conv;
39897         b_conv.inner = untag_ptr(b);
39898         b_conv.is_owned = ptr_is_owned(b);
39899         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
39900         b_conv.is_owned = false;
39901         jboolean ret_conv = RouteHop_eq(&a_conv, &b_conv);
39902         return ret_conv;
39903 }
39904
39905 int8_tArray  __attribute__((export_name("TS_RouteHop_write"))) TS_RouteHop_write(uint64_t obj) {
39906         LDKRouteHop obj_conv;
39907         obj_conv.inner = untag_ptr(obj);
39908         obj_conv.is_owned = ptr_is_owned(obj);
39909         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
39910         obj_conv.is_owned = false;
39911         LDKCVec_u8Z ret_var = RouteHop_write(&obj_conv);
39912         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
39913         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
39914         CVec_u8Z_free(ret_var);
39915         return ret_arr;
39916 }
39917
39918 uint64_t  __attribute__((export_name("TS_RouteHop_read"))) TS_RouteHop_read(int8_tArray ser) {
39919         LDKu8slice ser_ref;
39920         ser_ref.datalen = ser->arr_len;
39921         ser_ref.data = ser->elems;
39922         LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
39923         *ret_conv = RouteHop_read(ser_ref);
39924         FREE(ser);
39925         return tag_ptr(ret_conv, true);
39926 }
39927
39928 void  __attribute__((export_name("TS_Route_free"))) TS_Route_free(uint64_t this_obj) {
39929         LDKRoute this_obj_conv;
39930         this_obj_conv.inner = untag_ptr(this_obj);
39931         this_obj_conv.is_owned = ptr_is_owned(this_obj);
39932         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39933         Route_free(this_obj_conv);
39934 }
39935
39936 ptrArray  __attribute__((export_name("TS_Route_get_paths"))) TS_Route_get_paths(uint64_t this_ptr) {
39937         LDKRoute this_ptr_conv;
39938         this_ptr_conv.inner = untag_ptr(this_ptr);
39939         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39940         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39941         this_ptr_conv.is_owned = false;
39942         LDKCVec_CVec_RouteHopZZ ret_var = Route_get_paths(&this_ptr_conv);
39943         ptrArray ret_arr = NULL;
39944         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
39945         uint64_tArray *ret_arr_ptr = (uint64_tArray*)(((uint8_t*)ret_arr) + 8);
39946         for (size_t m = 0; m < ret_var.datalen; m++) {
39947                 LDKCVec_RouteHopZ ret_conv_12_var = ret_var.data[m];
39948                 uint64_tArray ret_conv_12_arr = NULL;
39949                 ret_conv_12_arr = init_uint64_tArray(ret_conv_12_var.datalen, __LINE__);
39950                 uint64_t *ret_conv_12_arr_ptr = (uint64_t*)(((uint8_t*)ret_conv_12_arr) + 8);
39951                 for (size_t k = 0; k < ret_conv_12_var.datalen; k++) {
39952                         LDKRouteHop ret_conv_12_conv_10_var = ret_conv_12_var.data[k];
39953                         uint64_t ret_conv_12_conv_10_ref = 0;
39954                         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_12_conv_10_var);
39955                         ret_conv_12_conv_10_ref = tag_ptr(ret_conv_12_conv_10_var.inner, ret_conv_12_conv_10_var.is_owned);
39956                         ret_conv_12_arr_ptr[k] = ret_conv_12_conv_10_ref;
39957                 }
39958                 
39959                 FREE(ret_conv_12_var.data);
39960                 ret_arr_ptr[m] = ret_conv_12_arr;
39961         }
39962         
39963         FREE(ret_var.data);
39964         return ret_arr;
39965 }
39966
39967 void  __attribute__((export_name("TS_Route_set_paths"))) TS_Route_set_paths(uint64_t this_ptr, ptrArray val) {
39968         LDKRoute this_ptr_conv;
39969         this_ptr_conv.inner = untag_ptr(this_ptr);
39970         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39971         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39972         this_ptr_conv.is_owned = false;
39973         LDKCVec_CVec_RouteHopZZ val_constr;
39974         val_constr.datalen = val->arr_len;
39975         if (val_constr.datalen > 0)
39976                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
39977         else
39978                 val_constr.data = NULL;
39979         uint64_tArray* val_vals = (void*) val->elems;
39980         for (size_t m = 0; m < val_constr.datalen; m++) {
39981                 uint64_tArray val_conv_12 = val_vals[m];
39982                 LDKCVec_RouteHopZ val_conv_12_constr;
39983                 val_conv_12_constr.datalen = val_conv_12->arr_len;
39984                 if (val_conv_12_constr.datalen > 0)
39985                         val_conv_12_constr.data = MALLOC(val_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
39986                 else
39987                         val_conv_12_constr.data = NULL;
39988                 uint64_t* val_conv_12_vals = val_conv_12->elems;
39989                 for (size_t k = 0; k < val_conv_12_constr.datalen; k++) {
39990                         uint64_t val_conv_12_conv_10 = val_conv_12_vals[k];
39991                         LDKRouteHop val_conv_12_conv_10_conv;
39992                         val_conv_12_conv_10_conv.inner = untag_ptr(val_conv_12_conv_10);
39993                         val_conv_12_conv_10_conv.is_owned = ptr_is_owned(val_conv_12_conv_10);
39994                         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_12_conv_10_conv);
39995                         val_conv_12_conv_10_conv = RouteHop_clone(&val_conv_12_conv_10_conv);
39996                         val_conv_12_constr.data[k] = val_conv_12_conv_10_conv;
39997                 }
39998                 FREE(val_conv_12);
39999                 val_constr.data[m] = val_conv_12_constr;
40000         }
40001         FREE(val);
40002         Route_set_paths(&this_ptr_conv, val_constr);
40003 }
40004
40005 uint64_t  __attribute__((export_name("TS_Route_get_payment_params"))) TS_Route_get_payment_params(uint64_t this_ptr) {
40006         LDKRoute this_ptr_conv;
40007         this_ptr_conv.inner = untag_ptr(this_ptr);
40008         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40009         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40010         this_ptr_conv.is_owned = false;
40011         LDKPaymentParameters ret_var = Route_get_payment_params(&this_ptr_conv);
40012         uint64_t ret_ref = 0;
40013         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40014         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40015         return ret_ref;
40016 }
40017
40018 void  __attribute__((export_name("TS_Route_set_payment_params"))) TS_Route_set_payment_params(uint64_t this_ptr, uint64_t val) {
40019         LDKRoute this_ptr_conv;
40020         this_ptr_conv.inner = untag_ptr(this_ptr);
40021         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40022         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40023         this_ptr_conv.is_owned = false;
40024         LDKPaymentParameters val_conv;
40025         val_conv.inner = untag_ptr(val);
40026         val_conv.is_owned = ptr_is_owned(val);
40027         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
40028         val_conv = PaymentParameters_clone(&val_conv);
40029         Route_set_payment_params(&this_ptr_conv, val_conv);
40030 }
40031
40032 uint64_t  __attribute__((export_name("TS_Route_new"))) TS_Route_new(ptrArray paths_arg, uint64_t payment_params_arg) {
40033         LDKCVec_CVec_RouteHopZZ paths_arg_constr;
40034         paths_arg_constr.datalen = paths_arg->arr_len;
40035         if (paths_arg_constr.datalen > 0)
40036                 paths_arg_constr.data = MALLOC(paths_arg_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
40037         else
40038                 paths_arg_constr.data = NULL;
40039         uint64_tArray* paths_arg_vals = (void*) paths_arg->elems;
40040         for (size_t m = 0; m < paths_arg_constr.datalen; m++) {
40041                 uint64_tArray paths_arg_conv_12 = paths_arg_vals[m];
40042                 LDKCVec_RouteHopZ paths_arg_conv_12_constr;
40043                 paths_arg_conv_12_constr.datalen = paths_arg_conv_12->arr_len;
40044                 if (paths_arg_conv_12_constr.datalen > 0)
40045                         paths_arg_conv_12_constr.data = MALLOC(paths_arg_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
40046                 else
40047                         paths_arg_conv_12_constr.data = NULL;
40048                 uint64_t* paths_arg_conv_12_vals = paths_arg_conv_12->elems;
40049                 for (size_t k = 0; k < paths_arg_conv_12_constr.datalen; k++) {
40050                         uint64_t paths_arg_conv_12_conv_10 = paths_arg_conv_12_vals[k];
40051                         LDKRouteHop paths_arg_conv_12_conv_10_conv;
40052                         paths_arg_conv_12_conv_10_conv.inner = untag_ptr(paths_arg_conv_12_conv_10);
40053                         paths_arg_conv_12_conv_10_conv.is_owned = ptr_is_owned(paths_arg_conv_12_conv_10);
40054                         CHECK_INNER_FIELD_ACCESS_OR_NULL(paths_arg_conv_12_conv_10_conv);
40055                         paths_arg_conv_12_conv_10_conv = RouteHop_clone(&paths_arg_conv_12_conv_10_conv);
40056                         paths_arg_conv_12_constr.data[k] = paths_arg_conv_12_conv_10_conv;
40057                 }
40058                 FREE(paths_arg_conv_12);
40059                 paths_arg_constr.data[m] = paths_arg_conv_12_constr;
40060         }
40061         FREE(paths_arg);
40062         LDKPaymentParameters payment_params_arg_conv;
40063         payment_params_arg_conv.inner = untag_ptr(payment_params_arg);
40064         payment_params_arg_conv.is_owned = ptr_is_owned(payment_params_arg);
40065         CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_params_arg_conv);
40066         payment_params_arg_conv = PaymentParameters_clone(&payment_params_arg_conv);
40067         LDKRoute ret_var = Route_new(paths_arg_constr, payment_params_arg_conv);
40068         uint64_t ret_ref = 0;
40069         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40070         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40071         return ret_ref;
40072 }
40073
40074 static inline uint64_t Route_clone_ptr(LDKRoute *NONNULL_PTR arg) {
40075         LDKRoute ret_var = Route_clone(arg);
40076         uint64_t ret_ref = 0;
40077         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40078         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40079         return ret_ref;
40080 }
40081 int64_t  __attribute__((export_name("TS_Route_clone_ptr"))) TS_Route_clone_ptr(uint64_t arg) {
40082         LDKRoute arg_conv;
40083         arg_conv.inner = untag_ptr(arg);
40084         arg_conv.is_owned = ptr_is_owned(arg);
40085         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40086         arg_conv.is_owned = false;
40087         int64_t ret_conv = Route_clone_ptr(&arg_conv);
40088         return ret_conv;
40089 }
40090
40091 uint64_t  __attribute__((export_name("TS_Route_clone"))) TS_Route_clone(uint64_t orig) {
40092         LDKRoute orig_conv;
40093         orig_conv.inner = untag_ptr(orig);
40094         orig_conv.is_owned = ptr_is_owned(orig);
40095         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40096         orig_conv.is_owned = false;
40097         LDKRoute ret_var = Route_clone(&orig_conv);
40098         uint64_t ret_ref = 0;
40099         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40100         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40101         return ret_ref;
40102 }
40103
40104 int64_t  __attribute__((export_name("TS_Route_hash"))) TS_Route_hash(uint64_t o) {
40105         LDKRoute o_conv;
40106         o_conv.inner = untag_ptr(o);
40107         o_conv.is_owned = ptr_is_owned(o);
40108         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
40109         o_conv.is_owned = false;
40110         int64_t ret_conv = Route_hash(&o_conv);
40111         return ret_conv;
40112 }
40113
40114 jboolean  __attribute__((export_name("TS_Route_eq"))) TS_Route_eq(uint64_t a, uint64_t b) {
40115         LDKRoute a_conv;
40116         a_conv.inner = untag_ptr(a);
40117         a_conv.is_owned = ptr_is_owned(a);
40118         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
40119         a_conv.is_owned = false;
40120         LDKRoute b_conv;
40121         b_conv.inner = untag_ptr(b);
40122         b_conv.is_owned = ptr_is_owned(b);
40123         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
40124         b_conv.is_owned = false;
40125         jboolean ret_conv = Route_eq(&a_conv, &b_conv);
40126         return ret_conv;
40127 }
40128
40129 int64_t  __attribute__((export_name("TS_Route_get_total_fees"))) TS_Route_get_total_fees(uint64_t this_arg) {
40130         LDKRoute this_arg_conv;
40131         this_arg_conv.inner = untag_ptr(this_arg);
40132         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40133         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40134         this_arg_conv.is_owned = false;
40135         int64_t ret_conv = Route_get_total_fees(&this_arg_conv);
40136         return ret_conv;
40137 }
40138
40139 int64_t  __attribute__((export_name("TS_Route_get_total_amount"))) TS_Route_get_total_amount(uint64_t this_arg) {
40140         LDKRoute this_arg_conv;
40141         this_arg_conv.inner = untag_ptr(this_arg);
40142         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40143         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40144         this_arg_conv.is_owned = false;
40145         int64_t ret_conv = Route_get_total_amount(&this_arg_conv);
40146         return ret_conv;
40147 }
40148
40149 int8_tArray  __attribute__((export_name("TS_Route_write"))) TS_Route_write(uint64_t obj) {
40150         LDKRoute obj_conv;
40151         obj_conv.inner = untag_ptr(obj);
40152         obj_conv.is_owned = ptr_is_owned(obj);
40153         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
40154         obj_conv.is_owned = false;
40155         LDKCVec_u8Z ret_var = Route_write(&obj_conv);
40156         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
40157         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
40158         CVec_u8Z_free(ret_var);
40159         return ret_arr;
40160 }
40161
40162 uint64_t  __attribute__((export_name("TS_Route_read"))) TS_Route_read(int8_tArray ser) {
40163         LDKu8slice ser_ref;
40164         ser_ref.datalen = ser->arr_len;
40165         ser_ref.data = ser->elems;
40166         LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
40167         *ret_conv = Route_read(ser_ref);
40168         FREE(ser);
40169         return tag_ptr(ret_conv, true);
40170 }
40171
40172 void  __attribute__((export_name("TS_RouteParameters_free"))) TS_RouteParameters_free(uint64_t this_obj) {
40173         LDKRouteParameters this_obj_conv;
40174         this_obj_conv.inner = untag_ptr(this_obj);
40175         this_obj_conv.is_owned = ptr_is_owned(this_obj);
40176         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40177         RouteParameters_free(this_obj_conv);
40178 }
40179
40180 uint64_t  __attribute__((export_name("TS_RouteParameters_get_payment_params"))) TS_RouteParameters_get_payment_params(uint64_t this_ptr) {
40181         LDKRouteParameters this_ptr_conv;
40182         this_ptr_conv.inner = untag_ptr(this_ptr);
40183         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40184         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40185         this_ptr_conv.is_owned = false;
40186         LDKPaymentParameters ret_var = RouteParameters_get_payment_params(&this_ptr_conv);
40187         uint64_t ret_ref = 0;
40188         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40189         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40190         return ret_ref;
40191 }
40192
40193 void  __attribute__((export_name("TS_RouteParameters_set_payment_params"))) TS_RouteParameters_set_payment_params(uint64_t this_ptr, uint64_t val) {
40194         LDKRouteParameters this_ptr_conv;
40195         this_ptr_conv.inner = untag_ptr(this_ptr);
40196         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40197         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40198         this_ptr_conv.is_owned = false;
40199         LDKPaymentParameters val_conv;
40200         val_conv.inner = untag_ptr(val);
40201         val_conv.is_owned = ptr_is_owned(val);
40202         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
40203         val_conv = PaymentParameters_clone(&val_conv);
40204         RouteParameters_set_payment_params(&this_ptr_conv, val_conv);
40205 }
40206
40207 int64_t  __attribute__((export_name("TS_RouteParameters_get_final_value_msat"))) TS_RouteParameters_get_final_value_msat(uint64_t this_ptr) {
40208         LDKRouteParameters this_ptr_conv;
40209         this_ptr_conv.inner = untag_ptr(this_ptr);
40210         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40211         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40212         this_ptr_conv.is_owned = false;
40213         int64_t ret_conv = RouteParameters_get_final_value_msat(&this_ptr_conv);
40214         return ret_conv;
40215 }
40216
40217 void  __attribute__((export_name("TS_RouteParameters_set_final_value_msat"))) TS_RouteParameters_set_final_value_msat(uint64_t this_ptr, int64_t val) {
40218         LDKRouteParameters this_ptr_conv;
40219         this_ptr_conv.inner = untag_ptr(this_ptr);
40220         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40221         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40222         this_ptr_conv.is_owned = false;
40223         RouteParameters_set_final_value_msat(&this_ptr_conv, val);
40224 }
40225
40226 int32_t  __attribute__((export_name("TS_RouteParameters_get_final_cltv_expiry_delta"))) TS_RouteParameters_get_final_cltv_expiry_delta(uint64_t this_ptr) {
40227         LDKRouteParameters this_ptr_conv;
40228         this_ptr_conv.inner = untag_ptr(this_ptr);
40229         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40230         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40231         this_ptr_conv.is_owned = false;
40232         int32_t ret_conv = RouteParameters_get_final_cltv_expiry_delta(&this_ptr_conv);
40233         return ret_conv;
40234 }
40235
40236 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) {
40237         LDKRouteParameters this_ptr_conv;
40238         this_ptr_conv.inner = untag_ptr(this_ptr);
40239         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40240         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40241         this_ptr_conv.is_owned = false;
40242         RouteParameters_set_final_cltv_expiry_delta(&this_ptr_conv, val);
40243 }
40244
40245 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) {
40246         LDKPaymentParameters payment_params_arg_conv;
40247         payment_params_arg_conv.inner = untag_ptr(payment_params_arg);
40248         payment_params_arg_conv.is_owned = ptr_is_owned(payment_params_arg);
40249         CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_params_arg_conv);
40250         payment_params_arg_conv = PaymentParameters_clone(&payment_params_arg_conv);
40251         LDKRouteParameters ret_var = RouteParameters_new(payment_params_arg_conv, final_value_msat_arg, final_cltv_expiry_delta_arg);
40252         uint64_t ret_ref = 0;
40253         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40254         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40255         return ret_ref;
40256 }
40257
40258 static inline uint64_t RouteParameters_clone_ptr(LDKRouteParameters *NONNULL_PTR arg) {
40259         LDKRouteParameters ret_var = RouteParameters_clone(arg);
40260         uint64_t ret_ref = 0;
40261         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40262         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40263         return ret_ref;
40264 }
40265 int64_t  __attribute__((export_name("TS_RouteParameters_clone_ptr"))) TS_RouteParameters_clone_ptr(uint64_t arg) {
40266         LDKRouteParameters arg_conv;
40267         arg_conv.inner = untag_ptr(arg);
40268         arg_conv.is_owned = ptr_is_owned(arg);
40269         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40270         arg_conv.is_owned = false;
40271         int64_t ret_conv = RouteParameters_clone_ptr(&arg_conv);
40272         return ret_conv;
40273 }
40274
40275 uint64_t  __attribute__((export_name("TS_RouteParameters_clone"))) TS_RouteParameters_clone(uint64_t orig) {
40276         LDKRouteParameters orig_conv;
40277         orig_conv.inner = untag_ptr(orig);
40278         orig_conv.is_owned = ptr_is_owned(orig);
40279         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40280         orig_conv.is_owned = false;
40281         LDKRouteParameters ret_var = RouteParameters_clone(&orig_conv);
40282         uint64_t ret_ref = 0;
40283         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40284         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40285         return ret_ref;
40286 }
40287
40288 int8_tArray  __attribute__((export_name("TS_RouteParameters_write"))) TS_RouteParameters_write(uint64_t obj) {
40289         LDKRouteParameters obj_conv;
40290         obj_conv.inner = untag_ptr(obj);
40291         obj_conv.is_owned = ptr_is_owned(obj);
40292         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
40293         obj_conv.is_owned = false;
40294         LDKCVec_u8Z ret_var = RouteParameters_write(&obj_conv);
40295         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
40296         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
40297         CVec_u8Z_free(ret_var);
40298         return ret_arr;
40299 }
40300
40301 uint64_t  __attribute__((export_name("TS_RouteParameters_read"))) TS_RouteParameters_read(int8_tArray ser) {
40302         LDKu8slice ser_ref;
40303         ser_ref.datalen = ser->arr_len;
40304         ser_ref.data = ser->elems;
40305         LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
40306         *ret_conv = RouteParameters_read(ser_ref);
40307         FREE(ser);
40308         return tag_ptr(ret_conv, true);
40309 }
40310
40311 void  __attribute__((export_name("TS_PaymentParameters_free"))) TS_PaymentParameters_free(uint64_t this_obj) {
40312         LDKPaymentParameters this_obj_conv;
40313         this_obj_conv.inner = untag_ptr(this_obj);
40314         this_obj_conv.is_owned = ptr_is_owned(this_obj);
40315         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40316         PaymentParameters_free(this_obj_conv);
40317 }
40318
40319 int8_tArray  __attribute__((export_name("TS_PaymentParameters_get_payee_pubkey"))) TS_PaymentParameters_get_payee_pubkey(uint64_t this_ptr) {
40320         LDKPaymentParameters this_ptr_conv;
40321         this_ptr_conv.inner = untag_ptr(this_ptr);
40322         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40323         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40324         this_ptr_conv.is_owned = false;
40325         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
40326         memcpy(ret_arr->elems, PaymentParameters_get_payee_pubkey(&this_ptr_conv).compressed_form, 33);
40327         return ret_arr;
40328 }
40329
40330 void  __attribute__((export_name("TS_PaymentParameters_set_payee_pubkey"))) TS_PaymentParameters_set_payee_pubkey(uint64_t this_ptr, int8_tArray val) {
40331         LDKPaymentParameters this_ptr_conv;
40332         this_ptr_conv.inner = untag_ptr(this_ptr);
40333         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40334         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40335         this_ptr_conv.is_owned = false;
40336         LDKPublicKey val_ref;
40337         CHECK(val->arr_len == 33);
40338         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
40339         PaymentParameters_set_payee_pubkey(&this_ptr_conv, val_ref);
40340 }
40341
40342 uint64_t  __attribute__((export_name("TS_PaymentParameters_get_features"))) TS_PaymentParameters_get_features(uint64_t this_ptr) {
40343         LDKPaymentParameters this_ptr_conv;
40344         this_ptr_conv.inner = untag_ptr(this_ptr);
40345         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40346         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40347         this_ptr_conv.is_owned = false;
40348         LDKInvoiceFeatures ret_var = PaymentParameters_get_features(&this_ptr_conv);
40349         uint64_t ret_ref = 0;
40350         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40351         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40352         return ret_ref;
40353 }
40354
40355 void  __attribute__((export_name("TS_PaymentParameters_set_features"))) TS_PaymentParameters_set_features(uint64_t this_ptr, uint64_t val) {
40356         LDKPaymentParameters this_ptr_conv;
40357         this_ptr_conv.inner = untag_ptr(this_ptr);
40358         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40359         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40360         this_ptr_conv.is_owned = false;
40361         LDKInvoiceFeatures val_conv;
40362         val_conv.inner = untag_ptr(val);
40363         val_conv.is_owned = ptr_is_owned(val);
40364         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
40365         val_conv = InvoiceFeatures_clone(&val_conv);
40366         PaymentParameters_set_features(&this_ptr_conv, val_conv);
40367 }
40368
40369 uint64_tArray  __attribute__((export_name("TS_PaymentParameters_get_route_hints"))) TS_PaymentParameters_get_route_hints(uint64_t this_ptr) {
40370         LDKPaymentParameters this_ptr_conv;
40371         this_ptr_conv.inner = untag_ptr(this_ptr);
40372         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40373         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40374         this_ptr_conv.is_owned = false;
40375         LDKCVec_RouteHintZ ret_var = PaymentParameters_get_route_hints(&this_ptr_conv);
40376         uint64_tArray ret_arr = NULL;
40377         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
40378         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
40379         for (size_t l = 0; l < ret_var.datalen; l++) {
40380                 LDKRouteHint ret_conv_11_var = ret_var.data[l];
40381                 uint64_t ret_conv_11_ref = 0;
40382                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_11_var);
40383                 ret_conv_11_ref = tag_ptr(ret_conv_11_var.inner, ret_conv_11_var.is_owned);
40384                 ret_arr_ptr[l] = ret_conv_11_ref;
40385         }
40386         
40387         FREE(ret_var.data);
40388         return ret_arr;
40389 }
40390
40391 void  __attribute__((export_name("TS_PaymentParameters_set_route_hints"))) TS_PaymentParameters_set_route_hints(uint64_t this_ptr, uint64_tArray val) {
40392         LDKPaymentParameters this_ptr_conv;
40393         this_ptr_conv.inner = untag_ptr(this_ptr);
40394         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40395         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40396         this_ptr_conv.is_owned = false;
40397         LDKCVec_RouteHintZ val_constr;
40398         val_constr.datalen = val->arr_len;
40399         if (val_constr.datalen > 0)
40400                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
40401         else
40402                 val_constr.data = NULL;
40403         uint64_t* val_vals = val->elems;
40404         for (size_t l = 0; l < val_constr.datalen; l++) {
40405                 uint64_t val_conv_11 = val_vals[l];
40406                 LDKRouteHint val_conv_11_conv;
40407                 val_conv_11_conv.inner = untag_ptr(val_conv_11);
40408                 val_conv_11_conv.is_owned = ptr_is_owned(val_conv_11);
40409                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_11_conv);
40410                 val_conv_11_conv = RouteHint_clone(&val_conv_11_conv);
40411                 val_constr.data[l] = val_conv_11_conv;
40412         }
40413         FREE(val);
40414         PaymentParameters_set_route_hints(&this_ptr_conv, val_constr);
40415 }
40416
40417 uint64_t  __attribute__((export_name("TS_PaymentParameters_get_expiry_time"))) TS_PaymentParameters_get_expiry_time(uint64_t this_ptr) {
40418         LDKPaymentParameters this_ptr_conv;
40419         this_ptr_conv.inner = untag_ptr(this_ptr);
40420         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40421         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40422         this_ptr_conv.is_owned = false;
40423         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
40424         *ret_copy = PaymentParameters_get_expiry_time(&this_ptr_conv);
40425         uint64_t ret_ref = tag_ptr(ret_copy, true);
40426         return ret_ref;
40427 }
40428
40429 void  __attribute__((export_name("TS_PaymentParameters_set_expiry_time"))) TS_PaymentParameters_set_expiry_time(uint64_t this_ptr, uint64_t val) {
40430         LDKPaymentParameters this_ptr_conv;
40431         this_ptr_conv.inner = untag_ptr(this_ptr);
40432         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40433         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40434         this_ptr_conv.is_owned = false;
40435         void* val_ptr = untag_ptr(val);
40436         CHECK_ACCESS(val_ptr);
40437         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
40438         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
40439         PaymentParameters_set_expiry_time(&this_ptr_conv, val_conv);
40440 }
40441
40442 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) {
40443         LDKPaymentParameters this_ptr_conv;
40444         this_ptr_conv.inner = untag_ptr(this_ptr);
40445         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40446         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40447         this_ptr_conv.is_owned = false;
40448         int32_t ret_conv = PaymentParameters_get_max_total_cltv_expiry_delta(&this_ptr_conv);
40449         return ret_conv;
40450 }
40451
40452 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) {
40453         LDKPaymentParameters this_ptr_conv;
40454         this_ptr_conv.inner = untag_ptr(this_ptr);
40455         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40456         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40457         this_ptr_conv.is_owned = false;
40458         PaymentParameters_set_max_total_cltv_expiry_delta(&this_ptr_conv, val);
40459 }
40460
40461 int8_t  __attribute__((export_name("TS_PaymentParameters_get_max_path_count"))) TS_PaymentParameters_get_max_path_count(uint64_t this_ptr) {
40462         LDKPaymentParameters this_ptr_conv;
40463         this_ptr_conv.inner = untag_ptr(this_ptr);
40464         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40465         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40466         this_ptr_conv.is_owned = false;
40467         int8_t ret_conv = PaymentParameters_get_max_path_count(&this_ptr_conv);
40468         return ret_conv;
40469 }
40470
40471 void  __attribute__((export_name("TS_PaymentParameters_set_max_path_count"))) TS_PaymentParameters_set_max_path_count(uint64_t this_ptr, int8_t val) {
40472         LDKPaymentParameters this_ptr_conv;
40473         this_ptr_conv.inner = untag_ptr(this_ptr);
40474         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40475         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40476         this_ptr_conv.is_owned = false;
40477         PaymentParameters_set_max_path_count(&this_ptr_conv, val);
40478 }
40479
40480 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) {
40481         LDKPaymentParameters this_ptr_conv;
40482         this_ptr_conv.inner = untag_ptr(this_ptr);
40483         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40484         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40485         this_ptr_conv.is_owned = false;
40486         int8_t ret_conv = PaymentParameters_get_max_channel_saturation_power_of_half(&this_ptr_conv);
40487         return ret_conv;
40488 }
40489
40490 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) {
40491         LDKPaymentParameters this_ptr_conv;
40492         this_ptr_conv.inner = untag_ptr(this_ptr);
40493         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40494         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40495         this_ptr_conv.is_owned = false;
40496         PaymentParameters_set_max_channel_saturation_power_of_half(&this_ptr_conv, val);
40497 }
40498
40499 int64_tArray  __attribute__((export_name("TS_PaymentParameters_get_previously_failed_channels"))) TS_PaymentParameters_get_previously_failed_channels(uint64_t this_ptr) {
40500         LDKPaymentParameters this_ptr_conv;
40501         this_ptr_conv.inner = untag_ptr(this_ptr);
40502         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40503         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40504         this_ptr_conv.is_owned = false;
40505         LDKCVec_u64Z ret_var = PaymentParameters_get_previously_failed_channels(&this_ptr_conv);
40506         int64_tArray ret_arr = NULL;
40507         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
40508         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
40509         for (size_t i = 0; i < ret_var.datalen; i++) {
40510                 int64_t ret_conv_8_conv = ret_var.data[i];
40511                 ret_arr_ptr[i] = ret_conv_8_conv;
40512         }
40513         
40514         FREE(ret_var.data);
40515         return ret_arr;
40516 }
40517
40518 void  __attribute__((export_name("TS_PaymentParameters_set_previously_failed_channels"))) TS_PaymentParameters_set_previously_failed_channels(uint64_t this_ptr, int64_tArray val) {
40519         LDKPaymentParameters this_ptr_conv;
40520         this_ptr_conv.inner = untag_ptr(this_ptr);
40521         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40522         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40523         this_ptr_conv.is_owned = false;
40524         LDKCVec_u64Z val_constr;
40525         val_constr.datalen = val->arr_len;
40526         if (val_constr.datalen > 0)
40527                 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
40528         else
40529                 val_constr.data = NULL;
40530         int64_t* val_vals = val->elems;
40531         for (size_t i = 0; i < val_constr.datalen; i++) {
40532                 int64_t val_conv_8 = val_vals[i];
40533                 val_constr.data[i] = val_conv_8;
40534         }
40535         FREE(val);
40536         PaymentParameters_set_previously_failed_channels(&this_ptr_conv, val_constr);
40537 }
40538
40539 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) {
40540         LDKPublicKey payee_pubkey_arg_ref;
40541         CHECK(payee_pubkey_arg->arr_len == 33);
40542         memcpy(payee_pubkey_arg_ref.compressed_form, payee_pubkey_arg->elems, 33); FREE(payee_pubkey_arg);
40543         LDKInvoiceFeatures features_arg_conv;
40544         features_arg_conv.inner = untag_ptr(features_arg);
40545         features_arg_conv.is_owned = ptr_is_owned(features_arg);
40546         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
40547         features_arg_conv = InvoiceFeatures_clone(&features_arg_conv);
40548         LDKCVec_RouteHintZ route_hints_arg_constr;
40549         route_hints_arg_constr.datalen = route_hints_arg->arr_len;
40550         if (route_hints_arg_constr.datalen > 0)
40551                 route_hints_arg_constr.data = MALLOC(route_hints_arg_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
40552         else
40553                 route_hints_arg_constr.data = NULL;
40554         uint64_t* route_hints_arg_vals = route_hints_arg->elems;
40555         for (size_t l = 0; l < route_hints_arg_constr.datalen; l++) {
40556                 uint64_t route_hints_arg_conv_11 = route_hints_arg_vals[l];
40557                 LDKRouteHint route_hints_arg_conv_11_conv;
40558                 route_hints_arg_conv_11_conv.inner = untag_ptr(route_hints_arg_conv_11);
40559                 route_hints_arg_conv_11_conv.is_owned = ptr_is_owned(route_hints_arg_conv_11);
40560                 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_hints_arg_conv_11_conv);
40561                 route_hints_arg_conv_11_conv = RouteHint_clone(&route_hints_arg_conv_11_conv);
40562                 route_hints_arg_constr.data[l] = route_hints_arg_conv_11_conv;
40563         }
40564         FREE(route_hints_arg);
40565         void* expiry_time_arg_ptr = untag_ptr(expiry_time_arg);
40566         CHECK_ACCESS(expiry_time_arg_ptr);
40567         LDKCOption_u64Z expiry_time_arg_conv = *(LDKCOption_u64Z*)(expiry_time_arg_ptr);
40568         expiry_time_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(expiry_time_arg));
40569         LDKCVec_u64Z previously_failed_channels_arg_constr;
40570         previously_failed_channels_arg_constr.datalen = previously_failed_channels_arg->arr_len;
40571         if (previously_failed_channels_arg_constr.datalen > 0)
40572                 previously_failed_channels_arg_constr.data = MALLOC(previously_failed_channels_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
40573         else
40574                 previously_failed_channels_arg_constr.data = NULL;
40575         int64_t* previously_failed_channels_arg_vals = previously_failed_channels_arg->elems;
40576         for (size_t i = 0; i < previously_failed_channels_arg_constr.datalen; i++) {
40577                 int64_t previously_failed_channels_arg_conv_8 = previously_failed_channels_arg_vals[i];
40578                 previously_failed_channels_arg_constr.data[i] = previously_failed_channels_arg_conv_8;
40579         }
40580         FREE(previously_failed_channels_arg);
40581         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);
40582         uint64_t ret_ref = 0;
40583         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40584         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40585         return ret_ref;
40586 }
40587
40588 static inline uint64_t PaymentParameters_clone_ptr(LDKPaymentParameters *NONNULL_PTR arg) {
40589         LDKPaymentParameters ret_var = PaymentParameters_clone(arg);
40590         uint64_t ret_ref = 0;
40591         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40592         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40593         return ret_ref;
40594 }
40595 int64_t  __attribute__((export_name("TS_PaymentParameters_clone_ptr"))) TS_PaymentParameters_clone_ptr(uint64_t arg) {
40596         LDKPaymentParameters arg_conv;
40597         arg_conv.inner = untag_ptr(arg);
40598         arg_conv.is_owned = ptr_is_owned(arg);
40599         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40600         arg_conv.is_owned = false;
40601         int64_t ret_conv = PaymentParameters_clone_ptr(&arg_conv);
40602         return ret_conv;
40603 }
40604
40605 uint64_t  __attribute__((export_name("TS_PaymentParameters_clone"))) TS_PaymentParameters_clone(uint64_t orig) {
40606         LDKPaymentParameters orig_conv;
40607         orig_conv.inner = untag_ptr(orig);
40608         orig_conv.is_owned = ptr_is_owned(orig);
40609         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40610         orig_conv.is_owned = false;
40611         LDKPaymentParameters ret_var = PaymentParameters_clone(&orig_conv);
40612         uint64_t ret_ref = 0;
40613         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40614         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40615         return ret_ref;
40616 }
40617
40618 int64_t  __attribute__((export_name("TS_PaymentParameters_hash"))) TS_PaymentParameters_hash(uint64_t o) {
40619         LDKPaymentParameters o_conv;
40620         o_conv.inner = untag_ptr(o);
40621         o_conv.is_owned = ptr_is_owned(o);
40622         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
40623         o_conv.is_owned = false;
40624         int64_t ret_conv = PaymentParameters_hash(&o_conv);
40625         return ret_conv;
40626 }
40627
40628 jboolean  __attribute__((export_name("TS_PaymentParameters_eq"))) TS_PaymentParameters_eq(uint64_t a, uint64_t b) {
40629         LDKPaymentParameters a_conv;
40630         a_conv.inner = untag_ptr(a);
40631         a_conv.is_owned = ptr_is_owned(a);
40632         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
40633         a_conv.is_owned = false;
40634         LDKPaymentParameters b_conv;
40635         b_conv.inner = untag_ptr(b);
40636         b_conv.is_owned = ptr_is_owned(b);
40637         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
40638         b_conv.is_owned = false;
40639         jboolean ret_conv = PaymentParameters_eq(&a_conv, &b_conv);
40640         return ret_conv;
40641 }
40642
40643 int8_tArray  __attribute__((export_name("TS_PaymentParameters_write"))) TS_PaymentParameters_write(uint64_t obj) {
40644         LDKPaymentParameters obj_conv;
40645         obj_conv.inner = untag_ptr(obj);
40646         obj_conv.is_owned = ptr_is_owned(obj);
40647         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
40648         obj_conv.is_owned = false;
40649         LDKCVec_u8Z ret_var = PaymentParameters_write(&obj_conv);
40650         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
40651         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
40652         CVec_u8Z_free(ret_var);
40653         return ret_arr;
40654 }
40655
40656 uint64_t  __attribute__((export_name("TS_PaymentParameters_read"))) TS_PaymentParameters_read(int8_tArray ser) {
40657         LDKu8slice ser_ref;
40658         ser_ref.datalen = ser->arr_len;
40659         ser_ref.data = ser->elems;
40660         LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
40661         *ret_conv = PaymentParameters_read(ser_ref);
40662         FREE(ser);
40663         return tag_ptr(ret_conv, true);
40664 }
40665
40666 uint64_t  __attribute__((export_name("TS_PaymentParameters_from_node_id"))) TS_PaymentParameters_from_node_id(int8_tArray payee_pubkey) {
40667         LDKPublicKey payee_pubkey_ref;
40668         CHECK(payee_pubkey->arr_len == 33);
40669         memcpy(payee_pubkey_ref.compressed_form, payee_pubkey->elems, 33); FREE(payee_pubkey);
40670         LDKPaymentParameters ret_var = PaymentParameters_from_node_id(payee_pubkey_ref);
40671         uint64_t ret_ref = 0;
40672         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40673         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40674         return ret_ref;
40675 }
40676
40677 uint64_t  __attribute__((export_name("TS_PaymentParameters_for_keysend"))) TS_PaymentParameters_for_keysend(int8_tArray payee_pubkey) {
40678         LDKPublicKey payee_pubkey_ref;
40679         CHECK(payee_pubkey->arr_len == 33);
40680         memcpy(payee_pubkey_ref.compressed_form, payee_pubkey->elems, 33); FREE(payee_pubkey);
40681         LDKPaymentParameters ret_var = PaymentParameters_for_keysend(payee_pubkey_ref);
40682         uint64_t ret_ref = 0;
40683         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40684         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40685         return ret_ref;
40686 }
40687
40688 void  __attribute__((export_name("TS_RouteHint_free"))) TS_RouteHint_free(uint64_t this_obj) {
40689         LDKRouteHint this_obj_conv;
40690         this_obj_conv.inner = untag_ptr(this_obj);
40691         this_obj_conv.is_owned = ptr_is_owned(this_obj);
40692         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40693         RouteHint_free(this_obj_conv);
40694 }
40695
40696 uint64_tArray  __attribute__((export_name("TS_RouteHint_get_a"))) TS_RouteHint_get_a(uint64_t this_ptr) {
40697         LDKRouteHint this_ptr_conv;
40698         this_ptr_conv.inner = untag_ptr(this_ptr);
40699         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40700         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40701         this_ptr_conv.is_owned = false;
40702         LDKCVec_RouteHintHopZ ret_var = RouteHint_get_a(&this_ptr_conv);
40703         uint64_tArray ret_arr = NULL;
40704         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
40705         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
40706         for (size_t o = 0; o < ret_var.datalen; o++) {
40707                 LDKRouteHintHop ret_conv_14_var = ret_var.data[o];
40708                 uint64_t ret_conv_14_ref = 0;
40709                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_14_var);
40710                 ret_conv_14_ref = tag_ptr(ret_conv_14_var.inner, ret_conv_14_var.is_owned);
40711                 ret_arr_ptr[o] = ret_conv_14_ref;
40712         }
40713         
40714         FREE(ret_var.data);
40715         return ret_arr;
40716 }
40717
40718 void  __attribute__((export_name("TS_RouteHint_set_a"))) TS_RouteHint_set_a(uint64_t this_ptr, uint64_tArray val) {
40719         LDKRouteHint this_ptr_conv;
40720         this_ptr_conv.inner = untag_ptr(this_ptr);
40721         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40722         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40723         this_ptr_conv.is_owned = false;
40724         LDKCVec_RouteHintHopZ val_constr;
40725         val_constr.datalen = val->arr_len;
40726         if (val_constr.datalen > 0)
40727                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKRouteHintHop), "LDKCVec_RouteHintHopZ Elements");
40728         else
40729                 val_constr.data = NULL;
40730         uint64_t* val_vals = val->elems;
40731         for (size_t o = 0; o < val_constr.datalen; o++) {
40732                 uint64_t val_conv_14 = val_vals[o];
40733                 LDKRouteHintHop val_conv_14_conv;
40734                 val_conv_14_conv.inner = untag_ptr(val_conv_14);
40735                 val_conv_14_conv.is_owned = ptr_is_owned(val_conv_14);
40736                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_14_conv);
40737                 val_conv_14_conv = RouteHintHop_clone(&val_conv_14_conv);
40738                 val_constr.data[o] = val_conv_14_conv;
40739         }
40740         FREE(val);
40741         RouteHint_set_a(&this_ptr_conv, val_constr);
40742 }
40743
40744 uint64_t  __attribute__((export_name("TS_RouteHint_new"))) TS_RouteHint_new(uint64_tArray a_arg) {
40745         LDKCVec_RouteHintHopZ a_arg_constr;
40746         a_arg_constr.datalen = a_arg->arr_len;
40747         if (a_arg_constr.datalen > 0)
40748                 a_arg_constr.data = MALLOC(a_arg_constr.datalen * sizeof(LDKRouteHintHop), "LDKCVec_RouteHintHopZ Elements");
40749         else
40750                 a_arg_constr.data = NULL;
40751         uint64_t* a_arg_vals = a_arg->elems;
40752         for (size_t o = 0; o < a_arg_constr.datalen; o++) {
40753                 uint64_t a_arg_conv_14 = a_arg_vals[o];
40754                 LDKRouteHintHop a_arg_conv_14_conv;
40755                 a_arg_conv_14_conv.inner = untag_ptr(a_arg_conv_14);
40756                 a_arg_conv_14_conv.is_owned = ptr_is_owned(a_arg_conv_14);
40757                 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_arg_conv_14_conv);
40758                 a_arg_conv_14_conv = RouteHintHop_clone(&a_arg_conv_14_conv);
40759                 a_arg_constr.data[o] = a_arg_conv_14_conv;
40760         }
40761         FREE(a_arg);
40762         LDKRouteHint ret_var = RouteHint_new(a_arg_constr);
40763         uint64_t ret_ref = 0;
40764         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40765         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40766         return ret_ref;
40767 }
40768
40769 static inline uint64_t RouteHint_clone_ptr(LDKRouteHint *NONNULL_PTR arg) {
40770         LDKRouteHint ret_var = RouteHint_clone(arg);
40771         uint64_t ret_ref = 0;
40772         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40773         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40774         return ret_ref;
40775 }
40776 int64_t  __attribute__((export_name("TS_RouteHint_clone_ptr"))) TS_RouteHint_clone_ptr(uint64_t arg) {
40777         LDKRouteHint arg_conv;
40778         arg_conv.inner = untag_ptr(arg);
40779         arg_conv.is_owned = ptr_is_owned(arg);
40780         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40781         arg_conv.is_owned = false;
40782         int64_t ret_conv = RouteHint_clone_ptr(&arg_conv);
40783         return ret_conv;
40784 }
40785
40786 uint64_t  __attribute__((export_name("TS_RouteHint_clone"))) TS_RouteHint_clone(uint64_t orig) {
40787         LDKRouteHint orig_conv;
40788         orig_conv.inner = untag_ptr(orig);
40789         orig_conv.is_owned = ptr_is_owned(orig);
40790         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40791         orig_conv.is_owned = false;
40792         LDKRouteHint ret_var = RouteHint_clone(&orig_conv);
40793         uint64_t ret_ref = 0;
40794         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40795         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40796         return ret_ref;
40797 }
40798
40799 int64_t  __attribute__((export_name("TS_RouteHint_hash"))) TS_RouteHint_hash(uint64_t o) {
40800         LDKRouteHint o_conv;
40801         o_conv.inner = untag_ptr(o);
40802         o_conv.is_owned = ptr_is_owned(o);
40803         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
40804         o_conv.is_owned = false;
40805         int64_t ret_conv = RouteHint_hash(&o_conv);
40806         return ret_conv;
40807 }
40808
40809 jboolean  __attribute__((export_name("TS_RouteHint_eq"))) TS_RouteHint_eq(uint64_t a, uint64_t b) {
40810         LDKRouteHint a_conv;
40811         a_conv.inner = untag_ptr(a);
40812         a_conv.is_owned = ptr_is_owned(a);
40813         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
40814         a_conv.is_owned = false;
40815         LDKRouteHint b_conv;
40816         b_conv.inner = untag_ptr(b);
40817         b_conv.is_owned = ptr_is_owned(b);
40818         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
40819         b_conv.is_owned = false;
40820         jboolean ret_conv = RouteHint_eq(&a_conv, &b_conv);
40821         return ret_conv;
40822 }
40823
40824 int8_tArray  __attribute__((export_name("TS_RouteHint_write"))) TS_RouteHint_write(uint64_t obj) {
40825         LDKRouteHint obj_conv;
40826         obj_conv.inner = untag_ptr(obj);
40827         obj_conv.is_owned = ptr_is_owned(obj);
40828         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
40829         obj_conv.is_owned = false;
40830         LDKCVec_u8Z ret_var = RouteHint_write(&obj_conv);
40831         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
40832         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
40833         CVec_u8Z_free(ret_var);
40834         return ret_arr;
40835 }
40836
40837 uint64_t  __attribute__((export_name("TS_RouteHint_read"))) TS_RouteHint_read(int8_tArray ser) {
40838         LDKu8slice ser_ref;
40839         ser_ref.datalen = ser->arr_len;
40840         ser_ref.data = ser->elems;
40841         LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
40842         *ret_conv = RouteHint_read(ser_ref);
40843         FREE(ser);
40844         return tag_ptr(ret_conv, true);
40845 }
40846
40847 void  __attribute__((export_name("TS_RouteHintHop_free"))) TS_RouteHintHop_free(uint64_t this_obj) {
40848         LDKRouteHintHop this_obj_conv;
40849         this_obj_conv.inner = untag_ptr(this_obj);
40850         this_obj_conv.is_owned = ptr_is_owned(this_obj);
40851         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40852         RouteHintHop_free(this_obj_conv);
40853 }
40854
40855 int8_tArray  __attribute__((export_name("TS_RouteHintHop_get_src_node_id"))) TS_RouteHintHop_get_src_node_id(uint64_t this_ptr) {
40856         LDKRouteHintHop this_ptr_conv;
40857         this_ptr_conv.inner = untag_ptr(this_ptr);
40858         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40859         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40860         this_ptr_conv.is_owned = false;
40861         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
40862         memcpy(ret_arr->elems, RouteHintHop_get_src_node_id(&this_ptr_conv).compressed_form, 33);
40863         return ret_arr;
40864 }
40865
40866 void  __attribute__((export_name("TS_RouteHintHop_set_src_node_id"))) TS_RouteHintHop_set_src_node_id(uint64_t this_ptr, int8_tArray val) {
40867         LDKRouteHintHop this_ptr_conv;
40868         this_ptr_conv.inner = untag_ptr(this_ptr);
40869         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40870         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40871         this_ptr_conv.is_owned = false;
40872         LDKPublicKey val_ref;
40873         CHECK(val->arr_len == 33);
40874         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
40875         RouteHintHop_set_src_node_id(&this_ptr_conv, val_ref);
40876 }
40877
40878 int64_t  __attribute__((export_name("TS_RouteHintHop_get_short_channel_id"))) TS_RouteHintHop_get_short_channel_id(uint64_t this_ptr) {
40879         LDKRouteHintHop this_ptr_conv;
40880         this_ptr_conv.inner = untag_ptr(this_ptr);
40881         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40882         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40883         this_ptr_conv.is_owned = false;
40884         int64_t ret_conv = RouteHintHop_get_short_channel_id(&this_ptr_conv);
40885         return ret_conv;
40886 }
40887
40888 void  __attribute__((export_name("TS_RouteHintHop_set_short_channel_id"))) TS_RouteHintHop_set_short_channel_id(uint64_t this_ptr, int64_t val) {
40889         LDKRouteHintHop this_ptr_conv;
40890         this_ptr_conv.inner = untag_ptr(this_ptr);
40891         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40892         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40893         this_ptr_conv.is_owned = false;
40894         RouteHintHop_set_short_channel_id(&this_ptr_conv, val);
40895 }
40896
40897 uint64_t  __attribute__((export_name("TS_RouteHintHop_get_fees"))) TS_RouteHintHop_get_fees(uint64_t this_ptr) {
40898         LDKRouteHintHop this_ptr_conv;
40899         this_ptr_conv.inner = untag_ptr(this_ptr);
40900         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40901         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40902         this_ptr_conv.is_owned = false;
40903         LDKRoutingFees ret_var = RouteHintHop_get_fees(&this_ptr_conv);
40904         uint64_t ret_ref = 0;
40905         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40906         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40907         return ret_ref;
40908 }
40909
40910 void  __attribute__((export_name("TS_RouteHintHop_set_fees"))) TS_RouteHintHop_set_fees(uint64_t this_ptr, uint64_t val) {
40911         LDKRouteHintHop this_ptr_conv;
40912         this_ptr_conv.inner = untag_ptr(this_ptr);
40913         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40914         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40915         this_ptr_conv.is_owned = false;
40916         LDKRoutingFees val_conv;
40917         val_conv.inner = untag_ptr(val);
40918         val_conv.is_owned = ptr_is_owned(val);
40919         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
40920         val_conv = RoutingFees_clone(&val_conv);
40921         RouteHintHop_set_fees(&this_ptr_conv, val_conv);
40922 }
40923
40924 int16_t  __attribute__((export_name("TS_RouteHintHop_get_cltv_expiry_delta"))) TS_RouteHintHop_get_cltv_expiry_delta(uint64_t this_ptr) {
40925         LDKRouteHintHop this_ptr_conv;
40926         this_ptr_conv.inner = untag_ptr(this_ptr);
40927         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40928         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40929         this_ptr_conv.is_owned = false;
40930         int16_t ret_conv = RouteHintHop_get_cltv_expiry_delta(&this_ptr_conv);
40931         return ret_conv;
40932 }
40933
40934 void  __attribute__((export_name("TS_RouteHintHop_set_cltv_expiry_delta"))) TS_RouteHintHop_set_cltv_expiry_delta(uint64_t this_ptr, int16_t val) {
40935         LDKRouteHintHop this_ptr_conv;
40936         this_ptr_conv.inner = untag_ptr(this_ptr);
40937         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40938         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40939         this_ptr_conv.is_owned = false;
40940         RouteHintHop_set_cltv_expiry_delta(&this_ptr_conv, val);
40941 }
40942
40943 uint64_t  __attribute__((export_name("TS_RouteHintHop_get_htlc_minimum_msat"))) TS_RouteHintHop_get_htlc_minimum_msat(uint64_t this_ptr) {
40944         LDKRouteHintHop this_ptr_conv;
40945         this_ptr_conv.inner = untag_ptr(this_ptr);
40946         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40947         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40948         this_ptr_conv.is_owned = false;
40949         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
40950         *ret_copy = RouteHintHop_get_htlc_minimum_msat(&this_ptr_conv);
40951         uint64_t ret_ref = tag_ptr(ret_copy, true);
40952         return ret_ref;
40953 }
40954
40955 void  __attribute__((export_name("TS_RouteHintHop_set_htlc_minimum_msat"))) TS_RouteHintHop_set_htlc_minimum_msat(uint64_t this_ptr, uint64_t val) {
40956         LDKRouteHintHop this_ptr_conv;
40957         this_ptr_conv.inner = untag_ptr(this_ptr);
40958         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40959         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40960         this_ptr_conv.is_owned = false;
40961         void* val_ptr = untag_ptr(val);
40962         CHECK_ACCESS(val_ptr);
40963         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
40964         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
40965         RouteHintHop_set_htlc_minimum_msat(&this_ptr_conv, val_conv);
40966 }
40967
40968 uint64_t  __attribute__((export_name("TS_RouteHintHop_get_htlc_maximum_msat"))) TS_RouteHintHop_get_htlc_maximum_msat(uint64_t this_ptr) {
40969         LDKRouteHintHop this_ptr_conv;
40970         this_ptr_conv.inner = untag_ptr(this_ptr);
40971         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40972         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40973         this_ptr_conv.is_owned = false;
40974         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
40975         *ret_copy = RouteHintHop_get_htlc_maximum_msat(&this_ptr_conv);
40976         uint64_t ret_ref = tag_ptr(ret_copy, true);
40977         return ret_ref;
40978 }
40979
40980 void  __attribute__((export_name("TS_RouteHintHop_set_htlc_maximum_msat"))) TS_RouteHintHop_set_htlc_maximum_msat(uint64_t this_ptr, uint64_t val) {
40981         LDKRouteHintHop this_ptr_conv;
40982         this_ptr_conv.inner = untag_ptr(this_ptr);
40983         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40984         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40985         this_ptr_conv.is_owned = false;
40986         void* val_ptr = untag_ptr(val);
40987         CHECK_ACCESS(val_ptr);
40988         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
40989         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
40990         RouteHintHop_set_htlc_maximum_msat(&this_ptr_conv, val_conv);
40991 }
40992
40993 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) {
40994         LDKPublicKey src_node_id_arg_ref;
40995         CHECK(src_node_id_arg->arr_len == 33);
40996         memcpy(src_node_id_arg_ref.compressed_form, src_node_id_arg->elems, 33); FREE(src_node_id_arg);
40997         LDKRoutingFees fees_arg_conv;
40998         fees_arg_conv.inner = untag_ptr(fees_arg);
40999         fees_arg_conv.is_owned = ptr_is_owned(fees_arg);
41000         CHECK_INNER_FIELD_ACCESS_OR_NULL(fees_arg_conv);
41001         fees_arg_conv = RoutingFees_clone(&fees_arg_conv);
41002         void* htlc_minimum_msat_arg_ptr = untag_ptr(htlc_minimum_msat_arg);
41003         CHECK_ACCESS(htlc_minimum_msat_arg_ptr);
41004         LDKCOption_u64Z htlc_minimum_msat_arg_conv = *(LDKCOption_u64Z*)(htlc_minimum_msat_arg_ptr);
41005         htlc_minimum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(htlc_minimum_msat_arg));
41006         void* htlc_maximum_msat_arg_ptr = untag_ptr(htlc_maximum_msat_arg);
41007         CHECK_ACCESS(htlc_maximum_msat_arg_ptr);
41008         LDKCOption_u64Z htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(htlc_maximum_msat_arg_ptr);
41009         htlc_maximum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(htlc_maximum_msat_arg));
41010         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);
41011         uint64_t ret_ref = 0;
41012         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41013         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41014         return ret_ref;
41015 }
41016
41017 static inline uint64_t RouteHintHop_clone_ptr(LDKRouteHintHop *NONNULL_PTR arg) {
41018         LDKRouteHintHop ret_var = RouteHintHop_clone(arg);
41019         uint64_t ret_ref = 0;
41020         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41021         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41022         return ret_ref;
41023 }
41024 int64_t  __attribute__((export_name("TS_RouteHintHop_clone_ptr"))) TS_RouteHintHop_clone_ptr(uint64_t arg) {
41025         LDKRouteHintHop arg_conv;
41026         arg_conv.inner = untag_ptr(arg);
41027         arg_conv.is_owned = ptr_is_owned(arg);
41028         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
41029         arg_conv.is_owned = false;
41030         int64_t ret_conv = RouteHintHop_clone_ptr(&arg_conv);
41031         return ret_conv;
41032 }
41033
41034 uint64_t  __attribute__((export_name("TS_RouteHintHop_clone"))) TS_RouteHintHop_clone(uint64_t orig) {
41035         LDKRouteHintHop orig_conv;
41036         orig_conv.inner = untag_ptr(orig);
41037         orig_conv.is_owned = ptr_is_owned(orig);
41038         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
41039         orig_conv.is_owned = false;
41040         LDKRouteHintHop ret_var = RouteHintHop_clone(&orig_conv);
41041         uint64_t ret_ref = 0;
41042         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41043         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41044         return ret_ref;
41045 }
41046
41047 int64_t  __attribute__((export_name("TS_RouteHintHop_hash"))) TS_RouteHintHop_hash(uint64_t o) {
41048         LDKRouteHintHop o_conv;
41049         o_conv.inner = untag_ptr(o);
41050         o_conv.is_owned = ptr_is_owned(o);
41051         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
41052         o_conv.is_owned = false;
41053         int64_t ret_conv = RouteHintHop_hash(&o_conv);
41054         return ret_conv;
41055 }
41056
41057 jboolean  __attribute__((export_name("TS_RouteHintHop_eq"))) TS_RouteHintHop_eq(uint64_t a, uint64_t b) {
41058         LDKRouteHintHop a_conv;
41059         a_conv.inner = untag_ptr(a);
41060         a_conv.is_owned = ptr_is_owned(a);
41061         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
41062         a_conv.is_owned = false;
41063         LDKRouteHintHop b_conv;
41064         b_conv.inner = untag_ptr(b);
41065         b_conv.is_owned = ptr_is_owned(b);
41066         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
41067         b_conv.is_owned = false;
41068         jboolean ret_conv = RouteHintHop_eq(&a_conv, &b_conv);
41069         return ret_conv;
41070 }
41071
41072 int8_tArray  __attribute__((export_name("TS_RouteHintHop_write"))) TS_RouteHintHop_write(uint64_t obj) {
41073         LDKRouteHintHop obj_conv;
41074         obj_conv.inner = untag_ptr(obj);
41075         obj_conv.is_owned = ptr_is_owned(obj);
41076         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
41077         obj_conv.is_owned = false;
41078         LDKCVec_u8Z ret_var = RouteHintHop_write(&obj_conv);
41079         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
41080         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
41081         CVec_u8Z_free(ret_var);
41082         return ret_arr;
41083 }
41084
41085 uint64_t  __attribute__((export_name("TS_RouteHintHop_read"))) TS_RouteHintHop_read(int8_tArray ser) {
41086         LDKu8slice ser_ref;
41087         ser_ref.datalen = ser->arr_len;
41088         ser_ref.data = ser->elems;
41089         LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
41090         *ret_conv = RouteHintHop_read(ser_ref);
41091         FREE(ser);
41092         return tag_ptr(ret_conv, true);
41093 }
41094
41095 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) {
41096         LDKPublicKey our_node_pubkey_ref;
41097         CHECK(our_node_pubkey->arr_len == 33);
41098         memcpy(our_node_pubkey_ref.compressed_form, our_node_pubkey->elems, 33); FREE(our_node_pubkey);
41099         LDKRouteParameters route_params_conv;
41100         route_params_conv.inner = untag_ptr(route_params);
41101         route_params_conv.is_owned = ptr_is_owned(route_params);
41102         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
41103         route_params_conv.is_owned = false;
41104         LDKNetworkGraph network_graph_conv;
41105         network_graph_conv.inner = untag_ptr(network_graph);
41106         network_graph_conv.is_owned = ptr_is_owned(network_graph);
41107         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
41108         network_graph_conv.is_owned = false;
41109         LDKCVec_ChannelDetailsZ first_hops_constr;
41110         LDKCVec_ChannelDetailsZ *first_hops_ptr = NULL;
41111         if (first_hops != 0) {
41112                 first_hops_constr.datalen = first_hops->arr_len;
41113                 if (first_hops_constr.datalen > 0)
41114                         first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
41115                 else
41116                         first_hops_constr.data = NULL;
41117                 uint64_t* first_hops_vals = first_hops->elems;
41118                 for (size_t q = 0; q < first_hops_constr.datalen; q++) {
41119                         uint64_t first_hops_conv_16 = first_hops_vals[q];
41120                         LDKChannelDetails first_hops_conv_16_conv;
41121                         first_hops_conv_16_conv.inner = untag_ptr(first_hops_conv_16);
41122                         first_hops_conv_16_conv.is_owned = ptr_is_owned(first_hops_conv_16);
41123                         CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_conv);
41124                         first_hops_conv_16_conv.is_owned = false;
41125                         first_hops_constr.data[q] = first_hops_conv_16_conv;
41126                 }
41127                 FREE(first_hops);
41128                 first_hops_ptr = &first_hops_constr;
41129         }
41130         void* logger_ptr = untag_ptr(logger);
41131         CHECK_ACCESS(logger_ptr);
41132         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
41133         if (logger_conv.free == LDKLogger_JCalls_free) {
41134                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
41135                 LDKLogger_JCalls_cloned(&logger_conv);
41136         }
41137         void* scorer_ptr = untag_ptr(scorer);
41138         if (ptr_is_owned(scorer)) { CHECK_ACCESS(scorer_ptr); }
41139         LDKScore* scorer_conv = (LDKScore*)scorer_ptr;
41140         unsigned char random_seed_bytes_arr[32];
41141         CHECK(random_seed_bytes->arr_len == 32);
41142         memcpy(random_seed_bytes_arr, random_seed_bytes->elems, 32); FREE(random_seed_bytes);
41143         unsigned char (*random_seed_bytes_ref)[32] = &random_seed_bytes_arr;
41144         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
41145         *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);
41146         if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); }
41147         return tag_ptr(ret_conv, true);
41148 }
41149
41150 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) {
41151         LDKPublicKey our_node_pubkey_ref;
41152         CHECK(our_node_pubkey->arr_len == 33);
41153         memcpy(our_node_pubkey_ref.compressed_form, our_node_pubkey->elems, 33); FREE(our_node_pubkey);
41154         LDKCVec_PublicKeyZ hops_constr;
41155         hops_constr.datalen = hops->arr_len;
41156         if (hops_constr.datalen > 0)
41157                 hops_constr.data = MALLOC(hops_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
41158         else
41159                 hops_constr.data = NULL;
41160         int8_tArray* hops_vals = (void*) hops->elems;
41161         for (size_t m = 0; m < hops_constr.datalen; m++) {
41162                 int8_tArray hops_conv_12 = hops_vals[m];
41163                 LDKPublicKey hops_conv_12_ref;
41164                 CHECK(hops_conv_12->arr_len == 33);
41165                 memcpy(hops_conv_12_ref.compressed_form, hops_conv_12->elems, 33); FREE(hops_conv_12);
41166                 hops_constr.data[m] = hops_conv_12_ref;
41167         }
41168         FREE(hops);
41169         LDKRouteParameters route_params_conv;
41170         route_params_conv.inner = untag_ptr(route_params);
41171         route_params_conv.is_owned = ptr_is_owned(route_params);
41172         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
41173         route_params_conv.is_owned = false;
41174         LDKNetworkGraph network_graph_conv;
41175         network_graph_conv.inner = untag_ptr(network_graph);
41176         network_graph_conv.is_owned = ptr_is_owned(network_graph);
41177         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
41178         network_graph_conv.is_owned = false;
41179         void* logger_ptr = untag_ptr(logger);
41180         CHECK_ACCESS(logger_ptr);
41181         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
41182         if (logger_conv.free == LDKLogger_JCalls_free) {
41183                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
41184                 LDKLogger_JCalls_cloned(&logger_conv);
41185         }
41186         unsigned char random_seed_bytes_arr[32];
41187         CHECK(random_seed_bytes->arr_len == 32);
41188         memcpy(random_seed_bytes_arr, random_seed_bytes->elems, 32); FREE(random_seed_bytes);
41189         unsigned char (*random_seed_bytes_ref)[32] = &random_seed_bytes_arr;
41190         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
41191         *ret_conv = build_route_from_hops(our_node_pubkey_ref, hops_constr, &route_params_conv, &network_graph_conv, logger_conv, random_seed_bytes_ref);
41192         return tag_ptr(ret_conv, true);
41193 }
41194
41195 void  __attribute__((export_name("TS_Score_free"))) TS_Score_free(uint64_t this_ptr) {
41196         if (!ptr_is_owned(this_ptr)) return;
41197         void* this_ptr_ptr = untag_ptr(this_ptr);
41198         CHECK_ACCESS(this_ptr_ptr);
41199         LDKScore this_ptr_conv = *(LDKScore*)(this_ptr_ptr);
41200         FREE(untag_ptr(this_ptr));
41201         Score_free(this_ptr_conv);
41202 }
41203
41204 void  __attribute__((export_name("TS_LockableScore_free"))) TS_LockableScore_free(uint64_t this_ptr) {
41205         if (!ptr_is_owned(this_ptr)) return;
41206         void* this_ptr_ptr = untag_ptr(this_ptr);
41207         CHECK_ACCESS(this_ptr_ptr);
41208         LDKLockableScore this_ptr_conv = *(LDKLockableScore*)(this_ptr_ptr);
41209         FREE(untag_ptr(this_ptr));
41210         LockableScore_free(this_ptr_conv);
41211 }
41212
41213 void  __attribute__((export_name("TS_MultiThreadedLockableScore_free"))) TS_MultiThreadedLockableScore_free(uint64_t this_obj) {
41214         LDKMultiThreadedLockableScore this_obj_conv;
41215         this_obj_conv.inner = untag_ptr(this_obj);
41216         this_obj_conv.is_owned = ptr_is_owned(this_obj);
41217         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41218         MultiThreadedLockableScore_free(this_obj_conv);
41219 }
41220
41221 int8_tArray  __attribute__((export_name("TS_MultiThreadedLockableScore_write"))) TS_MultiThreadedLockableScore_write(uint64_t obj) {
41222         LDKMultiThreadedLockableScore obj_conv;
41223         obj_conv.inner = untag_ptr(obj);
41224         obj_conv.is_owned = ptr_is_owned(obj);
41225         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
41226         obj_conv.is_owned = false;
41227         LDKCVec_u8Z ret_var = MultiThreadedLockableScore_write(&obj_conv);
41228         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
41229         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
41230         CVec_u8Z_free(ret_var);
41231         return ret_arr;
41232 }
41233
41234 uint64_t  __attribute__((export_name("TS_MultiThreadedLockableScore_new"))) TS_MultiThreadedLockableScore_new(uint64_t score) {
41235         void* score_ptr = untag_ptr(score);
41236         CHECK_ACCESS(score_ptr);
41237         LDKScore score_conv = *(LDKScore*)(score_ptr);
41238         if (score_conv.free == LDKScore_JCalls_free) {
41239                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
41240                 LDKScore_JCalls_cloned(&score_conv);
41241         }
41242         LDKMultiThreadedLockableScore ret_var = MultiThreadedLockableScore_new(score_conv);
41243         uint64_t ret_ref = 0;
41244         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41245         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41246         return ret_ref;
41247 }
41248
41249 void  __attribute__((export_name("TS_ChannelUsage_free"))) TS_ChannelUsage_free(uint64_t this_obj) {
41250         LDKChannelUsage this_obj_conv;
41251         this_obj_conv.inner = untag_ptr(this_obj);
41252         this_obj_conv.is_owned = ptr_is_owned(this_obj);
41253         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41254         ChannelUsage_free(this_obj_conv);
41255 }
41256
41257 int64_t  __attribute__((export_name("TS_ChannelUsage_get_amount_msat"))) TS_ChannelUsage_get_amount_msat(uint64_t this_ptr) {
41258         LDKChannelUsage this_ptr_conv;
41259         this_ptr_conv.inner = untag_ptr(this_ptr);
41260         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41261         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41262         this_ptr_conv.is_owned = false;
41263         int64_t ret_conv = ChannelUsage_get_amount_msat(&this_ptr_conv);
41264         return ret_conv;
41265 }
41266
41267 void  __attribute__((export_name("TS_ChannelUsage_set_amount_msat"))) TS_ChannelUsage_set_amount_msat(uint64_t this_ptr, int64_t val) {
41268         LDKChannelUsage this_ptr_conv;
41269         this_ptr_conv.inner = untag_ptr(this_ptr);
41270         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41271         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41272         this_ptr_conv.is_owned = false;
41273         ChannelUsage_set_amount_msat(&this_ptr_conv, val);
41274 }
41275
41276 int64_t  __attribute__((export_name("TS_ChannelUsage_get_inflight_htlc_msat"))) TS_ChannelUsage_get_inflight_htlc_msat(uint64_t this_ptr) {
41277         LDKChannelUsage this_ptr_conv;
41278         this_ptr_conv.inner = untag_ptr(this_ptr);
41279         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41280         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41281         this_ptr_conv.is_owned = false;
41282         int64_t ret_conv = ChannelUsage_get_inflight_htlc_msat(&this_ptr_conv);
41283         return ret_conv;
41284 }
41285
41286 void  __attribute__((export_name("TS_ChannelUsage_set_inflight_htlc_msat"))) TS_ChannelUsage_set_inflight_htlc_msat(uint64_t this_ptr, int64_t val) {
41287         LDKChannelUsage this_ptr_conv;
41288         this_ptr_conv.inner = untag_ptr(this_ptr);
41289         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41290         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41291         this_ptr_conv.is_owned = false;
41292         ChannelUsage_set_inflight_htlc_msat(&this_ptr_conv, val);
41293 }
41294
41295 uint64_t  __attribute__((export_name("TS_ChannelUsage_get_effective_capacity"))) TS_ChannelUsage_get_effective_capacity(uint64_t this_ptr) {
41296         LDKChannelUsage this_ptr_conv;
41297         this_ptr_conv.inner = untag_ptr(this_ptr);
41298         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41299         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41300         this_ptr_conv.is_owned = false;
41301         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
41302         *ret_copy = ChannelUsage_get_effective_capacity(&this_ptr_conv);
41303         uint64_t ret_ref = tag_ptr(ret_copy, true);
41304         return ret_ref;
41305 }
41306
41307 void  __attribute__((export_name("TS_ChannelUsage_set_effective_capacity"))) TS_ChannelUsage_set_effective_capacity(uint64_t this_ptr, uint64_t val) {
41308         LDKChannelUsage this_ptr_conv;
41309         this_ptr_conv.inner = untag_ptr(this_ptr);
41310         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41311         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41312         this_ptr_conv.is_owned = false;
41313         void* val_ptr = untag_ptr(val);
41314         CHECK_ACCESS(val_ptr);
41315         LDKEffectiveCapacity val_conv = *(LDKEffectiveCapacity*)(val_ptr);
41316         val_conv = EffectiveCapacity_clone((LDKEffectiveCapacity*)untag_ptr(val));
41317         ChannelUsage_set_effective_capacity(&this_ptr_conv, val_conv);
41318 }
41319
41320 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) {
41321         void* effective_capacity_arg_ptr = untag_ptr(effective_capacity_arg);
41322         CHECK_ACCESS(effective_capacity_arg_ptr);
41323         LDKEffectiveCapacity effective_capacity_arg_conv = *(LDKEffectiveCapacity*)(effective_capacity_arg_ptr);
41324         effective_capacity_arg_conv = EffectiveCapacity_clone((LDKEffectiveCapacity*)untag_ptr(effective_capacity_arg));
41325         LDKChannelUsage ret_var = ChannelUsage_new(amount_msat_arg, inflight_htlc_msat_arg, effective_capacity_arg_conv);
41326         uint64_t ret_ref = 0;
41327         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41328         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41329         return ret_ref;
41330 }
41331
41332 static inline uint64_t ChannelUsage_clone_ptr(LDKChannelUsage *NONNULL_PTR arg) {
41333         LDKChannelUsage ret_var = ChannelUsage_clone(arg);
41334         uint64_t ret_ref = 0;
41335         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41336         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41337         return ret_ref;
41338 }
41339 int64_t  __attribute__((export_name("TS_ChannelUsage_clone_ptr"))) TS_ChannelUsage_clone_ptr(uint64_t arg) {
41340         LDKChannelUsage arg_conv;
41341         arg_conv.inner = untag_ptr(arg);
41342         arg_conv.is_owned = ptr_is_owned(arg);
41343         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
41344         arg_conv.is_owned = false;
41345         int64_t ret_conv = ChannelUsage_clone_ptr(&arg_conv);
41346         return ret_conv;
41347 }
41348
41349 uint64_t  __attribute__((export_name("TS_ChannelUsage_clone"))) TS_ChannelUsage_clone(uint64_t orig) {
41350         LDKChannelUsage orig_conv;
41351         orig_conv.inner = untag_ptr(orig);
41352         orig_conv.is_owned = ptr_is_owned(orig);
41353         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
41354         orig_conv.is_owned = false;
41355         LDKChannelUsage ret_var = ChannelUsage_clone(&orig_conv);
41356         uint64_t ret_ref = 0;
41357         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41358         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41359         return ret_ref;
41360 }
41361
41362 void  __attribute__((export_name("TS_FixedPenaltyScorer_free"))) TS_FixedPenaltyScorer_free(uint64_t this_obj) {
41363         LDKFixedPenaltyScorer this_obj_conv;
41364         this_obj_conv.inner = untag_ptr(this_obj);
41365         this_obj_conv.is_owned = ptr_is_owned(this_obj);
41366         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41367         FixedPenaltyScorer_free(this_obj_conv);
41368 }
41369
41370 static inline uint64_t FixedPenaltyScorer_clone_ptr(LDKFixedPenaltyScorer *NONNULL_PTR arg) {
41371         LDKFixedPenaltyScorer ret_var = FixedPenaltyScorer_clone(arg);
41372         uint64_t ret_ref = 0;
41373         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41374         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41375         return ret_ref;
41376 }
41377 int64_t  __attribute__((export_name("TS_FixedPenaltyScorer_clone_ptr"))) TS_FixedPenaltyScorer_clone_ptr(uint64_t arg) {
41378         LDKFixedPenaltyScorer arg_conv;
41379         arg_conv.inner = untag_ptr(arg);
41380         arg_conv.is_owned = ptr_is_owned(arg);
41381         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
41382         arg_conv.is_owned = false;
41383         int64_t ret_conv = FixedPenaltyScorer_clone_ptr(&arg_conv);
41384         return ret_conv;
41385 }
41386
41387 uint64_t  __attribute__((export_name("TS_FixedPenaltyScorer_clone"))) TS_FixedPenaltyScorer_clone(uint64_t orig) {
41388         LDKFixedPenaltyScorer orig_conv;
41389         orig_conv.inner = untag_ptr(orig);
41390         orig_conv.is_owned = ptr_is_owned(orig);
41391         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
41392         orig_conv.is_owned = false;
41393         LDKFixedPenaltyScorer ret_var = FixedPenaltyScorer_clone(&orig_conv);
41394         uint64_t ret_ref = 0;
41395         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41396         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41397         return ret_ref;
41398 }
41399
41400 uint64_t  __attribute__((export_name("TS_FixedPenaltyScorer_with_penalty"))) TS_FixedPenaltyScorer_with_penalty(int64_t penalty_msat) {
41401         LDKFixedPenaltyScorer ret_var = FixedPenaltyScorer_with_penalty(penalty_msat);
41402         uint64_t ret_ref = 0;
41403         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41404         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41405         return ret_ref;
41406 }
41407
41408 uint64_t  __attribute__((export_name("TS_FixedPenaltyScorer_as_Score"))) TS_FixedPenaltyScorer_as_Score(uint64_t this_arg) {
41409         LDKFixedPenaltyScorer this_arg_conv;
41410         this_arg_conv.inner = untag_ptr(this_arg);
41411         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41412         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41413         this_arg_conv.is_owned = false;
41414         LDKScore* ret_ret = MALLOC(sizeof(LDKScore), "LDKScore");
41415         *ret_ret = FixedPenaltyScorer_as_Score(&this_arg_conv);
41416         return tag_ptr(ret_ret, true);
41417 }
41418
41419 int8_tArray  __attribute__((export_name("TS_FixedPenaltyScorer_write"))) TS_FixedPenaltyScorer_write(uint64_t obj) {
41420         LDKFixedPenaltyScorer obj_conv;
41421         obj_conv.inner = untag_ptr(obj);
41422         obj_conv.is_owned = ptr_is_owned(obj);
41423         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
41424         obj_conv.is_owned = false;
41425         LDKCVec_u8Z ret_var = FixedPenaltyScorer_write(&obj_conv);
41426         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
41427         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
41428         CVec_u8Z_free(ret_var);
41429         return ret_arr;
41430 }
41431
41432 uint64_t  __attribute__((export_name("TS_FixedPenaltyScorer_read"))) TS_FixedPenaltyScorer_read(int8_tArray ser, int64_t arg) {
41433         LDKu8slice ser_ref;
41434         ser_ref.datalen = ser->arr_len;
41435         ser_ref.data = ser->elems;
41436         LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
41437         *ret_conv = FixedPenaltyScorer_read(ser_ref, arg);
41438         FREE(ser);
41439         return tag_ptr(ret_conv, true);
41440 }
41441
41442 void  __attribute__((export_name("TS_ProbabilisticScorer_free"))) TS_ProbabilisticScorer_free(uint64_t this_obj) {
41443         LDKProbabilisticScorer this_obj_conv;
41444         this_obj_conv.inner = untag_ptr(this_obj);
41445         this_obj_conv.is_owned = ptr_is_owned(this_obj);
41446         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41447         ProbabilisticScorer_free(this_obj_conv);
41448 }
41449
41450 void  __attribute__((export_name("TS_ProbabilisticScoringParameters_free"))) TS_ProbabilisticScoringParameters_free(uint64_t this_obj) {
41451         LDKProbabilisticScoringParameters this_obj_conv;
41452         this_obj_conv.inner = untag_ptr(this_obj);
41453         this_obj_conv.is_owned = ptr_is_owned(this_obj);
41454         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41455         ProbabilisticScoringParameters_free(this_obj_conv);
41456 }
41457
41458 int64_t  __attribute__((export_name("TS_ProbabilisticScoringParameters_get_base_penalty_msat"))) TS_ProbabilisticScoringParameters_get_base_penalty_msat(uint64_t this_ptr) {
41459         LDKProbabilisticScoringParameters this_ptr_conv;
41460         this_ptr_conv.inner = untag_ptr(this_ptr);
41461         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41462         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41463         this_ptr_conv.is_owned = false;
41464         int64_t ret_conv = ProbabilisticScoringParameters_get_base_penalty_msat(&this_ptr_conv);
41465         return ret_conv;
41466 }
41467
41468 void  __attribute__((export_name("TS_ProbabilisticScoringParameters_set_base_penalty_msat"))) TS_ProbabilisticScoringParameters_set_base_penalty_msat(uint64_t this_ptr, int64_t val) {
41469         LDKProbabilisticScoringParameters this_ptr_conv;
41470         this_ptr_conv.inner = untag_ptr(this_ptr);
41471         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41472         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41473         this_ptr_conv.is_owned = false;
41474         ProbabilisticScoringParameters_set_base_penalty_msat(&this_ptr_conv, val);
41475 }
41476
41477 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) {
41478         LDKProbabilisticScoringParameters this_ptr_conv;
41479         this_ptr_conv.inner = untag_ptr(this_ptr);
41480         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41481         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41482         this_ptr_conv.is_owned = false;
41483         int64_t ret_conv = ProbabilisticScoringParameters_get_base_penalty_amount_multiplier_msat(&this_ptr_conv);
41484         return ret_conv;
41485 }
41486
41487 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) {
41488         LDKProbabilisticScoringParameters this_ptr_conv;
41489         this_ptr_conv.inner = untag_ptr(this_ptr);
41490         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41491         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41492         this_ptr_conv.is_owned = false;
41493         ProbabilisticScoringParameters_set_base_penalty_amount_multiplier_msat(&this_ptr_conv, val);
41494 }
41495
41496 int64_t  __attribute__((export_name("TS_ProbabilisticScoringParameters_get_liquidity_penalty_multiplier_msat"))) TS_ProbabilisticScoringParameters_get_liquidity_penalty_multiplier_msat(uint64_t this_ptr) {
41497         LDKProbabilisticScoringParameters this_ptr_conv;
41498         this_ptr_conv.inner = untag_ptr(this_ptr);
41499         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41500         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41501         this_ptr_conv.is_owned = false;
41502         int64_t ret_conv = ProbabilisticScoringParameters_get_liquidity_penalty_multiplier_msat(&this_ptr_conv);
41503         return ret_conv;
41504 }
41505
41506 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) {
41507         LDKProbabilisticScoringParameters this_ptr_conv;
41508         this_ptr_conv.inner = untag_ptr(this_ptr);
41509         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41510         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41511         this_ptr_conv.is_owned = false;
41512         ProbabilisticScoringParameters_set_liquidity_penalty_multiplier_msat(&this_ptr_conv, val);
41513 }
41514
41515 int64_t  __attribute__((export_name("TS_ProbabilisticScoringParameters_get_liquidity_offset_half_life"))) TS_ProbabilisticScoringParameters_get_liquidity_offset_half_life(uint64_t this_ptr) {
41516         LDKProbabilisticScoringParameters this_ptr_conv;
41517         this_ptr_conv.inner = untag_ptr(this_ptr);
41518         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41519         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41520         this_ptr_conv.is_owned = false;
41521         int64_t ret_conv = ProbabilisticScoringParameters_get_liquidity_offset_half_life(&this_ptr_conv);
41522         return ret_conv;
41523 }
41524
41525 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) {
41526         LDKProbabilisticScoringParameters this_ptr_conv;
41527         this_ptr_conv.inner = untag_ptr(this_ptr);
41528         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41529         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41530         this_ptr_conv.is_owned = false;
41531         ProbabilisticScoringParameters_set_liquidity_offset_half_life(&this_ptr_conv, val);
41532 }
41533
41534 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) {
41535         LDKProbabilisticScoringParameters this_ptr_conv;
41536         this_ptr_conv.inner = untag_ptr(this_ptr);
41537         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41538         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41539         this_ptr_conv.is_owned = false;
41540         int64_t ret_conv = ProbabilisticScoringParameters_get_liquidity_penalty_amount_multiplier_msat(&this_ptr_conv);
41541         return ret_conv;
41542 }
41543
41544 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) {
41545         LDKProbabilisticScoringParameters this_ptr_conv;
41546         this_ptr_conv.inner = untag_ptr(this_ptr);
41547         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41548         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41549         this_ptr_conv.is_owned = false;
41550         ProbabilisticScoringParameters_set_liquidity_penalty_amount_multiplier_msat(&this_ptr_conv, val);
41551 }
41552
41553 int64_t  __attribute__((export_name("TS_ProbabilisticScoringParameters_get_anti_probing_penalty_msat"))) TS_ProbabilisticScoringParameters_get_anti_probing_penalty_msat(uint64_t this_ptr) {
41554         LDKProbabilisticScoringParameters this_ptr_conv;
41555         this_ptr_conv.inner = untag_ptr(this_ptr);
41556         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41557         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41558         this_ptr_conv.is_owned = false;
41559         int64_t ret_conv = ProbabilisticScoringParameters_get_anti_probing_penalty_msat(&this_ptr_conv);
41560         return ret_conv;
41561 }
41562
41563 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) {
41564         LDKProbabilisticScoringParameters this_ptr_conv;
41565         this_ptr_conv.inner = untag_ptr(this_ptr);
41566         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41567         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41568         this_ptr_conv.is_owned = false;
41569         ProbabilisticScoringParameters_set_anti_probing_penalty_msat(&this_ptr_conv, val);
41570 }
41571
41572 int64_t  __attribute__((export_name("TS_ProbabilisticScoringParameters_get_considered_impossible_penalty_msat"))) TS_ProbabilisticScoringParameters_get_considered_impossible_penalty_msat(uint64_t this_ptr) {
41573         LDKProbabilisticScoringParameters this_ptr_conv;
41574         this_ptr_conv.inner = untag_ptr(this_ptr);
41575         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41576         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41577         this_ptr_conv.is_owned = false;
41578         int64_t ret_conv = ProbabilisticScoringParameters_get_considered_impossible_penalty_msat(&this_ptr_conv);
41579         return ret_conv;
41580 }
41581
41582 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) {
41583         LDKProbabilisticScoringParameters this_ptr_conv;
41584         this_ptr_conv.inner = untag_ptr(this_ptr);
41585         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41586         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41587         this_ptr_conv.is_owned = false;
41588         ProbabilisticScoringParameters_set_considered_impossible_penalty_msat(&this_ptr_conv, val);
41589 }
41590
41591 static inline uint64_t ProbabilisticScoringParameters_clone_ptr(LDKProbabilisticScoringParameters *NONNULL_PTR arg) {
41592         LDKProbabilisticScoringParameters ret_var = ProbabilisticScoringParameters_clone(arg);
41593         uint64_t ret_ref = 0;
41594         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41595         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41596         return ret_ref;
41597 }
41598 int64_t  __attribute__((export_name("TS_ProbabilisticScoringParameters_clone_ptr"))) TS_ProbabilisticScoringParameters_clone_ptr(uint64_t arg) {
41599         LDKProbabilisticScoringParameters arg_conv;
41600         arg_conv.inner = untag_ptr(arg);
41601         arg_conv.is_owned = ptr_is_owned(arg);
41602         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
41603         arg_conv.is_owned = false;
41604         int64_t ret_conv = ProbabilisticScoringParameters_clone_ptr(&arg_conv);
41605         return ret_conv;
41606 }
41607
41608 uint64_t  __attribute__((export_name("TS_ProbabilisticScoringParameters_clone"))) TS_ProbabilisticScoringParameters_clone(uint64_t orig) {
41609         LDKProbabilisticScoringParameters orig_conv;
41610         orig_conv.inner = untag_ptr(orig);
41611         orig_conv.is_owned = ptr_is_owned(orig);
41612         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
41613         orig_conv.is_owned = false;
41614         LDKProbabilisticScoringParameters ret_var = ProbabilisticScoringParameters_clone(&orig_conv);
41615         uint64_t ret_ref = 0;
41616         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41617         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41618         return ret_ref;
41619 }
41620
41621 uint64_t  __attribute__((export_name("TS_ProbabilisticScorer_new"))) TS_ProbabilisticScorer_new(uint64_t params, uint64_t network_graph, uint64_t logger) {
41622         LDKProbabilisticScoringParameters params_conv;
41623         params_conv.inner = untag_ptr(params);
41624         params_conv.is_owned = ptr_is_owned(params);
41625         CHECK_INNER_FIELD_ACCESS_OR_NULL(params_conv);
41626         params_conv = ProbabilisticScoringParameters_clone(&params_conv);
41627         LDKNetworkGraph network_graph_conv;
41628         network_graph_conv.inner = untag_ptr(network_graph);
41629         network_graph_conv.is_owned = ptr_is_owned(network_graph);
41630         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
41631         network_graph_conv.is_owned = false;
41632         void* logger_ptr = untag_ptr(logger);
41633         CHECK_ACCESS(logger_ptr);
41634         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
41635         if (logger_conv.free == LDKLogger_JCalls_free) {
41636                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
41637                 LDKLogger_JCalls_cloned(&logger_conv);
41638         }
41639         LDKProbabilisticScorer ret_var = ProbabilisticScorer_new(params_conv, &network_graph_conv, logger_conv);
41640         uint64_t ret_ref = 0;
41641         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41642         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41643         return ret_ref;
41644 }
41645
41646 void  __attribute__((export_name("TS_ProbabilisticScorer_debug_log_liquidity_stats"))) TS_ProbabilisticScorer_debug_log_liquidity_stats(uint64_t this_arg) {
41647         LDKProbabilisticScorer this_arg_conv;
41648         this_arg_conv.inner = untag_ptr(this_arg);
41649         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41650         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41651         this_arg_conv.is_owned = false;
41652         ProbabilisticScorer_debug_log_liquidity_stats(&this_arg_conv);
41653 }
41654
41655 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) {
41656         LDKProbabilisticScorer this_arg_conv;
41657         this_arg_conv.inner = untag_ptr(this_arg);
41658         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41659         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41660         this_arg_conv.is_owned = false;
41661         LDKNodeId target_conv;
41662         target_conv.inner = untag_ptr(target);
41663         target_conv.is_owned = ptr_is_owned(target);
41664         CHECK_INNER_FIELD_ACCESS_OR_NULL(target_conv);
41665         target_conv.is_owned = false;
41666         LDKCOption_C2Tuple_u64u64ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u64ZZ), "LDKCOption_C2Tuple_u64u64ZZ");
41667         *ret_copy = ProbabilisticScorer_estimated_channel_liquidity_range(&this_arg_conv, scid, &target_conv);
41668         uint64_t ret_ref = tag_ptr(ret_copy, true);
41669         return ret_ref;
41670 }
41671
41672 void  __attribute__((export_name("TS_ProbabilisticScorer_add_banned"))) TS_ProbabilisticScorer_add_banned(uint64_t this_arg, uint64_t node_id) {
41673         LDKProbabilisticScorer this_arg_conv;
41674         this_arg_conv.inner = untag_ptr(this_arg);
41675         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41676         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41677         this_arg_conv.is_owned = false;
41678         LDKNodeId node_id_conv;
41679         node_id_conv.inner = untag_ptr(node_id);
41680         node_id_conv.is_owned = ptr_is_owned(node_id);
41681         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv);
41682         node_id_conv.is_owned = false;
41683         ProbabilisticScorer_add_banned(&this_arg_conv, &node_id_conv);
41684 }
41685
41686 void  __attribute__((export_name("TS_ProbabilisticScorer_remove_banned"))) TS_ProbabilisticScorer_remove_banned(uint64_t this_arg, uint64_t node_id) {
41687         LDKProbabilisticScorer this_arg_conv;
41688         this_arg_conv.inner = untag_ptr(this_arg);
41689         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41690         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41691         this_arg_conv.is_owned = false;
41692         LDKNodeId node_id_conv;
41693         node_id_conv.inner = untag_ptr(node_id);
41694         node_id_conv.is_owned = ptr_is_owned(node_id);
41695         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv);
41696         node_id_conv.is_owned = false;
41697         ProbabilisticScorer_remove_banned(&this_arg_conv, &node_id_conv);
41698 }
41699
41700 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) {
41701         LDKProbabilisticScorer this_arg_conv;
41702         this_arg_conv.inner = untag_ptr(this_arg);
41703         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41704         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41705         this_arg_conv.is_owned = false;
41706         LDKNodeId node_id_conv;
41707         node_id_conv.inner = untag_ptr(node_id);
41708         node_id_conv.is_owned = ptr_is_owned(node_id);
41709         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv);
41710         node_id_conv.is_owned = false;
41711         ProbabilisticScorer_set_manual_penalty(&this_arg_conv, &node_id_conv, penalty);
41712 }
41713
41714 void  __attribute__((export_name("TS_ProbabilisticScorer_remove_manual_penalty"))) TS_ProbabilisticScorer_remove_manual_penalty(uint64_t this_arg, uint64_t node_id) {
41715         LDKProbabilisticScorer this_arg_conv;
41716         this_arg_conv.inner = untag_ptr(this_arg);
41717         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41718         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41719         this_arg_conv.is_owned = false;
41720         LDKNodeId node_id_conv;
41721         node_id_conv.inner = untag_ptr(node_id);
41722         node_id_conv.is_owned = ptr_is_owned(node_id);
41723         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv);
41724         node_id_conv.is_owned = false;
41725         ProbabilisticScorer_remove_manual_penalty(&this_arg_conv, &node_id_conv);
41726 }
41727
41728 void  __attribute__((export_name("TS_ProbabilisticScorer_clear_manual_penalties"))) TS_ProbabilisticScorer_clear_manual_penalties(uint64_t this_arg) {
41729         LDKProbabilisticScorer this_arg_conv;
41730         this_arg_conv.inner = untag_ptr(this_arg);
41731         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41732         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41733         this_arg_conv.is_owned = false;
41734         ProbabilisticScorer_clear_manual_penalties(&this_arg_conv);
41735 }
41736
41737 void  __attribute__((export_name("TS_ProbabilisticScoringParameters_add_banned_from_list"))) TS_ProbabilisticScoringParameters_add_banned_from_list(uint64_t this_arg, uint64_tArray node_ids) {
41738         LDKProbabilisticScoringParameters this_arg_conv;
41739         this_arg_conv.inner = untag_ptr(this_arg);
41740         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41741         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41742         this_arg_conv.is_owned = false;
41743         LDKCVec_NodeIdZ node_ids_constr;
41744         node_ids_constr.datalen = node_ids->arr_len;
41745         if (node_ids_constr.datalen > 0)
41746                 node_ids_constr.data = MALLOC(node_ids_constr.datalen * sizeof(LDKNodeId), "LDKCVec_NodeIdZ Elements");
41747         else
41748                 node_ids_constr.data = NULL;
41749         uint64_t* node_ids_vals = node_ids->elems;
41750         for (size_t i = 0; i < node_ids_constr.datalen; i++) {
41751                 uint64_t node_ids_conv_8 = node_ids_vals[i];
41752                 LDKNodeId node_ids_conv_8_conv;
41753                 node_ids_conv_8_conv.inner = untag_ptr(node_ids_conv_8);
41754                 node_ids_conv_8_conv.is_owned = ptr_is_owned(node_ids_conv_8);
41755                 CHECK_INNER_FIELD_ACCESS_OR_NULL(node_ids_conv_8_conv);
41756                 node_ids_conv_8_conv = NodeId_clone(&node_ids_conv_8_conv);
41757                 node_ids_constr.data[i] = node_ids_conv_8_conv;
41758         }
41759         FREE(node_ids);
41760         ProbabilisticScoringParameters_add_banned_from_list(&this_arg_conv, node_ids_constr);
41761 }
41762
41763 uint64_t  __attribute__((export_name("TS_ProbabilisticScoringParameters_default"))) TS_ProbabilisticScoringParameters_default() {
41764         LDKProbabilisticScoringParameters ret_var = ProbabilisticScoringParameters_default();
41765         uint64_t ret_ref = 0;
41766         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41767         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41768         return ret_ref;
41769 }
41770
41771 uint64_t  __attribute__((export_name("TS_ProbabilisticScorer_as_Score"))) TS_ProbabilisticScorer_as_Score(uint64_t this_arg) {
41772         LDKProbabilisticScorer this_arg_conv;
41773         this_arg_conv.inner = untag_ptr(this_arg);
41774         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41775         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41776         this_arg_conv.is_owned = false;
41777         LDKScore* ret_ret = MALLOC(sizeof(LDKScore), "LDKScore");
41778         *ret_ret = ProbabilisticScorer_as_Score(&this_arg_conv);
41779         return tag_ptr(ret_ret, true);
41780 }
41781
41782 int8_tArray  __attribute__((export_name("TS_ProbabilisticScorer_write"))) TS_ProbabilisticScorer_write(uint64_t obj) {
41783         LDKProbabilisticScorer obj_conv;
41784         obj_conv.inner = untag_ptr(obj);
41785         obj_conv.is_owned = ptr_is_owned(obj);
41786         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
41787         obj_conv.is_owned = false;
41788         LDKCVec_u8Z ret_var = ProbabilisticScorer_write(&obj_conv);
41789         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
41790         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
41791         CVec_u8Z_free(ret_var);
41792         return ret_arr;
41793 }
41794
41795 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) {
41796         LDKu8slice ser_ref;
41797         ser_ref.datalen = ser->arr_len;
41798         ser_ref.data = ser->elems;
41799         LDKProbabilisticScoringParameters arg_a_conv;
41800         arg_a_conv.inner = untag_ptr(arg_a);
41801         arg_a_conv.is_owned = ptr_is_owned(arg_a);
41802         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_a_conv);
41803         arg_a_conv = ProbabilisticScoringParameters_clone(&arg_a_conv);
41804         LDKNetworkGraph arg_b_conv;
41805         arg_b_conv.inner = untag_ptr(arg_b);
41806         arg_b_conv.is_owned = ptr_is_owned(arg_b);
41807         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_b_conv);
41808         arg_b_conv.is_owned = false;
41809         void* arg_c_ptr = untag_ptr(arg_c);
41810         CHECK_ACCESS(arg_c_ptr);
41811         LDKLogger arg_c_conv = *(LDKLogger*)(arg_c_ptr);
41812         if (arg_c_conv.free == LDKLogger_JCalls_free) {
41813                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
41814                 LDKLogger_JCalls_cloned(&arg_c_conv);
41815         }
41816         LDKCResult_ProbabilisticScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ProbabilisticScorerDecodeErrorZ), "LDKCResult_ProbabilisticScorerDecodeErrorZ");
41817         *ret_conv = ProbabilisticScorer_read(ser_ref, arg_a_conv, &arg_b_conv, arg_c_conv);
41818         FREE(ser);
41819         return tag_ptr(ret_conv, true);
41820 }
41821
41822 void  __attribute__((export_name("TS_ParseError_free"))) TS_ParseError_free(uint64_t this_ptr) {
41823         if (!ptr_is_owned(this_ptr)) return;
41824         void* this_ptr_ptr = untag_ptr(this_ptr);
41825         CHECK_ACCESS(this_ptr_ptr);
41826         LDKParseError this_ptr_conv = *(LDKParseError*)(this_ptr_ptr);
41827         FREE(untag_ptr(this_ptr));
41828         ParseError_free(this_ptr_conv);
41829 }
41830
41831 static inline uint64_t ParseError_clone_ptr(LDKParseError *NONNULL_PTR arg) {
41832         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
41833         *ret_copy = ParseError_clone(arg);
41834         uint64_t ret_ref = tag_ptr(ret_copy, true);
41835         return ret_ref;
41836 }
41837 int64_t  __attribute__((export_name("TS_ParseError_clone_ptr"))) TS_ParseError_clone_ptr(uint64_t arg) {
41838         LDKParseError* arg_conv = (LDKParseError*)untag_ptr(arg);
41839         int64_t ret_conv = ParseError_clone_ptr(arg_conv);
41840         return ret_conv;
41841 }
41842
41843 uint64_t  __attribute__((export_name("TS_ParseError_clone"))) TS_ParseError_clone(uint64_t orig) {
41844         LDKParseError* orig_conv = (LDKParseError*)untag_ptr(orig);
41845         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
41846         *ret_copy = ParseError_clone(orig_conv);
41847         uint64_t ret_ref = tag_ptr(ret_copy, true);
41848         return ret_ref;
41849 }
41850
41851 uint64_t  __attribute__((export_name("TS_ParseError_bech32_error"))) TS_ParseError_bech32_error(uint64_t a) {
41852         void* a_ptr = untag_ptr(a);
41853         CHECK_ACCESS(a_ptr);
41854         LDKBech32Error a_conv = *(LDKBech32Error*)(a_ptr);
41855         a_conv = Bech32Error_clone((LDKBech32Error*)untag_ptr(a));
41856         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
41857         *ret_copy = ParseError_bech32_error(a_conv);
41858         uint64_t ret_ref = tag_ptr(ret_copy, true);
41859         return ret_ref;
41860 }
41861
41862 uint64_t  __attribute__((export_name("TS_ParseError_parse_amount_error"))) TS_ParseError_parse_amount_error(int32_t a) {
41863         
41864         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
41865         *ret_copy = ParseError_parse_amount_error((LDKError){ ._dummy = 0 });
41866         uint64_t ret_ref = tag_ptr(ret_copy, true);
41867         return ret_ref;
41868 }
41869
41870 uint64_t  __attribute__((export_name("TS_ParseError_malformed_signature"))) TS_ParseError_malformed_signature(uint32_t a) {
41871         LDKSecp256k1Error a_conv = LDKSecp256k1Error_from_js(a);
41872         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
41873         *ret_copy = ParseError_malformed_signature(a_conv);
41874         uint64_t ret_ref = tag_ptr(ret_copy, true);
41875         return ret_ref;
41876 }
41877
41878 uint64_t  __attribute__((export_name("TS_ParseError_bad_prefix"))) TS_ParseError_bad_prefix() {
41879         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
41880         *ret_copy = ParseError_bad_prefix();
41881         uint64_t ret_ref = tag_ptr(ret_copy, true);
41882         return ret_ref;
41883 }
41884
41885 uint64_t  __attribute__((export_name("TS_ParseError_unknown_currency"))) TS_ParseError_unknown_currency() {
41886         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
41887         *ret_copy = ParseError_unknown_currency();
41888         uint64_t ret_ref = tag_ptr(ret_copy, true);
41889         return ret_ref;
41890 }
41891
41892 uint64_t  __attribute__((export_name("TS_ParseError_unknown_si_prefix"))) TS_ParseError_unknown_si_prefix() {
41893         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
41894         *ret_copy = ParseError_unknown_si_prefix();
41895         uint64_t ret_ref = tag_ptr(ret_copy, true);
41896         return ret_ref;
41897 }
41898
41899 uint64_t  __attribute__((export_name("TS_ParseError_malformed_hrp"))) TS_ParseError_malformed_hrp() {
41900         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
41901         *ret_copy = ParseError_malformed_hrp();
41902         uint64_t ret_ref = tag_ptr(ret_copy, true);
41903         return ret_ref;
41904 }
41905
41906 uint64_t  __attribute__((export_name("TS_ParseError_too_short_data_part"))) TS_ParseError_too_short_data_part() {
41907         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
41908         *ret_copy = ParseError_too_short_data_part();
41909         uint64_t ret_ref = tag_ptr(ret_copy, true);
41910         return ret_ref;
41911 }
41912
41913 uint64_t  __attribute__((export_name("TS_ParseError_unexpected_end_of_tagged_fields"))) TS_ParseError_unexpected_end_of_tagged_fields() {
41914         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
41915         *ret_copy = ParseError_unexpected_end_of_tagged_fields();
41916         uint64_t ret_ref = tag_ptr(ret_copy, true);
41917         return ret_ref;
41918 }
41919
41920 uint64_t  __attribute__((export_name("TS_ParseError_description_decode_error"))) TS_ParseError_description_decode_error(int32_t a) {
41921         
41922         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
41923         *ret_copy = ParseError_description_decode_error((LDKError){ ._dummy = 0 });
41924         uint64_t ret_ref = tag_ptr(ret_copy, true);
41925         return ret_ref;
41926 }
41927
41928 uint64_t  __attribute__((export_name("TS_ParseError_padding_error"))) TS_ParseError_padding_error() {
41929         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
41930         *ret_copy = ParseError_padding_error();
41931         uint64_t ret_ref = tag_ptr(ret_copy, true);
41932         return ret_ref;
41933 }
41934
41935 uint64_t  __attribute__((export_name("TS_ParseError_integer_overflow_error"))) TS_ParseError_integer_overflow_error() {
41936         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
41937         *ret_copy = ParseError_integer_overflow_error();
41938         uint64_t ret_ref = tag_ptr(ret_copy, true);
41939         return ret_ref;
41940 }
41941
41942 uint64_t  __attribute__((export_name("TS_ParseError_invalid_seg_wit_program_length"))) TS_ParseError_invalid_seg_wit_program_length() {
41943         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
41944         *ret_copy = ParseError_invalid_seg_wit_program_length();
41945         uint64_t ret_ref = tag_ptr(ret_copy, true);
41946         return ret_ref;
41947 }
41948
41949 uint64_t  __attribute__((export_name("TS_ParseError_invalid_pub_key_hash_length"))) TS_ParseError_invalid_pub_key_hash_length() {
41950         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
41951         *ret_copy = ParseError_invalid_pub_key_hash_length();
41952         uint64_t ret_ref = tag_ptr(ret_copy, true);
41953         return ret_ref;
41954 }
41955
41956 uint64_t  __attribute__((export_name("TS_ParseError_invalid_script_hash_length"))) TS_ParseError_invalid_script_hash_length() {
41957         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
41958         *ret_copy = ParseError_invalid_script_hash_length();
41959         uint64_t ret_ref = tag_ptr(ret_copy, true);
41960         return ret_ref;
41961 }
41962
41963 uint64_t  __attribute__((export_name("TS_ParseError_invalid_recovery_id"))) TS_ParseError_invalid_recovery_id() {
41964         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
41965         *ret_copy = ParseError_invalid_recovery_id();
41966         uint64_t ret_ref = tag_ptr(ret_copy, true);
41967         return ret_ref;
41968 }
41969
41970 uint64_t  __attribute__((export_name("TS_ParseError_invalid_slice_length"))) TS_ParseError_invalid_slice_length(jstring a) {
41971         LDKStr a_conv = str_ref_to_owned_c(a);
41972         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
41973         *ret_copy = ParseError_invalid_slice_length(a_conv);
41974         uint64_t ret_ref = tag_ptr(ret_copy, true);
41975         return ret_ref;
41976 }
41977
41978 uint64_t  __attribute__((export_name("TS_ParseError_skip"))) TS_ParseError_skip() {
41979         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
41980         *ret_copy = ParseError_skip();
41981         uint64_t ret_ref = tag_ptr(ret_copy, true);
41982         return ret_ref;
41983 }
41984
41985 void  __attribute__((export_name("TS_ParseOrSemanticError_free"))) TS_ParseOrSemanticError_free(uint64_t this_ptr) {
41986         if (!ptr_is_owned(this_ptr)) return;
41987         void* this_ptr_ptr = untag_ptr(this_ptr);
41988         CHECK_ACCESS(this_ptr_ptr);
41989         LDKParseOrSemanticError this_ptr_conv = *(LDKParseOrSemanticError*)(this_ptr_ptr);
41990         FREE(untag_ptr(this_ptr));
41991         ParseOrSemanticError_free(this_ptr_conv);
41992 }
41993
41994 static inline uint64_t ParseOrSemanticError_clone_ptr(LDKParseOrSemanticError *NONNULL_PTR arg) {
41995         LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
41996         *ret_copy = ParseOrSemanticError_clone(arg);
41997         uint64_t ret_ref = tag_ptr(ret_copy, true);
41998         return ret_ref;
41999 }
42000 int64_t  __attribute__((export_name("TS_ParseOrSemanticError_clone_ptr"))) TS_ParseOrSemanticError_clone_ptr(uint64_t arg) {
42001         LDKParseOrSemanticError* arg_conv = (LDKParseOrSemanticError*)untag_ptr(arg);
42002         int64_t ret_conv = ParseOrSemanticError_clone_ptr(arg_conv);
42003         return ret_conv;
42004 }
42005
42006 uint64_t  __attribute__((export_name("TS_ParseOrSemanticError_clone"))) TS_ParseOrSemanticError_clone(uint64_t orig) {
42007         LDKParseOrSemanticError* orig_conv = (LDKParseOrSemanticError*)untag_ptr(orig);
42008         LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
42009         *ret_copy = ParseOrSemanticError_clone(orig_conv);
42010         uint64_t ret_ref = tag_ptr(ret_copy, true);
42011         return ret_ref;
42012 }
42013
42014 uint64_t  __attribute__((export_name("TS_ParseOrSemanticError_parse_error"))) TS_ParseOrSemanticError_parse_error(uint64_t a) {
42015         void* a_ptr = untag_ptr(a);
42016         CHECK_ACCESS(a_ptr);
42017         LDKParseError a_conv = *(LDKParseError*)(a_ptr);
42018         a_conv = ParseError_clone((LDKParseError*)untag_ptr(a));
42019         LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
42020         *ret_copy = ParseOrSemanticError_parse_error(a_conv);
42021         uint64_t ret_ref = tag_ptr(ret_copy, true);
42022         return ret_ref;
42023 }
42024
42025 uint64_t  __attribute__((export_name("TS_ParseOrSemanticError_semantic_error"))) TS_ParseOrSemanticError_semantic_error(uint32_t a) {
42026         LDKSemanticError a_conv = LDKSemanticError_from_js(a);
42027         LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
42028         *ret_copy = ParseOrSemanticError_semantic_error(a_conv);
42029         uint64_t ret_ref = tag_ptr(ret_copy, true);
42030         return ret_ref;
42031 }
42032
42033 void  __attribute__((export_name("TS_Invoice_free"))) TS_Invoice_free(uint64_t this_obj) {
42034         LDKInvoice this_obj_conv;
42035         this_obj_conv.inner = untag_ptr(this_obj);
42036         this_obj_conv.is_owned = ptr_is_owned(this_obj);
42037         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42038         Invoice_free(this_obj_conv);
42039 }
42040
42041 jboolean  __attribute__((export_name("TS_Invoice_eq"))) TS_Invoice_eq(uint64_t a, uint64_t b) {
42042         LDKInvoice a_conv;
42043         a_conv.inner = untag_ptr(a);
42044         a_conv.is_owned = ptr_is_owned(a);
42045         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
42046         a_conv.is_owned = false;
42047         LDKInvoice b_conv;
42048         b_conv.inner = untag_ptr(b);
42049         b_conv.is_owned = ptr_is_owned(b);
42050         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
42051         b_conv.is_owned = false;
42052         jboolean ret_conv = Invoice_eq(&a_conv, &b_conv);
42053         return ret_conv;
42054 }
42055
42056 static inline uint64_t Invoice_clone_ptr(LDKInvoice *NONNULL_PTR arg) {
42057         LDKInvoice ret_var = Invoice_clone(arg);
42058         uint64_t ret_ref = 0;
42059         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42060         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42061         return ret_ref;
42062 }
42063 int64_t  __attribute__((export_name("TS_Invoice_clone_ptr"))) TS_Invoice_clone_ptr(uint64_t arg) {
42064         LDKInvoice arg_conv;
42065         arg_conv.inner = untag_ptr(arg);
42066         arg_conv.is_owned = ptr_is_owned(arg);
42067         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42068         arg_conv.is_owned = false;
42069         int64_t ret_conv = Invoice_clone_ptr(&arg_conv);
42070         return ret_conv;
42071 }
42072
42073 uint64_t  __attribute__((export_name("TS_Invoice_clone"))) TS_Invoice_clone(uint64_t orig) {
42074         LDKInvoice orig_conv;
42075         orig_conv.inner = untag_ptr(orig);
42076         orig_conv.is_owned = ptr_is_owned(orig);
42077         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
42078         orig_conv.is_owned = false;
42079         LDKInvoice ret_var = Invoice_clone(&orig_conv);
42080         uint64_t ret_ref = 0;
42081         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42082         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42083         return ret_ref;
42084 }
42085
42086 void  __attribute__((export_name("TS_SignedRawInvoice_free"))) TS_SignedRawInvoice_free(uint64_t this_obj) {
42087         LDKSignedRawInvoice this_obj_conv;
42088         this_obj_conv.inner = untag_ptr(this_obj);
42089         this_obj_conv.is_owned = ptr_is_owned(this_obj);
42090         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42091         SignedRawInvoice_free(this_obj_conv);
42092 }
42093
42094 jboolean  __attribute__((export_name("TS_SignedRawInvoice_eq"))) TS_SignedRawInvoice_eq(uint64_t a, uint64_t b) {
42095         LDKSignedRawInvoice a_conv;
42096         a_conv.inner = untag_ptr(a);
42097         a_conv.is_owned = ptr_is_owned(a);
42098         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
42099         a_conv.is_owned = false;
42100         LDKSignedRawInvoice b_conv;
42101         b_conv.inner = untag_ptr(b);
42102         b_conv.is_owned = ptr_is_owned(b);
42103         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
42104         b_conv.is_owned = false;
42105         jboolean ret_conv = SignedRawInvoice_eq(&a_conv, &b_conv);
42106         return ret_conv;
42107 }
42108
42109 static inline uint64_t SignedRawInvoice_clone_ptr(LDKSignedRawInvoice *NONNULL_PTR arg) {
42110         LDKSignedRawInvoice ret_var = SignedRawInvoice_clone(arg);
42111         uint64_t ret_ref = 0;
42112         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42113         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42114         return ret_ref;
42115 }
42116 int64_t  __attribute__((export_name("TS_SignedRawInvoice_clone_ptr"))) TS_SignedRawInvoice_clone_ptr(uint64_t arg) {
42117         LDKSignedRawInvoice arg_conv;
42118         arg_conv.inner = untag_ptr(arg);
42119         arg_conv.is_owned = ptr_is_owned(arg);
42120         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42121         arg_conv.is_owned = false;
42122         int64_t ret_conv = SignedRawInvoice_clone_ptr(&arg_conv);
42123         return ret_conv;
42124 }
42125
42126 uint64_t  __attribute__((export_name("TS_SignedRawInvoice_clone"))) TS_SignedRawInvoice_clone(uint64_t orig) {
42127         LDKSignedRawInvoice orig_conv;
42128         orig_conv.inner = untag_ptr(orig);
42129         orig_conv.is_owned = ptr_is_owned(orig);
42130         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
42131         orig_conv.is_owned = false;
42132         LDKSignedRawInvoice ret_var = SignedRawInvoice_clone(&orig_conv);
42133         uint64_t ret_ref = 0;
42134         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42135         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42136         return ret_ref;
42137 }
42138
42139 void  __attribute__((export_name("TS_RawInvoice_free"))) TS_RawInvoice_free(uint64_t this_obj) {
42140         LDKRawInvoice this_obj_conv;
42141         this_obj_conv.inner = untag_ptr(this_obj);
42142         this_obj_conv.is_owned = ptr_is_owned(this_obj);
42143         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42144         RawInvoice_free(this_obj_conv);
42145 }
42146
42147 uint64_t  __attribute__((export_name("TS_RawInvoice_get_data"))) TS_RawInvoice_get_data(uint64_t this_ptr) {
42148         LDKRawInvoice this_ptr_conv;
42149         this_ptr_conv.inner = untag_ptr(this_ptr);
42150         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42151         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42152         this_ptr_conv.is_owned = false;
42153         LDKRawDataPart ret_var = RawInvoice_get_data(&this_ptr_conv);
42154         uint64_t ret_ref = 0;
42155         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42156         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42157         return ret_ref;
42158 }
42159
42160 void  __attribute__((export_name("TS_RawInvoice_set_data"))) TS_RawInvoice_set_data(uint64_t this_ptr, uint64_t val) {
42161         LDKRawInvoice this_ptr_conv;
42162         this_ptr_conv.inner = untag_ptr(this_ptr);
42163         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42164         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42165         this_ptr_conv.is_owned = false;
42166         LDKRawDataPart val_conv;
42167         val_conv.inner = untag_ptr(val);
42168         val_conv.is_owned = ptr_is_owned(val);
42169         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
42170         val_conv = RawDataPart_clone(&val_conv);
42171         RawInvoice_set_data(&this_ptr_conv, val_conv);
42172 }
42173
42174 jboolean  __attribute__((export_name("TS_RawInvoice_eq"))) TS_RawInvoice_eq(uint64_t a, uint64_t b) {
42175         LDKRawInvoice a_conv;
42176         a_conv.inner = untag_ptr(a);
42177         a_conv.is_owned = ptr_is_owned(a);
42178         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
42179         a_conv.is_owned = false;
42180         LDKRawInvoice b_conv;
42181         b_conv.inner = untag_ptr(b);
42182         b_conv.is_owned = ptr_is_owned(b);
42183         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
42184         b_conv.is_owned = false;
42185         jboolean ret_conv = RawInvoice_eq(&a_conv, &b_conv);
42186         return ret_conv;
42187 }
42188
42189 static inline uint64_t RawInvoice_clone_ptr(LDKRawInvoice *NONNULL_PTR arg) {
42190         LDKRawInvoice ret_var = RawInvoice_clone(arg);
42191         uint64_t ret_ref = 0;
42192         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42193         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42194         return ret_ref;
42195 }
42196 int64_t  __attribute__((export_name("TS_RawInvoice_clone_ptr"))) TS_RawInvoice_clone_ptr(uint64_t arg) {
42197         LDKRawInvoice arg_conv;
42198         arg_conv.inner = untag_ptr(arg);
42199         arg_conv.is_owned = ptr_is_owned(arg);
42200         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42201         arg_conv.is_owned = false;
42202         int64_t ret_conv = RawInvoice_clone_ptr(&arg_conv);
42203         return ret_conv;
42204 }
42205
42206 uint64_t  __attribute__((export_name("TS_RawInvoice_clone"))) TS_RawInvoice_clone(uint64_t orig) {
42207         LDKRawInvoice orig_conv;
42208         orig_conv.inner = untag_ptr(orig);
42209         orig_conv.is_owned = ptr_is_owned(orig);
42210         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
42211         orig_conv.is_owned = false;
42212         LDKRawInvoice ret_var = RawInvoice_clone(&orig_conv);
42213         uint64_t ret_ref = 0;
42214         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42215         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42216         return ret_ref;
42217 }
42218
42219 void  __attribute__((export_name("TS_RawDataPart_free"))) TS_RawDataPart_free(uint64_t this_obj) {
42220         LDKRawDataPart this_obj_conv;
42221         this_obj_conv.inner = untag_ptr(this_obj);
42222         this_obj_conv.is_owned = ptr_is_owned(this_obj);
42223         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42224         RawDataPart_free(this_obj_conv);
42225 }
42226
42227 uint64_t  __attribute__((export_name("TS_RawDataPart_get_timestamp"))) TS_RawDataPart_get_timestamp(uint64_t this_ptr) {
42228         LDKRawDataPart this_ptr_conv;
42229         this_ptr_conv.inner = untag_ptr(this_ptr);
42230         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42231         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42232         this_ptr_conv.is_owned = false;
42233         LDKPositiveTimestamp ret_var = RawDataPart_get_timestamp(&this_ptr_conv);
42234         uint64_t ret_ref = 0;
42235         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42236         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42237         return ret_ref;
42238 }
42239
42240 void  __attribute__((export_name("TS_RawDataPart_set_timestamp"))) TS_RawDataPart_set_timestamp(uint64_t this_ptr, uint64_t val) {
42241         LDKRawDataPart this_ptr_conv;
42242         this_ptr_conv.inner = untag_ptr(this_ptr);
42243         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42244         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42245         this_ptr_conv.is_owned = false;
42246         LDKPositiveTimestamp val_conv;
42247         val_conv.inner = untag_ptr(val);
42248         val_conv.is_owned = ptr_is_owned(val);
42249         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
42250         val_conv = PositiveTimestamp_clone(&val_conv);
42251         RawDataPart_set_timestamp(&this_ptr_conv, val_conv);
42252 }
42253
42254 jboolean  __attribute__((export_name("TS_RawDataPart_eq"))) TS_RawDataPart_eq(uint64_t a, uint64_t b) {
42255         LDKRawDataPart a_conv;
42256         a_conv.inner = untag_ptr(a);
42257         a_conv.is_owned = ptr_is_owned(a);
42258         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
42259         a_conv.is_owned = false;
42260         LDKRawDataPart b_conv;
42261         b_conv.inner = untag_ptr(b);
42262         b_conv.is_owned = ptr_is_owned(b);
42263         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
42264         b_conv.is_owned = false;
42265         jboolean ret_conv = RawDataPart_eq(&a_conv, &b_conv);
42266         return ret_conv;
42267 }
42268
42269 static inline uint64_t RawDataPart_clone_ptr(LDKRawDataPart *NONNULL_PTR arg) {
42270         LDKRawDataPart ret_var = RawDataPart_clone(arg);
42271         uint64_t ret_ref = 0;
42272         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42273         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42274         return ret_ref;
42275 }
42276 int64_t  __attribute__((export_name("TS_RawDataPart_clone_ptr"))) TS_RawDataPart_clone_ptr(uint64_t arg) {
42277         LDKRawDataPart arg_conv;
42278         arg_conv.inner = untag_ptr(arg);
42279         arg_conv.is_owned = ptr_is_owned(arg);
42280         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42281         arg_conv.is_owned = false;
42282         int64_t ret_conv = RawDataPart_clone_ptr(&arg_conv);
42283         return ret_conv;
42284 }
42285
42286 uint64_t  __attribute__((export_name("TS_RawDataPart_clone"))) TS_RawDataPart_clone(uint64_t orig) {
42287         LDKRawDataPart orig_conv;
42288         orig_conv.inner = untag_ptr(orig);
42289         orig_conv.is_owned = ptr_is_owned(orig);
42290         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
42291         orig_conv.is_owned = false;
42292         LDKRawDataPart ret_var = RawDataPart_clone(&orig_conv);
42293         uint64_t ret_ref = 0;
42294         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42295         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42296         return ret_ref;
42297 }
42298
42299 void  __attribute__((export_name("TS_PositiveTimestamp_free"))) TS_PositiveTimestamp_free(uint64_t this_obj) {
42300         LDKPositiveTimestamp this_obj_conv;
42301         this_obj_conv.inner = untag_ptr(this_obj);
42302         this_obj_conv.is_owned = ptr_is_owned(this_obj);
42303         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42304         PositiveTimestamp_free(this_obj_conv);
42305 }
42306
42307 jboolean  __attribute__((export_name("TS_PositiveTimestamp_eq"))) TS_PositiveTimestamp_eq(uint64_t a, uint64_t b) {
42308         LDKPositiveTimestamp a_conv;
42309         a_conv.inner = untag_ptr(a);
42310         a_conv.is_owned = ptr_is_owned(a);
42311         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
42312         a_conv.is_owned = false;
42313         LDKPositiveTimestamp b_conv;
42314         b_conv.inner = untag_ptr(b);
42315         b_conv.is_owned = ptr_is_owned(b);
42316         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
42317         b_conv.is_owned = false;
42318         jboolean ret_conv = PositiveTimestamp_eq(&a_conv, &b_conv);
42319         return ret_conv;
42320 }
42321
42322 static inline uint64_t PositiveTimestamp_clone_ptr(LDKPositiveTimestamp *NONNULL_PTR arg) {
42323         LDKPositiveTimestamp ret_var = PositiveTimestamp_clone(arg);
42324         uint64_t ret_ref = 0;
42325         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42326         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42327         return ret_ref;
42328 }
42329 int64_t  __attribute__((export_name("TS_PositiveTimestamp_clone_ptr"))) TS_PositiveTimestamp_clone_ptr(uint64_t arg) {
42330         LDKPositiveTimestamp arg_conv;
42331         arg_conv.inner = untag_ptr(arg);
42332         arg_conv.is_owned = ptr_is_owned(arg);
42333         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42334         arg_conv.is_owned = false;
42335         int64_t ret_conv = PositiveTimestamp_clone_ptr(&arg_conv);
42336         return ret_conv;
42337 }
42338
42339 uint64_t  __attribute__((export_name("TS_PositiveTimestamp_clone"))) TS_PositiveTimestamp_clone(uint64_t orig) {
42340         LDKPositiveTimestamp orig_conv;
42341         orig_conv.inner = untag_ptr(orig);
42342         orig_conv.is_owned = ptr_is_owned(orig);
42343         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
42344         orig_conv.is_owned = false;
42345         LDKPositiveTimestamp ret_var = PositiveTimestamp_clone(&orig_conv);
42346         uint64_t ret_ref = 0;
42347         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42348         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42349         return ret_ref;
42350 }
42351
42352 uint32_t  __attribute__((export_name("TS_SiPrefix_clone"))) TS_SiPrefix_clone(uint64_t orig) {
42353         LDKSiPrefix* orig_conv = (LDKSiPrefix*)untag_ptr(orig);
42354         uint32_t ret_conv = LDKSiPrefix_to_js(SiPrefix_clone(orig_conv));
42355         return ret_conv;
42356 }
42357
42358 uint32_t  __attribute__((export_name("TS_SiPrefix_milli"))) TS_SiPrefix_milli() {
42359         uint32_t ret_conv = LDKSiPrefix_to_js(SiPrefix_milli());
42360         return ret_conv;
42361 }
42362
42363 uint32_t  __attribute__((export_name("TS_SiPrefix_micro"))) TS_SiPrefix_micro() {
42364         uint32_t ret_conv = LDKSiPrefix_to_js(SiPrefix_micro());
42365         return ret_conv;
42366 }
42367
42368 uint32_t  __attribute__((export_name("TS_SiPrefix_nano"))) TS_SiPrefix_nano() {
42369         uint32_t ret_conv = LDKSiPrefix_to_js(SiPrefix_nano());
42370         return ret_conv;
42371 }
42372
42373 uint32_t  __attribute__((export_name("TS_SiPrefix_pico"))) TS_SiPrefix_pico() {
42374         uint32_t ret_conv = LDKSiPrefix_to_js(SiPrefix_pico());
42375         return ret_conv;
42376 }
42377
42378 jboolean  __attribute__((export_name("TS_SiPrefix_eq"))) TS_SiPrefix_eq(uint64_t a, uint64_t b) {
42379         LDKSiPrefix* a_conv = (LDKSiPrefix*)untag_ptr(a);
42380         LDKSiPrefix* b_conv = (LDKSiPrefix*)untag_ptr(b);
42381         jboolean ret_conv = SiPrefix_eq(a_conv, b_conv);
42382         return ret_conv;
42383 }
42384
42385 int64_t  __attribute__((export_name("TS_SiPrefix_multiplier"))) TS_SiPrefix_multiplier(uint64_t this_arg) {
42386         LDKSiPrefix* this_arg_conv = (LDKSiPrefix*)untag_ptr(this_arg);
42387         int64_t ret_conv = SiPrefix_multiplier(this_arg_conv);
42388         return ret_conv;
42389 }
42390
42391 uint32_t  __attribute__((export_name("TS_Currency_clone"))) TS_Currency_clone(uint64_t orig) {
42392         LDKCurrency* orig_conv = (LDKCurrency*)untag_ptr(orig);
42393         uint32_t ret_conv = LDKCurrency_to_js(Currency_clone(orig_conv));
42394         return ret_conv;
42395 }
42396
42397 uint32_t  __attribute__((export_name("TS_Currency_bitcoin"))) TS_Currency_bitcoin() {
42398         uint32_t ret_conv = LDKCurrency_to_js(Currency_bitcoin());
42399         return ret_conv;
42400 }
42401
42402 uint32_t  __attribute__((export_name("TS_Currency_bitcoin_testnet"))) TS_Currency_bitcoin_testnet() {
42403         uint32_t ret_conv = LDKCurrency_to_js(Currency_bitcoin_testnet());
42404         return ret_conv;
42405 }
42406
42407 uint32_t  __attribute__((export_name("TS_Currency_regtest"))) TS_Currency_regtest() {
42408         uint32_t ret_conv = LDKCurrency_to_js(Currency_regtest());
42409         return ret_conv;
42410 }
42411
42412 uint32_t  __attribute__((export_name("TS_Currency_simnet"))) TS_Currency_simnet() {
42413         uint32_t ret_conv = LDKCurrency_to_js(Currency_simnet());
42414         return ret_conv;
42415 }
42416
42417 uint32_t  __attribute__((export_name("TS_Currency_signet"))) TS_Currency_signet() {
42418         uint32_t ret_conv = LDKCurrency_to_js(Currency_signet());
42419         return ret_conv;
42420 }
42421
42422 int64_t  __attribute__((export_name("TS_Currency_hash"))) TS_Currency_hash(uint64_t o) {
42423         LDKCurrency* o_conv = (LDKCurrency*)untag_ptr(o);
42424         int64_t ret_conv = Currency_hash(o_conv);
42425         return ret_conv;
42426 }
42427
42428 jboolean  __attribute__((export_name("TS_Currency_eq"))) TS_Currency_eq(uint64_t a, uint64_t b) {
42429         LDKCurrency* a_conv = (LDKCurrency*)untag_ptr(a);
42430         LDKCurrency* b_conv = (LDKCurrency*)untag_ptr(b);
42431         jboolean ret_conv = Currency_eq(a_conv, b_conv);
42432         return ret_conv;
42433 }
42434
42435 void  __attribute__((export_name("TS_Sha256_free"))) TS_Sha256_free(uint64_t this_obj) {
42436         LDKSha256 this_obj_conv;
42437         this_obj_conv.inner = untag_ptr(this_obj);
42438         this_obj_conv.is_owned = ptr_is_owned(this_obj);
42439         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42440         Sha256_free(this_obj_conv);
42441 }
42442
42443 static inline uint64_t Sha256_clone_ptr(LDKSha256 *NONNULL_PTR arg) {
42444         LDKSha256 ret_var = Sha256_clone(arg);
42445         uint64_t ret_ref = 0;
42446         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42447         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42448         return ret_ref;
42449 }
42450 int64_t  __attribute__((export_name("TS_Sha256_clone_ptr"))) TS_Sha256_clone_ptr(uint64_t arg) {
42451         LDKSha256 arg_conv;
42452         arg_conv.inner = untag_ptr(arg);
42453         arg_conv.is_owned = ptr_is_owned(arg);
42454         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42455         arg_conv.is_owned = false;
42456         int64_t ret_conv = Sha256_clone_ptr(&arg_conv);
42457         return ret_conv;
42458 }
42459
42460 uint64_t  __attribute__((export_name("TS_Sha256_clone"))) TS_Sha256_clone(uint64_t orig) {
42461         LDKSha256 orig_conv;
42462         orig_conv.inner = untag_ptr(orig);
42463         orig_conv.is_owned = ptr_is_owned(orig);
42464         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
42465         orig_conv.is_owned = false;
42466         LDKSha256 ret_var = Sha256_clone(&orig_conv);
42467         uint64_t ret_ref = 0;
42468         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42469         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42470         return ret_ref;
42471 }
42472
42473 int64_t  __attribute__((export_name("TS_Sha256_hash"))) TS_Sha256_hash(uint64_t o) {
42474         LDKSha256 o_conv;
42475         o_conv.inner = untag_ptr(o);
42476         o_conv.is_owned = ptr_is_owned(o);
42477         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
42478         o_conv.is_owned = false;
42479         int64_t ret_conv = Sha256_hash(&o_conv);
42480         return ret_conv;
42481 }
42482
42483 jboolean  __attribute__((export_name("TS_Sha256_eq"))) TS_Sha256_eq(uint64_t a, uint64_t b) {
42484         LDKSha256 a_conv;
42485         a_conv.inner = untag_ptr(a);
42486         a_conv.is_owned = ptr_is_owned(a);
42487         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
42488         a_conv.is_owned = false;
42489         LDKSha256 b_conv;
42490         b_conv.inner = untag_ptr(b);
42491         b_conv.is_owned = ptr_is_owned(b);
42492         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
42493         b_conv.is_owned = false;
42494         jboolean ret_conv = Sha256_eq(&a_conv, &b_conv);
42495         return ret_conv;
42496 }
42497
42498 void  __attribute__((export_name("TS_Description_free"))) TS_Description_free(uint64_t this_obj) {
42499         LDKDescription this_obj_conv;
42500         this_obj_conv.inner = untag_ptr(this_obj);
42501         this_obj_conv.is_owned = ptr_is_owned(this_obj);
42502         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42503         Description_free(this_obj_conv);
42504 }
42505
42506 static inline uint64_t Description_clone_ptr(LDKDescription *NONNULL_PTR arg) {
42507         LDKDescription ret_var = Description_clone(arg);
42508         uint64_t ret_ref = 0;
42509         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42510         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42511         return ret_ref;
42512 }
42513 int64_t  __attribute__((export_name("TS_Description_clone_ptr"))) TS_Description_clone_ptr(uint64_t arg) {
42514         LDKDescription arg_conv;
42515         arg_conv.inner = untag_ptr(arg);
42516         arg_conv.is_owned = ptr_is_owned(arg);
42517         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42518         arg_conv.is_owned = false;
42519         int64_t ret_conv = Description_clone_ptr(&arg_conv);
42520         return ret_conv;
42521 }
42522
42523 uint64_t  __attribute__((export_name("TS_Description_clone"))) TS_Description_clone(uint64_t orig) {
42524         LDKDescription orig_conv;
42525         orig_conv.inner = untag_ptr(orig);
42526         orig_conv.is_owned = ptr_is_owned(orig);
42527         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
42528         orig_conv.is_owned = false;
42529         LDKDescription ret_var = Description_clone(&orig_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 int64_t  __attribute__((export_name("TS_Description_hash"))) TS_Description_hash(uint64_t o) {
42537         LDKDescription o_conv;
42538         o_conv.inner = untag_ptr(o);
42539         o_conv.is_owned = ptr_is_owned(o);
42540         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
42541         o_conv.is_owned = false;
42542         int64_t ret_conv = Description_hash(&o_conv);
42543         return ret_conv;
42544 }
42545
42546 jboolean  __attribute__((export_name("TS_Description_eq"))) TS_Description_eq(uint64_t a, uint64_t b) {
42547         LDKDescription a_conv;
42548         a_conv.inner = untag_ptr(a);
42549         a_conv.is_owned = ptr_is_owned(a);
42550         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
42551         a_conv.is_owned = false;
42552         LDKDescription b_conv;
42553         b_conv.inner = untag_ptr(b);
42554         b_conv.is_owned = ptr_is_owned(b);
42555         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
42556         b_conv.is_owned = false;
42557         jboolean ret_conv = Description_eq(&a_conv, &b_conv);
42558         return ret_conv;
42559 }
42560
42561 void  __attribute__((export_name("TS_PayeePubKey_free"))) TS_PayeePubKey_free(uint64_t this_obj) {
42562         LDKPayeePubKey this_obj_conv;
42563         this_obj_conv.inner = untag_ptr(this_obj);
42564         this_obj_conv.is_owned = ptr_is_owned(this_obj);
42565         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42566         PayeePubKey_free(this_obj_conv);
42567 }
42568
42569 int8_tArray  __attribute__((export_name("TS_PayeePubKey_get_a"))) TS_PayeePubKey_get_a(uint64_t this_ptr) {
42570         LDKPayeePubKey this_ptr_conv;
42571         this_ptr_conv.inner = untag_ptr(this_ptr);
42572         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42573         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42574         this_ptr_conv.is_owned = false;
42575         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
42576         memcpy(ret_arr->elems, PayeePubKey_get_a(&this_ptr_conv).compressed_form, 33);
42577         return ret_arr;
42578 }
42579
42580 void  __attribute__((export_name("TS_PayeePubKey_set_a"))) TS_PayeePubKey_set_a(uint64_t this_ptr, int8_tArray val) {
42581         LDKPayeePubKey this_ptr_conv;
42582         this_ptr_conv.inner = untag_ptr(this_ptr);
42583         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42584         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42585         this_ptr_conv.is_owned = false;
42586         LDKPublicKey val_ref;
42587         CHECK(val->arr_len == 33);
42588         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
42589         PayeePubKey_set_a(&this_ptr_conv, val_ref);
42590 }
42591
42592 uint64_t  __attribute__((export_name("TS_PayeePubKey_new"))) TS_PayeePubKey_new(int8_tArray a_arg) {
42593         LDKPublicKey a_arg_ref;
42594         CHECK(a_arg->arr_len == 33);
42595         memcpy(a_arg_ref.compressed_form, a_arg->elems, 33); FREE(a_arg);
42596         LDKPayeePubKey ret_var = PayeePubKey_new(a_arg_ref);
42597         uint64_t ret_ref = 0;
42598         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42599         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42600         return ret_ref;
42601 }
42602
42603 static inline uint64_t PayeePubKey_clone_ptr(LDKPayeePubKey *NONNULL_PTR arg) {
42604         LDKPayeePubKey ret_var = PayeePubKey_clone(arg);
42605         uint64_t ret_ref = 0;
42606         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42607         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42608         return ret_ref;
42609 }
42610 int64_t  __attribute__((export_name("TS_PayeePubKey_clone_ptr"))) TS_PayeePubKey_clone_ptr(uint64_t arg) {
42611         LDKPayeePubKey arg_conv;
42612         arg_conv.inner = untag_ptr(arg);
42613         arg_conv.is_owned = ptr_is_owned(arg);
42614         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42615         arg_conv.is_owned = false;
42616         int64_t ret_conv = PayeePubKey_clone_ptr(&arg_conv);
42617         return ret_conv;
42618 }
42619
42620 uint64_t  __attribute__((export_name("TS_PayeePubKey_clone"))) TS_PayeePubKey_clone(uint64_t orig) {
42621         LDKPayeePubKey orig_conv;
42622         orig_conv.inner = untag_ptr(orig);
42623         orig_conv.is_owned = ptr_is_owned(orig);
42624         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
42625         orig_conv.is_owned = false;
42626         LDKPayeePubKey ret_var = PayeePubKey_clone(&orig_conv);
42627         uint64_t ret_ref = 0;
42628         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42629         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42630         return ret_ref;
42631 }
42632
42633 int64_t  __attribute__((export_name("TS_PayeePubKey_hash"))) TS_PayeePubKey_hash(uint64_t o) {
42634         LDKPayeePubKey o_conv;
42635         o_conv.inner = untag_ptr(o);
42636         o_conv.is_owned = ptr_is_owned(o);
42637         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
42638         o_conv.is_owned = false;
42639         int64_t ret_conv = PayeePubKey_hash(&o_conv);
42640         return ret_conv;
42641 }
42642
42643 jboolean  __attribute__((export_name("TS_PayeePubKey_eq"))) TS_PayeePubKey_eq(uint64_t a, uint64_t b) {
42644         LDKPayeePubKey a_conv;
42645         a_conv.inner = untag_ptr(a);
42646         a_conv.is_owned = ptr_is_owned(a);
42647         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
42648         a_conv.is_owned = false;
42649         LDKPayeePubKey b_conv;
42650         b_conv.inner = untag_ptr(b);
42651         b_conv.is_owned = ptr_is_owned(b);
42652         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
42653         b_conv.is_owned = false;
42654         jboolean ret_conv = PayeePubKey_eq(&a_conv, &b_conv);
42655         return ret_conv;
42656 }
42657
42658 void  __attribute__((export_name("TS_ExpiryTime_free"))) TS_ExpiryTime_free(uint64_t this_obj) {
42659         LDKExpiryTime this_obj_conv;
42660         this_obj_conv.inner = untag_ptr(this_obj);
42661         this_obj_conv.is_owned = ptr_is_owned(this_obj);
42662         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42663         ExpiryTime_free(this_obj_conv);
42664 }
42665
42666 static inline uint64_t ExpiryTime_clone_ptr(LDKExpiryTime *NONNULL_PTR arg) {
42667         LDKExpiryTime ret_var = ExpiryTime_clone(arg);
42668         uint64_t ret_ref = 0;
42669         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42670         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42671         return ret_ref;
42672 }
42673 int64_t  __attribute__((export_name("TS_ExpiryTime_clone_ptr"))) TS_ExpiryTime_clone_ptr(uint64_t arg) {
42674         LDKExpiryTime arg_conv;
42675         arg_conv.inner = untag_ptr(arg);
42676         arg_conv.is_owned = ptr_is_owned(arg);
42677         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42678         arg_conv.is_owned = false;
42679         int64_t ret_conv = ExpiryTime_clone_ptr(&arg_conv);
42680         return ret_conv;
42681 }
42682
42683 uint64_t  __attribute__((export_name("TS_ExpiryTime_clone"))) TS_ExpiryTime_clone(uint64_t orig) {
42684         LDKExpiryTime orig_conv;
42685         orig_conv.inner = untag_ptr(orig);
42686         orig_conv.is_owned = ptr_is_owned(orig);
42687         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
42688         orig_conv.is_owned = false;
42689         LDKExpiryTime ret_var = ExpiryTime_clone(&orig_conv);
42690         uint64_t ret_ref = 0;
42691         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42692         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42693         return ret_ref;
42694 }
42695
42696 int64_t  __attribute__((export_name("TS_ExpiryTime_hash"))) TS_ExpiryTime_hash(uint64_t o) {
42697         LDKExpiryTime o_conv;
42698         o_conv.inner = untag_ptr(o);
42699         o_conv.is_owned = ptr_is_owned(o);
42700         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
42701         o_conv.is_owned = false;
42702         int64_t ret_conv = ExpiryTime_hash(&o_conv);
42703         return ret_conv;
42704 }
42705
42706 jboolean  __attribute__((export_name("TS_ExpiryTime_eq"))) TS_ExpiryTime_eq(uint64_t a, uint64_t b) {
42707         LDKExpiryTime a_conv;
42708         a_conv.inner = untag_ptr(a);
42709         a_conv.is_owned = ptr_is_owned(a);
42710         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
42711         a_conv.is_owned = false;
42712         LDKExpiryTime b_conv;
42713         b_conv.inner = untag_ptr(b);
42714         b_conv.is_owned = ptr_is_owned(b);
42715         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
42716         b_conv.is_owned = false;
42717         jboolean ret_conv = ExpiryTime_eq(&a_conv, &b_conv);
42718         return ret_conv;
42719 }
42720
42721 void  __attribute__((export_name("TS_MinFinalCltvExpiry_free"))) TS_MinFinalCltvExpiry_free(uint64_t this_obj) {
42722         LDKMinFinalCltvExpiry this_obj_conv;
42723         this_obj_conv.inner = untag_ptr(this_obj);
42724         this_obj_conv.is_owned = ptr_is_owned(this_obj);
42725         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42726         MinFinalCltvExpiry_free(this_obj_conv);
42727 }
42728
42729 int64_t  __attribute__((export_name("TS_MinFinalCltvExpiry_get_a"))) TS_MinFinalCltvExpiry_get_a(uint64_t this_ptr) {
42730         LDKMinFinalCltvExpiry this_ptr_conv;
42731         this_ptr_conv.inner = untag_ptr(this_ptr);
42732         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42733         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42734         this_ptr_conv.is_owned = false;
42735         int64_t ret_conv = MinFinalCltvExpiry_get_a(&this_ptr_conv);
42736         return ret_conv;
42737 }
42738
42739 void  __attribute__((export_name("TS_MinFinalCltvExpiry_set_a"))) TS_MinFinalCltvExpiry_set_a(uint64_t this_ptr, int64_t val) {
42740         LDKMinFinalCltvExpiry this_ptr_conv;
42741         this_ptr_conv.inner = untag_ptr(this_ptr);
42742         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42743         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42744         this_ptr_conv.is_owned = false;
42745         MinFinalCltvExpiry_set_a(&this_ptr_conv, val);
42746 }
42747
42748 uint64_t  __attribute__((export_name("TS_MinFinalCltvExpiry_new"))) TS_MinFinalCltvExpiry_new(int64_t a_arg) {
42749         LDKMinFinalCltvExpiry ret_var = MinFinalCltvExpiry_new(a_arg);
42750         uint64_t ret_ref = 0;
42751         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42752         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42753         return ret_ref;
42754 }
42755
42756 static inline uint64_t MinFinalCltvExpiry_clone_ptr(LDKMinFinalCltvExpiry *NONNULL_PTR arg) {
42757         LDKMinFinalCltvExpiry ret_var = MinFinalCltvExpiry_clone(arg);
42758         uint64_t ret_ref = 0;
42759         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42760         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42761         return ret_ref;
42762 }
42763 int64_t  __attribute__((export_name("TS_MinFinalCltvExpiry_clone_ptr"))) TS_MinFinalCltvExpiry_clone_ptr(uint64_t arg) {
42764         LDKMinFinalCltvExpiry arg_conv;
42765         arg_conv.inner = untag_ptr(arg);
42766         arg_conv.is_owned = ptr_is_owned(arg);
42767         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42768         arg_conv.is_owned = false;
42769         int64_t ret_conv = MinFinalCltvExpiry_clone_ptr(&arg_conv);
42770         return ret_conv;
42771 }
42772
42773 uint64_t  __attribute__((export_name("TS_MinFinalCltvExpiry_clone"))) TS_MinFinalCltvExpiry_clone(uint64_t orig) {
42774         LDKMinFinalCltvExpiry orig_conv;
42775         orig_conv.inner = untag_ptr(orig);
42776         orig_conv.is_owned = ptr_is_owned(orig);
42777         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
42778         orig_conv.is_owned = false;
42779         LDKMinFinalCltvExpiry ret_var = MinFinalCltvExpiry_clone(&orig_conv);
42780         uint64_t ret_ref = 0;
42781         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42782         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42783         return ret_ref;
42784 }
42785
42786 int64_t  __attribute__((export_name("TS_MinFinalCltvExpiry_hash"))) TS_MinFinalCltvExpiry_hash(uint64_t o) {
42787         LDKMinFinalCltvExpiry o_conv;
42788         o_conv.inner = untag_ptr(o);
42789         o_conv.is_owned = ptr_is_owned(o);
42790         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
42791         o_conv.is_owned = false;
42792         int64_t ret_conv = MinFinalCltvExpiry_hash(&o_conv);
42793         return ret_conv;
42794 }
42795
42796 jboolean  __attribute__((export_name("TS_MinFinalCltvExpiry_eq"))) TS_MinFinalCltvExpiry_eq(uint64_t a, uint64_t b) {
42797         LDKMinFinalCltvExpiry a_conv;
42798         a_conv.inner = untag_ptr(a);
42799         a_conv.is_owned = ptr_is_owned(a);
42800         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
42801         a_conv.is_owned = false;
42802         LDKMinFinalCltvExpiry b_conv;
42803         b_conv.inner = untag_ptr(b);
42804         b_conv.is_owned = ptr_is_owned(b);
42805         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
42806         b_conv.is_owned = false;
42807         jboolean ret_conv = MinFinalCltvExpiry_eq(&a_conv, &b_conv);
42808         return ret_conv;
42809 }
42810
42811 void  __attribute__((export_name("TS_Fallback_free"))) TS_Fallback_free(uint64_t this_ptr) {
42812         if (!ptr_is_owned(this_ptr)) return;
42813         void* this_ptr_ptr = untag_ptr(this_ptr);
42814         CHECK_ACCESS(this_ptr_ptr);
42815         LDKFallback this_ptr_conv = *(LDKFallback*)(this_ptr_ptr);
42816         FREE(untag_ptr(this_ptr));
42817         Fallback_free(this_ptr_conv);
42818 }
42819
42820 static inline uint64_t Fallback_clone_ptr(LDKFallback *NONNULL_PTR arg) {
42821         LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
42822         *ret_copy = Fallback_clone(arg);
42823         uint64_t ret_ref = tag_ptr(ret_copy, true);
42824         return ret_ref;
42825 }
42826 int64_t  __attribute__((export_name("TS_Fallback_clone_ptr"))) TS_Fallback_clone_ptr(uint64_t arg) {
42827         LDKFallback* arg_conv = (LDKFallback*)untag_ptr(arg);
42828         int64_t ret_conv = Fallback_clone_ptr(arg_conv);
42829         return ret_conv;
42830 }
42831
42832 uint64_t  __attribute__((export_name("TS_Fallback_clone"))) TS_Fallback_clone(uint64_t orig) {
42833         LDKFallback* orig_conv = (LDKFallback*)untag_ptr(orig);
42834         LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
42835         *ret_copy = Fallback_clone(orig_conv);
42836         uint64_t ret_ref = tag_ptr(ret_copy, true);
42837         return ret_ref;
42838 }
42839
42840 uint64_t  __attribute__((export_name("TS_Fallback_seg_wit_program"))) TS_Fallback_seg_wit_program(int8_t version, int8_tArray program) {
42841         
42842         LDKCVec_u8Z program_ref;
42843         program_ref.datalen = program->arr_len;
42844         program_ref.data = MALLOC(program_ref.datalen, "LDKCVec_u8Z Bytes");
42845         memcpy(program_ref.data, program->elems, program_ref.datalen); FREE(program);
42846         LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
42847         *ret_copy = Fallback_seg_wit_program((LDKu5){ ._0 = version }, program_ref);
42848         uint64_t ret_ref = tag_ptr(ret_copy, true);
42849         return ret_ref;
42850 }
42851
42852 uint64_t  __attribute__((export_name("TS_Fallback_pub_key_hash"))) TS_Fallback_pub_key_hash(int8_tArray a) {
42853         LDKTwentyBytes a_ref;
42854         CHECK(a->arr_len == 20);
42855         memcpy(a_ref.data, a->elems, 20); FREE(a);
42856         LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
42857         *ret_copy = Fallback_pub_key_hash(a_ref);
42858         uint64_t ret_ref = tag_ptr(ret_copy, true);
42859         return ret_ref;
42860 }
42861
42862 uint64_t  __attribute__((export_name("TS_Fallback_script_hash"))) TS_Fallback_script_hash(int8_tArray a) {
42863         LDKTwentyBytes a_ref;
42864         CHECK(a->arr_len == 20);
42865         memcpy(a_ref.data, a->elems, 20); FREE(a);
42866         LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
42867         *ret_copy = Fallback_script_hash(a_ref);
42868         uint64_t ret_ref = tag_ptr(ret_copy, true);
42869         return ret_ref;
42870 }
42871
42872 int64_t  __attribute__((export_name("TS_Fallback_hash"))) TS_Fallback_hash(uint64_t o) {
42873         LDKFallback* o_conv = (LDKFallback*)untag_ptr(o);
42874         int64_t ret_conv = Fallback_hash(o_conv);
42875         return ret_conv;
42876 }
42877
42878 jboolean  __attribute__((export_name("TS_Fallback_eq"))) TS_Fallback_eq(uint64_t a, uint64_t b) {
42879         LDKFallback* a_conv = (LDKFallback*)untag_ptr(a);
42880         LDKFallback* b_conv = (LDKFallback*)untag_ptr(b);
42881         jboolean ret_conv = Fallback_eq(a_conv, b_conv);
42882         return ret_conv;
42883 }
42884
42885 void  __attribute__((export_name("TS_InvoiceSignature_free"))) TS_InvoiceSignature_free(uint64_t this_obj) {
42886         LDKInvoiceSignature this_obj_conv;
42887         this_obj_conv.inner = untag_ptr(this_obj);
42888         this_obj_conv.is_owned = ptr_is_owned(this_obj);
42889         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42890         InvoiceSignature_free(this_obj_conv);
42891 }
42892
42893 static inline uint64_t InvoiceSignature_clone_ptr(LDKInvoiceSignature *NONNULL_PTR arg) {
42894         LDKInvoiceSignature ret_var = InvoiceSignature_clone(arg);
42895         uint64_t ret_ref = 0;
42896         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42897         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42898         return ret_ref;
42899 }
42900 int64_t  __attribute__((export_name("TS_InvoiceSignature_clone_ptr"))) TS_InvoiceSignature_clone_ptr(uint64_t arg) {
42901         LDKInvoiceSignature arg_conv;
42902         arg_conv.inner = untag_ptr(arg);
42903         arg_conv.is_owned = ptr_is_owned(arg);
42904         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42905         arg_conv.is_owned = false;
42906         int64_t ret_conv = InvoiceSignature_clone_ptr(&arg_conv);
42907         return ret_conv;
42908 }
42909
42910 uint64_t  __attribute__((export_name("TS_InvoiceSignature_clone"))) TS_InvoiceSignature_clone(uint64_t orig) {
42911         LDKInvoiceSignature orig_conv;
42912         orig_conv.inner = untag_ptr(orig);
42913         orig_conv.is_owned = ptr_is_owned(orig);
42914         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
42915         orig_conv.is_owned = false;
42916         LDKInvoiceSignature ret_var = InvoiceSignature_clone(&orig_conv);
42917         uint64_t ret_ref = 0;
42918         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42919         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42920         return ret_ref;
42921 }
42922
42923 jboolean  __attribute__((export_name("TS_InvoiceSignature_eq"))) TS_InvoiceSignature_eq(uint64_t a, uint64_t b) {
42924         LDKInvoiceSignature a_conv;
42925         a_conv.inner = untag_ptr(a);
42926         a_conv.is_owned = ptr_is_owned(a);
42927         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
42928         a_conv.is_owned = false;
42929         LDKInvoiceSignature b_conv;
42930         b_conv.inner = untag_ptr(b);
42931         b_conv.is_owned = ptr_is_owned(b);
42932         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
42933         b_conv.is_owned = false;
42934         jboolean ret_conv = InvoiceSignature_eq(&a_conv, &b_conv);
42935         return ret_conv;
42936 }
42937
42938 void  __attribute__((export_name("TS_PrivateRoute_free"))) TS_PrivateRoute_free(uint64_t this_obj) {
42939         LDKPrivateRoute this_obj_conv;
42940         this_obj_conv.inner = untag_ptr(this_obj);
42941         this_obj_conv.is_owned = ptr_is_owned(this_obj);
42942         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42943         PrivateRoute_free(this_obj_conv);
42944 }
42945
42946 static inline uint64_t PrivateRoute_clone_ptr(LDKPrivateRoute *NONNULL_PTR arg) {
42947         LDKPrivateRoute ret_var = PrivateRoute_clone(arg);
42948         uint64_t ret_ref = 0;
42949         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42950         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42951         return ret_ref;
42952 }
42953 int64_t  __attribute__((export_name("TS_PrivateRoute_clone_ptr"))) TS_PrivateRoute_clone_ptr(uint64_t arg) {
42954         LDKPrivateRoute arg_conv;
42955         arg_conv.inner = untag_ptr(arg);
42956         arg_conv.is_owned = ptr_is_owned(arg);
42957         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42958         arg_conv.is_owned = false;
42959         int64_t ret_conv = PrivateRoute_clone_ptr(&arg_conv);
42960         return ret_conv;
42961 }
42962
42963 uint64_t  __attribute__((export_name("TS_PrivateRoute_clone"))) TS_PrivateRoute_clone(uint64_t orig) {
42964         LDKPrivateRoute orig_conv;
42965         orig_conv.inner = untag_ptr(orig);
42966         orig_conv.is_owned = ptr_is_owned(orig);
42967         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
42968         orig_conv.is_owned = false;
42969         LDKPrivateRoute ret_var = PrivateRoute_clone(&orig_conv);
42970         uint64_t ret_ref = 0;
42971         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42972         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42973         return ret_ref;
42974 }
42975
42976 int64_t  __attribute__((export_name("TS_PrivateRoute_hash"))) TS_PrivateRoute_hash(uint64_t o) {
42977         LDKPrivateRoute o_conv;
42978         o_conv.inner = untag_ptr(o);
42979         o_conv.is_owned = ptr_is_owned(o);
42980         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
42981         o_conv.is_owned = false;
42982         int64_t ret_conv = PrivateRoute_hash(&o_conv);
42983         return ret_conv;
42984 }
42985
42986 jboolean  __attribute__((export_name("TS_PrivateRoute_eq"))) TS_PrivateRoute_eq(uint64_t a, uint64_t b) {
42987         LDKPrivateRoute a_conv;
42988         a_conv.inner = untag_ptr(a);
42989         a_conv.is_owned = ptr_is_owned(a);
42990         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
42991         a_conv.is_owned = false;
42992         LDKPrivateRoute b_conv;
42993         b_conv.inner = untag_ptr(b);
42994         b_conv.is_owned = ptr_is_owned(b);
42995         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
42996         b_conv.is_owned = false;
42997         jboolean ret_conv = PrivateRoute_eq(&a_conv, &b_conv);
42998         return ret_conv;
42999 }
43000
43001 uint64_t  __attribute__((export_name("TS_SignedRawInvoice_into_parts"))) TS_SignedRawInvoice_into_parts(uint64_t this_arg) {
43002         LDKSignedRawInvoice this_arg_conv;
43003         this_arg_conv.inner = untag_ptr(this_arg);
43004         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43005         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43006         this_arg_conv = SignedRawInvoice_clone(&this_arg_conv);
43007         LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
43008         *ret_conv = SignedRawInvoice_into_parts(this_arg_conv);
43009         return tag_ptr(ret_conv, true);
43010 }
43011
43012 uint64_t  __attribute__((export_name("TS_SignedRawInvoice_raw_invoice"))) TS_SignedRawInvoice_raw_invoice(uint64_t this_arg) {
43013         LDKSignedRawInvoice this_arg_conv;
43014         this_arg_conv.inner = untag_ptr(this_arg);
43015         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43016         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43017         this_arg_conv.is_owned = false;
43018         LDKRawInvoice ret_var = SignedRawInvoice_raw_invoice(&this_arg_conv);
43019         uint64_t ret_ref = 0;
43020         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43021         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43022         return ret_ref;
43023 }
43024
43025 int8_tArray  __attribute__((export_name("TS_SignedRawInvoice_hash"))) TS_SignedRawInvoice_hash(uint64_t this_arg) {
43026         LDKSignedRawInvoice this_arg_conv;
43027         this_arg_conv.inner = untag_ptr(this_arg);
43028         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43029         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43030         this_arg_conv.is_owned = false;
43031         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
43032         memcpy(ret_arr->elems, *SignedRawInvoice_hash(&this_arg_conv), 32);
43033         return ret_arr;
43034 }
43035
43036 uint64_t  __attribute__((export_name("TS_SignedRawInvoice_signature"))) TS_SignedRawInvoice_signature(uint64_t this_arg) {
43037         LDKSignedRawInvoice this_arg_conv;
43038         this_arg_conv.inner = untag_ptr(this_arg);
43039         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43040         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43041         this_arg_conv.is_owned = false;
43042         LDKInvoiceSignature ret_var = SignedRawInvoice_signature(&this_arg_conv);
43043         uint64_t ret_ref = 0;
43044         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43045         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43046         return ret_ref;
43047 }
43048
43049 uint64_t  __attribute__((export_name("TS_SignedRawInvoice_recover_payee_pub_key"))) TS_SignedRawInvoice_recover_payee_pub_key(uint64_t this_arg) {
43050         LDKSignedRawInvoice this_arg_conv;
43051         this_arg_conv.inner = untag_ptr(this_arg);
43052         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43053         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43054         this_arg_conv.is_owned = false;
43055         LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
43056         *ret_conv = SignedRawInvoice_recover_payee_pub_key(&this_arg_conv);
43057         return tag_ptr(ret_conv, true);
43058 }
43059
43060 jboolean  __attribute__((export_name("TS_SignedRawInvoice_check_signature"))) TS_SignedRawInvoice_check_signature(uint64_t this_arg) {
43061         LDKSignedRawInvoice this_arg_conv;
43062         this_arg_conv.inner = untag_ptr(this_arg);
43063         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43064         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43065         this_arg_conv.is_owned = false;
43066         jboolean ret_conv = SignedRawInvoice_check_signature(&this_arg_conv);
43067         return ret_conv;
43068 }
43069
43070 int8_tArray  __attribute__((export_name("TS_RawInvoice_hash"))) TS_RawInvoice_hash(uint64_t this_arg) {
43071         LDKRawInvoice this_arg_conv;
43072         this_arg_conv.inner = untag_ptr(this_arg);
43073         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43074         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43075         this_arg_conv.is_owned = false;
43076         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
43077         memcpy(ret_arr->elems, RawInvoice_hash(&this_arg_conv).data, 32);
43078         return ret_arr;
43079 }
43080
43081 uint64_t  __attribute__((export_name("TS_RawInvoice_payment_hash"))) TS_RawInvoice_payment_hash(uint64_t this_arg) {
43082         LDKRawInvoice this_arg_conv;
43083         this_arg_conv.inner = untag_ptr(this_arg);
43084         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43085         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43086         this_arg_conv.is_owned = false;
43087         LDKSha256 ret_var = RawInvoice_payment_hash(&this_arg_conv);
43088         uint64_t ret_ref = 0;
43089         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43090         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43091         return ret_ref;
43092 }
43093
43094 uint64_t  __attribute__((export_name("TS_RawInvoice_description"))) TS_RawInvoice_description(uint64_t this_arg) {
43095         LDKRawInvoice this_arg_conv;
43096         this_arg_conv.inner = untag_ptr(this_arg);
43097         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43098         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43099         this_arg_conv.is_owned = false;
43100         LDKDescription ret_var = RawInvoice_description(&this_arg_conv);
43101         uint64_t ret_ref = 0;
43102         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43103         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43104         return ret_ref;
43105 }
43106
43107 uint64_t  __attribute__((export_name("TS_RawInvoice_payee_pub_key"))) TS_RawInvoice_payee_pub_key(uint64_t this_arg) {
43108         LDKRawInvoice this_arg_conv;
43109         this_arg_conv.inner = untag_ptr(this_arg);
43110         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43111         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43112         this_arg_conv.is_owned = false;
43113         LDKPayeePubKey ret_var = RawInvoice_payee_pub_key(&this_arg_conv);
43114         uint64_t ret_ref = 0;
43115         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43116         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43117         return ret_ref;
43118 }
43119
43120 uint64_t  __attribute__((export_name("TS_RawInvoice_description_hash"))) TS_RawInvoice_description_hash(uint64_t this_arg) {
43121         LDKRawInvoice this_arg_conv;
43122         this_arg_conv.inner = untag_ptr(this_arg);
43123         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43124         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43125         this_arg_conv.is_owned = false;
43126         LDKSha256 ret_var = RawInvoice_description_hash(&this_arg_conv);
43127         uint64_t ret_ref = 0;
43128         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43129         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43130         return ret_ref;
43131 }
43132
43133 uint64_t  __attribute__((export_name("TS_RawInvoice_expiry_time"))) TS_RawInvoice_expiry_time(uint64_t this_arg) {
43134         LDKRawInvoice this_arg_conv;
43135         this_arg_conv.inner = untag_ptr(this_arg);
43136         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43137         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43138         this_arg_conv.is_owned = false;
43139         LDKExpiryTime ret_var = RawInvoice_expiry_time(&this_arg_conv);
43140         uint64_t ret_ref = 0;
43141         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43142         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43143         return ret_ref;
43144 }
43145
43146 uint64_t  __attribute__((export_name("TS_RawInvoice_min_final_cltv_expiry"))) TS_RawInvoice_min_final_cltv_expiry(uint64_t this_arg) {
43147         LDKRawInvoice this_arg_conv;
43148         this_arg_conv.inner = untag_ptr(this_arg);
43149         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43150         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43151         this_arg_conv.is_owned = false;
43152         LDKMinFinalCltvExpiry ret_var = RawInvoice_min_final_cltv_expiry(&this_arg_conv);
43153         uint64_t ret_ref = 0;
43154         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43155         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43156         return ret_ref;
43157 }
43158
43159 int8_tArray  __attribute__((export_name("TS_RawInvoice_payment_secret"))) TS_RawInvoice_payment_secret(uint64_t this_arg) {
43160         LDKRawInvoice this_arg_conv;
43161         this_arg_conv.inner = untag_ptr(this_arg);
43162         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43163         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43164         this_arg_conv.is_owned = false;
43165         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
43166         memcpy(ret_arr->elems, RawInvoice_payment_secret(&this_arg_conv).data, 32);
43167         return ret_arr;
43168 }
43169
43170 uint64_t  __attribute__((export_name("TS_RawInvoice_features"))) TS_RawInvoice_features(uint64_t this_arg) {
43171         LDKRawInvoice this_arg_conv;
43172         this_arg_conv.inner = untag_ptr(this_arg);
43173         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43174         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43175         this_arg_conv.is_owned = false;
43176         LDKInvoiceFeatures ret_var = RawInvoice_features(&this_arg_conv);
43177         uint64_t ret_ref = 0;
43178         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43179         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43180         return ret_ref;
43181 }
43182
43183 uint64_tArray  __attribute__((export_name("TS_RawInvoice_private_routes"))) TS_RawInvoice_private_routes(uint64_t this_arg) {
43184         LDKRawInvoice this_arg_conv;
43185         this_arg_conv.inner = untag_ptr(this_arg);
43186         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43187         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43188         this_arg_conv.is_owned = false;
43189         LDKCVec_PrivateRouteZ ret_var = RawInvoice_private_routes(&this_arg_conv);
43190         uint64_tArray ret_arr = NULL;
43191         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
43192         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
43193         for (size_t o = 0; o < ret_var.datalen; o++) {
43194                 LDKPrivateRoute ret_conv_14_var = ret_var.data[o];
43195                 uint64_t ret_conv_14_ref = 0;
43196                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_14_var);
43197                 ret_conv_14_ref = tag_ptr(ret_conv_14_var.inner, ret_conv_14_var.is_owned);
43198                 ret_arr_ptr[o] = ret_conv_14_ref;
43199         }
43200         
43201         FREE(ret_var.data);
43202         return ret_arr;
43203 }
43204
43205 uint64_t  __attribute__((export_name("TS_RawInvoice_amount_pico_btc"))) TS_RawInvoice_amount_pico_btc(uint64_t this_arg) {
43206         LDKRawInvoice this_arg_conv;
43207         this_arg_conv.inner = untag_ptr(this_arg);
43208         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43209         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43210         this_arg_conv.is_owned = false;
43211         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
43212         *ret_copy = RawInvoice_amount_pico_btc(&this_arg_conv);
43213         uint64_t ret_ref = tag_ptr(ret_copy, true);
43214         return ret_ref;
43215 }
43216
43217 uint32_t  __attribute__((export_name("TS_RawInvoice_currency"))) TS_RawInvoice_currency(uint64_t this_arg) {
43218         LDKRawInvoice this_arg_conv;
43219         this_arg_conv.inner = untag_ptr(this_arg);
43220         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43221         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43222         this_arg_conv.is_owned = false;
43223         uint32_t ret_conv = LDKCurrency_to_js(RawInvoice_currency(&this_arg_conv));
43224         return ret_conv;
43225 }
43226
43227 uint64_t  __attribute__((export_name("TS_PositiveTimestamp_from_unix_timestamp"))) TS_PositiveTimestamp_from_unix_timestamp(int64_t unix_seconds) {
43228         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
43229         *ret_conv = PositiveTimestamp_from_unix_timestamp(unix_seconds);
43230         return tag_ptr(ret_conv, true);
43231 }
43232
43233 uint64_t  __attribute__((export_name("TS_PositiveTimestamp_from_duration_since_epoch"))) TS_PositiveTimestamp_from_duration_since_epoch(int64_t duration) {
43234         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
43235         *ret_conv = PositiveTimestamp_from_duration_since_epoch(duration);
43236         return tag_ptr(ret_conv, true);
43237 }
43238
43239 int64_t  __attribute__((export_name("TS_PositiveTimestamp_as_unix_timestamp"))) TS_PositiveTimestamp_as_unix_timestamp(uint64_t this_arg) {
43240         LDKPositiveTimestamp this_arg_conv;
43241         this_arg_conv.inner = untag_ptr(this_arg);
43242         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43243         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43244         this_arg_conv.is_owned = false;
43245         int64_t ret_conv = PositiveTimestamp_as_unix_timestamp(&this_arg_conv);
43246         return ret_conv;
43247 }
43248
43249 int64_t  __attribute__((export_name("TS_PositiveTimestamp_as_duration_since_epoch"))) TS_PositiveTimestamp_as_duration_since_epoch(uint64_t this_arg) {
43250         LDKPositiveTimestamp this_arg_conv;
43251         this_arg_conv.inner = untag_ptr(this_arg);
43252         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43253         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43254         this_arg_conv.is_owned = false;
43255         int64_t ret_conv = PositiveTimestamp_as_duration_since_epoch(&this_arg_conv);
43256         return ret_conv;
43257 }
43258
43259 uint64_t  __attribute__((export_name("TS_Invoice_into_signed_raw"))) TS_Invoice_into_signed_raw(uint64_t this_arg) {
43260         LDKInvoice this_arg_conv;
43261         this_arg_conv.inner = untag_ptr(this_arg);
43262         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43263         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43264         this_arg_conv = Invoice_clone(&this_arg_conv);
43265         LDKSignedRawInvoice ret_var = Invoice_into_signed_raw(this_arg_conv);
43266         uint64_t ret_ref = 0;
43267         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43268         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43269         return ret_ref;
43270 }
43271
43272 uint64_t  __attribute__((export_name("TS_Invoice_check_signature"))) TS_Invoice_check_signature(uint64_t this_arg) {
43273         LDKInvoice this_arg_conv;
43274         this_arg_conv.inner = untag_ptr(this_arg);
43275         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43276         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43277         this_arg_conv.is_owned = false;
43278         LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
43279         *ret_conv = Invoice_check_signature(&this_arg_conv);
43280         return tag_ptr(ret_conv, true);
43281 }
43282
43283 uint64_t  __attribute__((export_name("TS_Invoice_from_signed"))) TS_Invoice_from_signed(uint64_t signed_invoice) {
43284         LDKSignedRawInvoice signed_invoice_conv;
43285         signed_invoice_conv.inner = untag_ptr(signed_invoice);
43286         signed_invoice_conv.is_owned = ptr_is_owned(signed_invoice);
43287         CHECK_INNER_FIELD_ACCESS_OR_NULL(signed_invoice_conv);
43288         signed_invoice_conv = SignedRawInvoice_clone(&signed_invoice_conv);
43289         LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
43290         *ret_conv = Invoice_from_signed(signed_invoice_conv);
43291         return tag_ptr(ret_conv, true);
43292 }
43293
43294 int64_t  __attribute__((export_name("TS_Invoice_duration_since_epoch"))) TS_Invoice_duration_since_epoch(uint64_t this_arg) {
43295         LDKInvoice this_arg_conv;
43296         this_arg_conv.inner = untag_ptr(this_arg);
43297         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43298         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43299         this_arg_conv.is_owned = false;
43300         int64_t ret_conv = Invoice_duration_since_epoch(&this_arg_conv);
43301         return ret_conv;
43302 }
43303
43304 int8_tArray  __attribute__((export_name("TS_Invoice_payment_hash"))) TS_Invoice_payment_hash(uint64_t this_arg) {
43305         LDKInvoice this_arg_conv;
43306         this_arg_conv.inner = untag_ptr(this_arg);
43307         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43308         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43309         this_arg_conv.is_owned = false;
43310         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
43311         memcpy(ret_arr->elems, *Invoice_payment_hash(&this_arg_conv), 32);
43312         return ret_arr;
43313 }
43314
43315 int8_tArray  __attribute__((export_name("TS_Invoice_payee_pub_key"))) TS_Invoice_payee_pub_key(uint64_t this_arg) {
43316         LDKInvoice this_arg_conv;
43317         this_arg_conv.inner = untag_ptr(this_arg);
43318         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43319         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43320         this_arg_conv.is_owned = false;
43321         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
43322         memcpy(ret_arr->elems, Invoice_payee_pub_key(&this_arg_conv).compressed_form, 33);
43323         return ret_arr;
43324 }
43325
43326 int8_tArray  __attribute__((export_name("TS_Invoice_payment_secret"))) TS_Invoice_payment_secret(uint64_t this_arg) {
43327         LDKInvoice this_arg_conv;
43328         this_arg_conv.inner = untag_ptr(this_arg);
43329         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43330         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43331         this_arg_conv.is_owned = false;
43332         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
43333         memcpy(ret_arr->elems, *Invoice_payment_secret(&this_arg_conv), 32);
43334         return ret_arr;
43335 }
43336
43337 uint64_t  __attribute__((export_name("TS_Invoice_features"))) TS_Invoice_features(uint64_t this_arg) {
43338         LDKInvoice this_arg_conv;
43339         this_arg_conv.inner = untag_ptr(this_arg);
43340         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43341         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43342         this_arg_conv.is_owned = false;
43343         LDKInvoiceFeatures ret_var = Invoice_features(&this_arg_conv);
43344         uint64_t ret_ref = 0;
43345         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43346         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43347         return ret_ref;
43348 }
43349
43350 int8_tArray  __attribute__((export_name("TS_Invoice_recover_payee_pub_key"))) TS_Invoice_recover_payee_pub_key(uint64_t this_arg) {
43351         LDKInvoice this_arg_conv;
43352         this_arg_conv.inner = untag_ptr(this_arg);
43353         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43354         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43355         this_arg_conv.is_owned = false;
43356         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
43357         memcpy(ret_arr->elems, Invoice_recover_payee_pub_key(&this_arg_conv).compressed_form, 33);
43358         return ret_arr;
43359 }
43360
43361 int64_t  __attribute__((export_name("TS_Invoice_expiry_time"))) TS_Invoice_expiry_time(uint64_t this_arg) {
43362         LDKInvoice this_arg_conv;
43363         this_arg_conv.inner = untag_ptr(this_arg);
43364         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43365         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43366         this_arg_conv.is_owned = false;
43367         int64_t ret_conv = Invoice_expiry_time(&this_arg_conv);
43368         return ret_conv;
43369 }
43370
43371 jboolean  __attribute__((export_name("TS_Invoice_would_expire"))) TS_Invoice_would_expire(uint64_t this_arg, int64_t at_time) {
43372         LDKInvoice this_arg_conv;
43373         this_arg_conv.inner = untag_ptr(this_arg);
43374         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43375         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43376         this_arg_conv.is_owned = false;
43377         jboolean ret_conv = Invoice_would_expire(&this_arg_conv, at_time);
43378         return ret_conv;
43379 }
43380
43381 int64_t  __attribute__((export_name("TS_Invoice_min_final_cltv_expiry"))) TS_Invoice_min_final_cltv_expiry(uint64_t this_arg) {
43382         LDKInvoice this_arg_conv;
43383         this_arg_conv.inner = untag_ptr(this_arg);
43384         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43385         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43386         this_arg_conv.is_owned = false;
43387         int64_t ret_conv = Invoice_min_final_cltv_expiry(&this_arg_conv);
43388         return ret_conv;
43389 }
43390
43391 uint64_tArray  __attribute__((export_name("TS_Invoice_private_routes"))) TS_Invoice_private_routes(uint64_t this_arg) {
43392         LDKInvoice this_arg_conv;
43393         this_arg_conv.inner = untag_ptr(this_arg);
43394         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43395         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43396         this_arg_conv.is_owned = false;
43397         LDKCVec_PrivateRouteZ ret_var = Invoice_private_routes(&this_arg_conv);
43398         uint64_tArray ret_arr = NULL;
43399         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
43400         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
43401         for (size_t o = 0; o < ret_var.datalen; o++) {
43402                 LDKPrivateRoute ret_conv_14_var = ret_var.data[o];
43403                 uint64_t ret_conv_14_ref = 0;
43404                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_14_var);
43405                 ret_conv_14_ref = tag_ptr(ret_conv_14_var.inner, ret_conv_14_var.is_owned);
43406                 ret_arr_ptr[o] = ret_conv_14_ref;
43407         }
43408         
43409         FREE(ret_var.data);
43410         return ret_arr;
43411 }
43412
43413 uint64_tArray  __attribute__((export_name("TS_Invoice_route_hints"))) TS_Invoice_route_hints(uint64_t this_arg) {
43414         LDKInvoice this_arg_conv;
43415         this_arg_conv.inner = untag_ptr(this_arg);
43416         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43417         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43418         this_arg_conv.is_owned = false;
43419         LDKCVec_RouteHintZ ret_var = Invoice_route_hints(&this_arg_conv);
43420         uint64_tArray ret_arr = NULL;
43421         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
43422         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
43423         for (size_t l = 0; l < ret_var.datalen; l++) {
43424                 LDKRouteHint ret_conv_11_var = ret_var.data[l];
43425                 uint64_t ret_conv_11_ref = 0;
43426                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_11_var);
43427                 ret_conv_11_ref = tag_ptr(ret_conv_11_var.inner, ret_conv_11_var.is_owned);
43428                 ret_arr_ptr[l] = ret_conv_11_ref;
43429         }
43430         
43431         FREE(ret_var.data);
43432         return ret_arr;
43433 }
43434
43435 uint32_t  __attribute__((export_name("TS_Invoice_currency"))) TS_Invoice_currency(uint64_t this_arg) {
43436         LDKInvoice this_arg_conv;
43437         this_arg_conv.inner = untag_ptr(this_arg);
43438         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43439         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43440         this_arg_conv.is_owned = false;
43441         uint32_t ret_conv = LDKCurrency_to_js(Invoice_currency(&this_arg_conv));
43442         return ret_conv;
43443 }
43444
43445 uint64_t  __attribute__((export_name("TS_Invoice_amount_milli_satoshis"))) TS_Invoice_amount_milli_satoshis(uint64_t this_arg) {
43446         LDKInvoice this_arg_conv;
43447         this_arg_conv.inner = untag_ptr(this_arg);
43448         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43449         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43450         this_arg_conv.is_owned = false;
43451         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
43452         *ret_copy = Invoice_amount_milli_satoshis(&this_arg_conv);
43453         uint64_t ret_ref = tag_ptr(ret_copy, true);
43454         return ret_ref;
43455 }
43456
43457 uint64_t  __attribute__((export_name("TS_Description_new"))) TS_Description_new(jstring description) {
43458         LDKStr description_conv = str_ref_to_owned_c(description);
43459         LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
43460         *ret_conv = Description_new(description_conv);
43461         return tag_ptr(ret_conv, true);
43462 }
43463
43464 jstring  __attribute__((export_name("TS_Description_into_inner"))) TS_Description_into_inner(uint64_t this_arg) {
43465         LDKDescription this_arg_conv;
43466         this_arg_conv.inner = untag_ptr(this_arg);
43467         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43468         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43469         this_arg_conv = Description_clone(&this_arg_conv);
43470         LDKStr ret_str = Description_into_inner(this_arg_conv);
43471         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
43472         Str_free(ret_str);
43473         return ret_conv;
43474 }
43475
43476 uint64_t  __attribute__((export_name("TS_ExpiryTime_from_seconds"))) TS_ExpiryTime_from_seconds(int64_t seconds) {
43477         LDKExpiryTime ret_var = ExpiryTime_from_seconds(seconds);
43478         uint64_t ret_ref = 0;
43479         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43480         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43481         return ret_ref;
43482 }
43483
43484 uint64_t  __attribute__((export_name("TS_ExpiryTime_from_duration"))) TS_ExpiryTime_from_duration(int64_t duration) {
43485         LDKExpiryTime ret_var = ExpiryTime_from_duration(duration);
43486         uint64_t ret_ref = 0;
43487         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43488         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43489         return ret_ref;
43490 }
43491
43492 int64_t  __attribute__((export_name("TS_ExpiryTime_as_seconds"))) TS_ExpiryTime_as_seconds(uint64_t this_arg) {
43493         LDKExpiryTime this_arg_conv;
43494         this_arg_conv.inner = untag_ptr(this_arg);
43495         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43496         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43497         this_arg_conv.is_owned = false;
43498         int64_t ret_conv = ExpiryTime_as_seconds(&this_arg_conv);
43499         return ret_conv;
43500 }
43501
43502 int64_t  __attribute__((export_name("TS_ExpiryTime_as_duration"))) TS_ExpiryTime_as_duration(uint64_t this_arg) {
43503         LDKExpiryTime this_arg_conv;
43504         this_arg_conv.inner = untag_ptr(this_arg);
43505         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43506         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43507         this_arg_conv.is_owned = false;
43508         int64_t ret_conv = ExpiryTime_as_duration(&this_arg_conv);
43509         return ret_conv;
43510 }
43511
43512 uint64_t  __attribute__((export_name("TS_PrivateRoute_new"))) TS_PrivateRoute_new(uint64_t hops) {
43513         LDKRouteHint hops_conv;
43514         hops_conv.inner = untag_ptr(hops);
43515         hops_conv.is_owned = ptr_is_owned(hops);
43516         CHECK_INNER_FIELD_ACCESS_OR_NULL(hops_conv);
43517         hops_conv = RouteHint_clone(&hops_conv);
43518         LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
43519         *ret_conv = PrivateRoute_new(hops_conv);
43520         return tag_ptr(ret_conv, true);
43521 }
43522
43523 uint64_t  __attribute__((export_name("TS_PrivateRoute_into_inner"))) TS_PrivateRoute_into_inner(uint64_t this_arg) {
43524         LDKPrivateRoute this_arg_conv;
43525         this_arg_conv.inner = untag_ptr(this_arg);
43526         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43527         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43528         this_arg_conv = PrivateRoute_clone(&this_arg_conv);
43529         LDKRouteHint ret_var = PrivateRoute_into_inner(this_arg_conv);
43530         uint64_t ret_ref = 0;
43531         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43532         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43533         return ret_ref;
43534 }
43535
43536 uint32_t  __attribute__((export_name("TS_CreationError_clone"))) TS_CreationError_clone(uint64_t orig) {
43537         LDKCreationError* orig_conv = (LDKCreationError*)untag_ptr(orig);
43538         uint32_t ret_conv = LDKCreationError_to_js(CreationError_clone(orig_conv));
43539         return ret_conv;
43540 }
43541
43542 uint32_t  __attribute__((export_name("TS_CreationError_description_too_long"))) TS_CreationError_description_too_long() {
43543         uint32_t ret_conv = LDKCreationError_to_js(CreationError_description_too_long());
43544         return ret_conv;
43545 }
43546
43547 uint32_t  __attribute__((export_name("TS_CreationError_route_too_long"))) TS_CreationError_route_too_long() {
43548         uint32_t ret_conv = LDKCreationError_to_js(CreationError_route_too_long());
43549         return ret_conv;
43550 }
43551
43552 uint32_t  __attribute__((export_name("TS_CreationError_timestamp_out_of_bounds"))) TS_CreationError_timestamp_out_of_bounds() {
43553         uint32_t ret_conv = LDKCreationError_to_js(CreationError_timestamp_out_of_bounds());
43554         return ret_conv;
43555 }
43556
43557 uint32_t  __attribute__((export_name("TS_CreationError_invalid_amount"))) TS_CreationError_invalid_amount() {
43558         uint32_t ret_conv = LDKCreationError_to_js(CreationError_invalid_amount());
43559         return ret_conv;
43560 }
43561
43562 uint32_t  __attribute__((export_name("TS_CreationError_missing_route_hints"))) TS_CreationError_missing_route_hints() {
43563         uint32_t ret_conv = LDKCreationError_to_js(CreationError_missing_route_hints());
43564         return ret_conv;
43565 }
43566
43567 jboolean  __attribute__((export_name("TS_CreationError_eq"))) TS_CreationError_eq(uint64_t a, uint64_t b) {
43568         LDKCreationError* a_conv = (LDKCreationError*)untag_ptr(a);
43569         LDKCreationError* b_conv = (LDKCreationError*)untag_ptr(b);
43570         jboolean ret_conv = CreationError_eq(a_conv, b_conv);
43571         return ret_conv;
43572 }
43573
43574 jstring  __attribute__((export_name("TS_CreationError_to_str"))) TS_CreationError_to_str(uint64_t o) {
43575         LDKCreationError* o_conv = (LDKCreationError*)untag_ptr(o);
43576         LDKStr ret_str = CreationError_to_str(o_conv);
43577         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
43578         Str_free(ret_str);
43579         return ret_conv;
43580 }
43581
43582 uint32_t  __attribute__((export_name("TS_SemanticError_clone"))) TS_SemanticError_clone(uint64_t orig) {
43583         LDKSemanticError* orig_conv = (LDKSemanticError*)untag_ptr(orig);
43584         uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_clone(orig_conv));
43585         return ret_conv;
43586 }
43587
43588 uint32_t  __attribute__((export_name("TS_SemanticError_no_payment_hash"))) TS_SemanticError_no_payment_hash() {
43589         uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_no_payment_hash());
43590         return ret_conv;
43591 }
43592
43593 uint32_t  __attribute__((export_name("TS_SemanticError_multiple_payment_hashes"))) TS_SemanticError_multiple_payment_hashes() {
43594         uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_multiple_payment_hashes());
43595         return ret_conv;
43596 }
43597
43598 uint32_t  __attribute__((export_name("TS_SemanticError_no_description"))) TS_SemanticError_no_description() {
43599         uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_no_description());
43600         return ret_conv;
43601 }
43602
43603 uint32_t  __attribute__((export_name("TS_SemanticError_multiple_descriptions"))) TS_SemanticError_multiple_descriptions() {
43604         uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_multiple_descriptions());
43605         return ret_conv;
43606 }
43607
43608 uint32_t  __attribute__((export_name("TS_SemanticError_no_payment_secret"))) TS_SemanticError_no_payment_secret() {
43609         uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_no_payment_secret());
43610         return ret_conv;
43611 }
43612
43613 uint32_t  __attribute__((export_name("TS_SemanticError_multiple_payment_secrets"))) TS_SemanticError_multiple_payment_secrets() {
43614         uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_multiple_payment_secrets());
43615         return ret_conv;
43616 }
43617
43618 uint32_t  __attribute__((export_name("TS_SemanticError_invalid_features"))) TS_SemanticError_invalid_features() {
43619         uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_invalid_features());
43620         return ret_conv;
43621 }
43622
43623 uint32_t  __attribute__((export_name("TS_SemanticError_invalid_recovery_id"))) TS_SemanticError_invalid_recovery_id() {
43624         uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_invalid_recovery_id());
43625         return ret_conv;
43626 }
43627
43628 uint32_t  __attribute__((export_name("TS_SemanticError_invalid_signature"))) TS_SemanticError_invalid_signature() {
43629         uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_invalid_signature());
43630         return ret_conv;
43631 }
43632
43633 uint32_t  __attribute__((export_name("TS_SemanticError_imprecise_amount"))) TS_SemanticError_imprecise_amount() {
43634         uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_imprecise_amount());
43635         return ret_conv;
43636 }
43637
43638 jboolean  __attribute__((export_name("TS_SemanticError_eq"))) TS_SemanticError_eq(uint64_t a, uint64_t b) {
43639         LDKSemanticError* a_conv = (LDKSemanticError*)untag_ptr(a);
43640         LDKSemanticError* b_conv = (LDKSemanticError*)untag_ptr(b);
43641         jboolean ret_conv = SemanticError_eq(a_conv, b_conv);
43642         return ret_conv;
43643 }
43644
43645 jstring  __attribute__((export_name("TS_SemanticError_to_str"))) TS_SemanticError_to_str(uint64_t o) {
43646         LDKSemanticError* o_conv = (LDKSemanticError*)untag_ptr(o);
43647         LDKStr ret_str = SemanticError_to_str(o_conv);
43648         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
43649         Str_free(ret_str);
43650         return ret_conv;
43651 }
43652
43653 void  __attribute__((export_name("TS_SignOrCreationError_free"))) TS_SignOrCreationError_free(uint64_t this_ptr) {
43654         if (!ptr_is_owned(this_ptr)) return;
43655         void* this_ptr_ptr = untag_ptr(this_ptr);
43656         CHECK_ACCESS(this_ptr_ptr);
43657         LDKSignOrCreationError this_ptr_conv = *(LDKSignOrCreationError*)(this_ptr_ptr);
43658         FREE(untag_ptr(this_ptr));
43659         SignOrCreationError_free(this_ptr_conv);
43660 }
43661
43662 static inline uint64_t SignOrCreationError_clone_ptr(LDKSignOrCreationError *NONNULL_PTR arg) {
43663         LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
43664         *ret_copy = SignOrCreationError_clone(arg);
43665         uint64_t ret_ref = tag_ptr(ret_copy, true);
43666         return ret_ref;
43667 }
43668 int64_t  __attribute__((export_name("TS_SignOrCreationError_clone_ptr"))) TS_SignOrCreationError_clone_ptr(uint64_t arg) {
43669         LDKSignOrCreationError* arg_conv = (LDKSignOrCreationError*)untag_ptr(arg);
43670         int64_t ret_conv = SignOrCreationError_clone_ptr(arg_conv);
43671         return ret_conv;
43672 }
43673
43674 uint64_t  __attribute__((export_name("TS_SignOrCreationError_clone"))) TS_SignOrCreationError_clone(uint64_t orig) {
43675         LDKSignOrCreationError* orig_conv = (LDKSignOrCreationError*)untag_ptr(orig);
43676         LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
43677         *ret_copy = SignOrCreationError_clone(orig_conv);
43678         uint64_t ret_ref = tag_ptr(ret_copy, true);
43679         return ret_ref;
43680 }
43681
43682 uint64_t  __attribute__((export_name("TS_SignOrCreationError_sign_error"))) TS_SignOrCreationError_sign_error() {
43683         LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
43684         *ret_copy = SignOrCreationError_sign_error();
43685         uint64_t ret_ref = tag_ptr(ret_copy, true);
43686         return ret_ref;
43687 }
43688
43689 uint64_t  __attribute__((export_name("TS_SignOrCreationError_creation_error"))) TS_SignOrCreationError_creation_error(uint32_t a) {
43690         LDKCreationError a_conv = LDKCreationError_from_js(a);
43691         LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
43692         *ret_copy = SignOrCreationError_creation_error(a_conv);
43693         uint64_t ret_ref = tag_ptr(ret_copy, true);
43694         return ret_ref;
43695 }
43696
43697 jboolean  __attribute__((export_name("TS_SignOrCreationError_eq"))) TS_SignOrCreationError_eq(uint64_t a, uint64_t b) {
43698         LDKSignOrCreationError* a_conv = (LDKSignOrCreationError*)untag_ptr(a);
43699         LDKSignOrCreationError* b_conv = (LDKSignOrCreationError*)untag_ptr(b);
43700         jboolean ret_conv = SignOrCreationError_eq(a_conv, b_conv);
43701         return ret_conv;
43702 }
43703
43704 jstring  __attribute__((export_name("TS_SignOrCreationError_to_str"))) TS_SignOrCreationError_to_str(uint64_t o) {
43705         LDKSignOrCreationError* o_conv = (LDKSignOrCreationError*)untag_ptr(o);
43706         LDKStr ret_str = SignOrCreationError_to_str(o_conv);
43707         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
43708         Str_free(ret_str);
43709         return ret_conv;
43710 }
43711
43712 void  __attribute__((export_name("TS_InvoicePayer_free"))) TS_InvoicePayer_free(uint64_t this_obj) {
43713         LDKInvoicePayer this_obj_conv;
43714         this_obj_conv.inner = untag_ptr(this_obj);
43715         this_obj_conv.is_owned = ptr_is_owned(this_obj);
43716         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43717         InvoicePayer_free(this_obj_conv);
43718 }
43719
43720 void  __attribute__((export_name("TS_Payer_free"))) TS_Payer_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         LDKPayer this_ptr_conv = *(LDKPayer*)(this_ptr_ptr);
43725         FREE(untag_ptr(this_ptr));
43726         Payer_free(this_ptr_conv);
43727 }
43728
43729 void  __attribute__((export_name("TS_Router_free"))) TS_Router_free(uint64_t this_ptr) {
43730         if (!ptr_is_owned(this_ptr)) return;
43731         void* this_ptr_ptr = untag_ptr(this_ptr);
43732         CHECK_ACCESS(this_ptr_ptr);
43733         LDKRouter this_ptr_conv = *(LDKRouter*)(this_ptr_ptr);
43734         FREE(untag_ptr(this_ptr));
43735         Router_free(this_ptr_conv);
43736 }
43737
43738 void  __attribute__((export_name("TS_Retry_free"))) TS_Retry_free(uint64_t this_ptr) {
43739         if (!ptr_is_owned(this_ptr)) return;
43740         void* this_ptr_ptr = untag_ptr(this_ptr);
43741         CHECK_ACCESS(this_ptr_ptr);
43742         LDKRetry this_ptr_conv = *(LDKRetry*)(this_ptr_ptr);
43743         FREE(untag_ptr(this_ptr));
43744         Retry_free(this_ptr_conv);
43745 }
43746
43747 static inline uint64_t Retry_clone_ptr(LDKRetry *NONNULL_PTR arg) {
43748         LDKRetry *ret_copy = MALLOC(sizeof(LDKRetry), "LDKRetry");
43749         *ret_copy = Retry_clone(arg);
43750         uint64_t ret_ref = tag_ptr(ret_copy, true);
43751         return ret_ref;
43752 }
43753 int64_t  __attribute__((export_name("TS_Retry_clone_ptr"))) TS_Retry_clone_ptr(uint64_t arg) {
43754         LDKRetry* arg_conv = (LDKRetry*)untag_ptr(arg);
43755         int64_t ret_conv = Retry_clone_ptr(arg_conv);
43756         return ret_conv;
43757 }
43758
43759 uint64_t  __attribute__((export_name("TS_Retry_clone"))) TS_Retry_clone(uint64_t orig) {
43760         LDKRetry* orig_conv = (LDKRetry*)untag_ptr(orig);
43761         LDKRetry *ret_copy = MALLOC(sizeof(LDKRetry), "LDKRetry");
43762         *ret_copy = Retry_clone(orig_conv);
43763         uint64_t ret_ref = tag_ptr(ret_copy, true);
43764         return ret_ref;
43765 }
43766
43767 uint64_t  __attribute__((export_name("TS_Retry_attempts"))) TS_Retry_attempts(uint32_t a) {
43768         LDKRetry *ret_copy = MALLOC(sizeof(LDKRetry), "LDKRetry");
43769         *ret_copy = Retry_attempts(a);
43770         uint64_t ret_ref = tag_ptr(ret_copy, true);
43771         return ret_ref;
43772 }
43773
43774 jboolean  __attribute__((export_name("TS_Retry_eq"))) TS_Retry_eq(uint64_t a, uint64_t b) {
43775         LDKRetry* a_conv = (LDKRetry*)untag_ptr(a);
43776         LDKRetry* b_conv = (LDKRetry*)untag_ptr(b);
43777         jboolean ret_conv = Retry_eq(a_conv, b_conv);
43778         return ret_conv;
43779 }
43780
43781 int64_t  __attribute__((export_name("TS_Retry_hash"))) TS_Retry_hash(uint64_t o) {
43782         LDKRetry* o_conv = (LDKRetry*)untag_ptr(o);
43783         int64_t ret_conv = Retry_hash(o_conv);
43784         return ret_conv;
43785 }
43786
43787 void  __attribute__((export_name("TS_PaymentError_free"))) TS_PaymentError_free(uint64_t this_ptr) {
43788         if (!ptr_is_owned(this_ptr)) return;
43789         void* this_ptr_ptr = untag_ptr(this_ptr);
43790         CHECK_ACCESS(this_ptr_ptr);
43791         LDKPaymentError this_ptr_conv = *(LDKPaymentError*)(this_ptr_ptr);
43792         FREE(untag_ptr(this_ptr));
43793         PaymentError_free(this_ptr_conv);
43794 }
43795
43796 static inline uint64_t PaymentError_clone_ptr(LDKPaymentError *NONNULL_PTR arg) {
43797         LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
43798         *ret_copy = PaymentError_clone(arg);
43799         uint64_t ret_ref = tag_ptr(ret_copy, true);
43800         return ret_ref;
43801 }
43802 int64_t  __attribute__((export_name("TS_PaymentError_clone_ptr"))) TS_PaymentError_clone_ptr(uint64_t arg) {
43803         LDKPaymentError* arg_conv = (LDKPaymentError*)untag_ptr(arg);
43804         int64_t ret_conv = PaymentError_clone_ptr(arg_conv);
43805         return ret_conv;
43806 }
43807
43808 uint64_t  __attribute__((export_name("TS_PaymentError_clone"))) TS_PaymentError_clone(uint64_t orig) {
43809         LDKPaymentError* orig_conv = (LDKPaymentError*)untag_ptr(orig);
43810         LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
43811         *ret_copy = PaymentError_clone(orig_conv);
43812         uint64_t ret_ref = tag_ptr(ret_copy, true);
43813         return ret_ref;
43814 }
43815
43816 uint64_t  __attribute__((export_name("TS_PaymentError_invoice"))) TS_PaymentError_invoice(jstring a) {
43817         LDKStr a_conv = str_ref_to_owned_c(a);
43818         LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
43819         *ret_copy = PaymentError_invoice(a_conv);
43820         uint64_t ret_ref = tag_ptr(ret_copy, true);
43821         return ret_ref;
43822 }
43823
43824 uint64_t  __attribute__((export_name("TS_PaymentError_routing"))) TS_PaymentError_routing(uint64_t a) {
43825         LDKLightningError a_conv;
43826         a_conv.inner = untag_ptr(a);
43827         a_conv.is_owned = ptr_is_owned(a);
43828         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
43829         a_conv = LightningError_clone(&a_conv);
43830         LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
43831         *ret_copy = PaymentError_routing(a_conv);
43832         uint64_t ret_ref = tag_ptr(ret_copy, true);
43833         return ret_ref;
43834 }
43835
43836 uint64_t  __attribute__((export_name("TS_PaymentError_sending"))) TS_PaymentError_sending(uint64_t a) {
43837         void* a_ptr = untag_ptr(a);
43838         CHECK_ACCESS(a_ptr);
43839         LDKPaymentSendFailure a_conv = *(LDKPaymentSendFailure*)(a_ptr);
43840         a_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)untag_ptr(a));
43841         LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
43842         *ret_copy = PaymentError_sending(a_conv);
43843         uint64_t ret_ref = tag_ptr(ret_copy, true);
43844         return ret_ref;
43845 }
43846
43847 uint64_t  __attribute__((export_name("TS_InvoicePayer_new"))) TS_InvoicePayer_new(uint64_t payer, uint64_t router, uint64_t scorer, uint64_t logger, uint64_t event_handler, uint64_t retry) {
43848         void* payer_ptr = untag_ptr(payer);
43849         CHECK_ACCESS(payer_ptr);
43850         LDKPayer payer_conv = *(LDKPayer*)(payer_ptr);
43851         if (payer_conv.free == LDKPayer_JCalls_free) {
43852                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
43853                 LDKPayer_JCalls_cloned(&payer_conv);
43854         }
43855         void* router_ptr = untag_ptr(router);
43856         CHECK_ACCESS(router_ptr);
43857         LDKRouter router_conv = *(LDKRouter*)(router_ptr);
43858         if (router_conv.free == LDKRouter_JCalls_free) {
43859                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
43860                 LDKRouter_JCalls_cloned(&router_conv);
43861         }
43862         LDKMultiThreadedLockableScore scorer_conv;
43863         scorer_conv.inner = untag_ptr(scorer);
43864         scorer_conv.is_owned = ptr_is_owned(scorer);
43865         CHECK_INNER_FIELD_ACCESS_OR_NULL(scorer_conv);
43866         scorer_conv.is_owned = false;
43867         void* logger_ptr = untag_ptr(logger);
43868         CHECK_ACCESS(logger_ptr);
43869         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
43870         if (logger_conv.free == LDKLogger_JCalls_free) {
43871                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
43872                 LDKLogger_JCalls_cloned(&logger_conv);
43873         }
43874         void* event_handler_ptr = untag_ptr(event_handler);
43875         CHECK_ACCESS(event_handler_ptr);
43876         LDKEventHandler event_handler_conv = *(LDKEventHandler*)(event_handler_ptr);
43877         if (event_handler_conv.free == LDKEventHandler_JCalls_free) {
43878                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
43879                 LDKEventHandler_JCalls_cloned(&event_handler_conv);
43880         }
43881         void* retry_ptr = untag_ptr(retry);
43882         CHECK_ACCESS(retry_ptr);
43883         LDKRetry retry_conv = *(LDKRetry*)(retry_ptr);
43884         retry_conv = Retry_clone((LDKRetry*)untag_ptr(retry));
43885         LDKInvoicePayer ret_var = InvoicePayer_new(payer_conv, router_conv, &scorer_conv, logger_conv, event_handler_conv, retry_conv);
43886         uint64_t ret_ref = 0;
43887         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43888         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43889         return ret_ref;
43890 }
43891
43892 uint64_t  __attribute__((export_name("TS_InvoicePayer_pay_invoice"))) TS_InvoicePayer_pay_invoice(uint64_t this_arg, uint64_t invoice) {
43893         LDKInvoicePayer this_arg_conv;
43894         this_arg_conv.inner = untag_ptr(this_arg);
43895         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43896         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43897         this_arg_conv.is_owned = false;
43898         LDKInvoice invoice_conv;
43899         invoice_conv.inner = untag_ptr(invoice);
43900         invoice_conv.is_owned = ptr_is_owned(invoice);
43901         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv);
43902         invoice_conv.is_owned = false;
43903         LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
43904         *ret_conv = InvoicePayer_pay_invoice(&this_arg_conv, &invoice_conv);
43905         return tag_ptr(ret_conv, true);
43906 }
43907
43908 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) {
43909         LDKInvoicePayer this_arg_conv;
43910         this_arg_conv.inner = untag_ptr(this_arg);
43911         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43912         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43913         this_arg_conv.is_owned = false;
43914         LDKInvoice invoice_conv;
43915         invoice_conv.inner = untag_ptr(invoice);
43916         invoice_conv.is_owned = ptr_is_owned(invoice);
43917         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv);
43918         invoice_conv.is_owned = false;
43919         LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
43920         *ret_conv = InvoicePayer_pay_zero_value_invoice(&this_arg_conv, &invoice_conv, amount_msats);
43921         return tag_ptr(ret_conv, true);
43922 }
43923
43924 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) {
43925         LDKInvoicePayer this_arg_conv;
43926         this_arg_conv.inner = untag_ptr(this_arg);
43927         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43928         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43929         this_arg_conv.is_owned = false;
43930         LDKPublicKey pubkey_ref;
43931         CHECK(pubkey->arr_len == 33);
43932         memcpy(pubkey_ref.compressed_form, pubkey->elems, 33); FREE(pubkey);
43933         LDKThirtyTwoBytes payment_preimage_ref;
43934         CHECK(payment_preimage->arr_len == 32);
43935         memcpy(payment_preimage_ref.data, payment_preimage->elems, 32); FREE(payment_preimage);
43936         LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
43937         *ret_conv = InvoicePayer_pay_pubkey(&this_arg_conv, pubkey_ref, payment_preimage_ref, amount_msats, final_cltv_expiry_delta);
43938         return tag_ptr(ret_conv, true);
43939 }
43940
43941 void  __attribute__((export_name("TS_InvoicePayer_remove_cached_payment"))) TS_InvoicePayer_remove_cached_payment(uint64_t this_arg, int8_tArray payment_hash) {
43942         LDKInvoicePayer this_arg_conv;
43943         this_arg_conv.inner = untag_ptr(this_arg);
43944         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43945         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43946         this_arg_conv.is_owned = false;
43947         unsigned char payment_hash_arr[32];
43948         CHECK(payment_hash->arr_len == 32);
43949         memcpy(payment_hash_arr, payment_hash->elems, 32); FREE(payment_hash);
43950         unsigned char (*payment_hash_ref)[32] = &payment_hash_arr;
43951         InvoicePayer_remove_cached_payment(&this_arg_conv, payment_hash_ref);
43952 }
43953
43954 uint64_t  __attribute__((export_name("TS_InvoicePayer_as_EventHandler"))) TS_InvoicePayer_as_EventHandler(uint64_t this_arg) {
43955         LDKInvoicePayer this_arg_conv;
43956         this_arg_conv.inner = untag_ptr(this_arg);
43957         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43958         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43959         this_arg_conv.is_owned = false;
43960         LDKEventHandler* ret_ret = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
43961         *ret_ret = InvoicePayer_as_EventHandler(&this_arg_conv);
43962         return tag_ptr(ret_ret, true);
43963 }
43964
43965 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) {
43966         LDKChannelManager channelmanager_conv;
43967         channelmanager_conv.inner = untag_ptr(channelmanager);
43968         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
43969         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
43970         channelmanager_conv.is_owned = false;
43971         void* keys_manager_ptr = untag_ptr(keys_manager);
43972         CHECK_ACCESS(keys_manager_ptr);
43973         LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr);
43974         if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
43975                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
43976                 LDKKeysInterface_JCalls_cloned(&keys_manager_conv);
43977         }
43978         LDKCurrency network_conv = LDKCurrency_from_js(network);
43979         void* amt_msat_ptr = untag_ptr(amt_msat);
43980         CHECK_ACCESS(amt_msat_ptr);
43981         LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
43982         amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amt_msat));
43983         LDKSha256 description_hash_conv;
43984         description_hash_conv.inner = untag_ptr(description_hash);
43985         description_hash_conv.is_owned = ptr_is_owned(description_hash);
43986         CHECK_INNER_FIELD_ACCESS_OR_NULL(description_hash_conv);
43987         description_hash_conv = Sha256_clone(&description_hash_conv);
43988         LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
43989         *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);
43990         return tag_ptr(ret_conv, true);
43991 }
43992
43993 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) {
43994         LDKChannelManager channelmanager_conv;
43995         channelmanager_conv.inner = untag_ptr(channelmanager);
43996         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
43997         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
43998         channelmanager_conv.is_owned = false;
43999         void* keys_manager_ptr = untag_ptr(keys_manager);
44000         CHECK_ACCESS(keys_manager_ptr);
44001         LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr);
44002         if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
44003                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
44004                 LDKKeysInterface_JCalls_cloned(&keys_manager_conv);
44005         }
44006         LDKCurrency network_conv = LDKCurrency_from_js(network);
44007         void* amt_msat_ptr = untag_ptr(amt_msat);
44008         CHECK_ACCESS(amt_msat_ptr);
44009         LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
44010         amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amt_msat));
44011         LDKStr description_conv = str_ref_to_owned_c(description);
44012         LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
44013         *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);
44014         return tag_ptr(ret_conv, true);
44015 }
44016
44017 void  __attribute__((export_name("TS_DefaultRouter_free"))) TS_DefaultRouter_free(uint64_t this_obj) {
44018         LDKDefaultRouter this_obj_conv;
44019         this_obj_conv.inner = untag_ptr(this_obj);
44020         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44021         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44022         DefaultRouter_free(this_obj_conv);
44023 }
44024
44025 uint64_t  __attribute__((export_name("TS_DefaultRouter_new"))) TS_DefaultRouter_new(uint64_t network_graph, uint64_t logger, int8_tArray random_seed_bytes) {
44026         LDKNetworkGraph network_graph_conv;
44027         network_graph_conv.inner = untag_ptr(network_graph);
44028         network_graph_conv.is_owned = ptr_is_owned(network_graph);
44029         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
44030         network_graph_conv.is_owned = false;
44031         void* logger_ptr = untag_ptr(logger);
44032         CHECK_ACCESS(logger_ptr);
44033         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
44034         if (logger_conv.free == LDKLogger_JCalls_free) {
44035                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
44036                 LDKLogger_JCalls_cloned(&logger_conv);
44037         }
44038         LDKThirtyTwoBytes random_seed_bytes_ref;
44039         CHECK(random_seed_bytes->arr_len == 32);
44040         memcpy(random_seed_bytes_ref.data, random_seed_bytes->elems, 32); FREE(random_seed_bytes);
44041         LDKDefaultRouter ret_var = DefaultRouter_new(&network_graph_conv, logger_conv, random_seed_bytes_ref);
44042         uint64_t ret_ref = 0;
44043         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44044         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44045         return ret_ref;
44046 }
44047
44048 uint64_t  __attribute__((export_name("TS_DefaultRouter_as_Router"))) TS_DefaultRouter_as_Router(uint64_t this_arg) {
44049         LDKDefaultRouter this_arg_conv;
44050         this_arg_conv.inner = untag_ptr(this_arg);
44051         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44052         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44053         this_arg_conv.is_owned = false;
44054         LDKRouter* ret_ret = MALLOC(sizeof(LDKRouter), "LDKRouter");
44055         *ret_ret = DefaultRouter_as_Router(&this_arg_conv);
44056         return tag_ptr(ret_ret, true);
44057 }
44058
44059 uint64_t  __attribute__((export_name("TS_ChannelManager_as_Payer"))) TS_ChannelManager_as_Payer(uint64_t this_arg) {
44060         LDKChannelManager this_arg_conv;
44061         this_arg_conv.inner = untag_ptr(this_arg);
44062         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44063         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44064         this_arg_conv.is_owned = false;
44065         LDKPayer* ret_ret = MALLOC(sizeof(LDKPayer), "LDKPayer");
44066         *ret_ret = ChannelManager_as_Payer(&this_arg_conv);
44067         return tag_ptr(ret_ret, true);
44068 }
44069
44070 uint64_t  __attribute__((export_name("TS_SiPrefix_from_str"))) TS_SiPrefix_from_str(jstring s) {
44071         LDKStr s_conv = str_ref_to_owned_c(s);
44072         LDKCResult_SiPrefixParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixParseErrorZ), "LDKCResult_SiPrefixParseErrorZ");
44073         *ret_conv = SiPrefix_from_str(s_conv);
44074         return tag_ptr(ret_conv, true);
44075 }
44076
44077 uint64_t  __attribute__((export_name("TS_Invoice_from_str"))) TS_Invoice_from_str(jstring s) {
44078         LDKStr s_conv = str_ref_to_owned_c(s);
44079         LDKCResult_InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceParseOrSemanticErrorZ), "LDKCResult_InvoiceParseOrSemanticErrorZ");
44080         *ret_conv = Invoice_from_str(s_conv);
44081         return tag_ptr(ret_conv, true);
44082 }
44083
44084 uint64_t  __attribute__((export_name("TS_SignedRawInvoice_from_str"))) TS_SignedRawInvoice_from_str(jstring s) {
44085         LDKStr s_conv = str_ref_to_owned_c(s);
44086         LDKCResult_SignedRawInvoiceParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceParseErrorZ), "LDKCResult_SignedRawInvoiceParseErrorZ");
44087         *ret_conv = SignedRawInvoice_from_str(s_conv);
44088         return tag_ptr(ret_conv, true);
44089 }
44090
44091 jstring  __attribute__((export_name("TS_ParseError_to_str"))) TS_ParseError_to_str(uint64_t o) {
44092         LDKParseError* o_conv = (LDKParseError*)untag_ptr(o);
44093         LDKStr ret_str = ParseError_to_str(o_conv);
44094         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
44095         Str_free(ret_str);
44096         return ret_conv;
44097 }
44098
44099 jstring  __attribute__((export_name("TS_ParseOrSemanticError_to_str"))) TS_ParseOrSemanticError_to_str(uint64_t o) {
44100         LDKParseOrSemanticError* o_conv = (LDKParseOrSemanticError*)untag_ptr(o);
44101         LDKStr ret_str = ParseOrSemanticError_to_str(o_conv);
44102         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
44103         Str_free(ret_str);
44104         return ret_conv;
44105 }
44106
44107 jstring  __attribute__((export_name("TS_Invoice_to_str"))) TS_Invoice_to_str(uint64_t o) {
44108         LDKInvoice o_conv;
44109         o_conv.inner = untag_ptr(o);
44110         o_conv.is_owned = ptr_is_owned(o);
44111         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
44112         o_conv.is_owned = false;
44113         LDKStr ret_str = Invoice_to_str(&o_conv);
44114         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
44115         Str_free(ret_str);
44116         return ret_conv;
44117 }
44118
44119 jstring  __attribute__((export_name("TS_SignedRawInvoice_to_str"))) TS_SignedRawInvoice_to_str(uint64_t o) {
44120         LDKSignedRawInvoice o_conv;
44121         o_conv.inner = untag_ptr(o);
44122         o_conv.is_owned = ptr_is_owned(o);
44123         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
44124         o_conv.is_owned = false;
44125         LDKStr ret_str = SignedRawInvoice_to_str(&o_conv);
44126         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
44127         Str_free(ret_str);
44128         return ret_conv;
44129 }
44130
44131 jstring  __attribute__((export_name("TS_Currency_to_str"))) TS_Currency_to_str(uint64_t o) {
44132         LDKCurrency* o_conv = (LDKCurrency*)untag_ptr(o);
44133         LDKStr ret_str = Currency_to_str(o_conv);
44134         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
44135         Str_free(ret_str);
44136         return ret_conv;
44137 }
44138
44139 jstring  __attribute__((export_name("TS_SiPrefix_to_str"))) TS_SiPrefix_to_str(uint64_t o) {
44140         LDKSiPrefix* o_conv = (LDKSiPrefix*)untag_ptr(o);
44141         LDKStr ret_str = SiPrefix_to_str(o_conv);
44142         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
44143         Str_free(ret_str);
44144         return ret_conv;
44145 }
44146