[TS] Update auto-generated TS 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 CHECK(owner->result_ok);
495         return CounterpartyCommitmentSecrets_clone(&*owner->contents.result);
496 }
497 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_ok"))) TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_ok(uint64_t owner) {
498         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)untag_ptr(owner);
499         LDKCounterpartyCommitmentSecrets ret_var = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_ok(owner_conv);
500         uint64_t ret_ref = 0;
501         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
502         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
503         return ret_ref;
504 }
505
506 static inline struct LDKDecodeError CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_err(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ *NONNULL_PTR owner){
507 CHECK(!owner->result_ok);
508         return DecodeError_clone(&*owner->contents.err);
509 }
510 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_err"))) TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_err(uint64_t owner) {
511         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)untag_ptr(owner);
512         LDKDecodeError ret_var = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_err(owner_conv);
513         uint64_t ret_ref = 0;
514         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
515         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
516         return ret_ref;
517 }
518
519 static inline struct LDKSecretKey CResult_SecretKeyErrorZ_get_ok(LDKCResult_SecretKeyErrorZ *NONNULL_PTR owner){
520 CHECK(owner->result_ok);
521         return *owner->contents.result;
522 }
523 int8_tArray  __attribute__((export_name("TS_CResult_SecretKeyErrorZ_get_ok"))) TS_CResult_SecretKeyErrorZ_get_ok(uint64_t owner) {
524         LDKCResult_SecretKeyErrorZ* owner_conv = (LDKCResult_SecretKeyErrorZ*)untag_ptr(owner);
525         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
526         memcpy(ret_arr->elems, CResult_SecretKeyErrorZ_get_ok(owner_conv).bytes, 32);
527         return ret_arr;
528 }
529
530 static inline enum LDKSecp256k1Error CResult_SecretKeyErrorZ_get_err(LDKCResult_SecretKeyErrorZ *NONNULL_PTR owner){
531 CHECK(!owner->result_ok);
532         return *owner->contents.err;
533 }
534 uint32_t  __attribute__((export_name("TS_CResult_SecretKeyErrorZ_get_err"))) TS_CResult_SecretKeyErrorZ_get_err(uint64_t owner) {
535         LDKCResult_SecretKeyErrorZ* owner_conv = (LDKCResult_SecretKeyErrorZ*)untag_ptr(owner);
536         uint32_t ret_conv = LDKSecp256k1Error_to_js(CResult_SecretKeyErrorZ_get_err(owner_conv));
537         return ret_conv;
538 }
539
540 static inline struct LDKPublicKey CResult_PublicKeyErrorZ_get_ok(LDKCResult_PublicKeyErrorZ *NONNULL_PTR owner){
541 CHECK(owner->result_ok);
542         return *owner->contents.result;
543 }
544 int8_tArray  __attribute__((export_name("TS_CResult_PublicKeyErrorZ_get_ok"))) TS_CResult_PublicKeyErrorZ_get_ok(uint64_t owner) {
545         LDKCResult_PublicKeyErrorZ* owner_conv = (LDKCResult_PublicKeyErrorZ*)untag_ptr(owner);
546         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
547         memcpy(ret_arr->elems, CResult_PublicKeyErrorZ_get_ok(owner_conv).compressed_form, 33);
548         return ret_arr;
549 }
550
551 static inline enum LDKSecp256k1Error CResult_PublicKeyErrorZ_get_err(LDKCResult_PublicKeyErrorZ *NONNULL_PTR owner){
552 CHECK(!owner->result_ok);
553         return *owner->contents.err;
554 }
555 uint32_t  __attribute__((export_name("TS_CResult_PublicKeyErrorZ_get_err"))) TS_CResult_PublicKeyErrorZ_get_err(uint64_t owner) {
556         LDKCResult_PublicKeyErrorZ* owner_conv = (LDKCResult_PublicKeyErrorZ*)untag_ptr(owner);
557         uint32_t ret_conv = LDKSecp256k1Error_to_js(CResult_PublicKeyErrorZ_get_err(owner_conv));
558         return ret_conv;
559 }
560
561 static inline struct LDKTxCreationKeys CResult_TxCreationKeysDecodeErrorZ_get_ok(LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR owner){
562 CHECK(owner->result_ok);
563         return TxCreationKeys_clone(&*owner->contents.result);
564 }
565 uint64_t  __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_get_ok"))) TS_CResult_TxCreationKeysDecodeErrorZ_get_ok(uint64_t owner) {
566         LDKCResult_TxCreationKeysDecodeErrorZ* owner_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)untag_ptr(owner);
567         LDKTxCreationKeys ret_var = CResult_TxCreationKeysDecodeErrorZ_get_ok(owner_conv);
568         uint64_t ret_ref = 0;
569         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
570         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
571         return ret_ref;
572 }
573
574 static inline struct LDKDecodeError CResult_TxCreationKeysDecodeErrorZ_get_err(LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR owner){
575 CHECK(!owner->result_ok);
576         return DecodeError_clone(&*owner->contents.err);
577 }
578 uint64_t  __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_get_err"))) TS_CResult_TxCreationKeysDecodeErrorZ_get_err(uint64_t owner) {
579         LDKCResult_TxCreationKeysDecodeErrorZ* owner_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)untag_ptr(owner);
580         LDKDecodeError ret_var = CResult_TxCreationKeysDecodeErrorZ_get_err(owner_conv);
581         uint64_t ret_ref = 0;
582         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
583         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
584         return ret_ref;
585 }
586
587 static inline struct LDKChannelPublicKeys CResult_ChannelPublicKeysDecodeErrorZ_get_ok(LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR owner){
588 CHECK(owner->result_ok);
589         return ChannelPublicKeys_clone(&*owner->contents.result);
590 }
591 uint64_t  __attribute__((export_name("TS_CResult_ChannelPublicKeysDecodeErrorZ_get_ok"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_get_ok(uint64_t owner) {
592         LDKCResult_ChannelPublicKeysDecodeErrorZ* owner_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)untag_ptr(owner);
593         LDKChannelPublicKeys ret_var = CResult_ChannelPublicKeysDecodeErrorZ_get_ok(owner_conv);
594         uint64_t ret_ref = 0;
595         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
596         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
597         return ret_ref;
598 }
599
600 static inline struct LDKDecodeError CResult_ChannelPublicKeysDecodeErrorZ_get_err(LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR owner){
601 CHECK(!owner->result_ok);
602         return DecodeError_clone(&*owner->contents.err);
603 }
604 uint64_t  __attribute__((export_name("TS_CResult_ChannelPublicKeysDecodeErrorZ_get_err"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_get_err(uint64_t owner) {
605         LDKCResult_ChannelPublicKeysDecodeErrorZ* owner_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)untag_ptr(owner);
606         LDKDecodeError ret_var = CResult_ChannelPublicKeysDecodeErrorZ_get_err(owner_conv);
607         uint64_t ret_ref = 0;
608         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
609         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
610         return ret_ref;
611 }
612
613 static inline struct LDKTxCreationKeys CResult_TxCreationKeysErrorZ_get_ok(LDKCResult_TxCreationKeysErrorZ *NONNULL_PTR owner){
614 CHECK(owner->result_ok);
615         return TxCreationKeys_clone(&*owner->contents.result);
616 }
617 uint64_t  __attribute__((export_name("TS_CResult_TxCreationKeysErrorZ_get_ok"))) TS_CResult_TxCreationKeysErrorZ_get_ok(uint64_t owner) {
618         LDKCResult_TxCreationKeysErrorZ* owner_conv = (LDKCResult_TxCreationKeysErrorZ*)untag_ptr(owner);
619         LDKTxCreationKeys ret_var = CResult_TxCreationKeysErrorZ_get_ok(owner_conv);
620         uint64_t ret_ref = 0;
621         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
622         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
623         return ret_ref;
624 }
625
626 static inline enum LDKSecp256k1Error CResult_TxCreationKeysErrorZ_get_err(LDKCResult_TxCreationKeysErrorZ *NONNULL_PTR owner){
627 CHECK(!owner->result_ok);
628         return *owner->contents.err;
629 }
630 uint32_t  __attribute__((export_name("TS_CResult_TxCreationKeysErrorZ_get_err"))) TS_CResult_TxCreationKeysErrorZ_get_err(uint64_t owner) {
631         LDKCResult_TxCreationKeysErrorZ* owner_conv = (LDKCResult_TxCreationKeysErrorZ*)untag_ptr(owner);
632         uint32_t ret_conv = LDKSecp256k1Error_to_js(CResult_TxCreationKeysErrorZ_get_err(owner_conv));
633         return ret_conv;
634 }
635
636 uint32_t __attribute__((export_name("TS_LDKCOption_u32Z_ty_from_ptr"))) TS_LDKCOption_u32Z_ty_from_ptr(uint64_t ptr) {
637         LDKCOption_u32Z *obj = (LDKCOption_u32Z*)untag_ptr(ptr);
638         switch(obj->tag) {
639                 case LDKCOption_u32Z_Some: return 0;
640                 case LDKCOption_u32Z_None: return 1;
641                 default: abort();
642         }
643 }
644 int32_t __attribute__((export_name("TS_LDKCOption_u32Z_Some_get_some"))) TS_LDKCOption_u32Z_Some_get_some(uint64_t ptr) {
645         LDKCOption_u32Z *obj = (LDKCOption_u32Z*)untag_ptr(ptr);
646         assert(obj->tag == LDKCOption_u32Z_Some);
647                         int32_t some_conv = obj->some;
648         return some_conv;
649 }
650 static inline struct LDKHTLCOutputInCommitment CResult_HTLCOutputInCommitmentDecodeErrorZ_get_ok(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR owner){
651 CHECK(owner->result_ok);
652         return HTLCOutputInCommitment_clone(&*owner->contents.result);
653 }
654 uint64_t  __attribute__((export_name("TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_get_ok"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_get_ok(uint64_t owner) {
655         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* owner_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)untag_ptr(owner);
656         LDKHTLCOutputInCommitment ret_var = CResult_HTLCOutputInCommitmentDecodeErrorZ_get_ok(owner_conv);
657         uint64_t ret_ref = 0;
658         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
659         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
660         return ret_ref;
661 }
662
663 static inline struct LDKDecodeError CResult_HTLCOutputInCommitmentDecodeErrorZ_get_err(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR owner){
664 CHECK(!owner->result_ok);
665         return DecodeError_clone(&*owner->contents.err);
666 }
667 uint64_t  __attribute__((export_name("TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_get_err"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_get_err(uint64_t owner) {
668         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* owner_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)untag_ptr(owner);
669         LDKDecodeError ret_var = CResult_HTLCOutputInCommitmentDecodeErrorZ_get_err(owner_conv);
670         uint64_t ret_ref = 0;
671         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
672         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
673         return ret_ref;
674 }
675
676 static inline struct LDKCounterpartyChannelTransactionParameters CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_ok(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR owner){
677 CHECK(owner->result_ok);
678         return CounterpartyChannelTransactionParameters_clone(&*owner->contents.result);
679 }
680 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_ok"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_ok(uint64_t owner) {
681         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)untag_ptr(owner);
682         LDKCounterpartyChannelTransactionParameters ret_var = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_ok(owner_conv);
683         uint64_t ret_ref = 0;
684         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
685         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
686         return ret_ref;
687 }
688
689 static inline struct LDKDecodeError CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_err(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR owner){
690 CHECK(!owner->result_ok);
691         return DecodeError_clone(&*owner->contents.err);
692 }
693 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_err"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_err(uint64_t owner) {
694         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)untag_ptr(owner);
695         LDKDecodeError ret_var = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_err(owner_conv);
696         uint64_t ret_ref = 0;
697         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
698         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
699         return ret_ref;
700 }
701
702 static inline struct LDKChannelTransactionParameters CResult_ChannelTransactionParametersDecodeErrorZ_get_ok(LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR owner){
703 CHECK(owner->result_ok);
704         return ChannelTransactionParameters_clone(&*owner->contents.result);
705 }
706 uint64_t  __attribute__((export_name("TS_CResult_ChannelTransactionParametersDecodeErrorZ_get_ok"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_get_ok(uint64_t owner) {
707         LDKCResult_ChannelTransactionParametersDecodeErrorZ* owner_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)untag_ptr(owner);
708         LDKChannelTransactionParameters ret_var = CResult_ChannelTransactionParametersDecodeErrorZ_get_ok(owner_conv);
709         uint64_t ret_ref = 0;
710         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
711         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
712         return ret_ref;
713 }
714
715 static inline struct LDKDecodeError CResult_ChannelTransactionParametersDecodeErrorZ_get_err(LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR owner){
716 CHECK(!owner->result_ok);
717         return DecodeError_clone(&*owner->contents.err);
718 }
719 uint64_t  __attribute__((export_name("TS_CResult_ChannelTransactionParametersDecodeErrorZ_get_err"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_get_err(uint64_t owner) {
720         LDKCResult_ChannelTransactionParametersDecodeErrorZ* owner_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)untag_ptr(owner);
721         LDKDecodeError ret_var = CResult_ChannelTransactionParametersDecodeErrorZ_get_err(owner_conv);
722         uint64_t ret_ref = 0;
723         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
724         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
725         return ret_ref;
726 }
727
728 static inline struct LDKHolderCommitmentTransaction CResult_HolderCommitmentTransactionDecodeErrorZ_get_ok(LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
729 CHECK(owner->result_ok);
730         return HolderCommitmentTransaction_clone(&*owner->contents.result);
731 }
732 uint64_t  __attribute__((export_name("TS_CResult_HolderCommitmentTransactionDecodeErrorZ_get_ok"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_get_ok(uint64_t owner) {
733         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
734         LDKHolderCommitmentTransaction ret_var = CResult_HolderCommitmentTransactionDecodeErrorZ_get_ok(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 LDKDecodeError CResult_HolderCommitmentTransactionDecodeErrorZ_get_err(LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
742 CHECK(!owner->result_ok);
743         return DecodeError_clone(&*owner->contents.err);
744 }
745 uint64_t  __attribute__((export_name("TS_CResult_HolderCommitmentTransactionDecodeErrorZ_get_err"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_get_err(uint64_t owner) {
746         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
747         LDKDecodeError ret_var = CResult_HolderCommitmentTransactionDecodeErrorZ_get_err(owner_conv);
748         uint64_t ret_ref = 0;
749         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
750         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
751         return ret_ref;
752 }
753
754 static inline struct LDKBuiltCommitmentTransaction CResult_BuiltCommitmentTransactionDecodeErrorZ_get_ok(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
755 CHECK(owner->result_ok);
756         return BuiltCommitmentTransaction_clone(&*owner->contents.result);
757 }
758 uint64_t  __attribute__((export_name("TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_get_ok"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_get_ok(uint64_t owner) {
759         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
760         LDKBuiltCommitmentTransaction ret_var = CResult_BuiltCommitmentTransactionDecodeErrorZ_get_ok(owner_conv);
761         uint64_t ret_ref = 0;
762         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
763         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
764         return ret_ref;
765 }
766
767 static inline struct LDKDecodeError CResult_BuiltCommitmentTransactionDecodeErrorZ_get_err(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
768 CHECK(!owner->result_ok);
769         return DecodeError_clone(&*owner->contents.err);
770 }
771 uint64_t  __attribute__((export_name("TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_get_err"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_get_err(uint64_t owner) {
772         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
773         LDKDecodeError ret_var = CResult_BuiltCommitmentTransactionDecodeErrorZ_get_err(owner_conv);
774         uint64_t ret_ref = 0;
775         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
776         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
777         return ret_ref;
778 }
779
780 static inline struct LDKTrustedClosingTransaction *CResult_TrustedClosingTransactionNoneZ_get_ok(LDKCResult_TrustedClosingTransactionNoneZ *NONNULL_PTR owner){
781 CHECK(owner->result_ok);
782         return &*owner->contents.result;
783 }
784 uint64_t  __attribute__((export_name("TS_CResult_TrustedClosingTransactionNoneZ_get_ok"))) TS_CResult_TrustedClosingTransactionNoneZ_get_ok(uint64_t owner) {
785         LDKCResult_TrustedClosingTransactionNoneZ* owner_conv = (LDKCResult_TrustedClosingTransactionNoneZ*)untag_ptr(owner);
786         LDKTrustedClosingTransaction ret_var = *CResult_TrustedClosingTransactionNoneZ_get_ok(owner_conv);
787         uint64_t ret_ref = 0;
788         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
789         ret_ref = tag_ptr(ret_var.inner, false);
790         return ret_ref;
791 }
792
793 static inline void CResult_TrustedClosingTransactionNoneZ_get_err(LDKCResult_TrustedClosingTransactionNoneZ *NONNULL_PTR owner){
794 CHECK(!owner->result_ok);
795         return *owner->contents.err;
796 }
797 void  __attribute__((export_name("TS_CResult_TrustedClosingTransactionNoneZ_get_err"))) TS_CResult_TrustedClosingTransactionNoneZ_get_err(uint64_t owner) {
798         LDKCResult_TrustedClosingTransactionNoneZ* owner_conv = (LDKCResult_TrustedClosingTransactionNoneZ*)untag_ptr(owner);
799         CResult_TrustedClosingTransactionNoneZ_get_err(owner_conv);
800 }
801
802 static inline struct LDKCommitmentTransaction CResult_CommitmentTransactionDecodeErrorZ_get_ok(LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
803 CHECK(owner->result_ok);
804         return CommitmentTransaction_clone(&*owner->contents.result);
805 }
806 uint64_t  __attribute__((export_name("TS_CResult_CommitmentTransactionDecodeErrorZ_get_ok"))) TS_CResult_CommitmentTransactionDecodeErrorZ_get_ok(uint64_t owner) {
807         LDKCResult_CommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
808         LDKCommitmentTransaction ret_var = CResult_CommitmentTransactionDecodeErrorZ_get_ok(owner_conv);
809         uint64_t ret_ref = 0;
810         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
811         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
812         return ret_ref;
813 }
814
815 static inline struct LDKDecodeError CResult_CommitmentTransactionDecodeErrorZ_get_err(LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
816 CHECK(!owner->result_ok);
817         return DecodeError_clone(&*owner->contents.err);
818 }
819 uint64_t  __attribute__((export_name("TS_CResult_CommitmentTransactionDecodeErrorZ_get_err"))) TS_CResult_CommitmentTransactionDecodeErrorZ_get_err(uint64_t owner) {
820         LDKCResult_CommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
821         LDKDecodeError ret_var = CResult_CommitmentTransactionDecodeErrorZ_get_err(owner_conv);
822         uint64_t ret_ref = 0;
823         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
824         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
825         return ret_ref;
826 }
827
828 static inline struct LDKTrustedCommitmentTransaction *CResult_TrustedCommitmentTransactionNoneZ_get_ok(LDKCResult_TrustedCommitmentTransactionNoneZ *NONNULL_PTR owner){
829 CHECK(owner->result_ok);
830         return &*owner->contents.result;
831 }
832 uint64_t  __attribute__((export_name("TS_CResult_TrustedCommitmentTransactionNoneZ_get_ok"))) TS_CResult_TrustedCommitmentTransactionNoneZ_get_ok(uint64_t owner) {
833         LDKCResult_TrustedCommitmentTransactionNoneZ* owner_conv = (LDKCResult_TrustedCommitmentTransactionNoneZ*)untag_ptr(owner);
834         LDKTrustedCommitmentTransaction ret_var = *CResult_TrustedCommitmentTransactionNoneZ_get_ok(owner_conv);
835         uint64_t ret_ref = 0;
836         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
837         ret_ref = tag_ptr(ret_var.inner, false);
838         return ret_ref;
839 }
840
841 static inline void CResult_TrustedCommitmentTransactionNoneZ_get_err(LDKCResult_TrustedCommitmentTransactionNoneZ *NONNULL_PTR owner){
842 CHECK(!owner->result_ok);
843         return *owner->contents.err;
844 }
845 void  __attribute__((export_name("TS_CResult_TrustedCommitmentTransactionNoneZ_get_err"))) TS_CResult_TrustedCommitmentTransactionNoneZ_get_err(uint64_t owner) {
846         LDKCResult_TrustedCommitmentTransactionNoneZ* owner_conv = (LDKCResult_TrustedCommitmentTransactionNoneZ*)untag_ptr(owner);
847         CResult_TrustedCommitmentTransactionNoneZ_get_err(owner_conv);
848 }
849
850 static inline struct LDKCVec_SignatureZ CResult_CVec_SignatureZNoneZ_get_ok(LDKCResult_CVec_SignatureZNoneZ *NONNULL_PTR owner){
851 CHECK(owner->result_ok);
852         return *owner->contents.result;
853 }
854 ptrArray  __attribute__((export_name("TS_CResult_CVec_SignatureZNoneZ_get_ok"))) TS_CResult_CVec_SignatureZNoneZ_get_ok(uint64_t owner) {
855         LDKCResult_CVec_SignatureZNoneZ* owner_conv = (LDKCResult_CVec_SignatureZNoneZ*)untag_ptr(owner);
856         LDKCVec_SignatureZ ret_var = CResult_CVec_SignatureZNoneZ_get_ok(owner_conv);
857         ptrArray ret_arr = NULL;
858         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
859         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
860         for (size_t m = 0; m < ret_var.datalen; m++) {
861                 int8_tArray ret_conv_12_arr = init_int8_tArray(64, __LINE__);
862                 memcpy(ret_conv_12_arr->elems, ret_var.data[m].compact_form, 64);
863                 ret_arr_ptr[m] = ret_conv_12_arr;
864         }
865         
866         return ret_arr;
867 }
868
869 static inline void CResult_CVec_SignatureZNoneZ_get_err(LDKCResult_CVec_SignatureZNoneZ *NONNULL_PTR owner){
870 CHECK(!owner->result_ok);
871         return *owner->contents.err;
872 }
873 void  __attribute__((export_name("TS_CResult_CVec_SignatureZNoneZ_get_err"))) TS_CResult_CVec_SignatureZNoneZ_get_err(uint64_t owner) {
874         LDKCResult_CVec_SignatureZNoneZ* owner_conv = (LDKCResult_CVec_SignatureZNoneZ*)untag_ptr(owner);
875         CResult_CVec_SignatureZNoneZ_get_err(owner_conv);
876 }
877
878 static inline struct LDKShutdownScript CResult_ShutdownScriptDecodeErrorZ_get_ok(LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR owner){
879 CHECK(owner->result_ok);
880         return ShutdownScript_clone(&*owner->contents.result);
881 }
882 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptDecodeErrorZ_get_ok"))) TS_CResult_ShutdownScriptDecodeErrorZ_get_ok(uint64_t owner) {
883         LDKCResult_ShutdownScriptDecodeErrorZ* owner_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)untag_ptr(owner);
884         LDKShutdownScript ret_var = CResult_ShutdownScriptDecodeErrorZ_get_ok(owner_conv);
885         uint64_t ret_ref = 0;
886         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
887         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
888         return ret_ref;
889 }
890
891 static inline struct LDKDecodeError CResult_ShutdownScriptDecodeErrorZ_get_err(LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR owner){
892 CHECK(!owner->result_ok);
893         return DecodeError_clone(&*owner->contents.err);
894 }
895 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptDecodeErrorZ_get_err"))) TS_CResult_ShutdownScriptDecodeErrorZ_get_err(uint64_t owner) {
896         LDKCResult_ShutdownScriptDecodeErrorZ* owner_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)untag_ptr(owner);
897         LDKDecodeError ret_var = CResult_ShutdownScriptDecodeErrorZ_get_err(owner_conv);
898         uint64_t ret_ref = 0;
899         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
900         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
901         return ret_ref;
902 }
903
904 static inline struct LDKShutdownScript CResult_ShutdownScriptInvalidShutdownScriptZ_get_ok(LDKCResult_ShutdownScriptInvalidShutdownScriptZ *NONNULL_PTR owner){
905 CHECK(owner->result_ok);
906         return ShutdownScript_clone(&*owner->contents.result);
907 }
908 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptInvalidShutdownScriptZ_get_ok"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_get_ok(uint64_t owner) {
909         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* owner_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)untag_ptr(owner);
910         LDKShutdownScript ret_var = CResult_ShutdownScriptInvalidShutdownScriptZ_get_ok(owner_conv);
911         uint64_t ret_ref = 0;
912         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
913         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
914         return ret_ref;
915 }
916
917 static inline struct LDKInvalidShutdownScript CResult_ShutdownScriptInvalidShutdownScriptZ_get_err(LDKCResult_ShutdownScriptInvalidShutdownScriptZ *NONNULL_PTR owner){
918 CHECK(!owner->result_ok);
919         return InvalidShutdownScript_clone(&*owner->contents.err);
920 }
921 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptInvalidShutdownScriptZ_get_err"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_get_err(uint64_t owner) {
922         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* owner_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)untag_ptr(owner);
923         LDKInvalidShutdownScript ret_var = CResult_ShutdownScriptInvalidShutdownScriptZ_get_err(owner_conv);
924         uint64_t ret_ref = 0;
925         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
926         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
927         return ret_ref;
928 }
929
930 static inline struct LDKRouteHop CResult_RouteHopDecodeErrorZ_get_ok(LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR owner){
931 CHECK(owner->result_ok);
932         return RouteHop_clone(&*owner->contents.result);
933 }
934 uint64_t  __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_get_ok"))) TS_CResult_RouteHopDecodeErrorZ_get_ok(uint64_t owner) {
935         LDKCResult_RouteHopDecodeErrorZ* owner_conv = (LDKCResult_RouteHopDecodeErrorZ*)untag_ptr(owner);
936         LDKRouteHop ret_var = CResult_RouteHopDecodeErrorZ_get_ok(owner_conv);
937         uint64_t ret_ref = 0;
938         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
939         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
940         return ret_ref;
941 }
942
943 static inline struct LDKDecodeError CResult_RouteHopDecodeErrorZ_get_err(LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR owner){
944 CHECK(!owner->result_ok);
945         return DecodeError_clone(&*owner->contents.err);
946 }
947 uint64_t  __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_get_err"))) TS_CResult_RouteHopDecodeErrorZ_get_err(uint64_t owner) {
948         LDKCResult_RouteHopDecodeErrorZ* owner_conv = (LDKCResult_RouteHopDecodeErrorZ*)untag_ptr(owner);
949         LDKDecodeError ret_var = CResult_RouteHopDecodeErrorZ_get_err(owner_conv);
950         uint64_t ret_ref = 0;
951         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
952         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
953         return ret_ref;
954 }
955
956 static inline LDKCVec_RouteHopZ CVec_RouteHopZ_clone(const LDKCVec_RouteHopZ *orig) {
957         LDKCVec_RouteHopZ ret = { .data = MALLOC(sizeof(LDKRouteHop) * orig->datalen, "LDKCVec_RouteHopZ clone bytes"), .datalen = orig->datalen };
958         for (size_t i = 0; i < ret.datalen; i++) {
959                 ret.data[i] = RouteHop_clone(&orig->data[i]);
960         }
961         return ret;
962 }
963 static inline LDKCVec_CVec_RouteHopZZ CVec_CVec_RouteHopZZ_clone(const LDKCVec_CVec_RouteHopZZ *orig) {
964         LDKCVec_CVec_RouteHopZZ ret = { .data = MALLOC(sizeof(LDKCVec_RouteHopZ) * orig->datalen, "LDKCVec_CVec_RouteHopZZ clone bytes"), .datalen = orig->datalen };
965         for (size_t i = 0; i < ret.datalen; i++) {
966                 ret.data[i] = CVec_RouteHopZ_clone(&orig->data[i]);
967         }
968         return ret;
969 }
970 static inline struct LDKRoute CResult_RouteDecodeErrorZ_get_ok(LDKCResult_RouteDecodeErrorZ *NONNULL_PTR owner){
971 CHECK(owner->result_ok);
972         return Route_clone(&*owner->contents.result);
973 }
974 uint64_t  __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_get_ok"))) TS_CResult_RouteDecodeErrorZ_get_ok(uint64_t owner) {
975         LDKCResult_RouteDecodeErrorZ* owner_conv = (LDKCResult_RouteDecodeErrorZ*)untag_ptr(owner);
976         LDKRoute ret_var = CResult_RouteDecodeErrorZ_get_ok(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 struct LDKDecodeError CResult_RouteDecodeErrorZ_get_err(LDKCResult_RouteDecodeErrorZ *NONNULL_PTR owner){
984 CHECK(!owner->result_ok);
985         return DecodeError_clone(&*owner->contents.err);
986 }
987 uint64_t  __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_get_err"))) TS_CResult_RouteDecodeErrorZ_get_err(uint64_t owner) {
988         LDKCResult_RouteDecodeErrorZ* owner_conv = (LDKCResult_RouteDecodeErrorZ*)untag_ptr(owner);
989         LDKDecodeError ret_var = CResult_RouteDecodeErrorZ_get_err(owner_conv);
990         uint64_t ret_ref = 0;
991         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
992         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
993         return ret_ref;
994 }
995
996 static inline struct LDKRouteParameters CResult_RouteParametersDecodeErrorZ_get_ok(LDKCResult_RouteParametersDecodeErrorZ *NONNULL_PTR owner){
997 CHECK(owner->result_ok);
998         return RouteParameters_clone(&*owner->contents.result);
999 }
1000 uint64_t  __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_get_ok"))) TS_CResult_RouteParametersDecodeErrorZ_get_ok(uint64_t owner) {
1001         LDKCResult_RouteParametersDecodeErrorZ* owner_conv = (LDKCResult_RouteParametersDecodeErrorZ*)untag_ptr(owner);
1002         LDKRouteParameters ret_var = CResult_RouteParametersDecodeErrorZ_get_ok(owner_conv);
1003         uint64_t ret_ref = 0;
1004         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1005         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1006         return ret_ref;
1007 }
1008
1009 static inline struct LDKDecodeError CResult_RouteParametersDecodeErrorZ_get_err(LDKCResult_RouteParametersDecodeErrorZ *NONNULL_PTR owner){
1010 CHECK(!owner->result_ok);
1011         return DecodeError_clone(&*owner->contents.err);
1012 }
1013 uint64_t  __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_get_err"))) TS_CResult_RouteParametersDecodeErrorZ_get_err(uint64_t owner) {
1014         LDKCResult_RouteParametersDecodeErrorZ* owner_conv = (LDKCResult_RouteParametersDecodeErrorZ*)untag_ptr(owner);
1015         LDKDecodeError ret_var = CResult_RouteParametersDecodeErrorZ_get_err(owner_conv);
1016         uint64_t ret_ref = 0;
1017         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1018         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1019         return ret_ref;
1020 }
1021
1022 static inline LDKCVec_RouteHintZ CVec_RouteHintZ_clone(const LDKCVec_RouteHintZ *orig) {
1023         LDKCVec_RouteHintZ ret = { .data = MALLOC(sizeof(LDKRouteHint) * orig->datalen, "LDKCVec_RouteHintZ clone bytes"), .datalen = orig->datalen };
1024         for (size_t i = 0; i < ret.datalen; i++) {
1025                 ret.data[i] = RouteHint_clone(&orig->data[i]);
1026         }
1027         return ret;
1028 }
1029 uint32_t __attribute__((export_name("TS_LDKCOption_u64Z_ty_from_ptr"))) TS_LDKCOption_u64Z_ty_from_ptr(uint64_t ptr) {
1030         LDKCOption_u64Z *obj = (LDKCOption_u64Z*)untag_ptr(ptr);
1031         switch(obj->tag) {
1032                 case LDKCOption_u64Z_Some: return 0;
1033                 case LDKCOption_u64Z_None: return 1;
1034                 default: abort();
1035         }
1036 }
1037 int64_t __attribute__((export_name("TS_LDKCOption_u64Z_Some_get_some"))) TS_LDKCOption_u64Z_Some_get_some(uint64_t ptr) {
1038         LDKCOption_u64Z *obj = (LDKCOption_u64Z*)untag_ptr(ptr);
1039         assert(obj->tag == LDKCOption_u64Z_Some);
1040                         int64_t some_conv = obj->some;
1041         return some_conv;
1042 }
1043 static inline LDKCVec_u64Z CVec_u64Z_clone(const LDKCVec_u64Z *orig) {
1044         LDKCVec_u64Z ret = { .data = MALLOC(sizeof(int64_t) * orig->datalen, "LDKCVec_u64Z clone bytes"), .datalen = orig->datalen };
1045         memcpy(ret.data, orig->data, sizeof(int64_t) * ret.datalen);
1046         return ret;
1047 }
1048 static inline struct LDKPaymentParameters CResult_PaymentParametersDecodeErrorZ_get_ok(LDKCResult_PaymentParametersDecodeErrorZ *NONNULL_PTR owner){
1049 CHECK(owner->result_ok);
1050         return PaymentParameters_clone(&*owner->contents.result);
1051 }
1052 uint64_t  __attribute__((export_name("TS_CResult_PaymentParametersDecodeErrorZ_get_ok"))) TS_CResult_PaymentParametersDecodeErrorZ_get_ok(uint64_t owner) {
1053         LDKCResult_PaymentParametersDecodeErrorZ* owner_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)untag_ptr(owner);
1054         LDKPaymentParameters ret_var = CResult_PaymentParametersDecodeErrorZ_get_ok(owner_conv);
1055         uint64_t ret_ref = 0;
1056         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1057         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1058         return ret_ref;
1059 }
1060
1061 static inline struct LDKDecodeError CResult_PaymentParametersDecodeErrorZ_get_err(LDKCResult_PaymentParametersDecodeErrorZ *NONNULL_PTR owner){
1062 CHECK(!owner->result_ok);
1063         return DecodeError_clone(&*owner->contents.err);
1064 }
1065 uint64_t  __attribute__((export_name("TS_CResult_PaymentParametersDecodeErrorZ_get_err"))) TS_CResult_PaymentParametersDecodeErrorZ_get_err(uint64_t owner) {
1066         LDKCResult_PaymentParametersDecodeErrorZ* owner_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)untag_ptr(owner);
1067         LDKDecodeError ret_var = CResult_PaymentParametersDecodeErrorZ_get_err(owner_conv);
1068         uint64_t ret_ref = 0;
1069         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1070         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1071         return ret_ref;
1072 }
1073
1074 static inline LDKCVec_RouteHintHopZ CVec_RouteHintHopZ_clone(const LDKCVec_RouteHintHopZ *orig) {
1075         LDKCVec_RouteHintHopZ ret = { .data = MALLOC(sizeof(LDKRouteHintHop) * orig->datalen, "LDKCVec_RouteHintHopZ clone bytes"), .datalen = orig->datalen };
1076         for (size_t i = 0; i < ret.datalen; i++) {
1077                 ret.data[i] = RouteHintHop_clone(&orig->data[i]);
1078         }
1079         return ret;
1080 }
1081 static inline struct LDKRouteHint CResult_RouteHintDecodeErrorZ_get_ok(LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR owner){
1082 CHECK(owner->result_ok);
1083         return RouteHint_clone(&*owner->contents.result);
1084 }
1085 uint64_t  __attribute__((export_name("TS_CResult_RouteHintDecodeErrorZ_get_ok"))) TS_CResult_RouteHintDecodeErrorZ_get_ok(uint64_t owner) {
1086         LDKCResult_RouteHintDecodeErrorZ* owner_conv = (LDKCResult_RouteHintDecodeErrorZ*)untag_ptr(owner);
1087         LDKRouteHint ret_var = CResult_RouteHintDecodeErrorZ_get_ok(owner_conv);
1088         uint64_t ret_ref = 0;
1089         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1090         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1091         return ret_ref;
1092 }
1093
1094 static inline struct LDKDecodeError CResult_RouteHintDecodeErrorZ_get_err(LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR owner){
1095 CHECK(!owner->result_ok);
1096         return DecodeError_clone(&*owner->contents.err);
1097 }
1098 uint64_t  __attribute__((export_name("TS_CResult_RouteHintDecodeErrorZ_get_err"))) TS_CResult_RouteHintDecodeErrorZ_get_err(uint64_t owner) {
1099         LDKCResult_RouteHintDecodeErrorZ* owner_conv = (LDKCResult_RouteHintDecodeErrorZ*)untag_ptr(owner);
1100         LDKDecodeError ret_var = CResult_RouteHintDecodeErrorZ_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 struct LDKRouteHintHop CResult_RouteHintHopDecodeErrorZ_get_ok(LDKCResult_RouteHintHopDecodeErrorZ *NONNULL_PTR owner){
1108 CHECK(owner->result_ok);
1109         return RouteHintHop_clone(&*owner->contents.result);
1110 }
1111 uint64_t  __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_get_ok"))) TS_CResult_RouteHintHopDecodeErrorZ_get_ok(uint64_t owner) {
1112         LDKCResult_RouteHintHopDecodeErrorZ* owner_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)untag_ptr(owner);
1113         LDKRouteHintHop ret_var = CResult_RouteHintHopDecodeErrorZ_get_ok(owner_conv);
1114         uint64_t ret_ref = 0;
1115         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1116         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1117         return ret_ref;
1118 }
1119
1120 static inline struct LDKDecodeError CResult_RouteHintHopDecodeErrorZ_get_err(LDKCResult_RouteHintHopDecodeErrorZ *NONNULL_PTR owner){
1121 CHECK(!owner->result_ok);
1122         return DecodeError_clone(&*owner->contents.err);
1123 }
1124 uint64_t  __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_get_err"))) TS_CResult_RouteHintHopDecodeErrorZ_get_err(uint64_t owner) {
1125         LDKCResult_RouteHintHopDecodeErrorZ* owner_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)untag_ptr(owner);
1126         LDKDecodeError ret_var = CResult_RouteHintHopDecodeErrorZ_get_err(owner_conv);
1127         uint64_t ret_ref = 0;
1128         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1129         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1130         return ret_ref;
1131 }
1132
1133 static inline LDKCVec_ChannelDetailsZ CVec_ChannelDetailsZ_clone(const LDKCVec_ChannelDetailsZ *orig) {
1134         LDKCVec_ChannelDetailsZ ret = { .data = MALLOC(sizeof(LDKChannelDetails) * orig->datalen, "LDKCVec_ChannelDetailsZ clone bytes"), .datalen = orig->datalen };
1135         for (size_t i = 0; i < ret.datalen; i++) {
1136                 ret.data[i] = ChannelDetails_clone(&orig->data[i]);
1137         }
1138         return ret;
1139 }
1140 static inline struct LDKRoute CResult_RouteLightningErrorZ_get_ok(LDKCResult_RouteLightningErrorZ *NONNULL_PTR owner){
1141 CHECK(owner->result_ok);
1142         return Route_clone(&*owner->contents.result);
1143 }
1144 uint64_t  __attribute__((export_name("TS_CResult_RouteLightningErrorZ_get_ok"))) TS_CResult_RouteLightningErrorZ_get_ok(uint64_t owner) {
1145         LDKCResult_RouteLightningErrorZ* owner_conv = (LDKCResult_RouteLightningErrorZ*)untag_ptr(owner);
1146         LDKRoute ret_var = CResult_RouteLightningErrorZ_get_ok(owner_conv);
1147         uint64_t ret_ref = 0;
1148         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1149         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1150         return ret_ref;
1151 }
1152
1153 static inline struct LDKLightningError CResult_RouteLightningErrorZ_get_err(LDKCResult_RouteLightningErrorZ *NONNULL_PTR owner){
1154 CHECK(!owner->result_ok);
1155         return LightningError_clone(&*owner->contents.err);
1156 }
1157 uint64_t  __attribute__((export_name("TS_CResult_RouteLightningErrorZ_get_err"))) TS_CResult_RouteLightningErrorZ_get_err(uint64_t owner) {
1158         LDKCResult_RouteLightningErrorZ* owner_conv = (LDKCResult_RouteLightningErrorZ*)untag_ptr(owner);
1159         LDKLightningError ret_var = CResult_RouteLightningErrorZ_get_err(owner_conv);
1160         uint64_t ret_ref = 0;
1161         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1162         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1163         return ret_ref;
1164 }
1165
1166 uint32_t __attribute__((export_name("TS_LDKPaymentPurpose_ty_from_ptr"))) TS_LDKPaymentPurpose_ty_from_ptr(uint64_t ptr) {
1167         LDKPaymentPurpose *obj = (LDKPaymentPurpose*)untag_ptr(ptr);
1168         switch(obj->tag) {
1169                 case LDKPaymentPurpose_InvoicePayment: return 0;
1170                 case LDKPaymentPurpose_SpontaneousPayment: return 1;
1171                 default: abort();
1172         }
1173 }
1174 int8_tArray __attribute__((export_name("TS_LDKPaymentPurpose_InvoicePayment_get_payment_preimage"))) TS_LDKPaymentPurpose_InvoicePayment_get_payment_preimage(uint64_t ptr) {
1175         LDKPaymentPurpose *obj = (LDKPaymentPurpose*)untag_ptr(ptr);
1176         assert(obj->tag == LDKPaymentPurpose_InvoicePayment);
1177                         int8_tArray payment_preimage_arr = init_int8_tArray(32, __LINE__);
1178                         memcpy(payment_preimage_arr->elems, obj->invoice_payment.payment_preimage.data, 32);
1179         return payment_preimage_arr;
1180 }
1181 int8_tArray __attribute__((export_name("TS_LDKPaymentPurpose_InvoicePayment_get_payment_secret"))) TS_LDKPaymentPurpose_InvoicePayment_get_payment_secret(uint64_t ptr) {
1182         LDKPaymentPurpose *obj = (LDKPaymentPurpose*)untag_ptr(ptr);
1183         assert(obj->tag == LDKPaymentPurpose_InvoicePayment);
1184                         int8_tArray payment_secret_arr = init_int8_tArray(32, __LINE__);
1185                         memcpy(payment_secret_arr->elems, obj->invoice_payment.payment_secret.data, 32);
1186         return payment_secret_arr;
1187 }
1188 int8_tArray __attribute__((export_name("TS_LDKPaymentPurpose_SpontaneousPayment_get_spontaneous_payment"))) TS_LDKPaymentPurpose_SpontaneousPayment_get_spontaneous_payment(uint64_t ptr) {
1189         LDKPaymentPurpose *obj = (LDKPaymentPurpose*)untag_ptr(ptr);
1190         assert(obj->tag == LDKPaymentPurpose_SpontaneousPayment);
1191                         int8_tArray spontaneous_payment_arr = init_int8_tArray(32, __LINE__);
1192                         memcpy(spontaneous_payment_arr->elems, obj->spontaneous_payment.data, 32);
1193         return spontaneous_payment_arr;
1194 }
1195 static inline struct LDKPaymentPurpose CResult_PaymentPurposeDecodeErrorZ_get_ok(LDKCResult_PaymentPurposeDecodeErrorZ *NONNULL_PTR owner){
1196 CHECK(owner->result_ok);
1197         return PaymentPurpose_clone(&*owner->contents.result);
1198 }
1199 uint64_t  __attribute__((export_name("TS_CResult_PaymentPurposeDecodeErrorZ_get_ok"))) TS_CResult_PaymentPurposeDecodeErrorZ_get_ok(uint64_t owner) {
1200         LDKCResult_PaymentPurposeDecodeErrorZ* owner_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)untag_ptr(owner);
1201         LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
1202         *ret_copy = CResult_PaymentPurposeDecodeErrorZ_get_ok(owner_conv);
1203         uint64_t ret_ref = tag_ptr(ret_copy, true);
1204         return ret_ref;
1205 }
1206
1207 static inline struct LDKDecodeError CResult_PaymentPurposeDecodeErrorZ_get_err(LDKCResult_PaymentPurposeDecodeErrorZ *NONNULL_PTR owner){
1208 CHECK(!owner->result_ok);
1209         return DecodeError_clone(&*owner->contents.err);
1210 }
1211 uint64_t  __attribute__((export_name("TS_CResult_PaymentPurposeDecodeErrorZ_get_err"))) TS_CResult_PaymentPurposeDecodeErrorZ_get_err(uint64_t owner) {
1212         LDKCResult_PaymentPurposeDecodeErrorZ* owner_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)untag_ptr(owner);
1213         LDKDecodeError ret_var = CResult_PaymentPurposeDecodeErrorZ_get_err(owner_conv);
1214         uint64_t ret_ref = 0;
1215         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1216         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1217         return ret_ref;
1218 }
1219
1220 uint32_t __attribute__((export_name("TS_LDKClosureReason_ty_from_ptr"))) TS_LDKClosureReason_ty_from_ptr(uint64_t ptr) {
1221         LDKClosureReason *obj = (LDKClosureReason*)untag_ptr(ptr);
1222         switch(obj->tag) {
1223                 case LDKClosureReason_CounterpartyForceClosed: return 0;
1224                 case LDKClosureReason_HolderForceClosed: return 1;
1225                 case LDKClosureReason_CooperativeClosure: return 2;
1226                 case LDKClosureReason_CommitmentTxConfirmed: return 3;
1227                 case LDKClosureReason_FundingTimedOut: return 4;
1228                 case LDKClosureReason_ProcessingError: return 5;
1229                 case LDKClosureReason_DisconnectedPeer: return 6;
1230                 case LDKClosureReason_OutdatedChannelManager: return 7;
1231                 default: abort();
1232         }
1233 }
1234 jstring __attribute__((export_name("TS_LDKClosureReason_CounterpartyForceClosed_get_peer_msg"))) TS_LDKClosureReason_CounterpartyForceClosed_get_peer_msg(uint64_t ptr) {
1235         LDKClosureReason *obj = (LDKClosureReason*)untag_ptr(ptr);
1236         assert(obj->tag == LDKClosureReason_CounterpartyForceClosed);
1237                         LDKStr peer_msg_str = obj->counterparty_force_closed.peer_msg;
1238                         jstring peer_msg_conv = str_ref_to_ts(peer_msg_str.chars, peer_msg_str.len);
1239         return peer_msg_conv;
1240 }
1241 jstring __attribute__((export_name("TS_LDKClosureReason_ProcessingError_get_err"))) TS_LDKClosureReason_ProcessingError_get_err(uint64_t ptr) {
1242         LDKClosureReason *obj = (LDKClosureReason*)untag_ptr(ptr);
1243         assert(obj->tag == LDKClosureReason_ProcessingError);
1244                         LDKStr err_str = obj->processing_error.err;
1245                         jstring err_conv = str_ref_to_ts(err_str.chars, err_str.len);
1246         return err_conv;
1247 }
1248 uint32_t __attribute__((export_name("TS_LDKCOption_ClosureReasonZ_ty_from_ptr"))) TS_LDKCOption_ClosureReasonZ_ty_from_ptr(uint64_t ptr) {
1249         LDKCOption_ClosureReasonZ *obj = (LDKCOption_ClosureReasonZ*)untag_ptr(ptr);
1250         switch(obj->tag) {
1251                 case LDKCOption_ClosureReasonZ_Some: return 0;
1252                 case LDKCOption_ClosureReasonZ_None: return 1;
1253                 default: abort();
1254         }
1255 }
1256 uint64_t __attribute__((export_name("TS_LDKCOption_ClosureReasonZ_Some_get_some"))) TS_LDKCOption_ClosureReasonZ_Some_get_some(uint64_t ptr) {
1257         LDKCOption_ClosureReasonZ *obj = (LDKCOption_ClosureReasonZ*)untag_ptr(ptr);
1258         assert(obj->tag == LDKCOption_ClosureReasonZ_Some);
1259                         uint64_t some_ref = tag_ptr(&obj->some, false);
1260         return some_ref;
1261 }
1262 static inline struct LDKCOption_ClosureReasonZ CResult_COption_ClosureReasonZDecodeErrorZ_get_ok(LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR owner){
1263 CHECK(owner->result_ok);
1264         return COption_ClosureReasonZ_clone(&*owner->contents.result);
1265 }
1266 uint64_t  __attribute__((export_name("TS_CResult_COption_ClosureReasonZDecodeErrorZ_get_ok"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_get_ok(uint64_t owner) {
1267         LDKCResult_COption_ClosureReasonZDecodeErrorZ* owner_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)untag_ptr(owner);
1268         LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
1269         *ret_copy = CResult_COption_ClosureReasonZDecodeErrorZ_get_ok(owner_conv);
1270         uint64_t ret_ref = tag_ptr(ret_copy, true);
1271         return ret_ref;
1272 }
1273
1274 static inline struct LDKDecodeError CResult_COption_ClosureReasonZDecodeErrorZ_get_err(LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR owner){
1275 CHECK(!owner->result_ok);
1276         return DecodeError_clone(&*owner->contents.err);
1277 }
1278 uint64_t  __attribute__((export_name("TS_CResult_COption_ClosureReasonZDecodeErrorZ_get_err"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_get_err(uint64_t owner) {
1279         LDKCResult_COption_ClosureReasonZDecodeErrorZ* owner_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)untag_ptr(owner);
1280         LDKDecodeError ret_var = CResult_COption_ClosureReasonZDecodeErrorZ_get_err(owner_conv);
1281         uint64_t ret_ref = 0;
1282         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1283         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1284         return ret_ref;
1285 }
1286
1287 uint32_t __attribute__((export_name("TS_LDKHTLCDestination_ty_from_ptr"))) TS_LDKHTLCDestination_ty_from_ptr(uint64_t ptr) {
1288         LDKHTLCDestination *obj = (LDKHTLCDestination*)untag_ptr(ptr);
1289         switch(obj->tag) {
1290                 case LDKHTLCDestination_NextHopChannel: return 0;
1291                 case LDKHTLCDestination_UnknownNextHop: return 1;
1292                 case LDKHTLCDestination_FailedPayment: return 2;
1293                 default: abort();
1294         }
1295 }
1296 int8_tArray __attribute__((export_name("TS_LDKHTLCDestination_NextHopChannel_get_node_id"))) TS_LDKHTLCDestination_NextHopChannel_get_node_id(uint64_t ptr) {
1297         LDKHTLCDestination *obj = (LDKHTLCDestination*)untag_ptr(ptr);
1298         assert(obj->tag == LDKHTLCDestination_NextHopChannel);
1299                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
1300                         memcpy(node_id_arr->elems, obj->next_hop_channel.node_id.compressed_form, 33);
1301         return node_id_arr;
1302 }
1303 int8_tArray __attribute__((export_name("TS_LDKHTLCDestination_NextHopChannel_get_channel_id"))) TS_LDKHTLCDestination_NextHopChannel_get_channel_id(uint64_t ptr) {
1304         LDKHTLCDestination *obj = (LDKHTLCDestination*)untag_ptr(ptr);
1305         assert(obj->tag == LDKHTLCDestination_NextHopChannel);
1306                         int8_tArray channel_id_arr = init_int8_tArray(32, __LINE__);
1307                         memcpy(channel_id_arr->elems, obj->next_hop_channel.channel_id.data, 32);
1308         return channel_id_arr;
1309 }
1310 int64_t __attribute__((export_name("TS_LDKHTLCDestination_UnknownNextHop_get_requested_forward_scid"))) TS_LDKHTLCDestination_UnknownNextHop_get_requested_forward_scid(uint64_t ptr) {
1311         LDKHTLCDestination *obj = (LDKHTLCDestination*)untag_ptr(ptr);
1312         assert(obj->tag == LDKHTLCDestination_UnknownNextHop);
1313                         int64_t requested_forward_scid_conv = obj->unknown_next_hop.requested_forward_scid;
1314         return requested_forward_scid_conv;
1315 }
1316 int8_tArray __attribute__((export_name("TS_LDKHTLCDestination_FailedPayment_get_payment_hash"))) TS_LDKHTLCDestination_FailedPayment_get_payment_hash(uint64_t ptr) {
1317         LDKHTLCDestination *obj = (LDKHTLCDestination*)untag_ptr(ptr);
1318         assert(obj->tag == LDKHTLCDestination_FailedPayment);
1319                         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
1320                         memcpy(payment_hash_arr->elems, obj->failed_payment.payment_hash.data, 32);
1321         return payment_hash_arr;
1322 }
1323 uint32_t __attribute__((export_name("TS_LDKCOption_HTLCDestinationZ_ty_from_ptr"))) TS_LDKCOption_HTLCDestinationZ_ty_from_ptr(uint64_t ptr) {
1324         LDKCOption_HTLCDestinationZ *obj = (LDKCOption_HTLCDestinationZ*)untag_ptr(ptr);
1325         switch(obj->tag) {
1326                 case LDKCOption_HTLCDestinationZ_Some: return 0;
1327                 case LDKCOption_HTLCDestinationZ_None: return 1;
1328                 default: abort();
1329         }
1330 }
1331 uint64_t __attribute__((export_name("TS_LDKCOption_HTLCDestinationZ_Some_get_some"))) TS_LDKCOption_HTLCDestinationZ_Some_get_some(uint64_t ptr) {
1332         LDKCOption_HTLCDestinationZ *obj = (LDKCOption_HTLCDestinationZ*)untag_ptr(ptr);
1333         assert(obj->tag == LDKCOption_HTLCDestinationZ_Some);
1334                         uint64_t some_ref = tag_ptr(&obj->some, false);
1335         return some_ref;
1336 }
1337 static inline struct LDKCOption_HTLCDestinationZ CResult_COption_HTLCDestinationZDecodeErrorZ_get_ok(LDKCResult_COption_HTLCDestinationZDecodeErrorZ *NONNULL_PTR owner){
1338 CHECK(owner->result_ok);
1339         return COption_HTLCDestinationZ_clone(&*owner->contents.result);
1340 }
1341 uint64_t  __attribute__((export_name("TS_CResult_COption_HTLCDestinationZDecodeErrorZ_get_ok"))) TS_CResult_COption_HTLCDestinationZDecodeErrorZ_get_ok(uint64_t owner) {
1342         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* owner_conv = (LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)untag_ptr(owner);
1343         LDKCOption_HTLCDestinationZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCDestinationZ), "LDKCOption_HTLCDestinationZ");
1344         *ret_copy = CResult_COption_HTLCDestinationZDecodeErrorZ_get_ok(owner_conv);
1345         uint64_t ret_ref = tag_ptr(ret_copy, true);
1346         return ret_ref;
1347 }
1348
1349 static inline struct LDKDecodeError CResult_COption_HTLCDestinationZDecodeErrorZ_get_err(LDKCResult_COption_HTLCDestinationZDecodeErrorZ *NONNULL_PTR owner){
1350 CHECK(!owner->result_ok);
1351         return DecodeError_clone(&*owner->contents.err);
1352 }
1353 uint64_t  __attribute__((export_name("TS_CResult_COption_HTLCDestinationZDecodeErrorZ_get_err"))) TS_CResult_COption_HTLCDestinationZDecodeErrorZ_get_err(uint64_t owner) {
1354         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* owner_conv = (LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)untag_ptr(owner);
1355         LDKDecodeError ret_var = CResult_COption_HTLCDestinationZDecodeErrorZ_get_err(owner_conv);
1356         uint64_t ret_ref = 0;
1357         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1358         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1359         return ret_ref;
1360 }
1361
1362 uint32_t __attribute__((export_name("TS_LDKNetworkUpdate_ty_from_ptr"))) TS_LDKNetworkUpdate_ty_from_ptr(uint64_t ptr) {
1363         LDKNetworkUpdate *obj = (LDKNetworkUpdate*)untag_ptr(ptr);
1364         switch(obj->tag) {
1365                 case LDKNetworkUpdate_ChannelUpdateMessage: return 0;
1366                 case LDKNetworkUpdate_ChannelFailure: return 1;
1367                 case LDKNetworkUpdate_NodeFailure: return 2;
1368                 default: abort();
1369         }
1370 }
1371 uint64_t __attribute__((export_name("TS_LDKNetworkUpdate_ChannelUpdateMessage_get_msg"))) TS_LDKNetworkUpdate_ChannelUpdateMessage_get_msg(uint64_t ptr) {
1372         LDKNetworkUpdate *obj = (LDKNetworkUpdate*)untag_ptr(ptr);
1373         assert(obj->tag == LDKNetworkUpdate_ChannelUpdateMessage);
1374                         LDKChannelUpdate msg_var = obj->channel_update_message.msg;
1375                         uint64_t msg_ref = 0;
1376                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
1377                         msg_ref = tag_ptr(msg_var.inner, false);
1378         return msg_ref;
1379 }
1380 int64_t __attribute__((export_name("TS_LDKNetworkUpdate_ChannelFailure_get_short_channel_id"))) TS_LDKNetworkUpdate_ChannelFailure_get_short_channel_id(uint64_t ptr) {
1381         LDKNetworkUpdate *obj = (LDKNetworkUpdate*)untag_ptr(ptr);
1382         assert(obj->tag == LDKNetworkUpdate_ChannelFailure);
1383                         int64_t short_channel_id_conv = obj->channel_failure.short_channel_id;
1384         return short_channel_id_conv;
1385 }
1386 jboolean __attribute__((export_name("TS_LDKNetworkUpdate_ChannelFailure_get_is_permanent"))) TS_LDKNetworkUpdate_ChannelFailure_get_is_permanent(uint64_t ptr) {
1387         LDKNetworkUpdate *obj = (LDKNetworkUpdate*)untag_ptr(ptr);
1388         assert(obj->tag == LDKNetworkUpdate_ChannelFailure);
1389                         jboolean is_permanent_conv = obj->channel_failure.is_permanent;
1390         return is_permanent_conv;
1391 }
1392 int8_tArray __attribute__((export_name("TS_LDKNetworkUpdate_NodeFailure_get_node_id"))) TS_LDKNetworkUpdate_NodeFailure_get_node_id(uint64_t ptr) {
1393         LDKNetworkUpdate *obj = (LDKNetworkUpdate*)untag_ptr(ptr);
1394         assert(obj->tag == LDKNetworkUpdate_NodeFailure);
1395                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
1396                         memcpy(node_id_arr->elems, obj->node_failure.node_id.compressed_form, 33);
1397         return node_id_arr;
1398 }
1399 jboolean __attribute__((export_name("TS_LDKNetworkUpdate_NodeFailure_get_is_permanent"))) TS_LDKNetworkUpdate_NodeFailure_get_is_permanent(uint64_t ptr) {
1400         LDKNetworkUpdate *obj = (LDKNetworkUpdate*)untag_ptr(ptr);
1401         assert(obj->tag == LDKNetworkUpdate_NodeFailure);
1402                         jboolean is_permanent_conv = obj->node_failure.is_permanent;
1403         return is_permanent_conv;
1404 }
1405 uint32_t __attribute__((export_name("TS_LDKCOption_NetworkUpdateZ_ty_from_ptr"))) TS_LDKCOption_NetworkUpdateZ_ty_from_ptr(uint64_t ptr) {
1406         LDKCOption_NetworkUpdateZ *obj = (LDKCOption_NetworkUpdateZ*)untag_ptr(ptr);
1407         switch(obj->tag) {
1408                 case LDKCOption_NetworkUpdateZ_Some: return 0;
1409                 case LDKCOption_NetworkUpdateZ_None: return 1;
1410                 default: abort();
1411         }
1412 }
1413 uint64_t __attribute__((export_name("TS_LDKCOption_NetworkUpdateZ_Some_get_some"))) TS_LDKCOption_NetworkUpdateZ_Some_get_some(uint64_t ptr) {
1414         LDKCOption_NetworkUpdateZ *obj = (LDKCOption_NetworkUpdateZ*)untag_ptr(ptr);
1415         assert(obj->tag == LDKCOption_NetworkUpdateZ_Some);
1416                         uint64_t some_ref = tag_ptr(&obj->some, false);
1417         return some_ref;
1418 }
1419 uint32_t __attribute__((export_name("TS_LDKSpendableOutputDescriptor_ty_from_ptr"))) TS_LDKSpendableOutputDescriptor_ty_from_ptr(uint64_t ptr) {
1420         LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)untag_ptr(ptr);
1421         switch(obj->tag) {
1422                 case LDKSpendableOutputDescriptor_StaticOutput: return 0;
1423                 case LDKSpendableOutputDescriptor_DelayedPaymentOutput: return 1;
1424                 case LDKSpendableOutputDescriptor_StaticPaymentOutput: return 2;
1425                 default: abort();
1426         }
1427 }
1428 uint64_t __attribute__((export_name("TS_LDKSpendableOutputDescriptor_StaticOutput_get_outpoint"))) TS_LDKSpendableOutputDescriptor_StaticOutput_get_outpoint(uint64_t ptr) {
1429         LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)untag_ptr(ptr);
1430         assert(obj->tag == LDKSpendableOutputDescriptor_StaticOutput);
1431                         LDKOutPoint outpoint_var = obj->static_output.outpoint;
1432                         uint64_t outpoint_ref = 0;
1433                         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_var);
1434                         outpoint_ref = tag_ptr(outpoint_var.inner, false);
1435         return outpoint_ref;
1436 }
1437 uint64_t __attribute__((export_name("TS_LDKSpendableOutputDescriptor_StaticOutput_get_output"))) TS_LDKSpendableOutputDescriptor_StaticOutput_get_output(uint64_t ptr) {
1438         LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)untag_ptr(ptr);
1439         assert(obj->tag == LDKSpendableOutputDescriptor_StaticOutput);
1440                         LDKTxOut* output_ref = &obj->static_output.output;
1441         return tag_ptr(output_ref, false);
1442 }
1443 uint64_t __attribute__((export_name("TS_LDKSpendableOutputDescriptor_DelayedPaymentOutput_get_delayed_payment_output"))) TS_LDKSpendableOutputDescriptor_DelayedPaymentOutput_get_delayed_payment_output(uint64_t ptr) {
1444         LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)untag_ptr(ptr);
1445         assert(obj->tag == LDKSpendableOutputDescriptor_DelayedPaymentOutput);
1446                         LDKDelayedPaymentOutputDescriptor delayed_payment_output_var = obj->delayed_payment_output;
1447                         uint64_t delayed_payment_output_ref = 0;
1448                         CHECK_INNER_FIELD_ACCESS_OR_NULL(delayed_payment_output_var);
1449                         delayed_payment_output_ref = tag_ptr(delayed_payment_output_var.inner, false);
1450         return delayed_payment_output_ref;
1451 }
1452 uint64_t __attribute__((export_name("TS_LDKSpendableOutputDescriptor_StaticPaymentOutput_get_static_payment_output"))) TS_LDKSpendableOutputDescriptor_StaticPaymentOutput_get_static_payment_output(uint64_t ptr) {
1453         LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)untag_ptr(ptr);
1454         assert(obj->tag == LDKSpendableOutputDescriptor_StaticPaymentOutput);
1455                         LDKStaticPaymentOutputDescriptor static_payment_output_var = obj->static_payment_output;
1456                         uint64_t static_payment_output_ref = 0;
1457                         CHECK_INNER_FIELD_ACCESS_OR_NULL(static_payment_output_var);
1458                         static_payment_output_ref = tag_ptr(static_payment_output_var.inner, false);
1459         return static_payment_output_ref;
1460 }
1461 static inline LDKCVec_SpendableOutputDescriptorZ CVec_SpendableOutputDescriptorZ_clone(const LDKCVec_SpendableOutputDescriptorZ *orig) {
1462         LDKCVec_SpendableOutputDescriptorZ ret = { .data = MALLOC(sizeof(LDKSpendableOutputDescriptor) * orig->datalen, "LDKCVec_SpendableOutputDescriptorZ clone bytes"), .datalen = orig->datalen };
1463         for (size_t i = 0; i < ret.datalen; i++) {
1464                 ret.data[i] = SpendableOutputDescriptor_clone(&orig->data[i]);
1465         }
1466         return ret;
1467 }
1468 uint32_t __attribute__((export_name("TS_LDKEvent_ty_from_ptr"))) TS_LDKEvent_ty_from_ptr(uint64_t ptr) {
1469         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1470         switch(obj->tag) {
1471                 case LDKEvent_FundingGenerationReady: return 0;
1472                 case LDKEvent_PaymentReceived: return 1;
1473                 case LDKEvent_PaymentClaimed: return 2;
1474                 case LDKEvent_PaymentSent: return 3;
1475                 case LDKEvent_PaymentFailed: return 4;
1476                 case LDKEvent_PaymentPathSuccessful: return 5;
1477                 case LDKEvent_PaymentPathFailed: return 6;
1478                 case LDKEvent_ProbeSuccessful: return 7;
1479                 case LDKEvent_ProbeFailed: return 8;
1480                 case LDKEvent_PendingHTLCsForwardable: return 9;
1481                 case LDKEvent_SpendableOutputs: return 10;
1482                 case LDKEvent_PaymentForwarded: return 11;
1483                 case LDKEvent_ChannelClosed: return 12;
1484                 case LDKEvent_DiscardFunding: return 13;
1485                 case LDKEvent_OpenChannelRequest: return 14;
1486                 case LDKEvent_HTLCHandlingFailed: return 15;
1487                 default: abort();
1488         }
1489 }
1490 int8_tArray __attribute__((export_name("TS_LDKEvent_FundingGenerationReady_get_temporary_channel_id"))) TS_LDKEvent_FundingGenerationReady_get_temporary_channel_id(uint64_t ptr) {
1491         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1492         assert(obj->tag == LDKEvent_FundingGenerationReady);
1493                         int8_tArray temporary_channel_id_arr = init_int8_tArray(32, __LINE__);
1494                         memcpy(temporary_channel_id_arr->elems, obj->funding_generation_ready.temporary_channel_id.data, 32);
1495         return temporary_channel_id_arr;
1496 }
1497 int8_tArray __attribute__((export_name("TS_LDKEvent_FundingGenerationReady_get_counterparty_node_id"))) TS_LDKEvent_FundingGenerationReady_get_counterparty_node_id(uint64_t ptr) {
1498         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1499         assert(obj->tag == LDKEvent_FundingGenerationReady);
1500                         int8_tArray counterparty_node_id_arr = init_int8_tArray(33, __LINE__);
1501                         memcpy(counterparty_node_id_arr->elems, obj->funding_generation_ready.counterparty_node_id.compressed_form, 33);
1502         return counterparty_node_id_arr;
1503 }
1504 int64_t __attribute__((export_name("TS_LDKEvent_FundingGenerationReady_get_channel_value_satoshis"))) TS_LDKEvent_FundingGenerationReady_get_channel_value_satoshis(uint64_t ptr) {
1505         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1506         assert(obj->tag == LDKEvent_FundingGenerationReady);
1507                         int64_t channel_value_satoshis_conv = obj->funding_generation_ready.channel_value_satoshis;
1508         return channel_value_satoshis_conv;
1509 }
1510 int8_tArray __attribute__((export_name("TS_LDKEvent_FundingGenerationReady_get_output_script"))) TS_LDKEvent_FundingGenerationReady_get_output_script(uint64_t ptr) {
1511         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1512         assert(obj->tag == LDKEvent_FundingGenerationReady);
1513                         LDKCVec_u8Z output_script_var = obj->funding_generation_ready.output_script;
1514                         int8_tArray output_script_arr = init_int8_tArray(output_script_var.datalen, __LINE__);
1515                         memcpy(output_script_arr->elems, output_script_var.data, output_script_var.datalen);
1516         return output_script_arr;
1517 }
1518 int64_t __attribute__((export_name("TS_LDKEvent_FundingGenerationReady_get_user_channel_id"))) TS_LDKEvent_FundingGenerationReady_get_user_channel_id(uint64_t ptr) {
1519         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1520         assert(obj->tag == LDKEvent_FundingGenerationReady);
1521                         int64_t user_channel_id_conv = obj->funding_generation_ready.user_channel_id;
1522         return user_channel_id_conv;
1523 }
1524 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentReceived_get_payment_hash"))) TS_LDKEvent_PaymentReceived_get_payment_hash(uint64_t ptr) {
1525         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1526         assert(obj->tag == LDKEvent_PaymentReceived);
1527                         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
1528                         memcpy(payment_hash_arr->elems, obj->payment_received.payment_hash.data, 32);
1529         return payment_hash_arr;
1530 }
1531 int64_t __attribute__((export_name("TS_LDKEvent_PaymentReceived_get_amount_msat"))) TS_LDKEvent_PaymentReceived_get_amount_msat(uint64_t ptr) {
1532         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1533         assert(obj->tag == LDKEvent_PaymentReceived);
1534                         int64_t amount_msat_conv = obj->payment_received.amount_msat;
1535         return amount_msat_conv;
1536 }
1537 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentReceived_get_purpose"))) TS_LDKEvent_PaymentReceived_get_purpose(uint64_t ptr) {
1538         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1539         assert(obj->tag == LDKEvent_PaymentReceived);
1540                         uint64_t purpose_ref = tag_ptr(&obj->payment_received.purpose, false);
1541         return purpose_ref;
1542 }
1543 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentClaimed_get_payment_hash"))) TS_LDKEvent_PaymentClaimed_get_payment_hash(uint64_t ptr) {
1544         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1545         assert(obj->tag == LDKEvent_PaymentClaimed);
1546                         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
1547                         memcpy(payment_hash_arr->elems, obj->payment_claimed.payment_hash.data, 32);
1548         return payment_hash_arr;
1549 }
1550 int64_t __attribute__((export_name("TS_LDKEvent_PaymentClaimed_get_amount_msat"))) TS_LDKEvent_PaymentClaimed_get_amount_msat(uint64_t ptr) {
1551         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1552         assert(obj->tag == LDKEvent_PaymentClaimed);
1553                         int64_t amount_msat_conv = obj->payment_claimed.amount_msat;
1554         return amount_msat_conv;
1555 }
1556 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentClaimed_get_purpose"))) TS_LDKEvent_PaymentClaimed_get_purpose(uint64_t ptr) {
1557         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1558         assert(obj->tag == LDKEvent_PaymentClaimed);
1559                         uint64_t purpose_ref = tag_ptr(&obj->payment_claimed.purpose, false);
1560         return purpose_ref;
1561 }
1562 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentSent_get_payment_id"))) TS_LDKEvent_PaymentSent_get_payment_id(uint64_t ptr) {
1563         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1564         assert(obj->tag == LDKEvent_PaymentSent);
1565                         int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
1566                         memcpy(payment_id_arr->elems, obj->payment_sent.payment_id.data, 32);
1567         return payment_id_arr;
1568 }
1569 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentSent_get_payment_preimage"))) TS_LDKEvent_PaymentSent_get_payment_preimage(uint64_t ptr) {
1570         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1571         assert(obj->tag == LDKEvent_PaymentSent);
1572                         int8_tArray payment_preimage_arr = init_int8_tArray(32, __LINE__);
1573                         memcpy(payment_preimage_arr->elems, obj->payment_sent.payment_preimage.data, 32);
1574         return payment_preimage_arr;
1575 }
1576 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentSent_get_payment_hash"))) TS_LDKEvent_PaymentSent_get_payment_hash(uint64_t ptr) {
1577         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1578         assert(obj->tag == LDKEvent_PaymentSent);
1579                         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
1580                         memcpy(payment_hash_arr->elems, obj->payment_sent.payment_hash.data, 32);
1581         return payment_hash_arr;
1582 }
1583 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentSent_get_fee_paid_msat"))) TS_LDKEvent_PaymentSent_get_fee_paid_msat(uint64_t ptr) {
1584         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1585         assert(obj->tag == LDKEvent_PaymentSent);
1586                         uint64_t fee_paid_msat_ref = tag_ptr(&obj->payment_sent.fee_paid_msat, false);
1587         return fee_paid_msat_ref;
1588 }
1589 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentFailed_get_payment_id"))) TS_LDKEvent_PaymentFailed_get_payment_id(uint64_t ptr) {
1590         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1591         assert(obj->tag == LDKEvent_PaymentFailed);
1592                         int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
1593                         memcpy(payment_id_arr->elems, obj->payment_failed.payment_id.data, 32);
1594         return payment_id_arr;
1595 }
1596 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentFailed_get_payment_hash"))) TS_LDKEvent_PaymentFailed_get_payment_hash(uint64_t ptr) {
1597         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1598         assert(obj->tag == LDKEvent_PaymentFailed);
1599                         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
1600                         memcpy(payment_hash_arr->elems, obj->payment_failed.payment_hash.data, 32);
1601         return payment_hash_arr;
1602 }
1603 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentPathSuccessful_get_payment_id"))) TS_LDKEvent_PaymentPathSuccessful_get_payment_id(uint64_t ptr) {
1604         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1605         assert(obj->tag == LDKEvent_PaymentPathSuccessful);
1606                         int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
1607                         memcpy(payment_id_arr->elems, obj->payment_path_successful.payment_id.data, 32);
1608         return payment_id_arr;
1609 }
1610 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentPathSuccessful_get_payment_hash"))) TS_LDKEvent_PaymentPathSuccessful_get_payment_hash(uint64_t ptr) {
1611         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1612         assert(obj->tag == LDKEvent_PaymentPathSuccessful);
1613                         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
1614                         memcpy(payment_hash_arr->elems, obj->payment_path_successful.payment_hash.data, 32);
1615         return payment_hash_arr;
1616 }
1617 uint64_tArray __attribute__((export_name("TS_LDKEvent_PaymentPathSuccessful_get_path"))) TS_LDKEvent_PaymentPathSuccessful_get_path(uint64_t ptr) {
1618         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1619         assert(obj->tag == LDKEvent_PaymentPathSuccessful);
1620                         LDKCVec_RouteHopZ path_var = obj->payment_path_successful.path;
1621                         uint64_tArray path_arr = NULL;
1622                         path_arr = init_uint64_tArray(path_var.datalen, __LINE__);
1623                         uint64_t *path_arr_ptr = (uint64_t*)(((uint8_t*)path_arr) + 8);
1624                         for (size_t k = 0; k < path_var.datalen; k++) {
1625                                 LDKRouteHop path_conv_10_var = path_var.data[k];
1626                                 uint64_t path_conv_10_ref = 0;
1627                                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var);
1628                                 path_conv_10_ref = tag_ptr(path_conv_10_var.inner, false);
1629                                 path_arr_ptr[k] = path_conv_10_ref;
1630                         }
1631                         
1632         return path_arr;
1633 }
1634 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentPathFailed_get_payment_id"))) TS_LDKEvent_PaymentPathFailed_get_payment_id(uint64_t ptr) {
1635         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1636         assert(obj->tag == LDKEvent_PaymentPathFailed);
1637                         int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
1638                         memcpy(payment_id_arr->elems, obj->payment_path_failed.payment_id.data, 32);
1639         return payment_id_arr;
1640 }
1641 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentPathFailed_get_payment_hash"))) TS_LDKEvent_PaymentPathFailed_get_payment_hash(uint64_t ptr) {
1642         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1643         assert(obj->tag == LDKEvent_PaymentPathFailed);
1644                         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
1645                         memcpy(payment_hash_arr->elems, obj->payment_path_failed.payment_hash.data, 32);
1646         return payment_hash_arr;
1647 }
1648 jboolean __attribute__((export_name("TS_LDKEvent_PaymentPathFailed_get_rejected_by_dest"))) TS_LDKEvent_PaymentPathFailed_get_rejected_by_dest(uint64_t ptr) {
1649         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1650         assert(obj->tag == LDKEvent_PaymentPathFailed);
1651                         jboolean rejected_by_dest_conv = obj->payment_path_failed.rejected_by_dest;
1652         return rejected_by_dest_conv;
1653 }
1654 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentPathFailed_get_network_update"))) TS_LDKEvent_PaymentPathFailed_get_network_update(uint64_t ptr) {
1655         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1656         assert(obj->tag == LDKEvent_PaymentPathFailed);
1657                         uint64_t network_update_ref = tag_ptr(&obj->payment_path_failed.network_update, false);
1658         return network_update_ref;
1659 }
1660 jboolean __attribute__((export_name("TS_LDKEvent_PaymentPathFailed_get_all_paths_failed"))) TS_LDKEvent_PaymentPathFailed_get_all_paths_failed(uint64_t ptr) {
1661         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1662         assert(obj->tag == LDKEvent_PaymentPathFailed);
1663                         jboolean all_paths_failed_conv = obj->payment_path_failed.all_paths_failed;
1664         return all_paths_failed_conv;
1665 }
1666 uint64_tArray __attribute__((export_name("TS_LDKEvent_PaymentPathFailed_get_path"))) TS_LDKEvent_PaymentPathFailed_get_path(uint64_t ptr) {
1667         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1668         assert(obj->tag == LDKEvent_PaymentPathFailed);
1669                         LDKCVec_RouteHopZ path_var = obj->payment_path_failed.path;
1670                         uint64_tArray path_arr = NULL;
1671                         path_arr = init_uint64_tArray(path_var.datalen, __LINE__);
1672                         uint64_t *path_arr_ptr = (uint64_t*)(((uint8_t*)path_arr) + 8);
1673                         for (size_t k = 0; k < path_var.datalen; k++) {
1674                                 LDKRouteHop path_conv_10_var = path_var.data[k];
1675                                 uint64_t path_conv_10_ref = 0;
1676                                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var);
1677                                 path_conv_10_ref = tag_ptr(path_conv_10_var.inner, false);
1678                                 path_arr_ptr[k] = path_conv_10_ref;
1679                         }
1680                         
1681         return path_arr;
1682 }
1683 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentPathFailed_get_short_channel_id"))) TS_LDKEvent_PaymentPathFailed_get_short_channel_id(uint64_t ptr) {
1684         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1685         assert(obj->tag == LDKEvent_PaymentPathFailed);
1686                         uint64_t short_channel_id_ref = tag_ptr(&obj->payment_path_failed.short_channel_id, false);
1687         return short_channel_id_ref;
1688 }
1689 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentPathFailed_get_retry"))) TS_LDKEvent_PaymentPathFailed_get_retry(uint64_t ptr) {
1690         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1691         assert(obj->tag == LDKEvent_PaymentPathFailed);
1692                         LDKRouteParameters retry_var = obj->payment_path_failed.retry;
1693                         uint64_t retry_ref = 0;
1694                         CHECK_INNER_FIELD_ACCESS_OR_NULL(retry_var);
1695                         retry_ref = tag_ptr(retry_var.inner, false);
1696         return retry_ref;
1697 }
1698 int8_tArray __attribute__((export_name("TS_LDKEvent_ProbeSuccessful_get_payment_id"))) TS_LDKEvent_ProbeSuccessful_get_payment_id(uint64_t ptr) {
1699         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1700         assert(obj->tag == LDKEvent_ProbeSuccessful);
1701                         int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
1702                         memcpy(payment_id_arr->elems, obj->probe_successful.payment_id.data, 32);
1703         return payment_id_arr;
1704 }
1705 int8_tArray __attribute__((export_name("TS_LDKEvent_ProbeSuccessful_get_payment_hash"))) TS_LDKEvent_ProbeSuccessful_get_payment_hash(uint64_t ptr) {
1706         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1707         assert(obj->tag == LDKEvent_ProbeSuccessful);
1708                         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
1709                         memcpy(payment_hash_arr->elems, obj->probe_successful.payment_hash.data, 32);
1710         return payment_hash_arr;
1711 }
1712 uint64_tArray __attribute__((export_name("TS_LDKEvent_ProbeSuccessful_get_path"))) TS_LDKEvent_ProbeSuccessful_get_path(uint64_t ptr) {
1713         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1714         assert(obj->tag == LDKEvent_ProbeSuccessful);
1715                         LDKCVec_RouteHopZ path_var = obj->probe_successful.path;
1716                         uint64_tArray path_arr = NULL;
1717                         path_arr = init_uint64_tArray(path_var.datalen, __LINE__);
1718                         uint64_t *path_arr_ptr = (uint64_t*)(((uint8_t*)path_arr) + 8);
1719                         for (size_t k = 0; k < path_var.datalen; k++) {
1720                                 LDKRouteHop path_conv_10_var = path_var.data[k];
1721                                 uint64_t path_conv_10_ref = 0;
1722                                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var);
1723                                 path_conv_10_ref = tag_ptr(path_conv_10_var.inner, false);
1724                                 path_arr_ptr[k] = path_conv_10_ref;
1725                         }
1726                         
1727         return path_arr;
1728 }
1729 int8_tArray __attribute__((export_name("TS_LDKEvent_ProbeFailed_get_payment_id"))) TS_LDKEvent_ProbeFailed_get_payment_id(uint64_t ptr) {
1730         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1731         assert(obj->tag == LDKEvent_ProbeFailed);
1732                         int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
1733                         memcpy(payment_id_arr->elems, obj->probe_failed.payment_id.data, 32);
1734         return payment_id_arr;
1735 }
1736 int8_tArray __attribute__((export_name("TS_LDKEvent_ProbeFailed_get_payment_hash"))) TS_LDKEvent_ProbeFailed_get_payment_hash(uint64_t ptr) {
1737         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1738         assert(obj->tag == LDKEvent_ProbeFailed);
1739                         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
1740                         memcpy(payment_hash_arr->elems, obj->probe_failed.payment_hash.data, 32);
1741         return payment_hash_arr;
1742 }
1743 uint64_tArray __attribute__((export_name("TS_LDKEvent_ProbeFailed_get_path"))) TS_LDKEvent_ProbeFailed_get_path(uint64_t ptr) {
1744         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1745         assert(obj->tag == LDKEvent_ProbeFailed);
1746                         LDKCVec_RouteHopZ path_var = obj->probe_failed.path;
1747                         uint64_tArray path_arr = NULL;
1748                         path_arr = init_uint64_tArray(path_var.datalen, __LINE__);
1749                         uint64_t *path_arr_ptr = (uint64_t*)(((uint8_t*)path_arr) + 8);
1750                         for (size_t k = 0; k < path_var.datalen; k++) {
1751                                 LDKRouteHop path_conv_10_var = path_var.data[k];
1752                                 uint64_t path_conv_10_ref = 0;
1753                                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var);
1754                                 path_conv_10_ref = tag_ptr(path_conv_10_var.inner, false);
1755                                 path_arr_ptr[k] = path_conv_10_ref;
1756                         }
1757                         
1758         return path_arr;
1759 }
1760 uint64_t __attribute__((export_name("TS_LDKEvent_ProbeFailed_get_short_channel_id"))) TS_LDKEvent_ProbeFailed_get_short_channel_id(uint64_t ptr) {
1761         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1762         assert(obj->tag == LDKEvent_ProbeFailed);
1763                         uint64_t short_channel_id_ref = tag_ptr(&obj->probe_failed.short_channel_id, false);
1764         return short_channel_id_ref;
1765 }
1766 int64_t __attribute__((export_name("TS_LDKEvent_PendingHTLCsForwardable_get_time_forwardable"))) TS_LDKEvent_PendingHTLCsForwardable_get_time_forwardable(uint64_t ptr) {
1767         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1768         assert(obj->tag == LDKEvent_PendingHTLCsForwardable);
1769                         int64_t time_forwardable_conv = obj->pending_htl_cs_forwardable.time_forwardable;
1770         return time_forwardable_conv;
1771 }
1772 uint64_tArray __attribute__((export_name("TS_LDKEvent_SpendableOutputs_get_outputs"))) TS_LDKEvent_SpendableOutputs_get_outputs(uint64_t ptr) {
1773         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1774         assert(obj->tag == LDKEvent_SpendableOutputs);
1775                         LDKCVec_SpendableOutputDescriptorZ outputs_var = obj->spendable_outputs.outputs;
1776                         uint64_tArray outputs_arr = NULL;
1777                         outputs_arr = init_uint64_tArray(outputs_var.datalen, __LINE__);
1778                         uint64_t *outputs_arr_ptr = (uint64_t*)(((uint8_t*)outputs_arr) + 8);
1779                         for (size_t b = 0; b < outputs_var.datalen; b++) {
1780                                 uint64_t outputs_conv_27_ref = tag_ptr(&outputs_var.data[b], false);
1781                                 outputs_arr_ptr[b] = outputs_conv_27_ref;
1782                         }
1783                         
1784         return outputs_arr;
1785 }
1786 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentForwarded_get_prev_channel_id"))) TS_LDKEvent_PaymentForwarded_get_prev_channel_id(uint64_t ptr) {
1787         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1788         assert(obj->tag == LDKEvent_PaymentForwarded);
1789                         int8_tArray prev_channel_id_arr = init_int8_tArray(32, __LINE__);
1790                         memcpy(prev_channel_id_arr->elems, obj->payment_forwarded.prev_channel_id.data, 32);
1791         return prev_channel_id_arr;
1792 }
1793 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentForwarded_get_next_channel_id"))) TS_LDKEvent_PaymentForwarded_get_next_channel_id(uint64_t ptr) {
1794         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1795         assert(obj->tag == LDKEvent_PaymentForwarded);
1796                         int8_tArray next_channel_id_arr = init_int8_tArray(32, __LINE__);
1797                         memcpy(next_channel_id_arr->elems, obj->payment_forwarded.next_channel_id.data, 32);
1798         return next_channel_id_arr;
1799 }
1800 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentForwarded_get_fee_earned_msat"))) TS_LDKEvent_PaymentForwarded_get_fee_earned_msat(uint64_t ptr) {
1801         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1802         assert(obj->tag == LDKEvent_PaymentForwarded);
1803                         uint64_t fee_earned_msat_ref = tag_ptr(&obj->payment_forwarded.fee_earned_msat, false);
1804         return fee_earned_msat_ref;
1805 }
1806 jboolean __attribute__((export_name("TS_LDKEvent_PaymentForwarded_get_claim_from_onchain_tx"))) TS_LDKEvent_PaymentForwarded_get_claim_from_onchain_tx(uint64_t ptr) {
1807         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1808         assert(obj->tag == LDKEvent_PaymentForwarded);
1809                         jboolean claim_from_onchain_tx_conv = obj->payment_forwarded.claim_from_onchain_tx;
1810         return claim_from_onchain_tx_conv;
1811 }
1812 int8_tArray __attribute__((export_name("TS_LDKEvent_ChannelClosed_get_channel_id"))) TS_LDKEvent_ChannelClosed_get_channel_id(uint64_t ptr) {
1813         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1814         assert(obj->tag == LDKEvent_ChannelClosed);
1815                         int8_tArray channel_id_arr = init_int8_tArray(32, __LINE__);
1816                         memcpy(channel_id_arr->elems, obj->channel_closed.channel_id.data, 32);
1817         return channel_id_arr;
1818 }
1819 int64_t __attribute__((export_name("TS_LDKEvent_ChannelClosed_get_user_channel_id"))) TS_LDKEvent_ChannelClosed_get_user_channel_id(uint64_t ptr) {
1820         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1821         assert(obj->tag == LDKEvent_ChannelClosed);
1822                         int64_t user_channel_id_conv = obj->channel_closed.user_channel_id;
1823         return user_channel_id_conv;
1824 }
1825 uint64_t __attribute__((export_name("TS_LDKEvent_ChannelClosed_get_reason"))) TS_LDKEvent_ChannelClosed_get_reason(uint64_t ptr) {
1826         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1827         assert(obj->tag == LDKEvent_ChannelClosed);
1828                         uint64_t reason_ref = tag_ptr(&obj->channel_closed.reason, false);
1829         return reason_ref;
1830 }
1831 int8_tArray __attribute__((export_name("TS_LDKEvent_DiscardFunding_get_channel_id"))) TS_LDKEvent_DiscardFunding_get_channel_id(uint64_t ptr) {
1832         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1833         assert(obj->tag == LDKEvent_DiscardFunding);
1834                         int8_tArray channel_id_arr = init_int8_tArray(32, __LINE__);
1835                         memcpy(channel_id_arr->elems, obj->discard_funding.channel_id.data, 32);
1836         return channel_id_arr;
1837 }
1838 int8_tArray __attribute__((export_name("TS_LDKEvent_DiscardFunding_get_transaction"))) TS_LDKEvent_DiscardFunding_get_transaction(uint64_t ptr) {
1839         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1840         assert(obj->tag == LDKEvent_DiscardFunding);
1841                         LDKTransaction transaction_var = obj->discard_funding.transaction;
1842                         int8_tArray transaction_arr = init_int8_tArray(transaction_var.datalen, __LINE__);
1843                         memcpy(transaction_arr->elems, transaction_var.data, transaction_var.datalen);
1844         return transaction_arr;
1845 }
1846 int8_tArray __attribute__((export_name("TS_LDKEvent_OpenChannelRequest_get_temporary_channel_id"))) TS_LDKEvent_OpenChannelRequest_get_temporary_channel_id(uint64_t ptr) {
1847         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1848         assert(obj->tag == LDKEvent_OpenChannelRequest);
1849                         int8_tArray temporary_channel_id_arr = init_int8_tArray(32, __LINE__);
1850                         memcpy(temporary_channel_id_arr->elems, obj->open_channel_request.temporary_channel_id.data, 32);
1851         return temporary_channel_id_arr;
1852 }
1853 int8_tArray __attribute__((export_name("TS_LDKEvent_OpenChannelRequest_get_counterparty_node_id"))) TS_LDKEvent_OpenChannelRequest_get_counterparty_node_id(uint64_t ptr) {
1854         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1855         assert(obj->tag == LDKEvent_OpenChannelRequest);
1856                         int8_tArray counterparty_node_id_arr = init_int8_tArray(33, __LINE__);
1857                         memcpy(counterparty_node_id_arr->elems, obj->open_channel_request.counterparty_node_id.compressed_form, 33);
1858         return counterparty_node_id_arr;
1859 }
1860 int64_t __attribute__((export_name("TS_LDKEvent_OpenChannelRequest_get_funding_satoshis"))) TS_LDKEvent_OpenChannelRequest_get_funding_satoshis(uint64_t ptr) {
1861         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1862         assert(obj->tag == LDKEvent_OpenChannelRequest);
1863                         int64_t funding_satoshis_conv = obj->open_channel_request.funding_satoshis;
1864         return funding_satoshis_conv;
1865 }
1866 int64_t __attribute__((export_name("TS_LDKEvent_OpenChannelRequest_get_push_msat"))) TS_LDKEvent_OpenChannelRequest_get_push_msat(uint64_t ptr) {
1867         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1868         assert(obj->tag == LDKEvent_OpenChannelRequest);
1869                         int64_t push_msat_conv = obj->open_channel_request.push_msat;
1870         return push_msat_conv;
1871 }
1872 uint64_t __attribute__((export_name("TS_LDKEvent_OpenChannelRequest_get_channel_type"))) TS_LDKEvent_OpenChannelRequest_get_channel_type(uint64_t ptr) {
1873         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1874         assert(obj->tag == LDKEvent_OpenChannelRequest);
1875                         LDKChannelTypeFeatures channel_type_var = obj->open_channel_request.channel_type;
1876                         uint64_t channel_type_ref = 0;
1877                         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_var);
1878                         channel_type_ref = tag_ptr(channel_type_var.inner, false);
1879         return channel_type_ref;
1880 }
1881 int8_tArray __attribute__((export_name("TS_LDKEvent_HTLCHandlingFailed_get_prev_channel_id"))) TS_LDKEvent_HTLCHandlingFailed_get_prev_channel_id(uint64_t ptr) {
1882         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1883         assert(obj->tag == LDKEvent_HTLCHandlingFailed);
1884                         int8_tArray prev_channel_id_arr = init_int8_tArray(32, __LINE__);
1885                         memcpy(prev_channel_id_arr->elems, obj->htlc_handling_failed.prev_channel_id.data, 32);
1886         return prev_channel_id_arr;
1887 }
1888 uint64_t __attribute__((export_name("TS_LDKEvent_HTLCHandlingFailed_get_failed_next_destination"))) TS_LDKEvent_HTLCHandlingFailed_get_failed_next_destination(uint64_t ptr) {
1889         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1890         assert(obj->tag == LDKEvent_HTLCHandlingFailed);
1891                         uint64_t failed_next_destination_ref = tag_ptr(&obj->htlc_handling_failed.failed_next_destination, false);
1892         return failed_next_destination_ref;
1893 }
1894 uint32_t __attribute__((export_name("TS_LDKCOption_EventZ_ty_from_ptr"))) TS_LDKCOption_EventZ_ty_from_ptr(uint64_t ptr) {
1895         LDKCOption_EventZ *obj = (LDKCOption_EventZ*)untag_ptr(ptr);
1896         switch(obj->tag) {
1897                 case LDKCOption_EventZ_Some: return 0;
1898                 case LDKCOption_EventZ_None: return 1;
1899                 default: abort();
1900         }
1901 }
1902 uint64_t __attribute__((export_name("TS_LDKCOption_EventZ_Some_get_some"))) TS_LDKCOption_EventZ_Some_get_some(uint64_t ptr) {
1903         LDKCOption_EventZ *obj = (LDKCOption_EventZ*)untag_ptr(ptr);
1904         assert(obj->tag == LDKCOption_EventZ_Some);
1905                         uint64_t some_ref = tag_ptr(&obj->some, false);
1906         return some_ref;
1907 }
1908 static inline struct LDKCOption_EventZ CResult_COption_EventZDecodeErrorZ_get_ok(LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR owner){
1909 CHECK(owner->result_ok);
1910         return COption_EventZ_clone(&*owner->contents.result);
1911 }
1912 uint64_t  __attribute__((export_name("TS_CResult_COption_EventZDecodeErrorZ_get_ok"))) TS_CResult_COption_EventZDecodeErrorZ_get_ok(uint64_t owner) {
1913         LDKCResult_COption_EventZDecodeErrorZ* owner_conv = (LDKCResult_COption_EventZDecodeErrorZ*)untag_ptr(owner);
1914         LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
1915         *ret_copy = CResult_COption_EventZDecodeErrorZ_get_ok(owner_conv);
1916         uint64_t ret_ref = tag_ptr(ret_copy, true);
1917         return ret_ref;
1918 }
1919
1920 static inline struct LDKDecodeError CResult_COption_EventZDecodeErrorZ_get_err(LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR owner){
1921 CHECK(!owner->result_ok);
1922         return DecodeError_clone(&*owner->contents.err);
1923 }
1924 uint64_t  __attribute__((export_name("TS_CResult_COption_EventZDecodeErrorZ_get_err"))) TS_CResult_COption_EventZDecodeErrorZ_get_err(uint64_t owner) {
1925         LDKCResult_COption_EventZDecodeErrorZ* owner_conv = (LDKCResult_COption_EventZDecodeErrorZ*)untag_ptr(owner);
1926         LDKDecodeError ret_var = CResult_COption_EventZDecodeErrorZ_get_err(owner_conv);
1927         uint64_t ret_ref = 0;
1928         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1929         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1930         return ret_ref;
1931 }
1932
1933 uint32_t __attribute__((export_name("TS_LDKErrorAction_ty_from_ptr"))) TS_LDKErrorAction_ty_from_ptr(uint64_t ptr) {
1934         LDKErrorAction *obj = (LDKErrorAction*)untag_ptr(ptr);
1935         switch(obj->tag) {
1936                 case LDKErrorAction_DisconnectPeer: return 0;
1937                 case LDKErrorAction_IgnoreError: return 1;
1938                 case LDKErrorAction_IgnoreAndLog: return 2;
1939                 case LDKErrorAction_IgnoreDuplicateGossip: return 3;
1940                 case LDKErrorAction_SendErrorMessage: return 4;
1941                 case LDKErrorAction_SendWarningMessage: return 5;
1942                 default: abort();
1943         }
1944 }
1945 uint64_t __attribute__((export_name("TS_LDKErrorAction_DisconnectPeer_get_msg"))) TS_LDKErrorAction_DisconnectPeer_get_msg(uint64_t ptr) {
1946         LDKErrorAction *obj = (LDKErrorAction*)untag_ptr(ptr);
1947         assert(obj->tag == LDKErrorAction_DisconnectPeer);
1948                         LDKErrorMessage msg_var = obj->disconnect_peer.msg;
1949                         uint64_t msg_ref = 0;
1950                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
1951                         msg_ref = tag_ptr(msg_var.inner, false);
1952         return msg_ref;
1953 }
1954 uint32_t __attribute__((export_name("TS_LDKErrorAction_IgnoreAndLog_get_ignore_and_log"))) TS_LDKErrorAction_IgnoreAndLog_get_ignore_and_log(uint64_t ptr) {
1955         LDKErrorAction *obj = (LDKErrorAction*)untag_ptr(ptr);
1956         assert(obj->tag == LDKErrorAction_IgnoreAndLog);
1957                         uint32_t ignore_and_log_conv = LDKLevel_to_js(obj->ignore_and_log);
1958         return ignore_and_log_conv;
1959 }
1960 uint64_t __attribute__((export_name("TS_LDKErrorAction_SendErrorMessage_get_msg"))) TS_LDKErrorAction_SendErrorMessage_get_msg(uint64_t ptr) {
1961         LDKErrorAction *obj = (LDKErrorAction*)untag_ptr(ptr);
1962         assert(obj->tag == LDKErrorAction_SendErrorMessage);
1963                         LDKErrorMessage msg_var = obj->send_error_message.msg;
1964                         uint64_t msg_ref = 0;
1965                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
1966                         msg_ref = tag_ptr(msg_var.inner, false);
1967         return msg_ref;
1968 }
1969 uint64_t __attribute__((export_name("TS_LDKErrorAction_SendWarningMessage_get_msg"))) TS_LDKErrorAction_SendWarningMessage_get_msg(uint64_t ptr) {
1970         LDKErrorAction *obj = (LDKErrorAction*)untag_ptr(ptr);
1971         assert(obj->tag == LDKErrorAction_SendWarningMessage);
1972                         LDKWarningMessage msg_var = obj->send_warning_message.msg;
1973                         uint64_t msg_ref = 0;
1974                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
1975                         msg_ref = tag_ptr(msg_var.inner, false);
1976         return msg_ref;
1977 }
1978 uint32_t __attribute__((export_name("TS_LDKErrorAction_SendWarningMessage_get_log_level"))) TS_LDKErrorAction_SendWarningMessage_get_log_level(uint64_t ptr) {
1979         LDKErrorAction *obj = (LDKErrorAction*)untag_ptr(ptr);
1980         assert(obj->tag == LDKErrorAction_SendWarningMessage);
1981                         uint32_t log_level_conv = LDKLevel_to_js(obj->send_warning_message.log_level);
1982         return log_level_conv;
1983 }
1984 uint32_t __attribute__((export_name("TS_LDKMessageSendEvent_ty_from_ptr"))) TS_LDKMessageSendEvent_ty_from_ptr(uint64_t ptr) {
1985         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
1986         switch(obj->tag) {
1987                 case LDKMessageSendEvent_SendAcceptChannel: return 0;
1988                 case LDKMessageSendEvent_SendOpenChannel: return 1;
1989                 case LDKMessageSendEvent_SendFundingCreated: return 2;
1990                 case LDKMessageSendEvent_SendFundingSigned: return 3;
1991                 case LDKMessageSendEvent_SendChannelReady: return 4;
1992                 case LDKMessageSendEvent_SendAnnouncementSignatures: return 5;
1993                 case LDKMessageSendEvent_UpdateHTLCs: return 6;
1994                 case LDKMessageSendEvent_SendRevokeAndACK: return 7;
1995                 case LDKMessageSendEvent_SendClosingSigned: return 8;
1996                 case LDKMessageSendEvent_SendShutdown: return 9;
1997                 case LDKMessageSendEvent_SendChannelReestablish: return 10;
1998                 case LDKMessageSendEvent_BroadcastChannelAnnouncement: return 11;
1999                 case LDKMessageSendEvent_BroadcastNodeAnnouncement: return 12;
2000                 case LDKMessageSendEvent_BroadcastChannelUpdate: return 13;
2001                 case LDKMessageSendEvent_SendChannelUpdate: return 14;
2002                 case LDKMessageSendEvent_HandleError: return 15;
2003                 case LDKMessageSendEvent_SendChannelRangeQuery: return 16;
2004                 case LDKMessageSendEvent_SendShortIdsQuery: return 17;
2005                 case LDKMessageSendEvent_SendReplyChannelRange: return 18;
2006                 case LDKMessageSendEvent_SendGossipTimestampFilter: return 19;
2007                 default: abort();
2008         }
2009 }
2010 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendAcceptChannel_get_node_id"))) TS_LDKMessageSendEvent_SendAcceptChannel_get_node_id(uint64_t ptr) {
2011         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2012         assert(obj->tag == LDKMessageSendEvent_SendAcceptChannel);
2013                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2014                         memcpy(node_id_arr->elems, obj->send_accept_channel.node_id.compressed_form, 33);
2015         return node_id_arr;
2016 }
2017 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendAcceptChannel_get_msg"))) TS_LDKMessageSendEvent_SendAcceptChannel_get_msg(uint64_t ptr) {
2018         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2019         assert(obj->tag == LDKMessageSendEvent_SendAcceptChannel);
2020                         LDKAcceptChannel msg_var = obj->send_accept_channel.msg;
2021                         uint64_t msg_ref = 0;
2022                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2023                         msg_ref = tag_ptr(msg_var.inner, false);
2024         return msg_ref;
2025 }
2026 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendOpenChannel_get_node_id"))) TS_LDKMessageSendEvent_SendOpenChannel_get_node_id(uint64_t ptr) {
2027         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2028         assert(obj->tag == LDKMessageSendEvent_SendOpenChannel);
2029                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2030                         memcpy(node_id_arr->elems, obj->send_open_channel.node_id.compressed_form, 33);
2031         return node_id_arr;
2032 }
2033 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendOpenChannel_get_msg"))) TS_LDKMessageSendEvent_SendOpenChannel_get_msg(uint64_t ptr) {
2034         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2035         assert(obj->tag == LDKMessageSendEvent_SendOpenChannel);
2036                         LDKOpenChannel msg_var = obj->send_open_channel.msg;
2037                         uint64_t msg_ref = 0;
2038                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2039                         msg_ref = tag_ptr(msg_var.inner, false);
2040         return msg_ref;
2041 }
2042 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendFundingCreated_get_node_id"))) TS_LDKMessageSendEvent_SendFundingCreated_get_node_id(uint64_t ptr) {
2043         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2044         assert(obj->tag == LDKMessageSendEvent_SendFundingCreated);
2045                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2046                         memcpy(node_id_arr->elems, obj->send_funding_created.node_id.compressed_form, 33);
2047         return node_id_arr;
2048 }
2049 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendFundingCreated_get_msg"))) TS_LDKMessageSendEvent_SendFundingCreated_get_msg(uint64_t ptr) {
2050         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2051         assert(obj->tag == LDKMessageSendEvent_SendFundingCreated);
2052                         LDKFundingCreated msg_var = obj->send_funding_created.msg;
2053                         uint64_t msg_ref = 0;
2054                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2055                         msg_ref = tag_ptr(msg_var.inner, false);
2056         return msg_ref;
2057 }
2058 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendFundingSigned_get_node_id"))) TS_LDKMessageSendEvent_SendFundingSigned_get_node_id(uint64_t ptr) {
2059         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2060         assert(obj->tag == LDKMessageSendEvent_SendFundingSigned);
2061                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2062                         memcpy(node_id_arr->elems, obj->send_funding_signed.node_id.compressed_form, 33);
2063         return node_id_arr;
2064 }
2065 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendFundingSigned_get_msg"))) TS_LDKMessageSendEvent_SendFundingSigned_get_msg(uint64_t ptr) {
2066         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2067         assert(obj->tag == LDKMessageSendEvent_SendFundingSigned);
2068                         LDKFundingSigned msg_var = obj->send_funding_signed.msg;
2069                         uint64_t msg_ref = 0;
2070                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2071                         msg_ref = tag_ptr(msg_var.inner, false);
2072         return msg_ref;
2073 }
2074 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelReady_get_node_id"))) TS_LDKMessageSendEvent_SendChannelReady_get_node_id(uint64_t ptr) {
2075         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2076         assert(obj->tag == LDKMessageSendEvent_SendChannelReady);
2077                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2078                         memcpy(node_id_arr->elems, obj->send_channel_ready.node_id.compressed_form, 33);
2079         return node_id_arr;
2080 }
2081 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelReady_get_msg"))) TS_LDKMessageSendEvent_SendChannelReady_get_msg(uint64_t ptr) {
2082         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2083         assert(obj->tag == LDKMessageSendEvent_SendChannelReady);
2084                         LDKChannelReady msg_var = obj->send_channel_ready.msg;
2085                         uint64_t msg_ref = 0;
2086                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2087                         msg_ref = tag_ptr(msg_var.inner, false);
2088         return msg_ref;
2089 }
2090 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendAnnouncementSignatures_get_node_id"))) TS_LDKMessageSendEvent_SendAnnouncementSignatures_get_node_id(uint64_t ptr) {
2091         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2092         assert(obj->tag == LDKMessageSendEvent_SendAnnouncementSignatures);
2093                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2094                         memcpy(node_id_arr->elems, obj->send_announcement_signatures.node_id.compressed_form, 33);
2095         return node_id_arr;
2096 }
2097 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendAnnouncementSignatures_get_msg"))) TS_LDKMessageSendEvent_SendAnnouncementSignatures_get_msg(uint64_t ptr) {
2098         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2099         assert(obj->tag == LDKMessageSendEvent_SendAnnouncementSignatures);
2100                         LDKAnnouncementSignatures msg_var = obj->send_announcement_signatures.msg;
2101                         uint64_t msg_ref = 0;
2102                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2103                         msg_ref = tag_ptr(msg_var.inner, false);
2104         return msg_ref;
2105 }
2106 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_UpdateHTLCs_get_node_id"))) TS_LDKMessageSendEvent_UpdateHTLCs_get_node_id(uint64_t ptr) {
2107         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2108         assert(obj->tag == LDKMessageSendEvent_UpdateHTLCs);
2109                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2110                         memcpy(node_id_arr->elems, obj->update_htl_cs.node_id.compressed_form, 33);
2111         return node_id_arr;
2112 }
2113 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_UpdateHTLCs_get_updates"))) TS_LDKMessageSendEvent_UpdateHTLCs_get_updates(uint64_t ptr) {
2114         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2115         assert(obj->tag == LDKMessageSendEvent_UpdateHTLCs);
2116                         LDKCommitmentUpdate updates_var = obj->update_htl_cs.updates;
2117                         uint64_t updates_ref = 0;
2118                         CHECK_INNER_FIELD_ACCESS_OR_NULL(updates_var);
2119                         updates_ref = tag_ptr(updates_var.inner, false);
2120         return updates_ref;
2121 }
2122 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendRevokeAndACK_get_node_id"))) TS_LDKMessageSendEvent_SendRevokeAndACK_get_node_id(uint64_t ptr) {
2123         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2124         assert(obj->tag == LDKMessageSendEvent_SendRevokeAndACK);
2125                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2126                         memcpy(node_id_arr->elems, obj->send_revoke_and_ack.node_id.compressed_form, 33);
2127         return node_id_arr;
2128 }
2129 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendRevokeAndACK_get_msg"))) TS_LDKMessageSendEvent_SendRevokeAndACK_get_msg(uint64_t ptr) {
2130         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2131         assert(obj->tag == LDKMessageSendEvent_SendRevokeAndACK);
2132                         LDKRevokeAndACK msg_var = obj->send_revoke_and_ack.msg;
2133                         uint64_t msg_ref = 0;
2134                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2135                         msg_ref = tag_ptr(msg_var.inner, false);
2136         return msg_ref;
2137 }
2138 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendClosingSigned_get_node_id"))) TS_LDKMessageSendEvent_SendClosingSigned_get_node_id(uint64_t ptr) {
2139         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2140         assert(obj->tag == LDKMessageSendEvent_SendClosingSigned);
2141                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2142                         memcpy(node_id_arr->elems, obj->send_closing_signed.node_id.compressed_form, 33);
2143         return node_id_arr;
2144 }
2145 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendClosingSigned_get_msg"))) TS_LDKMessageSendEvent_SendClosingSigned_get_msg(uint64_t ptr) {
2146         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2147         assert(obj->tag == LDKMessageSendEvent_SendClosingSigned);
2148                         LDKClosingSigned msg_var = obj->send_closing_signed.msg;
2149                         uint64_t msg_ref = 0;
2150                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2151                         msg_ref = tag_ptr(msg_var.inner, false);
2152         return msg_ref;
2153 }
2154 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendShutdown_get_node_id"))) TS_LDKMessageSendEvent_SendShutdown_get_node_id(uint64_t ptr) {
2155         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2156         assert(obj->tag == LDKMessageSendEvent_SendShutdown);
2157                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2158                         memcpy(node_id_arr->elems, obj->send_shutdown.node_id.compressed_form, 33);
2159         return node_id_arr;
2160 }
2161 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendShutdown_get_msg"))) TS_LDKMessageSendEvent_SendShutdown_get_msg(uint64_t ptr) {
2162         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2163         assert(obj->tag == LDKMessageSendEvent_SendShutdown);
2164                         LDKShutdown msg_var = obj->send_shutdown.msg;
2165                         uint64_t msg_ref = 0;
2166                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2167                         msg_ref = tag_ptr(msg_var.inner, false);
2168         return msg_ref;
2169 }
2170 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelReestablish_get_node_id"))) TS_LDKMessageSendEvent_SendChannelReestablish_get_node_id(uint64_t ptr) {
2171         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2172         assert(obj->tag == LDKMessageSendEvent_SendChannelReestablish);
2173                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2174                         memcpy(node_id_arr->elems, obj->send_channel_reestablish.node_id.compressed_form, 33);
2175         return node_id_arr;
2176 }
2177 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelReestablish_get_msg"))) TS_LDKMessageSendEvent_SendChannelReestablish_get_msg(uint64_t ptr) {
2178         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2179         assert(obj->tag == LDKMessageSendEvent_SendChannelReestablish);
2180                         LDKChannelReestablish msg_var = obj->send_channel_reestablish.msg;
2181                         uint64_t msg_ref = 0;
2182                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2183                         msg_ref = tag_ptr(msg_var.inner, false);
2184         return msg_ref;
2185 }
2186 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_BroadcastChannelAnnouncement_get_msg"))) TS_LDKMessageSendEvent_BroadcastChannelAnnouncement_get_msg(uint64_t ptr) {
2187         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2188         assert(obj->tag == LDKMessageSendEvent_BroadcastChannelAnnouncement);
2189                         LDKChannelAnnouncement msg_var = obj->broadcast_channel_announcement.msg;
2190                         uint64_t msg_ref = 0;
2191                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2192                         msg_ref = tag_ptr(msg_var.inner, false);
2193         return msg_ref;
2194 }
2195 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_BroadcastChannelAnnouncement_get_update_msg"))) TS_LDKMessageSendEvent_BroadcastChannelAnnouncement_get_update_msg(uint64_t ptr) {
2196         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2197         assert(obj->tag == LDKMessageSendEvent_BroadcastChannelAnnouncement);
2198                         LDKChannelUpdate update_msg_var = obj->broadcast_channel_announcement.update_msg;
2199                         uint64_t update_msg_ref = 0;
2200                         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_msg_var);
2201                         update_msg_ref = tag_ptr(update_msg_var.inner, false);
2202         return update_msg_ref;
2203 }
2204 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_BroadcastNodeAnnouncement_get_msg"))) TS_LDKMessageSendEvent_BroadcastNodeAnnouncement_get_msg(uint64_t ptr) {
2205         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2206         assert(obj->tag == LDKMessageSendEvent_BroadcastNodeAnnouncement);
2207                         LDKNodeAnnouncement msg_var = obj->broadcast_node_announcement.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 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_BroadcastChannelUpdate_get_msg"))) TS_LDKMessageSendEvent_BroadcastChannelUpdate_get_msg(uint64_t ptr) {
2214         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2215         assert(obj->tag == LDKMessageSendEvent_BroadcastChannelUpdate);
2216                         LDKChannelUpdate msg_var = obj->broadcast_channel_update.msg;
2217                         uint64_t msg_ref = 0;
2218                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2219                         msg_ref = tag_ptr(msg_var.inner, false);
2220         return msg_ref;
2221 }
2222 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelUpdate_get_node_id"))) TS_LDKMessageSendEvent_SendChannelUpdate_get_node_id(uint64_t ptr) {
2223         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2224         assert(obj->tag == LDKMessageSendEvent_SendChannelUpdate);
2225                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2226                         memcpy(node_id_arr->elems, obj->send_channel_update.node_id.compressed_form, 33);
2227         return node_id_arr;
2228 }
2229 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelUpdate_get_msg"))) TS_LDKMessageSendEvent_SendChannelUpdate_get_msg(uint64_t ptr) {
2230         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2231         assert(obj->tag == LDKMessageSendEvent_SendChannelUpdate);
2232                         LDKChannelUpdate msg_var = obj->send_channel_update.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 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_HandleError_get_node_id"))) TS_LDKMessageSendEvent_HandleError_get_node_id(uint64_t ptr) {
2239         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2240         assert(obj->tag == LDKMessageSendEvent_HandleError);
2241                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2242                         memcpy(node_id_arr->elems, obj->handle_error.node_id.compressed_form, 33);
2243         return node_id_arr;
2244 }
2245 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_HandleError_get_action"))) TS_LDKMessageSendEvent_HandleError_get_action(uint64_t ptr) {
2246         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2247         assert(obj->tag == LDKMessageSendEvent_HandleError);
2248                         uint64_t action_ref = tag_ptr(&obj->handle_error.action, false);
2249         return action_ref;
2250 }
2251 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelRangeQuery_get_node_id"))) TS_LDKMessageSendEvent_SendChannelRangeQuery_get_node_id(uint64_t ptr) {
2252         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2253         assert(obj->tag == LDKMessageSendEvent_SendChannelRangeQuery);
2254                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2255                         memcpy(node_id_arr->elems, obj->send_channel_range_query.node_id.compressed_form, 33);
2256         return node_id_arr;
2257 }
2258 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelRangeQuery_get_msg"))) TS_LDKMessageSendEvent_SendChannelRangeQuery_get_msg(uint64_t ptr) {
2259         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2260         assert(obj->tag == LDKMessageSendEvent_SendChannelRangeQuery);
2261                         LDKQueryChannelRange msg_var = obj->send_channel_range_query.msg;
2262                         uint64_t msg_ref = 0;
2263                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2264                         msg_ref = tag_ptr(msg_var.inner, false);
2265         return msg_ref;
2266 }
2267 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendShortIdsQuery_get_node_id"))) TS_LDKMessageSendEvent_SendShortIdsQuery_get_node_id(uint64_t ptr) {
2268         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2269         assert(obj->tag == LDKMessageSendEvent_SendShortIdsQuery);
2270                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2271                         memcpy(node_id_arr->elems, obj->send_short_ids_query.node_id.compressed_form, 33);
2272         return node_id_arr;
2273 }
2274 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendShortIdsQuery_get_msg"))) TS_LDKMessageSendEvent_SendShortIdsQuery_get_msg(uint64_t ptr) {
2275         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2276         assert(obj->tag == LDKMessageSendEvent_SendShortIdsQuery);
2277                         LDKQueryShortChannelIds msg_var = obj->send_short_ids_query.msg;
2278                         uint64_t msg_ref = 0;
2279                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2280                         msg_ref = tag_ptr(msg_var.inner, false);
2281         return msg_ref;
2282 }
2283 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendReplyChannelRange_get_node_id"))) TS_LDKMessageSendEvent_SendReplyChannelRange_get_node_id(uint64_t ptr) {
2284         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2285         assert(obj->tag == LDKMessageSendEvent_SendReplyChannelRange);
2286                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2287                         memcpy(node_id_arr->elems, obj->send_reply_channel_range.node_id.compressed_form, 33);
2288         return node_id_arr;
2289 }
2290 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendReplyChannelRange_get_msg"))) TS_LDKMessageSendEvent_SendReplyChannelRange_get_msg(uint64_t ptr) {
2291         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2292         assert(obj->tag == LDKMessageSendEvent_SendReplyChannelRange);
2293                         LDKReplyChannelRange msg_var = obj->send_reply_channel_range.msg;
2294                         uint64_t msg_ref = 0;
2295                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2296                         msg_ref = tag_ptr(msg_var.inner, false);
2297         return msg_ref;
2298 }
2299 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendGossipTimestampFilter_get_node_id"))) TS_LDKMessageSendEvent_SendGossipTimestampFilter_get_node_id(uint64_t ptr) {
2300         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2301         assert(obj->tag == LDKMessageSendEvent_SendGossipTimestampFilter);
2302                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2303                         memcpy(node_id_arr->elems, obj->send_gossip_timestamp_filter.node_id.compressed_form, 33);
2304         return node_id_arr;
2305 }
2306 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendGossipTimestampFilter_get_msg"))) TS_LDKMessageSendEvent_SendGossipTimestampFilter_get_msg(uint64_t ptr) {
2307         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2308         assert(obj->tag == LDKMessageSendEvent_SendGossipTimestampFilter);
2309                         LDKGossipTimestampFilter msg_var = obj->send_gossip_timestamp_filter.msg;
2310                         uint64_t msg_ref = 0;
2311                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2312                         msg_ref = tag_ptr(msg_var.inner, false);
2313         return msg_ref;
2314 }
2315 static inline LDKCVec_MessageSendEventZ CVec_MessageSendEventZ_clone(const LDKCVec_MessageSendEventZ *orig) {
2316         LDKCVec_MessageSendEventZ ret = { .data = MALLOC(sizeof(LDKMessageSendEvent) * orig->datalen, "LDKCVec_MessageSendEventZ clone bytes"), .datalen = orig->datalen };
2317         for (size_t i = 0; i < ret.datalen; i++) {
2318                 ret.data[i] = MessageSendEvent_clone(&orig->data[i]);
2319         }
2320         return ret;
2321 }
2322 static inline struct LDKTxOut CResult_TxOutAccessErrorZ_get_ok(LDKCResult_TxOutAccessErrorZ *NONNULL_PTR owner){
2323 CHECK(owner->result_ok);
2324         return TxOut_clone(&*owner->contents.result);
2325 }
2326 uint64_t  __attribute__((export_name("TS_CResult_TxOutAccessErrorZ_get_ok"))) TS_CResult_TxOutAccessErrorZ_get_ok(uint64_t owner) {
2327         LDKCResult_TxOutAccessErrorZ* owner_conv = (LDKCResult_TxOutAccessErrorZ*)untag_ptr(owner);
2328         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
2329         *ret_ref = CResult_TxOutAccessErrorZ_get_ok(owner_conv);
2330         return tag_ptr(ret_ref, true);
2331 }
2332
2333 static inline enum LDKAccessError CResult_TxOutAccessErrorZ_get_err(LDKCResult_TxOutAccessErrorZ *NONNULL_PTR owner){
2334 CHECK(!owner->result_ok);
2335         return AccessError_clone(&*owner->contents.err);
2336 }
2337 uint32_t  __attribute__((export_name("TS_CResult_TxOutAccessErrorZ_get_err"))) TS_CResult_TxOutAccessErrorZ_get_err(uint64_t owner) {
2338         LDKCResult_TxOutAccessErrorZ* owner_conv = (LDKCResult_TxOutAccessErrorZ*)untag_ptr(owner);
2339         uint32_t ret_conv = LDKAccessError_to_js(CResult_TxOutAccessErrorZ_get_err(owner_conv));
2340         return ret_conv;
2341 }
2342
2343 static inline uintptr_t C2Tuple_usizeTransactionZ_get_a(LDKC2Tuple_usizeTransactionZ *NONNULL_PTR owner){
2344         return owner->a;
2345 }
2346 uint32_t  __attribute__((export_name("TS_C2Tuple_usizeTransactionZ_get_a"))) TS_C2Tuple_usizeTransactionZ_get_a(uint64_t owner) {
2347         LDKC2Tuple_usizeTransactionZ* owner_conv = (LDKC2Tuple_usizeTransactionZ*)untag_ptr(owner);
2348         uint32_t ret_conv = C2Tuple_usizeTransactionZ_get_a(owner_conv);
2349         return ret_conv;
2350 }
2351
2352 static inline struct LDKTransaction C2Tuple_usizeTransactionZ_get_b(LDKC2Tuple_usizeTransactionZ *NONNULL_PTR owner){
2353         return owner->b;
2354 }
2355 int8_tArray  __attribute__((export_name("TS_C2Tuple_usizeTransactionZ_get_b"))) TS_C2Tuple_usizeTransactionZ_get_b(uint64_t owner) {
2356         LDKC2Tuple_usizeTransactionZ* owner_conv = (LDKC2Tuple_usizeTransactionZ*)untag_ptr(owner);
2357         LDKTransaction ret_var = C2Tuple_usizeTransactionZ_get_b(owner_conv);
2358         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
2359         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
2360         return ret_arr;
2361 }
2362
2363 static inline LDKCVec_C2Tuple_usizeTransactionZZ CVec_C2Tuple_usizeTransactionZZ_clone(const LDKCVec_C2Tuple_usizeTransactionZZ *orig) {
2364         LDKCVec_C2Tuple_usizeTransactionZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ) * orig->datalen, "LDKCVec_C2Tuple_usizeTransactionZZ clone bytes"), .datalen = orig->datalen };
2365         for (size_t i = 0; i < ret.datalen; i++) {
2366                 ret.data[i] = C2Tuple_usizeTransactionZ_clone(&orig->data[i]);
2367         }
2368         return ret;
2369 }
2370 static inline LDKCVec_TxidZ CVec_TxidZ_clone(const LDKCVec_TxidZ *orig) {
2371         LDKCVec_TxidZ ret = { .data = MALLOC(sizeof(LDKThirtyTwoBytes) * orig->datalen, "LDKCVec_TxidZ clone bytes"), .datalen = orig->datalen };
2372         for (size_t i = 0; i < ret.datalen; i++) {
2373                 ret.data[i] = ThirtyTwoBytes_clone(&orig->data[i]);
2374         }
2375         return ret;
2376 }
2377 static inline void CResult_NoneChannelMonitorUpdateErrZ_get_ok(LDKCResult_NoneChannelMonitorUpdateErrZ *NONNULL_PTR owner){
2378 CHECK(owner->result_ok);
2379         return *owner->contents.result;
2380 }
2381 void  __attribute__((export_name("TS_CResult_NoneChannelMonitorUpdateErrZ_get_ok"))) TS_CResult_NoneChannelMonitorUpdateErrZ_get_ok(uint64_t owner) {
2382         LDKCResult_NoneChannelMonitorUpdateErrZ* owner_conv = (LDKCResult_NoneChannelMonitorUpdateErrZ*)untag_ptr(owner);
2383         CResult_NoneChannelMonitorUpdateErrZ_get_ok(owner_conv);
2384 }
2385
2386 static inline enum LDKChannelMonitorUpdateErr CResult_NoneChannelMonitorUpdateErrZ_get_err(LDKCResult_NoneChannelMonitorUpdateErrZ *NONNULL_PTR owner){
2387 CHECK(!owner->result_ok);
2388         return ChannelMonitorUpdateErr_clone(&*owner->contents.err);
2389 }
2390 uint32_t  __attribute__((export_name("TS_CResult_NoneChannelMonitorUpdateErrZ_get_err"))) TS_CResult_NoneChannelMonitorUpdateErrZ_get_err(uint64_t owner) {
2391         LDKCResult_NoneChannelMonitorUpdateErrZ* owner_conv = (LDKCResult_NoneChannelMonitorUpdateErrZ*)untag_ptr(owner);
2392         uint32_t ret_conv = LDKChannelMonitorUpdateErr_to_js(CResult_NoneChannelMonitorUpdateErrZ_get_err(owner_conv));
2393         return ret_conv;
2394 }
2395
2396 uint32_t __attribute__((export_name("TS_LDKMonitorEvent_ty_from_ptr"))) TS_LDKMonitorEvent_ty_from_ptr(uint64_t ptr) {
2397         LDKMonitorEvent *obj = (LDKMonitorEvent*)untag_ptr(ptr);
2398         switch(obj->tag) {
2399                 case LDKMonitorEvent_HTLCEvent: return 0;
2400                 case LDKMonitorEvent_CommitmentTxConfirmed: return 1;
2401                 case LDKMonitorEvent_UpdateCompleted: return 2;
2402                 case LDKMonitorEvent_UpdateFailed: return 3;
2403                 default: abort();
2404         }
2405 }
2406 uint64_t __attribute__((export_name("TS_LDKMonitorEvent_HTLCEvent_get_htlc_event"))) TS_LDKMonitorEvent_HTLCEvent_get_htlc_event(uint64_t ptr) {
2407         LDKMonitorEvent *obj = (LDKMonitorEvent*)untag_ptr(ptr);
2408         assert(obj->tag == LDKMonitorEvent_HTLCEvent);
2409                         LDKHTLCUpdate htlc_event_var = obj->htlc_event;
2410                         uint64_t htlc_event_ref = 0;
2411                         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_event_var);
2412                         htlc_event_ref = tag_ptr(htlc_event_var.inner, false);
2413         return htlc_event_ref;
2414 }
2415 uint64_t __attribute__((export_name("TS_LDKMonitorEvent_CommitmentTxConfirmed_get_commitment_tx_confirmed"))) TS_LDKMonitorEvent_CommitmentTxConfirmed_get_commitment_tx_confirmed(uint64_t ptr) {
2416         LDKMonitorEvent *obj = (LDKMonitorEvent*)untag_ptr(ptr);
2417         assert(obj->tag == LDKMonitorEvent_CommitmentTxConfirmed);
2418                         LDKOutPoint commitment_tx_confirmed_var = obj->commitment_tx_confirmed;
2419                         uint64_t commitment_tx_confirmed_ref = 0;
2420                         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_confirmed_var);
2421                         commitment_tx_confirmed_ref = tag_ptr(commitment_tx_confirmed_var.inner, false);
2422         return commitment_tx_confirmed_ref;
2423 }
2424 uint64_t __attribute__((export_name("TS_LDKMonitorEvent_UpdateCompleted_get_funding_txo"))) TS_LDKMonitorEvent_UpdateCompleted_get_funding_txo(uint64_t ptr) {
2425         LDKMonitorEvent *obj = (LDKMonitorEvent*)untag_ptr(ptr);
2426         assert(obj->tag == LDKMonitorEvent_UpdateCompleted);
2427                         LDKOutPoint funding_txo_var = obj->update_completed.funding_txo;
2428                         uint64_t funding_txo_ref = 0;
2429                         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_var);
2430                         funding_txo_ref = tag_ptr(funding_txo_var.inner, false);
2431         return funding_txo_ref;
2432 }
2433 int64_t __attribute__((export_name("TS_LDKMonitorEvent_UpdateCompleted_get_monitor_update_id"))) TS_LDKMonitorEvent_UpdateCompleted_get_monitor_update_id(uint64_t ptr) {
2434         LDKMonitorEvent *obj = (LDKMonitorEvent*)untag_ptr(ptr);
2435         assert(obj->tag == LDKMonitorEvent_UpdateCompleted);
2436                         int64_t monitor_update_id_conv = obj->update_completed.monitor_update_id;
2437         return monitor_update_id_conv;
2438 }
2439 uint64_t __attribute__((export_name("TS_LDKMonitorEvent_UpdateFailed_get_update_failed"))) TS_LDKMonitorEvent_UpdateFailed_get_update_failed(uint64_t ptr) {
2440         LDKMonitorEvent *obj = (LDKMonitorEvent*)untag_ptr(ptr);
2441         assert(obj->tag == LDKMonitorEvent_UpdateFailed);
2442                         LDKOutPoint update_failed_var = obj->update_failed;
2443                         uint64_t update_failed_ref = 0;
2444                         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_failed_var);
2445                         update_failed_ref = tag_ptr(update_failed_var.inner, false);
2446         return update_failed_ref;
2447 }
2448 static inline LDKCVec_MonitorEventZ CVec_MonitorEventZ_clone(const LDKCVec_MonitorEventZ *orig) {
2449         LDKCVec_MonitorEventZ ret = { .data = MALLOC(sizeof(LDKMonitorEvent) * orig->datalen, "LDKCVec_MonitorEventZ clone bytes"), .datalen = orig->datalen };
2450         for (size_t i = 0; i < ret.datalen; i++) {
2451                 ret.data[i] = MonitorEvent_clone(&orig->data[i]);
2452         }
2453         return ret;
2454 }
2455 static inline struct LDKOutPoint C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_a(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ *NONNULL_PTR owner){
2456         return OutPoint_clone(&owner->a);
2457 }
2458 uint64_t  __attribute__((export_name("TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_a"))) TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_a(uint64_t owner) {
2459         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* owner_conv = (LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)untag_ptr(owner);
2460         LDKOutPoint ret_var = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_a(owner_conv);
2461         uint64_t ret_ref = 0;
2462         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2463         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2464         return ret_ref;
2465 }
2466
2467 static inline struct LDKCVec_MonitorEventZ C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_b(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ *NONNULL_PTR owner){
2468         return CVec_MonitorEventZ_clone(&owner->b);
2469 }
2470 uint64_tArray  __attribute__((export_name("TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_b"))) TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_b(uint64_t owner) {
2471         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* owner_conv = (LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)untag_ptr(owner);
2472         LDKCVec_MonitorEventZ ret_var = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_b(owner_conv);
2473         uint64_tArray ret_arr = NULL;
2474         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
2475         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
2476         for (size_t o = 0; o < ret_var.datalen; o++) {
2477                 LDKMonitorEvent *ret_conv_14_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
2478                 *ret_conv_14_copy = ret_var.data[o];
2479                 uint64_t ret_conv_14_ref = tag_ptr(ret_conv_14_copy, true);
2480                 ret_arr_ptr[o] = ret_conv_14_ref;
2481         }
2482         
2483         FREE(ret_var.data);
2484         return ret_arr;
2485 }
2486
2487 static inline struct LDKPublicKey C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_c(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ *NONNULL_PTR owner){
2488         return owner->c;
2489 }
2490 int8_tArray  __attribute__((export_name("TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_c"))) TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_c(uint64_t owner) {
2491         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* owner_conv = (LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)untag_ptr(owner);
2492         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
2493         memcpy(ret_arr->elems, C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_c(owner_conv).compressed_form, 33);
2494         return ret_arr;
2495 }
2496
2497 static inline LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ_clone(const LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ *orig) {
2498         LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ ret = { .data = MALLOC(sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ) * orig->datalen, "LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ clone bytes"), .datalen = orig->datalen };
2499         for (size_t i = 0; i < ret.datalen; i++) {
2500                 ret.data[i] = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone(&orig->data[i]);
2501         }
2502         return ret;
2503 }
2504 uint32_t __attribute__((export_name("TS_LDKCOption_C2Tuple_usizeTransactionZZ_ty_from_ptr"))) TS_LDKCOption_C2Tuple_usizeTransactionZZ_ty_from_ptr(uint64_t ptr) {
2505         LDKCOption_C2Tuple_usizeTransactionZZ *obj = (LDKCOption_C2Tuple_usizeTransactionZZ*)untag_ptr(ptr);
2506         switch(obj->tag) {
2507                 case LDKCOption_C2Tuple_usizeTransactionZZ_Some: return 0;
2508                 case LDKCOption_C2Tuple_usizeTransactionZZ_None: return 1;
2509                 default: abort();
2510         }
2511 }
2512 uint64_t __attribute__((export_name("TS_LDKCOption_C2Tuple_usizeTransactionZZ_Some_get_some"))) TS_LDKCOption_C2Tuple_usizeTransactionZZ_Some_get_some(uint64_t ptr) {
2513         LDKCOption_C2Tuple_usizeTransactionZZ *obj = (LDKCOption_C2Tuple_usizeTransactionZZ*)untag_ptr(ptr);
2514         assert(obj->tag == LDKCOption_C2Tuple_usizeTransactionZZ_Some);
2515                         LDKC2Tuple_usizeTransactionZ* some_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
2516                         *some_conv = obj->some;
2517                         *some_conv = C2Tuple_usizeTransactionZ_clone(some_conv);
2518         return tag_ptr(some_conv, true);
2519 }
2520 static inline struct LDKFixedPenaltyScorer CResult_FixedPenaltyScorerDecodeErrorZ_get_ok(LDKCResult_FixedPenaltyScorerDecodeErrorZ *NONNULL_PTR owner){
2521 CHECK(owner->result_ok);
2522         return FixedPenaltyScorer_clone(&*owner->contents.result);
2523 }
2524 uint64_t  __attribute__((export_name("TS_CResult_FixedPenaltyScorerDecodeErrorZ_get_ok"))) TS_CResult_FixedPenaltyScorerDecodeErrorZ_get_ok(uint64_t owner) {
2525         LDKCResult_FixedPenaltyScorerDecodeErrorZ* owner_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)untag_ptr(owner);
2526         LDKFixedPenaltyScorer ret_var = CResult_FixedPenaltyScorerDecodeErrorZ_get_ok(owner_conv);
2527         uint64_t ret_ref = 0;
2528         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2529         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2530         return ret_ref;
2531 }
2532
2533 static inline struct LDKDecodeError CResult_FixedPenaltyScorerDecodeErrorZ_get_err(LDKCResult_FixedPenaltyScorerDecodeErrorZ *NONNULL_PTR owner){
2534 CHECK(!owner->result_ok);
2535         return DecodeError_clone(&*owner->contents.err);
2536 }
2537 uint64_t  __attribute__((export_name("TS_CResult_FixedPenaltyScorerDecodeErrorZ_get_err"))) TS_CResult_FixedPenaltyScorerDecodeErrorZ_get_err(uint64_t owner) {
2538         LDKCResult_FixedPenaltyScorerDecodeErrorZ* owner_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)untag_ptr(owner);
2539         LDKDecodeError ret_var = CResult_FixedPenaltyScorerDecodeErrorZ_get_err(owner_conv);
2540         uint64_t ret_ref = 0;
2541         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2542         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2543         return ret_ref;
2544 }
2545
2546 static inline uint64_t C2Tuple_u64u64Z_get_a(LDKC2Tuple_u64u64Z *NONNULL_PTR owner){
2547         return owner->a;
2548 }
2549 int64_t  __attribute__((export_name("TS_C2Tuple_u64u64Z_get_a"))) TS_C2Tuple_u64u64Z_get_a(uint64_t owner) {
2550         LDKC2Tuple_u64u64Z* owner_conv = (LDKC2Tuple_u64u64Z*)untag_ptr(owner);
2551         int64_t ret_conv = C2Tuple_u64u64Z_get_a(owner_conv);
2552         return ret_conv;
2553 }
2554
2555 static inline uint64_t C2Tuple_u64u64Z_get_b(LDKC2Tuple_u64u64Z *NONNULL_PTR owner){
2556         return owner->b;
2557 }
2558 int64_t  __attribute__((export_name("TS_C2Tuple_u64u64Z_get_b"))) TS_C2Tuple_u64u64Z_get_b(uint64_t owner) {
2559         LDKC2Tuple_u64u64Z* owner_conv = (LDKC2Tuple_u64u64Z*)untag_ptr(owner);
2560         int64_t ret_conv = C2Tuple_u64u64Z_get_b(owner_conv);
2561         return ret_conv;
2562 }
2563
2564 uint32_t __attribute__((export_name("TS_LDKCOption_C2Tuple_u64u64ZZ_ty_from_ptr"))) TS_LDKCOption_C2Tuple_u64u64ZZ_ty_from_ptr(uint64_t ptr) {
2565         LDKCOption_C2Tuple_u64u64ZZ *obj = (LDKCOption_C2Tuple_u64u64ZZ*)untag_ptr(ptr);
2566         switch(obj->tag) {
2567                 case LDKCOption_C2Tuple_u64u64ZZ_Some: return 0;
2568                 case LDKCOption_C2Tuple_u64u64ZZ_None: return 1;
2569                 default: abort();
2570         }
2571 }
2572 uint64_t __attribute__((export_name("TS_LDKCOption_C2Tuple_u64u64ZZ_Some_get_some"))) TS_LDKCOption_C2Tuple_u64u64ZZ_Some_get_some(uint64_t ptr) {
2573         LDKCOption_C2Tuple_u64u64ZZ *obj = (LDKCOption_C2Tuple_u64u64ZZ*)untag_ptr(ptr);
2574         assert(obj->tag == LDKCOption_C2Tuple_u64u64ZZ_Some);
2575                         LDKC2Tuple_u64u64Z* some_conv = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
2576                         *some_conv = obj->some;
2577                         *some_conv = C2Tuple_u64u64Z_clone(some_conv);
2578         return tag_ptr(some_conv, true);
2579 }
2580 static inline LDKCVec_NodeIdZ CVec_NodeIdZ_clone(const LDKCVec_NodeIdZ *orig) {
2581         LDKCVec_NodeIdZ ret = { .data = MALLOC(sizeof(LDKNodeId) * orig->datalen, "LDKCVec_NodeIdZ clone bytes"), .datalen = orig->datalen };
2582         for (size_t i = 0; i < ret.datalen; i++) {
2583                 ret.data[i] = NodeId_clone(&orig->data[i]);
2584         }
2585         return ret;
2586 }
2587 typedef struct LDKLogger_JCalls {
2588         atomic_size_t refcnt;
2589         uint32_t instance_ptr;
2590 } LDKLogger_JCalls;
2591 static void LDKLogger_JCalls_free(void* this_arg) {
2592         LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
2593         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2594                 FREE(j_calls);
2595         }
2596 }
2597 void log_LDKLogger_jcall(const void* this_arg, const LDKRecord * record) {
2598         LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
2599         LDKRecord record_var = *record;
2600         uint64_t record_ref = 0;
2601         record_var = Record_clone(&record_var);
2602         CHECK_INNER_FIELD_ACCESS_OR_NULL(record_var);
2603         record_ref = tag_ptr(record_var.inner, record_var.is_owned);
2604         js_invoke_function_buuuuu(j_calls->instance_ptr, 0, record_ref, 0, 0, 0, 0, 0);
2605 }
2606 static void LDKLogger_JCalls_cloned(LDKLogger* new_obj) {
2607         LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) new_obj->this_arg;
2608         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2609 }
2610 static inline LDKLogger LDKLogger_init (JSValue o) {
2611         LDKLogger_JCalls *calls = MALLOC(sizeof(LDKLogger_JCalls), "LDKLogger_JCalls");
2612         atomic_init(&calls->refcnt, 1);
2613         calls->instance_ptr = o;
2614
2615         LDKLogger ret = {
2616                 .this_arg = (void*) calls,
2617                 .log = log_LDKLogger_jcall,
2618                 .free = LDKLogger_JCalls_free,
2619         };
2620         return ret;
2621 }
2622 uint64_t  __attribute__((export_name("TS_LDKLogger_new"))) TS_LDKLogger_new(JSValue o) {
2623         LDKLogger *res_ptr = MALLOC(sizeof(LDKLogger), "LDKLogger");
2624         *res_ptr = LDKLogger_init(o);
2625         return tag_ptr(res_ptr, true);
2626 }
2627 static inline struct LDKProbabilisticScorer *CResult_ProbabilisticScorerDecodeErrorZ_get_ok(LDKCResult_ProbabilisticScorerDecodeErrorZ *NONNULL_PTR owner){
2628 CHECK(owner->result_ok);
2629         return &*owner->contents.result;
2630 }
2631 uint64_t  __attribute__((export_name("TS_CResult_ProbabilisticScorerDecodeErrorZ_get_ok"))) TS_CResult_ProbabilisticScorerDecodeErrorZ_get_ok(uint64_t owner) {
2632         LDKCResult_ProbabilisticScorerDecodeErrorZ* owner_conv = (LDKCResult_ProbabilisticScorerDecodeErrorZ*)untag_ptr(owner);
2633         LDKProbabilisticScorer ret_var = *CResult_ProbabilisticScorerDecodeErrorZ_get_ok(owner_conv);
2634         uint64_t ret_ref = 0;
2635         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2636         ret_ref = tag_ptr(ret_var.inner, false);
2637         return ret_ref;
2638 }
2639
2640 static inline struct LDKDecodeError CResult_ProbabilisticScorerDecodeErrorZ_get_err(LDKCResult_ProbabilisticScorerDecodeErrorZ *NONNULL_PTR owner){
2641 CHECK(!owner->result_ok);
2642         return DecodeError_clone(&*owner->contents.err);
2643 }
2644 uint64_t  __attribute__((export_name("TS_CResult_ProbabilisticScorerDecodeErrorZ_get_err"))) TS_CResult_ProbabilisticScorerDecodeErrorZ_get_err(uint64_t owner) {
2645         LDKCResult_ProbabilisticScorerDecodeErrorZ* owner_conv = (LDKCResult_ProbabilisticScorerDecodeErrorZ*)untag_ptr(owner);
2646         LDKDecodeError ret_var = CResult_ProbabilisticScorerDecodeErrorZ_get_err(owner_conv);
2647         uint64_t ret_ref = 0;
2648         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2649         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2650         return ret_ref;
2651 }
2652
2653 static inline struct LDKInitFeatures CResult_InitFeaturesDecodeErrorZ_get_ok(LDKCResult_InitFeaturesDecodeErrorZ *NONNULL_PTR owner){
2654 CHECK(owner->result_ok);
2655         return InitFeatures_clone(&*owner->contents.result);
2656 }
2657 uint64_t  __attribute__((export_name("TS_CResult_InitFeaturesDecodeErrorZ_get_ok"))) TS_CResult_InitFeaturesDecodeErrorZ_get_ok(uint64_t owner) {
2658         LDKCResult_InitFeaturesDecodeErrorZ* owner_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)untag_ptr(owner);
2659         LDKInitFeatures ret_var = CResult_InitFeaturesDecodeErrorZ_get_ok(owner_conv);
2660         uint64_t ret_ref = 0;
2661         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2662         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2663         return ret_ref;
2664 }
2665
2666 static inline struct LDKDecodeError CResult_InitFeaturesDecodeErrorZ_get_err(LDKCResult_InitFeaturesDecodeErrorZ *NONNULL_PTR owner){
2667 CHECK(!owner->result_ok);
2668         return DecodeError_clone(&*owner->contents.err);
2669 }
2670 uint64_t  __attribute__((export_name("TS_CResult_InitFeaturesDecodeErrorZ_get_err"))) TS_CResult_InitFeaturesDecodeErrorZ_get_err(uint64_t owner) {
2671         LDKCResult_InitFeaturesDecodeErrorZ* owner_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)untag_ptr(owner);
2672         LDKDecodeError ret_var = CResult_InitFeaturesDecodeErrorZ_get_err(owner_conv);
2673         uint64_t ret_ref = 0;
2674         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2675         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2676         return ret_ref;
2677 }
2678
2679 static inline struct LDKChannelFeatures CResult_ChannelFeaturesDecodeErrorZ_get_ok(LDKCResult_ChannelFeaturesDecodeErrorZ *NONNULL_PTR owner){
2680 CHECK(owner->result_ok);
2681         return ChannelFeatures_clone(&*owner->contents.result);
2682 }
2683 uint64_t  __attribute__((export_name("TS_CResult_ChannelFeaturesDecodeErrorZ_get_ok"))) TS_CResult_ChannelFeaturesDecodeErrorZ_get_ok(uint64_t owner) {
2684         LDKCResult_ChannelFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)untag_ptr(owner);
2685         LDKChannelFeatures ret_var = CResult_ChannelFeaturesDecodeErrorZ_get_ok(owner_conv);
2686         uint64_t ret_ref = 0;
2687         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2688         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2689         return ret_ref;
2690 }
2691
2692 static inline struct LDKDecodeError CResult_ChannelFeaturesDecodeErrorZ_get_err(LDKCResult_ChannelFeaturesDecodeErrorZ *NONNULL_PTR owner){
2693 CHECK(!owner->result_ok);
2694         return DecodeError_clone(&*owner->contents.err);
2695 }
2696 uint64_t  __attribute__((export_name("TS_CResult_ChannelFeaturesDecodeErrorZ_get_err"))) TS_CResult_ChannelFeaturesDecodeErrorZ_get_err(uint64_t owner) {
2697         LDKCResult_ChannelFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)untag_ptr(owner);
2698         LDKDecodeError ret_var = CResult_ChannelFeaturesDecodeErrorZ_get_err(owner_conv);
2699         uint64_t ret_ref = 0;
2700         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2701         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2702         return ret_ref;
2703 }
2704
2705 static inline struct LDKNodeFeatures CResult_NodeFeaturesDecodeErrorZ_get_ok(LDKCResult_NodeFeaturesDecodeErrorZ *NONNULL_PTR owner){
2706 CHECK(owner->result_ok);
2707         return NodeFeatures_clone(&*owner->contents.result);
2708 }
2709 uint64_t  __attribute__((export_name("TS_CResult_NodeFeaturesDecodeErrorZ_get_ok"))) TS_CResult_NodeFeaturesDecodeErrorZ_get_ok(uint64_t owner) {
2710         LDKCResult_NodeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)untag_ptr(owner);
2711         LDKNodeFeatures ret_var = CResult_NodeFeaturesDecodeErrorZ_get_ok(owner_conv);
2712         uint64_t ret_ref = 0;
2713         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2714         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2715         return ret_ref;
2716 }
2717
2718 static inline struct LDKDecodeError CResult_NodeFeaturesDecodeErrorZ_get_err(LDKCResult_NodeFeaturesDecodeErrorZ *NONNULL_PTR owner){
2719 CHECK(!owner->result_ok);
2720         return DecodeError_clone(&*owner->contents.err);
2721 }
2722 uint64_t  __attribute__((export_name("TS_CResult_NodeFeaturesDecodeErrorZ_get_err"))) TS_CResult_NodeFeaturesDecodeErrorZ_get_err(uint64_t owner) {
2723         LDKCResult_NodeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)untag_ptr(owner);
2724         LDKDecodeError ret_var = CResult_NodeFeaturesDecodeErrorZ_get_err(owner_conv);
2725         uint64_t ret_ref = 0;
2726         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2727         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2728         return ret_ref;
2729 }
2730
2731 static inline struct LDKInvoiceFeatures CResult_InvoiceFeaturesDecodeErrorZ_get_ok(LDKCResult_InvoiceFeaturesDecodeErrorZ *NONNULL_PTR owner){
2732 CHECK(owner->result_ok);
2733         return InvoiceFeatures_clone(&*owner->contents.result);
2734 }
2735 uint64_t  __attribute__((export_name("TS_CResult_InvoiceFeaturesDecodeErrorZ_get_ok"))) TS_CResult_InvoiceFeaturesDecodeErrorZ_get_ok(uint64_t owner) {
2736         LDKCResult_InvoiceFeaturesDecodeErrorZ* owner_conv = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)untag_ptr(owner);
2737         LDKInvoiceFeatures ret_var = CResult_InvoiceFeaturesDecodeErrorZ_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_InvoiceFeaturesDecodeErrorZ_get_err(LDKCResult_InvoiceFeaturesDecodeErrorZ *NONNULL_PTR owner){
2745 CHECK(!owner->result_ok);
2746         return DecodeError_clone(&*owner->contents.err);
2747 }
2748 uint64_t  __attribute__((export_name("TS_CResult_InvoiceFeaturesDecodeErrorZ_get_err"))) TS_CResult_InvoiceFeaturesDecodeErrorZ_get_err(uint64_t owner) {
2749         LDKCResult_InvoiceFeaturesDecodeErrorZ* owner_conv = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)untag_ptr(owner);
2750         LDKDecodeError ret_var = CResult_InvoiceFeaturesDecodeErrorZ_get_err(owner_conv);
2751         uint64_t ret_ref = 0;
2752         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2753         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2754         return ret_ref;
2755 }
2756
2757 static inline struct LDKChannelTypeFeatures CResult_ChannelTypeFeaturesDecodeErrorZ_get_ok(LDKCResult_ChannelTypeFeaturesDecodeErrorZ *NONNULL_PTR owner){
2758 CHECK(owner->result_ok);
2759         return ChannelTypeFeatures_clone(&*owner->contents.result);
2760 }
2761 uint64_t  __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_get_ok"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_get_ok(uint64_t owner) {
2762         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)untag_ptr(owner);
2763         LDKChannelTypeFeatures ret_var = CResult_ChannelTypeFeaturesDecodeErrorZ_get_ok(owner_conv);
2764         uint64_t ret_ref = 0;
2765         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2766         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2767         return ret_ref;
2768 }
2769
2770 static inline struct LDKDecodeError CResult_ChannelTypeFeaturesDecodeErrorZ_get_err(LDKCResult_ChannelTypeFeaturesDecodeErrorZ *NONNULL_PTR owner){
2771 CHECK(!owner->result_ok);
2772         return DecodeError_clone(&*owner->contents.err);
2773 }
2774 uint64_t  __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_get_err"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_get_err(uint64_t owner) {
2775         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)untag_ptr(owner);
2776         LDKDecodeError ret_var = CResult_ChannelTypeFeaturesDecodeErrorZ_get_err(owner_conv);
2777         uint64_t ret_ref = 0;
2778         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2779         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2780         return ret_ref;
2781 }
2782
2783 static inline struct LDKNodeId CResult_NodeIdDecodeErrorZ_get_ok(LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR owner){
2784 CHECK(owner->result_ok);
2785         return NodeId_clone(&*owner->contents.result);
2786 }
2787 uint64_t  __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_get_ok"))) TS_CResult_NodeIdDecodeErrorZ_get_ok(uint64_t owner) {
2788         LDKCResult_NodeIdDecodeErrorZ* owner_conv = (LDKCResult_NodeIdDecodeErrorZ*)untag_ptr(owner);
2789         LDKNodeId ret_var = CResult_NodeIdDecodeErrorZ_get_ok(owner_conv);
2790         uint64_t ret_ref = 0;
2791         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2792         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2793         return ret_ref;
2794 }
2795
2796 static inline struct LDKDecodeError CResult_NodeIdDecodeErrorZ_get_err(LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR owner){
2797 CHECK(!owner->result_ok);
2798         return DecodeError_clone(&*owner->contents.err);
2799 }
2800 uint64_t  __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_get_err"))) TS_CResult_NodeIdDecodeErrorZ_get_err(uint64_t owner) {
2801         LDKCResult_NodeIdDecodeErrorZ* owner_conv = (LDKCResult_NodeIdDecodeErrorZ*)untag_ptr(owner);
2802         LDKDecodeError ret_var = CResult_NodeIdDecodeErrorZ_get_err(owner_conv);
2803         uint64_t ret_ref = 0;
2804         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2805         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2806         return ret_ref;
2807 }
2808
2809 static inline struct LDKCOption_NetworkUpdateZ CResult_COption_NetworkUpdateZDecodeErrorZ_get_ok(LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR owner){
2810 CHECK(owner->result_ok);
2811         return COption_NetworkUpdateZ_clone(&*owner->contents.result);
2812 }
2813 uint64_t  __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_get_ok"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_get_ok(uint64_t owner) {
2814         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* owner_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)untag_ptr(owner);
2815         LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
2816         *ret_copy = CResult_COption_NetworkUpdateZDecodeErrorZ_get_ok(owner_conv);
2817         uint64_t ret_ref = tag_ptr(ret_copy, true);
2818         return ret_ref;
2819 }
2820
2821 static inline struct LDKDecodeError CResult_COption_NetworkUpdateZDecodeErrorZ_get_err(LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR owner){
2822 CHECK(!owner->result_ok);
2823         return DecodeError_clone(&*owner->contents.err);
2824 }
2825 uint64_t  __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_get_err"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_get_err(uint64_t owner) {
2826         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* owner_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)untag_ptr(owner);
2827         LDKDecodeError ret_var = CResult_COption_NetworkUpdateZDecodeErrorZ_get_err(owner_conv);
2828         uint64_t ret_ref = 0;
2829         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2830         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2831         return ret_ref;
2832 }
2833
2834 typedef struct LDKAccess_JCalls {
2835         atomic_size_t refcnt;
2836         uint32_t instance_ptr;
2837 } LDKAccess_JCalls;
2838 static void LDKAccess_JCalls_free(void* this_arg) {
2839         LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
2840         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2841                 FREE(j_calls);
2842         }
2843 }
2844 LDKCResult_TxOutAccessErrorZ get_utxo_LDKAccess_jcall(const void* this_arg, const uint8_t (* genesis_hash)[32], uint64_t short_channel_id) {
2845         LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
2846         int8_tArray genesis_hash_arr = init_int8_tArray(32, __LINE__);
2847         memcpy(genesis_hash_arr->elems, *genesis_hash, 32);
2848         int64_t short_channel_id_conv = short_channel_id;
2849         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);
2850         void* ret_ptr = untag_ptr(ret);
2851         CHECK_ACCESS(ret_ptr);
2852         LDKCResult_TxOutAccessErrorZ ret_conv = *(LDKCResult_TxOutAccessErrorZ*)(ret_ptr);
2853         FREE(untag_ptr(ret));
2854         return ret_conv;
2855 }
2856 static void LDKAccess_JCalls_cloned(LDKAccess* new_obj) {
2857         LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) new_obj->this_arg;
2858         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2859 }
2860 static inline LDKAccess LDKAccess_init (JSValue o) {
2861         LDKAccess_JCalls *calls = MALLOC(sizeof(LDKAccess_JCalls), "LDKAccess_JCalls");
2862         atomic_init(&calls->refcnt, 1);
2863         calls->instance_ptr = o;
2864
2865         LDKAccess ret = {
2866                 .this_arg = (void*) calls,
2867                 .get_utxo = get_utxo_LDKAccess_jcall,
2868                 .free = LDKAccess_JCalls_free,
2869         };
2870         return ret;
2871 }
2872 uint64_t  __attribute__((export_name("TS_LDKAccess_new"))) TS_LDKAccess_new(JSValue o) {
2873         LDKAccess *res_ptr = MALLOC(sizeof(LDKAccess), "LDKAccess");
2874         *res_ptr = LDKAccess_init(o);
2875         return tag_ptr(res_ptr, true);
2876 }
2877 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) {
2878         void* this_arg_ptr = untag_ptr(this_arg);
2879         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
2880         LDKAccess* this_arg_conv = (LDKAccess*)this_arg_ptr;
2881         unsigned char genesis_hash_arr[32];
2882         CHECK(genesis_hash->arr_len == 32);
2883         memcpy(genesis_hash_arr, genesis_hash->elems, 32); FREE(genesis_hash);
2884         unsigned char (*genesis_hash_ref)[32] = &genesis_hash_arr;
2885         LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
2886         *ret_conv = (this_arg_conv->get_utxo)(this_arg_conv->this_arg, genesis_hash_ref, short_channel_id);
2887         return tag_ptr(ret_conv, true);
2888 }
2889
2890 uint32_t __attribute__((export_name("TS_LDKCOption_AccessZ_ty_from_ptr"))) TS_LDKCOption_AccessZ_ty_from_ptr(uint64_t ptr) {
2891         LDKCOption_AccessZ *obj = (LDKCOption_AccessZ*)untag_ptr(ptr);
2892         switch(obj->tag) {
2893                 case LDKCOption_AccessZ_Some: return 0;
2894                 case LDKCOption_AccessZ_None: return 1;
2895                 default: abort();
2896         }
2897 }
2898 uint64_t __attribute__((export_name("TS_LDKCOption_AccessZ_Some_get_some"))) TS_LDKCOption_AccessZ_Some_get_some(uint64_t ptr) {
2899         LDKCOption_AccessZ *obj = (LDKCOption_AccessZ*)untag_ptr(ptr);
2900         assert(obj->tag == LDKCOption_AccessZ_Some);
2901                         LDKAccess* some_ret = MALLOC(sizeof(LDKAccess), "LDKAccess");
2902                         *some_ret = obj->some;
2903                         // WARNING: We likely need to clone here, but no clone is available, so we just do it for Java instances
2904                         if ((*some_ret).free == LDKAccess_JCalls_free) {
2905                                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
2906                                 LDKAccess_JCalls_cloned(&(*some_ret));
2907                         }
2908         return tag_ptr(some_ret, true);
2909 }
2910 static inline bool CResult_boolLightningErrorZ_get_ok(LDKCResult_boolLightningErrorZ *NONNULL_PTR owner){
2911 CHECK(owner->result_ok);
2912         return *owner->contents.result;
2913 }
2914 jboolean  __attribute__((export_name("TS_CResult_boolLightningErrorZ_get_ok"))) TS_CResult_boolLightningErrorZ_get_ok(uint64_t owner) {
2915         LDKCResult_boolLightningErrorZ* owner_conv = (LDKCResult_boolLightningErrorZ*)untag_ptr(owner);
2916         jboolean ret_conv = CResult_boolLightningErrorZ_get_ok(owner_conv);
2917         return ret_conv;
2918 }
2919
2920 static inline struct LDKLightningError CResult_boolLightningErrorZ_get_err(LDKCResult_boolLightningErrorZ *NONNULL_PTR owner){
2921 CHECK(!owner->result_ok);
2922         return LightningError_clone(&*owner->contents.err);
2923 }
2924 uint64_t  __attribute__((export_name("TS_CResult_boolLightningErrorZ_get_err"))) TS_CResult_boolLightningErrorZ_get_err(uint64_t owner) {
2925         LDKCResult_boolLightningErrorZ* owner_conv = (LDKCResult_boolLightningErrorZ*)untag_ptr(owner);
2926         LDKLightningError ret_var = CResult_boolLightningErrorZ_get_err(owner_conv);
2927         uint64_t ret_ref = 0;
2928         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2929         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2930         return ret_ref;
2931 }
2932
2933 static inline struct LDKChannelAnnouncement C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_a(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR owner){
2934         return ChannelAnnouncement_clone(&owner->a);
2935 }
2936 uint64_t  __attribute__((export_name("TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_a"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_a(uint64_t owner) {
2937         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* owner_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(owner);
2938         LDKChannelAnnouncement ret_var = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_a(owner_conv);
2939         uint64_t ret_ref = 0;
2940         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2941         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2942         return ret_ref;
2943 }
2944
2945 static inline struct LDKChannelUpdate C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_b(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR owner){
2946         return ChannelUpdate_clone(&owner->b);
2947 }
2948 uint64_t  __attribute__((export_name("TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_b"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_b(uint64_t owner) {
2949         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* owner_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(owner);
2950         LDKChannelUpdate ret_var = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_b(owner_conv);
2951         uint64_t ret_ref = 0;
2952         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2953         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2954         return ret_ref;
2955 }
2956
2957 static inline struct LDKChannelUpdate C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR owner){
2958         return ChannelUpdate_clone(&owner->c);
2959 }
2960 uint64_t  __attribute__((export_name("TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c(uint64_t owner) {
2961         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* owner_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(owner);
2962         LDKChannelUpdate ret_var = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c(owner_conv);
2963         uint64_t ret_ref = 0;
2964         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2965         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2966         return ret_ref;
2967 }
2968
2969 static inline LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone(const LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *orig) {
2970         LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret = { .data = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) * orig->datalen, "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ clone bytes"), .datalen = orig->datalen };
2971         for (size_t i = 0; i < ret.datalen; i++) {
2972                 ret.data[i] = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(&orig->data[i]);
2973         }
2974         return ret;
2975 }
2976 static inline LDKCVec_NodeAnnouncementZ CVec_NodeAnnouncementZ_clone(const LDKCVec_NodeAnnouncementZ *orig) {
2977         LDKCVec_NodeAnnouncementZ ret = { .data = MALLOC(sizeof(LDKNodeAnnouncement) * orig->datalen, "LDKCVec_NodeAnnouncementZ clone bytes"), .datalen = orig->datalen };
2978         for (size_t i = 0; i < ret.datalen; i++) {
2979                 ret.data[i] = NodeAnnouncement_clone(&orig->data[i]);
2980         }
2981         return ret;
2982 }
2983 static inline void CResult_NoneLightningErrorZ_get_ok(LDKCResult_NoneLightningErrorZ *NONNULL_PTR owner){
2984 CHECK(owner->result_ok);
2985         return *owner->contents.result;
2986 }
2987 void  __attribute__((export_name("TS_CResult_NoneLightningErrorZ_get_ok"))) TS_CResult_NoneLightningErrorZ_get_ok(uint64_t owner) {
2988         LDKCResult_NoneLightningErrorZ* owner_conv = (LDKCResult_NoneLightningErrorZ*)untag_ptr(owner);
2989         CResult_NoneLightningErrorZ_get_ok(owner_conv);
2990 }
2991
2992 static inline struct LDKLightningError CResult_NoneLightningErrorZ_get_err(LDKCResult_NoneLightningErrorZ *NONNULL_PTR owner){
2993 CHECK(!owner->result_ok);
2994         return LightningError_clone(&*owner->contents.err);
2995 }
2996 uint64_t  __attribute__((export_name("TS_CResult_NoneLightningErrorZ_get_err"))) TS_CResult_NoneLightningErrorZ_get_err(uint64_t owner) {
2997         LDKCResult_NoneLightningErrorZ* owner_conv = (LDKCResult_NoneLightningErrorZ*)untag_ptr(owner);
2998         LDKLightningError ret_var = CResult_NoneLightningErrorZ_get_err(owner_conv);
2999         uint64_t ret_ref = 0;
3000         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3001         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3002         return ret_ref;
3003 }
3004
3005 static inline struct LDKChannelUpdateInfo CResult_ChannelUpdateInfoDecodeErrorZ_get_ok(LDKCResult_ChannelUpdateInfoDecodeErrorZ *NONNULL_PTR owner){
3006 CHECK(owner->result_ok);
3007         return ChannelUpdateInfo_clone(&*owner->contents.result);
3008 }
3009 uint64_t  __attribute__((export_name("TS_CResult_ChannelUpdateInfoDecodeErrorZ_get_ok"))) TS_CResult_ChannelUpdateInfoDecodeErrorZ_get_ok(uint64_t owner) {
3010         LDKCResult_ChannelUpdateInfoDecodeErrorZ* owner_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)untag_ptr(owner);
3011         LDKChannelUpdateInfo ret_var = CResult_ChannelUpdateInfoDecodeErrorZ_get_ok(owner_conv);
3012         uint64_t ret_ref = 0;
3013         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3014         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3015         return ret_ref;
3016 }
3017
3018 static inline struct LDKDecodeError CResult_ChannelUpdateInfoDecodeErrorZ_get_err(LDKCResult_ChannelUpdateInfoDecodeErrorZ *NONNULL_PTR owner){
3019 CHECK(!owner->result_ok);
3020         return DecodeError_clone(&*owner->contents.err);
3021 }
3022 uint64_t  __attribute__((export_name("TS_CResult_ChannelUpdateInfoDecodeErrorZ_get_err"))) TS_CResult_ChannelUpdateInfoDecodeErrorZ_get_err(uint64_t owner) {
3023         LDKCResult_ChannelUpdateInfoDecodeErrorZ* owner_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)untag_ptr(owner);
3024         LDKDecodeError ret_var = CResult_ChannelUpdateInfoDecodeErrorZ_get_err(owner_conv);
3025         uint64_t ret_ref = 0;
3026         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3027         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3028         return ret_ref;
3029 }
3030
3031 static inline struct LDKChannelInfo CResult_ChannelInfoDecodeErrorZ_get_ok(LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR owner){
3032 CHECK(owner->result_ok);
3033         return ChannelInfo_clone(&*owner->contents.result);
3034 }
3035 uint64_t  __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_get_ok"))) TS_CResult_ChannelInfoDecodeErrorZ_get_ok(uint64_t owner) {
3036         LDKCResult_ChannelInfoDecodeErrorZ* owner_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)untag_ptr(owner);
3037         LDKChannelInfo ret_var = CResult_ChannelInfoDecodeErrorZ_get_ok(owner_conv);
3038         uint64_t ret_ref = 0;
3039         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3040         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3041         return ret_ref;
3042 }
3043
3044 static inline struct LDKDecodeError CResult_ChannelInfoDecodeErrorZ_get_err(LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR owner){
3045 CHECK(!owner->result_ok);
3046         return DecodeError_clone(&*owner->contents.err);
3047 }
3048 uint64_t  __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_get_err"))) TS_CResult_ChannelInfoDecodeErrorZ_get_err(uint64_t owner) {
3049         LDKCResult_ChannelInfoDecodeErrorZ* owner_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)untag_ptr(owner);
3050         LDKDecodeError ret_var = CResult_ChannelInfoDecodeErrorZ_get_err(owner_conv);
3051         uint64_t ret_ref = 0;
3052         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3053         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3054         return ret_ref;
3055 }
3056
3057 static inline struct LDKRoutingFees CResult_RoutingFeesDecodeErrorZ_get_ok(LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR owner){
3058 CHECK(owner->result_ok);
3059         return RoutingFees_clone(&*owner->contents.result);
3060 }
3061 uint64_t  __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_get_ok"))) TS_CResult_RoutingFeesDecodeErrorZ_get_ok(uint64_t owner) {
3062         LDKCResult_RoutingFeesDecodeErrorZ* owner_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)untag_ptr(owner);
3063         LDKRoutingFees ret_var = CResult_RoutingFeesDecodeErrorZ_get_ok(owner_conv);
3064         uint64_t ret_ref = 0;
3065         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3066         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3067         return ret_ref;
3068 }
3069
3070 static inline struct LDKDecodeError CResult_RoutingFeesDecodeErrorZ_get_err(LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR owner){
3071 CHECK(!owner->result_ok);
3072         return DecodeError_clone(&*owner->contents.err);
3073 }
3074 uint64_t  __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_get_err"))) TS_CResult_RoutingFeesDecodeErrorZ_get_err(uint64_t owner) {
3075         LDKCResult_RoutingFeesDecodeErrorZ* owner_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)untag_ptr(owner);
3076         LDKDecodeError ret_var = CResult_RoutingFeesDecodeErrorZ_get_err(owner_conv);
3077         uint64_t ret_ref = 0;
3078         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3079         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3080         return ret_ref;
3081 }
3082
3083 uint32_t __attribute__((export_name("TS_LDKNetAddress_ty_from_ptr"))) TS_LDKNetAddress_ty_from_ptr(uint64_t ptr) {
3084         LDKNetAddress *obj = (LDKNetAddress*)untag_ptr(ptr);
3085         switch(obj->tag) {
3086                 case LDKNetAddress_IPv4: return 0;
3087                 case LDKNetAddress_IPv6: return 1;
3088                 case LDKNetAddress_OnionV2: return 2;
3089                 case LDKNetAddress_OnionV3: return 3;
3090                 case LDKNetAddress_Hostname: return 4;
3091                 default: abort();
3092         }
3093 }
3094 int8_tArray __attribute__((export_name("TS_LDKNetAddress_IPv4_get_addr"))) TS_LDKNetAddress_IPv4_get_addr(uint64_t ptr) {
3095         LDKNetAddress *obj = (LDKNetAddress*)untag_ptr(ptr);
3096         assert(obj->tag == LDKNetAddress_IPv4);
3097                         int8_tArray addr_arr = init_int8_tArray(4, __LINE__);
3098                         memcpy(addr_arr->elems, obj->i_pv4.addr.data, 4);
3099         return addr_arr;
3100 }
3101 int16_t __attribute__((export_name("TS_LDKNetAddress_IPv4_get_port"))) TS_LDKNetAddress_IPv4_get_port(uint64_t ptr) {
3102         LDKNetAddress *obj = (LDKNetAddress*)untag_ptr(ptr);
3103         assert(obj->tag == LDKNetAddress_IPv4);
3104                         int16_t port_conv = obj->i_pv4.port;
3105         return port_conv;
3106 }
3107 int8_tArray __attribute__((export_name("TS_LDKNetAddress_IPv6_get_addr"))) TS_LDKNetAddress_IPv6_get_addr(uint64_t ptr) {
3108         LDKNetAddress *obj = (LDKNetAddress*)untag_ptr(ptr);
3109         assert(obj->tag == LDKNetAddress_IPv6);
3110                         int8_tArray addr_arr = init_int8_tArray(16, __LINE__);
3111                         memcpy(addr_arr->elems, obj->i_pv6.addr.data, 16);
3112         return addr_arr;
3113 }
3114 int16_t __attribute__((export_name("TS_LDKNetAddress_IPv6_get_port"))) TS_LDKNetAddress_IPv6_get_port(uint64_t ptr) {
3115         LDKNetAddress *obj = (LDKNetAddress*)untag_ptr(ptr);
3116         assert(obj->tag == LDKNetAddress_IPv6);
3117                         int16_t port_conv = obj->i_pv6.port;
3118         return port_conv;
3119 }
3120 int8_tArray __attribute__((export_name("TS_LDKNetAddress_OnionV2_get_onion_v2"))) TS_LDKNetAddress_OnionV2_get_onion_v2(uint64_t ptr) {
3121         LDKNetAddress *obj = (LDKNetAddress*)untag_ptr(ptr);
3122         assert(obj->tag == LDKNetAddress_OnionV2);
3123                         int8_tArray onion_v2_arr = init_int8_tArray(12, __LINE__);
3124                         memcpy(onion_v2_arr->elems, obj->onion_v2.data, 12);
3125         return onion_v2_arr;
3126 }
3127 int8_tArray __attribute__((export_name("TS_LDKNetAddress_OnionV3_get_ed25519_pubkey"))) TS_LDKNetAddress_OnionV3_get_ed25519_pubkey(uint64_t ptr) {
3128         LDKNetAddress *obj = (LDKNetAddress*)untag_ptr(ptr);
3129         assert(obj->tag == LDKNetAddress_OnionV3);
3130                         int8_tArray ed25519_pubkey_arr = init_int8_tArray(32, __LINE__);
3131                         memcpy(ed25519_pubkey_arr->elems, obj->onion_v3.ed25519_pubkey.data, 32);
3132         return ed25519_pubkey_arr;
3133 }
3134 int16_t __attribute__((export_name("TS_LDKNetAddress_OnionV3_get_checksum"))) TS_LDKNetAddress_OnionV3_get_checksum(uint64_t ptr) {
3135         LDKNetAddress *obj = (LDKNetAddress*)untag_ptr(ptr);
3136         assert(obj->tag == LDKNetAddress_OnionV3);
3137                         int16_t checksum_conv = obj->onion_v3.checksum;
3138         return checksum_conv;
3139 }
3140 int8_t __attribute__((export_name("TS_LDKNetAddress_OnionV3_get_version"))) TS_LDKNetAddress_OnionV3_get_version(uint64_t ptr) {
3141         LDKNetAddress *obj = (LDKNetAddress*)untag_ptr(ptr);
3142         assert(obj->tag == LDKNetAddress_OnionV3);
3143                         int8_t version_conv = obj->onion_v3.version;
3144         return version_conv;
3145 }
3146 int16_t __attribute__((export_name("TS_LDKNetAddress_OnionV3_get_port"))) TS_LDKNetAddress_OnionV3_get_port(uint64_t ptr) {
3147         LDKNetAddress *obj = (LDKNetAddress*)untag_ptr(ptr);
3148         assert(obj->tag == LDKNetAddress_OnionV3);
3149                         int16_t port_conv = obj->onion_v3.port;
3150         return port_conv;
3151 }
3152 uint64_t __attribute__((export_name("TS_LDKNetAddress_Hostname_get_hostname"))) TS_LDKNetAddress_Hostname_get_hostname(uint64_t ptr) {
3153         LDKNetAddress *obj = (LDKNetAddress*)untag_ptr(ptr);
3154         assert(obj->tag == LDKNetAddress_Hostname);
3155                         LDKHostname hostname_var = obj->hostname.hostname;
3156                         uint64_t hostname_ref = 0;
3157                         CHECK_INNER_FIELD_ACCESS_OR_NULL(hostname_var);
3158                         hostname_ref = tag_ptr(hostname_var.inner, false);
3159         return hostname_ref;
3160 }
3161 int16_t __attribute__((export_name("TS_LDKNetAddress_Hostname_get_port"))) TS_LDKNetAddress_Hostname_get_port(uint64_t ptr) {
3162         LDKNetAddress *obj = (LDKNetAddress*)untag_ptr(ptr);
3163         assert(obj->tag == LDKNetAddress_Hostname);
3164                         int16_t port_conv = obj->hostname.port;
3165         return port_conv;
3166 }
3167 static inline LDKCVec_NetAddressZ CVec_NetAddressZ_clone(const LDKCVec_NetAddressZ *orig) {
3168         LDKCVec_NetAddressZ ret = { .data = MALLOC(sizeof(LDKNetAddress) * orig->datalen, "LDKCVec_NetAddressZ clone bytes"), .datalen = orig->datalen };
3169         for (size_t i = 0; i < ret.datalen; i++) {
3170                 ret.data[i] = NetAddress_clone(&orig->data[i]);
3171         }
3172         return ret;
3173 }
3174 static inline struct LDKNodeAnnouncementInfo CResult_NodeAnnouncementInfoDecodeErrorZ_get_ok(LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR owner){
3175 CHECK(owner->result_ok);
3176         return NodeAnnouncementInfo_clone(&*owner->contents.result);
3177 }
3178 uint64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_get_ok"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_get_ok(uint64_t owner) {
3179         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)untag_ptr(owner);
3180         LDKNodeAnnouncementInfo ret_var = CResult_NodeAnnouncementInfoDecodeErrorZ_get_ok(owner_conv);
3181         uint64_t ret_ref = 0;
3182         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3183         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3184         return ret_ref;
3185 }
3186
3187 static inline struct LDKDecodeError CResult_NodeAnnouncementInfoDecodeErrorZ_get_err(LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR owner){
3188 CHECK(!owner->result_ok);
3189         return DecodeError_clone(&*owner->contents.err);
3190 }
3191 uint64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_get_err"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_get_err(uint64_t owner) {
3192         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)untag_ptr(owner);
3193         LDKDecodeError ret_var = CResult_NodeAnnouncementInfoDecodeErrorZ_get_err(owner_conv);
3194         uint64_t ret_ref = 0;
3195         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3196         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3197         return ret_ref;
3198 }
3199
3200 static inline struct LDKNodeAlias CResult_NodeAliasDecodeErrorZ_get_ok(LDKCResult_NodeAliasDecodeErrorZ *NONNULL_PTR owner){
3201 CHECK(owner->result_ok);
3202         return NodeAlias_clone(&*owner->contents.result);
3203 }
3204 uint64_t  __attribute__((export_name("TS_CResult_NodeAliasDecodeErrorZ_get_ok"))) TS_CResult_NodeAliasDecodeErrorZ_get_ok(uint64_t owner) {
3205         LDKCResult_NodeAliasDecodeErrorZ* owner_conv = (LDKCResult_NodeAliasDecodeErrorZ*)untag_ptr(owner);
3206         LDKNodeAlias ret_var = CResult_NodeAliasDecodeErrorZ_get_ok(owner_conv);
3207         uint64_t ret_ref = 0;
3208         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3209         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3210         return ret_ref;
3211 }
3212
3213 static inline struct LDKDecodeError CResult_NodeAliasDecodeErrorZ_get_err(LDKCResult_NodeAliasDecodeErrorZ *NONNULL_PTR owner){
3214 CHECK(!owner->result_ok);
3215         return DecodeError_clone(&*owner->contents.err);
3216 }
3217 uint64_t  __attribute__((export_name("TS_CResult_NodeAliasDecodeErrorZ_get_err"))) TS_CResult_NodeAliasDecodeErrorZ_get_err(uint64_t owner) {
3218         LDKCResult_NodeAliasDecodeErrorZ* owner_conv = (LDKCResult_NodeAliasDecodeErrorZ*)untag_ptr(owner);
3219         LDKDecodeError ret_var = CResult_NodeAliasDecodeErrorZ_get_err(owner_conv);
3220         uint64_t ret_ref = 0;
3221         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3222         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3223         return ret_ref;
3224 }
3225
3226 static inline struct LDKNodeInfo CResult_NodeInfoDecodeErrorZ_get_ok(LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR owner){
3227 CHECK(owner->result_ok);
3228         return NodeInfo_clone(&*owner->contents.result);
3229 }
3230 uint64_t  __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_get_ok"))) TS_CResult_NodeInfoDecodeErrorZ_get_ok(uint64_t owner) {
3231         LDKCResult_NodeInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeInfoDecodeErrorZ*)untag_ptr(owner);
3232         LDKNodeInfo ret_var = CResult_NodeInfoDecodeErrorZ_get_ok(owner_conv);
3233         uint64_t ret_ref = 0;
3234         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3235         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3236         return ret_ref;
3237 }
3238
3239 static inline struct LDKDecodeError CResult_NodeInfoDecodeErrorZ_get_err(LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR owner){
3240 CHECK(!owner->result_ok);
3241         return DecodeError_clone(&*owner->contents.err);
3242 }
3243 uint64_t  __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_get_err"))) TS_CResult_NodeInfoDecodeErrorZ_get_err(uint64_t owner) {
3244         LDKCResult_NodeInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeInfoDecodeErrorZ*)untag_ptr(owner);
3245         LDKDecodeError ret_var = CResult_NodeInfoDecodeErrorZ_get_err(owner_conv);
3246         uint64_t ret_ref = 0;
3247         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3248         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3249         return ret_ref;
3250 }
3251
3252 static inline struct LDKNetworkGraph *CResult_NetworkGraphDecodeErrorZ_get_ok(LDKCResult_NetworkGraphDecodeErrorZ *NONNULL_PTR owner){
3253 CHECK(owner->result_ok);
3254         return &*owner->contents.result;
3255 }
3256 uint64_t  __attribute__((export_name("TS_CResult_NetworkGraphDecodeErrorZ_get_ok"))) TS_CResult_NetworkGraphDecodeErrorZ_get_ok(uint64_t owner) {
3257         LDKCResult_NetworkGraphDecodeErrorZ* owner_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)untag_ptr(owner);
3258         LDKNetworkGraph ret_var = *CResult_NetworkGraphDecodeErrorZ_get_ok(owner_conv);
3259         uint64_t ret_ref = 0;
3260         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3261         ret_ref = tag_ptr(ret_var.inner, false);
3262         return ret_ref;
3263 }
3264
3265 static inline struct LDKDecodeError CResult_NetworkGraphDecodeErrorZ_get_err(LDKCResult_NetworkGraphDecodeErrorZ *NONNULL_PTR owner){
3266 CHECK(!owner->result_ok);
3267         return DecodeError_clone(&*owner->contents.err);
3268 }
3269 uint64_t  __attribute__((export_name("TS_CResult_NetworkGraphDecodeErrorZ_get_err"))) TS_CResult_NetworkGraphDecodeErrorZ_get_err(uint64_t owner) {
3270         LDKCResult_NetworkGraphDecodeErrorZ* owner_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)untag_ptr(owner);
3271         LDKDecodeError ret_var = CResult_NetworkGraphDecodeErrorZ_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 uint32_t __attribute__((export_name("TS_LDKCOption_CVec_NetAddressZZ_ty_from_ptr"))) TS_LDKCOption_CVec_NetAddressZZ_ty_from_ptr(uint64_t ptr) {
3279         LDKCOption_CVec_NetAddressZZ *obj = (LDKCOption_CVec_NetAddressZZ*)untag_ptr(ptr);
3280         switch(obj->tag) {
3281                 case LDKCOption_CVec_NetAddressZZ_Some: return 0;
3282                 case LDKCOption_CVec_NetAddressZZ_None: return 1;
3283                 default: abort();
3284         }
3285 }
3286 uint64_tArray __attribute__((export_name("TS_LDKCOption_CVec_NetAddressZZ_Some_get_some"))) TS_LDKCOption_CVec_NetAddressZZ_Some_get_some(uint64_t ptr) {
3287         LDKCOption_CVec_NetAddressZZ *obj = (LDKCOption_CVec_NetAddressZZ*)untag_ptr(ptr);
3288         assert(obj->tag == LDKCOption_CVec_NetAddressZZ_Some);
3289                         LDKCVec_NetAddressZ some_var = obj->some;
3290                         uint64_tArray some_arr = NULL;
3291                         some_arr = init_uint64_tArray(some_var.datalen, __LINE__);
3292                         uint64_t *some_arr_ptr = (uint64_t*)(((uint8_t*)some_arr) + 8);
3293                         for (size_t m = 0; m < some_var.datalen; m++) {
3294                                 uint64_t some_conv_12_ref = tag_ptr(&some_var.data[m], false);
3295                                 some_arr_ptr[m] = some_conv_12_ref;
3296                         }
3297                         
3298         return some_arr;
3299 }
3300 static inline struct LDKDelayedPaymentOutputDescriptor CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_ok(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
3301 CHECK(owner->result_ok);
3302         return DelayedPaymentOutputDescriptor_clone(&*owner->contents.result);
3303 }
3304 uint64_t  __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_ok"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_ok(uint64_t owner) {
3305         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
3306         LDKDelayedPaymentOutputDescriptor ret_var = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_ok(owner_conv);
3307         uint64_t ret_ref = 0;
3308         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3309         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3310         return ret_ref;
3311 }
3312
3313 static inline struct LDKDecodeError CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_err(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
3314 CHECK(!owner->result_ok);
3315         return DecodeError_clone(&*owner->contents.err);
3316 }
3317 uint64_t  __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_err"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_err(uint64_t owner) {
3318         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
3319         LDKDecodeError ret_var = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_err(owner_conv);
3320         uint64_t ret_ref = 0;
3321         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3322         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3323         return ret_ref;
3324 }
3325
3326 static inline struct LDKStaticPaymentOutputDescriptor CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_ok(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
3327 CHECK(owner->result_ok);
3328         return StaticPaymentOutputDescriptor_clone(&*owner->contents.result);
3329 }
3330 uint64_t  __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_ok"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_ok(uint64_t owner) {
3331         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
3332         LDKStaticPaymentOutputDescriptor ret_var = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_ok(owner_conv);
3333         uint64_t ret_ref = 0;
3334         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3335         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3336         return ret_ref;
3337 }
3338
3339 static inline struct LDKDecodeError CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_err(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
3340 CHECK(!owner->result_ok);
3341         return DecodeError_clone(&*owner->contents.err);
3342 }
3343 uint64_t  __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_err"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_err(uint64_t owner) {
3344         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
3345         LDKDecodeError ret_var = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_err(owner_conv);
3346         uint64_t ret_ref = 0;
3347         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3348         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3349         return ret_ref;
3350 }
3351
3352 static inline struct LDKSpendableOutputDescriptor CResult_SpendableOutputDescriptorDecodeErrorZ_get_ok(LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
3353 CHECK(owner->result_ok);
3354         return SpendableOutputDescriptor_clone(&*owner->contents.result);
3355 }
3356 uint64_t  __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_get_ok"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_get_ok(uint64_t owner) {
3357         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
3358         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
3359         *ret_copy = CResult_SpendableOutputDescriptorDecodeErrorZ_get_ok(owner_conv);
3360         uint64_t ret_ref = tag_ptr(ret_copy, true);
3361         return ret_ref;
3362 }
3363
3364 static inline struct LDKDecodeError CResult_SpendableOutputDescriptorDecodeErrorZ_get_err(LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
3365 CHECK(!owner->result_ok);
3366         return DecodeError_clone(&*owner->contents.err);
3367 }
3368 uint64_t  __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_get_err"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_get_err(uint64_t owner) {
3369         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
3370         LDKDecodeError ret_var = CResult_SpendableOutputDescriptorDecodeErrorZ_get_err(owner_conv);
3371         uint64_t ret_ref = 0;
3372         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3373         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3374         return ret_ref;
3375 }
3376
3377 static inline LDKCVec_PaymentPreimageZ CVec_PaymentPreimageZ_clone(const LDKCVec_PaymentPreimageZ *orig) {
3378         LDKCVec_PaymentPreimageZ ret = { .data = MALLOC(sizeof(LDKThirtyTwoBytes) * orig->datalen, "LDKCVec_PaymentPreimageZ clone bytes"), .datalen = orig->datalen };
3379         for (size_t i = 0; i < ret.datalen; i++) {
3380                 ret.data[i] = ThirtyTwoBytes_clone(&orig->data[i]);
3381         }
3382         return ret;
3383 }
3384 static inline struct LDKSignature C2Tuple_SignatureCVec_SignatureZZ_get_a(LDKC2Tuple_SignatureCVec_SignatureZZ *NONNULL_PTR owner){
3385         return owner->a;
3386 }
3387 int8_tArray  __attribute__((export_name("TS_C2Tuple_SignatureCVec_SignatureZZ_get_a"))) TS_C2Tuple_SignatureCVec_SignatureZZ_get_a(uint64_t owner) {
3388         LDKC2Tuple_SignatureCVec_SignatureZZ* owner_conv = (LDKC2Tuple_SignatureCVec_SignatureZZ*)untag_ptr(owner);
3389         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
3390         memcpy(ret_arr->elems, C2Tuple_SignatureCVec_SignatureZZ_get_a(owner_conv).compact_form, 64);
3391         return ret_arr;
3392 }
3393
3394 static inline struct LDKCVec_SignatureZ C2Tuple_SignatureCVec_SignatureZZ_get_b(LDKC2Tuple_SignatureCVec_SignatureZZ *NONNULL_PTR owner){
3395         return owner->b;
3396 }
3397 ptrArray  __attribute__((export_name("TS_C2Tuple_SignatureCVec_SignatureZZ_get_b"))) TS_C2Tuple_SignatureCVec_SignatureZZ_get_b(uint64_t owner) {
3398         LDKC2Tuple_SignatureCVec_SignatureZZ* owner_conv = (LDKC2Tuple_SignatureCVec_SignatureZZ*)untag_ptr(owner);
3399         LDKCVec_SignatureZ ret_var = C2Tuple_SignatureCVec_SignatureZZ_get_b(owner_conv);
3400         ptrArray ret_arr = NULL;
3401         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
3402         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
3403         for (size_t m = 0; m < ret_var.datalen; m++) {
3404                 int8_tArray ret_conv_12_arr = init_int8_tArray(64, __LINE__);
3405                 memcpy(ret_conv_12_arr->elems, ret_var.data[m].compact_form, 64);
3406                 ret_arr_ptr[m] = ret_conv_12_arr;
3407         }
3408         
3409         return ret_arr;
3410 }
3411
3412 static inline struct LDKC2Tuple_SignatureCVec_SignatureZZ CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_ok(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *NONNULL_PTR owner){
3413 CHECK(owner->result_ok);
3414         return C2Tuple_SignatureCVec_SignatureZZ_clone(&*owner->contents.result);
3415 }
3416 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_ok"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_ok(uint64_t owner) {
3417         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* owner_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)untag_ptr(owner);
3418         LDKC2Tuple_SignatureCVec_SignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
3419         *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_ok(owner_conv);
3420         return tag_ptr(ret_conv, true);
3421 }
3422
3423 static inline void CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_err(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *NONNULL_PTR owner){
3424 CHECK(!owner->result_ok);
3425         return *owner->contents.err;
3426 }
3427 void  __attribute__((export_name("TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_err"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_err(uint64_t owner) {
3428         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* owner_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)untag_ptr(owner);
3429         CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_err(owner_conv);
3430 }
3431
3432 static inline struct LDKSignature CResult_SignatureNoneZ_get_ok(LDKCResult_SignatureNoneZ *NONNULL_PTR owner){
3433 CHECK(owner->result_ok);
3434         return *owner->contents.result;
3435 }
3436 int8_tArray  __attribute__((export_name("TS_CResult_SignatureNoneZ_get_ok"))) TS_CResult_SignatureNoneZ_get_ok(uint64_t owner) {
3437         LDKCResult_SignatureNoneZ* owner_conv = (LDKCResult_SignatureNoneZ*)untag_ptr(owner);
3438         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
3439         memcpy(ret_arr->elems, CResult_SignatureNoneZ_get_ok(owner_conv).compact_form, 64);
3440         return ret_arr;
3441 }
3442
3443 static inline void CResult_SignatureNoneZ_get_err(LDKCResult_SignatureNoneZ *NONNULL_PTR owner){
3444 CHECK(!owner->result_ok);
3445         return *owner->contents.err;
3446 }
3447 void  __attribute__((export_name("TS_CResult_SignatureNoneZ_get_err"))) TS_CResult_SignatureNoneZ_get_err(uint64_t owner) {
3448         LDKCResult_SignatureNoneZ* owner_conv = (LDKCResult_SignatureNoneZ*)untag_ptr(owner);
3449         CResult_SignatureNoneZ_get_err(owner_conv);
3450 }
3451
3452 static inline struct LDKSignature C2Tuple_SignatureSignatureZ_get_a(LDKC2Tuple_SignatureSignatureZ *NONNULL_PTR owner){
3453         return owner->a;
3454 }
3455 int8_tArray  __attribute__((export_name("TS_C2Tuple_SignatureSignatureZ_get_a"))) TS_C2Tuple_SignatureSignatureZ_get_a(uint64_t owner) {
3456         LDKC2Tuple_SignatureSignatureZ* owner_conv = (LDKC2Tuple_SignatureSignatureZ*)untag_ptr(owner);
3457         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
3458         memcpy(ret_arr->elems, C2Tuple_SignatureSignatureZ_get_a(owner_conv).compact_form, 64);
3459         return ret_arr;
3460 }
3461
3462 static inline struct LDKSignature C2Tuple_SignatureSignatureZ_get_b(LDKC2Tuple_SignatureSignatureZ *NONNULL_PTR owner){
3463         return owner->b;
3464 }
3465 int8_tArray  __attribute__((export_name("TS_C2Tuple_SignatureSignatureZ_get_b"))) TS_C2Tuple_SignatureSignatureZ_get_b(uint64_t owner) {
3466         LDKC2Tuple_SignatureSignatureZ* owner_conv = (LDKC2Tuple_SignatureSignatureZ*)untag_ptr(owner);
3467         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
3468         memcpy(ret_arr->elems, C2Tuple_SignatureSignatureZ_get_b(owner_conv).compact_form, 64);
3469         return ret_arr;
3470 }
3471
3472 static inline struct LDKC2Tuple_SignatureSignatureZ CResult_C2Tuple_SignatureSignatureZNoneZ_get_ok(LDKCResult_C2Tuple_SignatureSignatureZNoneZ *NONNULL_PTR owner){
3473 CHECK(owner->result_ok);
3474         return C2Tuple_SignatureSignatureZ_clone(&*owner->contents.result);
3475 }
3476 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_SignatureSignatureZNoneZ_get_ok"))) TS_CResult_C2Tuple_SignatureSignatureZNoneZ_get_ok(uint64_t owner) {
3477         LDKCResult_C2Tuple_SignatureSignatureZNoneZ* owner_conv = (LDKCResult_C2Tuple_SignatureSignatureZNoneZ*)untag_ptr(owner);
3478         LDKC2Tuple_SignatureSignatureZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureSignatureZ), "LDKC2Tuple_SignatureSignatureZ");
3479         *ret_conv = CResult_C2Tuple_SignatureSignatureZNoneZ_get_ok(owner_conv);
3480         return tag_ptr(ret_conv, true);
3481 }
3482
3483 static inline void CResult_C2Tuple_SignatureSignatureZNoneZ_get_err(LDKCResult_C2Tuple_SignatureSignatureZNoneZ *NONNULL_PTR owner){
3484 CHECK(!owner->result_ok);
3485         return *owner->contents.err;
3486 }
3487 void  __attribute__((export_name("TS_CResult_C2Tuple_SignatureSignatureZNoneZ_get_err"))) TS_CResult_C2Tuple_SignatureSignatureZNoneZ_get_err(uint64_t owner) {
3488         LDKCResult_C2Tuple_SignatureSignatureZNoneZ* owner_conv = (LDKCResult_C2Tuple_SignatureSignatureZNoneZ*)untag_ptr(owner);
3489         CResult_C2Tuple_SignatureSignatureZNoneZ_get_err(owner_conv);
3490 }
3491
3492 static inline struct LDKSecretKey CResult_SecretKeyNoneZ_get_ok(LDKCResult_SecretKeyNoneZ *NONNULL_PTR owner){
3493 CHECK(owner->result_ok);
3494         return *owner->contents.result;
3495 }
3496 int8_tArray  __attribute__((export_name("TS_CResult_SecretKeyNoneZ_get_ok"))) TS_CResult_SecretKeyNoneZ_get_ok(uint64_t owner) {
3497         LDKCResult_SecretKeyNoneZ* owner_conv = (LDKCResult_SecretKeyNoneZ*)untag_ptr(owner);
3498         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
3499         memcpy(ret_arr->elems, CResult_SecretKeyNoneZ_get_ok(owner_conv).bytes, 32);
3500         return ret_arr;
3501 }
3502
3503 static inline void CResult_SecretKeyNoneZ_get_err(LDKCResult_SecretKeyNoneZ *NONNULL_PTR owner){
3504 CHECK(!owner->result_ok);
3505         return *owner->contents.err;
3506 }
3507 void  __attribute__((export_name("TS_CResult_SecretKeyNoneZ_get_err"))) TS_CResult_SecretKeyNoneZ_get_err(uint64_t owner) {
3508         LDKCResult_SecretKeyNoneZ* owner_conv = (LDKCResult_SecretKeyNoneZ*)untag_ptr(owner);
3509         CResult_SecretKeyNoneZ_get_err(owner_conv);
3510 }
3511
3512 typedef struct LDKBaseSign_JCalls {
3513         atomic_size_t refcnt;
3514         uint32_t instance_ptr;
3515 } LDKBaseSign_JCalls;
3516 static void LDKBaseSign_JCalls_free(void* this_arg) {
3517         LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
3518         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3519                 FREE(j_calls);
3520         }
3521 }
3522 LDKPublicKey get_per_commitment_point_LDKBaseSign_jcall(const void* this_arg, uint64_t idx) {
3523         LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
3524         int64_t idx_conv = idx;
3525         int8_tArray ret = (int8_tArray)js_invoke_function_buuuuu(j_calls->instance_ptr, 2, idx_conv, 0, 0, 0, 0, 0);
3526         LDKPublicKey ret_ref;
3527         CHECK(ret->arr_len == 33);
3528         memcpy(ret_ref.compressed_form, ret->elems, 33); FREE(ret);
3529         return ret_ref;
3530 }
3531 LDKThirtyTwoBytes release_commitment_secret_LDKBaseSign_jcall(const void* this_arg, uint64_t idx) {
3532         LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
3533         int64_t idx_conv = idx;
3534         int8_tArray ret = (int8_tArray)js_invoke_function_buuuuu(j_calls->instance_ptr, 3, idx_conv, 0, 0, 0, 0, 0);
3535         LDKThirtyTwoBytes ret_ref;
3536         CHECK(ret->arr_len == 32);
3537         memcpy(ret_ref.data, ret->elems, 32); FREE(ret);
3538         return ret_ref;
3539 }
3540 LDKCResult_NoneNoneZ validate_holder_commitment_LDKBaseSign_jcall(const void* this_arg, const LDKHolderCommitmentTransaction * holder_tx, LDKCVec_PaymentPreimageZ preimages) {
3541         LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
3542         LDKHolderCommitmentTransaction holder_tx_var = *holder_tx;
3543         uint64_t holder_tx_ref = 0;
3544         holder_tx_var = HolderCommitmentTransaction_clone(&holder_tx_var);
3545         CHECK_INNER_FIELD_ACCESS_OR_NULL(holder_tx_var);
3546         holder_tx_ref = tag_ptr(holder_tx_var.inner, holder_tx_var.is_owned);
3547         LDKCVec_PaymentPreimageZ preimages_var = preimages;
3548         ptrArray preimages_arr = NULL;
3549         preimages_arr = init_ptrArray(preimages_var.datalen, __LINE__);
3550         int8_tArray *preimages_arr_ptr = (int8_tArray*)(((uint8_t*)preimages_arr) + 8);
3551         for (size_t m = 0; m < preimages_var.datalen; m++) {
3552                 int8_tArray preimages_conv_12_arr = init_int8_tArray(32, __LINE__);
3553                 memcpy(preimages_conv_12_arr->elems, preimages_var.data[m].data, 32);
3554                 preimages_arr_ptr[m] = preimages_conv_12_arr;
3555         }
3556         
3557         FREE(preimages_var.data);
3558         uint32_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 4, holder_tx_ref, (uint32_t)preimages_arr, 0, 0, 0, 0);
3559         void* ret_ptr = untag_ptr(ret);
3560         CHECK_ACCESS(ret_ptr);
3561         LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
3562         FREE(untag_ptr(ret));
3563         return ret_conv;
3564 }
3565 LDKThirtyTwoBytes channel_keys_id_LDKBaseSign_jcall(const void* this_arg) {
3566         LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
3567         int8_tArray ret = (int8_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 5, 0, 0, 0, 0, 0, 0);
3568         LDKThirtyTwoBytes ret_ref;
3569         CHECK(ret->arr_len == 32);
3570         memcpy(ret_ref.data, ret->elems, 32); FREE(ret);
3571         return ret_ref;
3572 }
3573 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_counterparty_commitment_LDKBaseSign_jcall(const void* this_arg, const LDKCommitmentTransaction * commitment_tx, LDKCVec_PaymentPreimageZ preimages) {
3574         LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
3575         LDKCommitmentTransaction commitment_tx_var = *commitment_tx;
3576         uint64_t commitment_tx_ref = 0;
3577         commitment_tx_var = CommitmentTransaction_clone(&commitment_tx_var);
3578         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_var);
3579         commitment_tx_ref = tag_ptr(commitment_tx_var.inner, commitment_tx_var.is_owned);
3580         LDKCVec_PaymentPreimageZ preimages_var = preimages;
3581         ptrArray preimages_arr = NULL;
3582         preimages_arr = init_ptrArray(preimages_var.datalen, __LINE__);
3583         int8_tArray *preimages_arr_ptr = (int8_tArray*)(((uint8_t*)preimages_arr) + 8);
3584         for (size_t m = 0; m < preimages_var.datalen; m++) {
3585                 int8_tArray preimages_conv_12_arr = init_int8_tArray(32, __LINE__);
3586                 memcpy(preimages_conv_12_arr->elems, preimages_var.data[m].data, 32);
3587                 preimages_arr_ptr[m] = preimages_conv_12_arr;
3588         }
3589         
3590         FREE(preimages_var.data);
3591         uint32_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 6, commitment_tx_ref, (uint32_t)preimages_arr, 0, 0, 0, 0);
3592         void* ret_ptr = untag_ptr(ret);
3593         CHECK_ACCESS(ret_ptr);
3594         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ ret_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(ret_ptr);
3595         FREE(untag_ptr(ret));
3596         return ret_conv;
3597 }
3598 LDKCResult_NoneNoneZ validate_counterparty_revocation_LDKBaseSign_jcall(const void* this_arg, uint64_t idx, const uint8_t (* secret)[32]) {
3599         LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
3600         int64_t idx_conv = idx;
3601         int8_tArray secret_arr = init_int8_tArray(32, __LINE__);
3602         memcpy(secret_arr->elems, *secret, 32);
3603         uint32_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 7, idx_conv, (uint32_t)secret_arr, 0, 0, 0, 0);
3604         void* ret_ptr = untag_ptr(ret);
3605         CHECK_ACCESS(ret_ptr);
3606         LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
3607         FREE(untag_ptr(ret));
3608         return ret_conv;
3609 }
3610 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_holder_commitment_and_htlcs_LDKBaseSign_jcall(const void* this_arg, const LDKHolderCommitmentTransaction * commitment_tx) {
3611         LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
3612         LDKHolderCommitmentTransaction commitment_tx_var = *commitment_tx;
3613         uint64_t commitment_tx_ref = 0;
3614         commitment_tx_var = HolderCommitmentTransaction_clone(&commitment_tx_var);
3615         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_var);
3616         commitment_tx_ref = tag_ptr(commitment_tx_var.inner, commitment_tx_var.is_owned);
3617         uint32_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 8, commitment_tx_ref, 0, 0, 0, 0, 0);
3618         void* ret_ptr = untag_ptr(ret);
3619         CHECK_ACCESS(ret_ptr);
3620         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ ret_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(ret_ptr);
3621         FREE(untag_ptr(ret));
3622         return ret_conv;
3623 }
3624 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]) {
3625         LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
3626         LDKTransaction justice_tx_var = justice_tx;
3627         int8_tArray justice_tx_arr = init_int8_tArray(justice_tx_var.datalen, __LINE__);
3628         memcpy(justice_tx_arr->elems, justice_tx_var.data, justice_tx_var.datalen);
3629         Transaction_free(justice_tx_var);
3630         uint32_t input_conv = input;
3631         int64_t amount_conv = amount;
3632         int8_tArray per_commitment_key_arr = init_int8_tArray(32, __LINE__);
3633         memcpy(per_commitment_key_arr->elems, *per_commitment_key, 32);
3634         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);
3635         void* ret_ptr = untag_ptr(ret);
3636         CHECK_ACCESS(ret_ptr);
3637         LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr);
3638         FREE(untag_ptr(ret));
3639         return ret_conv;
3640 }
3641 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) {
3642         LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
3643         LDKTransaction justice_tx_var = justice_tx;
3644         int8_tArray justice_tx_arr = init_int8_tArray(justice_tx_var.datalen, __LINE__);
3645         memcpy(justice_tx_arr->elems, justice_tx_var.data, justice_tx_var.datalen);
3646         Transaction_free(justice_tx_var);
3647         uint32_t input_conv = input;
3648         int64_t amount_conv = amount;
3649         int8_tArray per_commitment_key_arr = init_int8_tArray(32, __LINE__);
3650         memcpy(per_commitment_key_arr->elems, *per_commitment_key, 32);
3651         LDKHTLCOutputInCommitment htlc_var = *htlc;
3652         uint64_t htlc_ref = 0;
3653         htlc_var = HTLCOutputInCommitment_clone(&htlc_var);
3654         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_var);
3655         htlc_ref = tag_ptr(htlc_var.inner, htlc_var.is_owned);
3656         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);
3657         void* ret_ptr = untag_ptr(ret);
3658         CHECK_ACCESS(ret_ptr);
3659         LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr);
3660         FREE(untag_ptr(ret));
3661         return ret_conv;
3662 }
3663 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) {
3664         LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
3665         LDKTransaction htlc_tx_var = htlc_tx;
3666         int8_tArray htlc_tx_arr = init_int8_tArray(htlc_tx_var.datalen, __LINE__);
3667         memcpy(htlc_tx_arr->elems, htlc_tx_var.data, htlc_tx_var.datalen);
3668         Transaction_free(htlc_tx_var);
3669         uint32_t input_conv = input;
3670         int64_t amount_conv = amount;
3671         int8_tArray per_commitment_point_arr = init_int8_tArray(33, __LINE__);
3672         memcpy(per_commitment_point_arr->elems, per_commitment_point.compressed_form, 33);
3673         LDKHTLCOutputInCommitment htlc_var = *htlc;
3674         uint64_t htlc_ref = 0;
3675         htlc_var = HTLCOutputInCommitment_clone(&htlc_var);
3676         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_var);
3677         htlc_ref = tag_ptr(htlc_var.inner, htlc_var.is_owned);
3678         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);
3679         void* ret_ptr = untag_ptr(ret);
3680         CHECK_ACCESS(ret_ptr);
3681         LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr);
3682         FREE(untag_ptr(ret));
3683         return ret_conv;
3684 }
3685 LDKCResult_SignatureNoneZ sign_closing_transaction_LDKBaseSign_jcall(const void* this_arg, const LDKClosingTransaction * closing_tx) {
3686         LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
3687         LDKClosingTransaction closing_tx_var = *closing_tx;
3688         uint64_t closing_tx_ref = 0;
3689         closing_tx_var = ClosingTransaction_clone(&closing_tx_var);
3690         CHECK_INNER_FIELD_ACCESS_OR_NULL(closing_tx_var);
3691         closing_tx_ref = tag_ptr(closing_tx_var.inner, closing_tx_var.is_owned);
3692         uint32_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 12, closing_tx_ref, 0, 0, 0, 0, 0);
3693         void* ret_ptr = untag_ptr(ret);
3694         CHECK_ACCESS(ret_ptr);
3695         LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr);
3696         FREE(untag_ptr(ret));
3697         return ret_conv;
3698 }
3699 LDKCResult_C2Tuple_SignatureSignatureZNoneZ sign_channel_announcement_LDKBaseSign_jcall(const void* this_arg, const LDKUnsignedChannelAnnouncement * msg) {
3700         LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
3701         LDKUnsignedChannelAnnouncement msg_var = *msg;
3702         uint64_t msg_ref = 0;
3703         msg_var = UnsignedChannelAnnouncement_clone(&msg_var);
3704         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3705         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
3706         uint32_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 13, msg_ref, 0, 0, 0, 0, 0);
3707         void* ret_ptr = untag_ptr(ret);
3708         CHECK_ACCESS(ret_ptr);
3709         LDKCResult_C2Tuple_SignatureSignatureZNoneZ ret_conv = *(LDKCResult_C2Tuple_SignatureSignatureZNoneZ*)(ret_ptr);
3710         FREE(untag_ptr(ret));
3711         return ret_conv;
3712 }
3713 void ready_channel_LDKBaseSign_jcall(void* this_arg, const LDKChannelTransactionParameters * channel_parameters) {
3714         LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
3715         LDKChannelTransactionParameters channel_parameters_var = *channel_parameters;
3716         uint64_t channel_parameters_ref = 0;
3717         channel_parameters_var = ChannelTransactionParameters_clone(&channel_parameters_var);
3718         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_var);
3719         channel_parameters_ref = tag_ptr(channel_parameters_var.inner, channel_parameters_var.is_owned);
3720         js_invoke_function_buuuuu(j_calls->instance_ptr, 14, channel_parameters_ref, 0, 0, 0, 0, 0);
3721 }
3722 static void LDKBaseSign_JCalls_cloned(LDKBaseSign* new_obj) {
3723         LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) new_obj->this_arg;
3724         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3725 }
3726 static inline LDKBaseSign LDKBaseSign_init (JSValue o, uint64_t pubkeys) {
3727         LDKBaseSign_JCalls *calls = MALLOC(sizeof(LDKBaseSign_JCalls), "LDKBaseSign_JCalls");
3728         atomic_init(&calls->refcnt, 1);
3729         calls->instance_ptr = o;
3730
3731         LDKChannelPublicKeys pubkeys_conv;
3732         pubkeys_conv.inner = untag_ptr(pubkeys);
3733         pubkeys_conv.is_owned = ptr_is_owned(pubkeys);
3734         CHECK_INNER_FIELD_ACCESS_OR_NULL(pubkeys_conv);
3735
3736         LDKBaseSign ret = {
3737                 .this_arg = (void*) calls,
3738                 .get_per_commitment_point = get_per_commitment_point_LDKBaseSign_jcall,
3739                 .release_commitment_secret = release_commitment_secret_LDKBaseSign_jcall,
3740                 .validate_holder_commitment = validate_holder_commitment_LDKBaseSign_jcall,
3741                 .channel_keys_id = channel_keys_id_LDKBaseSign_jcall,
3742                 .sign_counterparty_commitment = sign_counterparty_commitment_LDKBaseSign_jcall,
3743                 .validate_counterparty_revocation = validate_counterparty_revocation_LDKBaseSign_jcall,
3744                 .sign_holder_commitment_and_htlcs = sign_holder_commitment_and_htlcs_LDKBaseSign_jcall,
3745                 .sign_justice_revoked_output = sign_justice_revoked_output_LDKBaseSign_jcall,
3746                 .sign_justice_revoked_htlc = sign_justice_revoked_htlc_LDKBaseSign_jcall,
3747                 .sign_counterparty_htlc_transaction = sign_counterparty_htlc_transaction_LDKBaseSign_jcall,
3748                 .sign_closing_transaction = sign_closing_transaction_LDKBaseSign_jcall,
3749                 .sign_channel_announcement = sign_channel_announcement_LDKBaseSign_jcall,
3750                 .ready_channel = ready_channel_LDKBaseSign_jcall,
3751                 .free = LDKBaseSign_JCalls_free,
3752                 .pubkeys = pubkeys_conv,
3753                 .set_pubkeys = NULL,
3754         };
3755         return ret;
3756 }
3757 uint64_t  __attribute__((export_name("TS_LDKBaseSign_new"))) TS_LDKBaseSign_new(JSValue o, uint64_t pubkeys) {
3758         LDKBaseSign *res_ptr = MALLOC(sizeof(LDKBaseSign), "LDKBaseSign");
3759         *res_ptr = LDKBaseSign_init(o, pubkeys);
3760         return tag_ptr(res_ptr, true);
3761 }
3762 int8_tArray  __attribute__((export_name("TS_BaseSign_get_per_commitment_point"))) TS_BaseSign_get_per_commitment_point(uint64_t this_arg, int64_t idx) {
3763         void* this_arg_ptr = untag_ptr(this_arg);
3764         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
3765         LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
3766         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
3767         memcpy(ret_arr->elems, (this_arg_conv->get_per_commitment_point)(this_arg_conv->this_arg, idx).compressed_form, 33);
3768         return ret_arr;
3769 }
3770
3771 int8_tArray  __attribute__((export_name("TS_BaseSign_release_commitment_secret"))) TS_BaseSign_release_commitment_secret(uint64_t this_arg, int64_t idx) {
3772         void* this_arg_ptr = untag_ptr(this_arg);
3773         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
3774         LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
3775         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
3776         memcpy(ret_arr->elems, (this_arg_conv->release_commitment_secret)(this_arg_conv->this_arg, idx).data, 32);
3777         return ret_arr;
3778 }
3779
3780 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) {
3781         void* this_arg_ptr = untag_ptr(this_arg);
3782         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
3783         LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
3784         LDKHolderCommitmentTransaction holder_tx_conv;
3785         holder_tx_conv.inner = untag_ptr(holder_tx);
3786         holder_tx_conv.is_owned = ptr_is_owned(holder_tx);
3787         CHECK_INNER_FIELD_ACCESS_OR_NULL(holder_tx_conv);
3788         holder_tx_conv.is_owned = false;
3789         LDKCVec_PaymentPreimageZ preimages_constr;
3790         preimages_constr.datalen = preimages->arr_len;
3791         if (preimages_constr.datalen > 0)
3792                 preimages_constr.data = MALLOC(preimages_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_PaymentPreimageZ Elements");
3793         else
3794                 preimages_constr.data = NULL;
3795         int8_tArray* preimages_vals = (void*) preimages->elems;
3796         for (size_t m = 0; m < preimages_constr.datalen; m++) {
3797                 int8_tArray preimages_conv_12 = preimages_vals[m];
3798                 LDKThirtyTwoBytes preimages_conv_12_ref;
3799                 CHECK(preimages_conv_12->arr_len == 32);
3800                 memcpy(preimages_conv_12_ref.data, preimages_conv_12->elems, 32); FREE(preimages_conv_12);
3801                 preimages_constr.data[m] = preimages_conv_12_ref;
3802         }
3803         FREE(preimages);
3804         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
3805         *ret_conv = (this_arg_conv->validate_holder_commitment)(this_arg_conv->this_arg, &holder_tx_conv, preimages_constr);
3806         return tag_ptr(ret_conv, true);
3807 }
3808
3809 int8_tArray  __attribute__((export_name("TS_BaseSign_channel_keys_id"))) TS_BaseSign_channel_keys_id(uint64_t this_arg) {
3810         void* this_arg_ptr = untag_ptr(this_arg);
3811         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
3812         LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
3813         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
3814         memcpy(ret_arr->elems, (this_arg_conv->channel_keys_id)(this_arg_conv->this_arg).data, 32);
3815         return ret_arr;
3816 }
3817
3818 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) {
3819         void* this_arg_ptr = untag_ptr(this_arg);
3820         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
3821         LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
3822         LDKCommitmentTransaction commitment_tx_conv;
3823         commitment_tx_conv.inner = untag_ptr(commitment_tx);
3824         commitment_tx_conv.is_owned = ptr_is_owned(commitment_tx);
3825         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_conv);
3826         commitment_tx_conv.is_owned = false;
3827         LDKCVec_PaymentPreimageZ preimages_constr;
3828         preimages_constr.datalen = preimages->arr_len;
3829         if (preimages_constr.datalen > 0)
3830                 preimages_constr.data = MALLOC(preimages_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_PaymentPreimageZ Elements");
3831         else
3832                 preimages_constr.data = NULL;
3833         int8_tArray* preimages_vals = (void*) preimages->elems;
3834         for (size_t m = 0; m < preimages_constr.datalen; m++) {
3835                 int8_tArray preimages_conv_12 = preimages_vals[m];
3836                 LDKThirtyTwoBytes preimages_conv_12_ref;
3837                 CHECK(preimages_conv_12->arr_len == 32);
3838                 memcpy(preimages_conv_12_ref.data, preimages_conv_12->elems, 32); FREE(preimages_conv_12);
3839                 preimages_constr.data[m] = preimages_conv_12_ref;
3840         }
3841         FREE(preimages);
3842         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
3843         *ret_conv = (this_arg_conv->sign_counterparty_commitment)(this_arg_conv->this_arg, &commitment_tx_conv, preimages_constr);
3844         return tag_ptr(ret_conv, true);
3845 }
3846
3847 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) {
3848         void* this_arg_ptr = untag_ptr(this_arg);
3849         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
3850         LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
3851         unsigned char secret_arr[32];
3852         CHECK(secret->arr_len == 32);
3853         memcpy(secret_arr, secret->elems, 32); FREE(secret);
3854         unsigned char (*secret_ref)[32] = &secret_arr;
3855         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
3856         *ret_conv = (this_arg_conv->validate_counterparty_revocation)(this_arg_conv->this_arg, idx, secret_ref);
3857         return tag_ptr(ret_conv, true);
3858 }
3859
3860 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) {
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         LDKHolderCommitmentTransaction commitment_tx_conv;
3865         commitment_tx_conv.inner = untag_ptr(commitment_tx);
3866         commitment_tx_conv.is_owned = ptr_is_owned(commitment_tx);
3867         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_conv);
3868         commitment_tx_conv.is_owned = false;
3869         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
3870         *ret_conv = (this_arg_conv->sign_holder_commitment_and_htlcs)(this_arg_conv->this_arg, &commitment_tx_conv);
3871         return tag_ptr(ret_conv, true);
3872 }
3873
3874 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) {
3875         void* this_arg_ptr = untag_ptr(this_arg);
3876         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
3877         LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
3878         LDKTransaction justice_tx_ref;
3879         justice_tx_ref.datalen = justice_tx->arr_len;
3880         justice_tx_ref.data = MALLOC(justice_tx_ref.datalen, "LDKTransaction Bytes");
3881         memcpy(justice_tx_ref.data, justice_tx->elems, justice_tx_ref.datalen); FREE(justice_tx);
3882         justice_tx_ref.data_is_owned = true;
3883         unsigned char per_commitment_key_arr[32];
3884         CHECK(per_commitment_key->arr_len == 32);
3885         memcpy(per_commitment_key_arr, per_commitment_key->elems, 32); FREE(per_commitment_key);
3886         unsigned char (*per_commitment_key_ref)[32] = &per_commitment_key_arr;
3887         LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
3888         *ret_conv = (this_arg_conv->sign_justice_revoked_output)(this_arg_conv->this_arg, justice_tx_ref, input, amount, per_commitment_key_ref);
3889         return tag_ptr(ret_conv, true);
3890 }
3891
3892 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) {
3893         void* this_arg_ptr = untag_ptr(this_arg);
3894         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
3895         LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
3896         LDKTransaction justice_tx_ref;
3897         justice_tx_ref.datalen = justice_tx->arr_len;
3898         justice_tx_ref.data = MALLOC(justice_tx_ref.datalen, "LDKTransaction Bytes");
3899         memcpy(justice_tx_ref.data, justice_tx->elems, justice_tx_ref.datalen); FREE(justice_tx);
3900         justice_tx_ref.data_is_owned = true;
3901         unsigned char per_commitment_key_arr[32];
3902         CHECK(per_commitment_key->arr_len == 32);
3903         memcpy(per_commitment_key_arr, per_commitment_key->elems, 32); FREE(per_commitment_key);
3904         unsigned char (*per_commitment_key_ref)[32] = &per_commitment_key_arr;
3905         LDKHTLCOutputInCommitment htlc_conv;
3906         htlc_conv.inner = untag_ptr(htlc);
3907         htlc_conv.is_owned = ptr_is_owned(htlc);
3908         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
3909         htlc_conv.is_owned = false;
3910         LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
3911         *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);
3912         return tag_ptr(ret_conv, true);
3913 }
3914
3915 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) {
3916         void* this_arg_ptr = untag_ptr(this_arg);
3917         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
3918         LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
3919         LDKTransaction htlc_tx_ref;
3920         htlc_tx_ref.datalen = htlc_tx->arr_len;
3921         htlc_tx_ref.data = MALLOC(htlc_tx_ref.datalen, "LDKTransaction Bytes");
3922         memcpy(htlc_tx_ref.data, htlc_tx->elems, htlc_tx_ref.datalen); FREE(htlc_tx);
3923         htlc_tx_ref.data_is_owned = true;
3924         LDKPublicKey per_commitment_point_ref;
3925         CHECK(per_commitment_point->arr_len == 33);
3926         memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33); FREE(per_commitment_point);
3927         LDKHTLCOutputInCommitment htlc_conv;
3928         htlc_conv.inner = untag_ptr(htlc);
3929         htlc_conv.is_owned = ptr_is_owned(htlc);
3930         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
3931         htlc_conv.is_owned = false;
3932         LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
3933         *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);
3934         return tag_ptr(ret_conv, true);
3935 }
3936
3937 uint64_t  __attribute__((export_name("TS_BaseSign_sign_closing_transaction"))) TS_BaseSign_sign_closing_transaction(uint64_t this_arg, uint64_t closing_tx) {
3938         void* this_arg_ptr = untag_ptr(this_arg);
3939         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
3940         LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
3941         LDKClosingTransaction closing_tx_conv;
3942         closing_tx_conv.inner = untag_ptr(closing_tx);
3943         closing_tx_conv.is_owned = ptr_is_owned(closing_tx);
3944         CHECK_INNER_FIELD_ACCESS_OR_NULL(closing_tx_conv);
3945         closing_tx_conv.is_owned = false;
3946         LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
3947         *ret_conv = (this_arg_conv->sign_closing_transaction)(this_arg_conv->this_arg, &closing_tx_conv);
3948         return tag_ptr(ret_conv, true);
3949 }
3950
3951 uint64_t  __attribute__((export_name("TS_BaseSign_sign_channel_announcement"))) TS_BaseSign_sign_channel_announcement(uint64_t this_arg, uint64_t msg) {
3952         void* this_arg_ptr = untag_ptr(this_arg);
3953         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
3954         LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
3955         LDKUnsignedChannelAnnouncement msg_conv;
3956         msg_conv.inner = untag_ptr(msg);
3957         msg_conv.is_owned = ptr_is_owned(msg);
3958         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
3959         msg_conv.is_owned = false;
3960         LDKCResult_C2Tuple_SignatureSignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureSignatureZNoneZ), "LDKCResult_C2Tuple_SignatureSignatureZNoneZ");
3961         *ret_conv = (this_arg_conv->sign_channel_announcement)(this_arg_conv->this_arg, &msg_conv);
3962         return tag_ptr(ret_conv, true);
3963 }
3964
3965 void  __attribute__((export_name("TS_BaseSign_ready_channel"))) TS_BaseSign_ready_channel(uint64_t this_arg, uint64_t channel_parameters) {
3966         void* this_arg_ptr = untag_ptr(this_arg);
3967         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
3968         LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
3969         LDKChannelTransactionParameters channel_parameters_conv;
3970         channel_parameters_conv.inner = untag_ptr(channel_parameters);
3971         channel_parameters_conv.is_owned = ptr_is_owned(channel_parameters);
3972         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_conv);
3973         channel_parameters_conv.is_owned = false;
3974         (this_arg_conv->ready_channel)(this_arg_conv->this_arg, &channel_parameters_conv);
3975 }
3976
3977 LDKChannelPublicKeys LDKBaseSign_set_get_pubkeys(LDKBaseSign* this_arg) {
3978         if (this_arg->set_pubkeys != NULL)
3979                 this_arg->set_pubkeys(this_arg);
3980         return this_arg->pubkeys;
3981 }
3982 uint64_t  __attribute__((export_name("TS_BaseSign_get_pubkeys"))) TS_BaseSign_get_pubkeys(uint64_t this_arg) {
3983         void* this_arg_ptr = untag_ptr(this_arg);
3984         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
3985         LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
3986         LDKChannelPublicKeys ret_var = LDKBaseSign_set_get_pubkeys(this_arg_conv);
3987         uint64_t ret_ref = 0;
3988         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3989         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3990         return ret_ref;
3991 }
3992
3993 typedef struct LDKSign_JCalls {
3994         atomic_size_t refcnt;
3995         uint32_t instance_ptr;
3996         LDKBaseSign_JCalls* BaseSign;
3997 } LDKSign_JCalls;
3998 static void LDKSign_JCalls_free(void* this_arg) {
3999         LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg;
4000         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4001                 FREE(j_calls);
4002         }
4003 }
4004 LDKCVec_u8Z write_LDKSign_jcall(const void* this_arg) {
4005         LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg;
4006         int8_tArray ret = (int8_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 15, 0, 0, 0, 0, 0, 0);
4007         LDKCVec_u8Z ret_ref;
4008         ret_ref.datalen = ret->arr_len;
4009         ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
4010         memcpy(ret_ref.data, ret->elems, ret_ref.datalen); FREE(ret);
4011         return ret_ref;
4012 }
4013 static void LDKSign_JCalls_cloned(LDKSign* new_obj) {
4014         LDKSign_JCalls *j_calls = (LDKSign_JCalls*) new_obj->this_arg;
4015         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
4016         atomic_fetch_add_explicit(&j_calls->BaseSign->refcnt, 1, memory_order_release);
4017 }
4018 static inline LDKSign LDKSign_init (JSValue o, JSValue BaseSign, uint64_t pubkeys) {
4019         LDKSign_JCalls *calls = MALLOC(sizeof(LDKSign_JCalls), "LDKSign_JCalls");
4020         atomic_init(&calls->refcnt, 1);
4021         calls->instance_ptr = o;
4022
4023         LDKChannelPublicKeys pubkeys_conv;
4024         pubkeys_conv.inner = untag_ptr(pubkeys);
4025         pubkeys_conv.is_owned = ptr_is_owned(pubkeys);
4026         CHECK_INNER_FIELD_ACCESS_OR_NULL(pubkeys_conv);
4027
4028         LDKSign ret = {
4029                 .this_arg = (void*) calls,
4030                 .write = write_LDKSign_jcall,
4031                 .cloned = LDKSign_JCalls_cloned,
4032                 .free = LDKSign_JCalls_free,
4033                 .BaseSign = LDKBaseSign_init(BaseSign, pubkeys),
4034         };
4035         calls->BaseSign = ret.BaseSign.this_arg;
4036         return ret;
4037 }
4038 uint64_t  __attribute__((export_name("TS_LDKSign_new"))) TS_LDKSign_new(JSValue o, JSValue BaseSign, uint64_t pubkeys) {
4039         LDKSign *res_ptr = MALLOC(sizeof(LDKSign), "LDKSign");
4040         *res_ptr = LDKSign_init(o, BaseSign, pubkeys);
4041         return tag_ptr(res_ptr, true);
4042 }
4043 int8_tArray  __attribute__((export_name("TS_Sign_write"))) TS_Sign_write(uint64_t this_arg) {
4044         void* this_arg_ptr = untag_ptr(this_arg);
4045         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4046         LDKSign* this_arg_conv = (LDKSign*)this_arg_ptr;
4047         LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
4048         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
4049         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
4050         CVec_u8Z_free(ret_var);
4051         return ret_arr;
4052 }
4053
4054 static inline struct LDKSign CResult_SignDecodeErrorZ_get_ok(LDKCResult_SignDecodeErrorZ *NONNULL_PTR owner){
4055 CHECK(owner->result_ok);
4056         return Sign_clone(&*owner->contents.result);
4057 }
4058 uint64_t  __attribute__((export_name("TS_CResult_SignDecodeErrorZ_get_ok"))) TS_CResult_SignDecodeErrorZ_get_ok(uint64_t owner) {
4059         LDKCResult_SignDecodeErrorZ* owner_conv = (LDKCResult_SignDecodeErrorZ*)untag_ptr(owner);
4060         LDKSign* ret_ret = MALLOC(sizeof(LDKSign), "LDKSign");
4061         *ret_ret = CResult_SignDecodeErrorZ_get_ok(owner_conv);
4062         return tag_ptr(ret_ret, true);
4063 }
4064
4065 static inline struct LDKDecodeError CResult_SignDecodeErrorZ_get_err(LDKCResult_SignDecodeErrorZ *NONNULL_PTR owner){
4066 CHECK(!owner->result_ok);
4067         return DecodeError_clone(&*owner->contents.err);
4068 }
4069 uint64_t  __attribute__((export_name("TS_CResult_SignDecodeErrorZ_get_err"))) TS_CResult_SignDecodeErrorZ_get_err(uint64_t owner) {
4070         LDKCResult_SignDecodeErrorZ* owner_conv = (LDKCResult_SignDecodeErrorZ*)untag_ptr(owner);
4071         LDKDecodeError ret_var = CResult_SignDecodeErrorZ_get_err(owner_conv);
4072         uint64_t ret_ref = 0;
4073         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4074         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4075         return ret_ref;
4076 }
4077
4078 static inline struct LDKRecoverableSignature CResult_RecoverableSignatureNoneZ_get_ok(LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR owner){
4079 CHECK(owner->result_ok);
4080         return *owner->contents.result;
4081 }
4082 int8_tArray  __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_get_ok"))) TS_CResult_RecoverableSignatureNoneZ_get_ok(uint64_t owner) {
4083         LDKCResult_RecoverableSignatureNoneZ* owner_conv = (LDKCResult_RecoverableSignatureNoneZ*)untag_ptr(owner);
4084         int8_tArray ret_arr = init_int8_tArray(68, __LINE__);
4085         memcpy(ret_arr->elems, CResult_RecoverableSignatureNoneZ_get_ok(owner_conv).serialized_form, 68);
4086         return ret_arr;
4087 }
4088
4089 static inline void CResult_RecoverableSignatureNoneZ_get_err(LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR owner){
4090 CHECK(!owner->result_ok);
4091         return *owner->contents.err;
4092 }
4093 void  __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_get_err"))) TS_CResult_RecoverableSignatureNoneZ_get_err(uint64_t owner) {
4094         LDKCResult_RecoverableSignatureNoneZ* owner_conv = (LDKCResult_RecoverableSignatureNoneZ*)untag_ptr(owner);
4095         CResult_RecoverableSignatureNoneZ_get_err(owner_conv);
4096 }
4097
4098 static inline LDKCVec_CVec_u8ZZ CVec_CVec_u8ZZ_clone(const LDKCVec_CVec_u8ZZ *orig) {
4099         LDKCVec_CVec_u8ZZ ret = { .data = MALLOC(sizeof(LDKCVec_u8Z) * orig->datalen, "LDKCVec_CVec_u8ZZ clone bytes"), .datalen = orig->datalen };
4100         for (size_t i = 0; i < ret.datalen; i++) {
4101                 ret.data[i] = CVec_u8Z_clone(&orig->data[i]);
4102         }
4103         return ret;
4104 }
4105 static inline struct LDKCVec_CVec_u8ZZ CResult_CVec_CVec_u8ZZNoneZ_get_ok(LDKCResult_CVec_CVec_u8ZZNoneZ *NONNULL_PTR owner){
4106 CHECK(owner->result_ok);
4107         return CVec_CVec_u8ZZ_clone(&*owner->contents.result);
4108 }
4109 ptrArray  __attribute__((export_name("TS_CResult_CVec_CVec_u8ZZNoneZ_get_ok"))) TS_CResult_CVec_CVec_u8ZZNoneZ_get_ok(uint64_t owner) {
4110         LDKCResult_CVec_CVec_u8ZZNoneZ* owner_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)untag_ptr(owner);
4111         LDKCVec_CVec_u8ZZ ret_var = CResult_CVec_CVec_u8ZZNoneZ_get_ok(owner_conv);
4112         ptrArray ret_arr = NULL;
4113         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
4114         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
4115         for (size_t m = 0; m < ret_var.datalen; m++) {
4116                 LDKCVec_u8Z ret_conv_12_var = ret_var.data[m];
4117                 int8_tArray ret_conv_12_arr = init_int8_tArray(ret_conv_12_var.datalen, __LINE__);
4118                 memcpy(ret_conv_12_arr->elems, ret_conv_12_var.data, ret_conv_12_var.datalen);
4119                 CVec_u8Z_free(ret_conv_12_var);
4120                 ret_arr_ptr[m] = ret_conv_12_arr;
4121         }
4122         
4123         FREE(ret_var.data);
4124         return ret_arr;
4125 }
4126
4127 static inline void CResult_CVec_CVec_u8ZZNoneZ_get_err(LDKCResult_CVec_CVec_u8ZZNoneZ *NONNULL_PTR owner){
4128 CHECK(!owner->result_ok);
4129         return *owner->contents.err;
4130 }
4131 void  __attribute__((export_name("TS_CResult_CVec_CVec_u8ZZNoneZ_get_err"))) TS_CResult_CVec_CVec_u8ZZNoneZ_get_err(uint64_t owner) {
4132         LDKCResult_CVec_CVec_u8ZZNoneZ* owner_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)untag_ptr(owner);
4133         CResult_CVec_CVec_u8ZZNoneZ_get_err(owner_conv);
4134 }
4135
4136 static inline struct LDKInMemorySigner CResult_InMemorySignerDecodeErrorZ_get_ok(LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR owner){
4137 CHECK(owner->result_ok);
4138         return InMemorySigner_clone(&*owner->contents.result);
4139 }
4140 uint64_t  __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_get_ok"))) TS_CResult_InMemorySignerDecodeErrorZ_get_ok(uint64_t owner) {
4141         LDKCResult_InMemorySignerDecodeErrorZ* owner_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)untag_ptr(owner);
4142         LDKInMemorySigner ret_var = CResult_InMemorySignerDecodeErrorZ_get_ok(owner_conv);
4143         uint64_t ret_ref = 0;
4144         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4145         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4146         return ret_ref;
4147 }
4148
4149 static inline struct LDKDecodeError CResult_InMemorySignerDecodeErrorZ_get_err(LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR owner){
4150 CHECK(!owner->result_ok);
4151         return DecodeError_clone(&*owner->contents.err);
4152 }
4153 uint64_t  __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_get_err"))) TS_CResult_InMemorySignerDecodeErrorZ_get_err(uint64_t owner) {
4154         LDKCResult_InMemorySignerDecodeErrorZ* owner_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)untag_ptr(owner);
4155         LDKDecodeError ret_var = CResult_InMemorySignerDecodeErrorZ_get_err(owner_conv);
4156         uint64_t ret_ref = 0;
4157         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4158         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4159         return ret_ref;
4160 }
4161
4162 static inline LDKCVec_TxOutZ CVec_TxOutZ_clone(const LDKCVec_TxOutZ *orig) {
4163         LDKCVec_TxOutZ ret = { .data = MALLOC(sizeof(LDKTxOut) * orig->datalen, "LDKCVec_TxOutZ clone bytes"), .datalen = orig->datalen };
4164         for (size_t i = 0; i < ret.datalen; i++) {
4165                 ret.data[i] = TxOut_clone(&orig->data[i]);
4166         }
4167         return ret;
4168 }
4169 static inline struct LDKTransaction CResult_TransactionNoneZ_get_ok(LDKCResult_TransactionNoneZ *NONNULL_PTR owner){
4170 CHECK(owner->result_ok);
4171         return *owner->contents.result;
4172 }
4173 int8_tArray  __attribute__((export_name("TS_CResult_TransactionNoneZ_get_ok"))) TS_CResult_TransactionNoneZ_get_ok(uint64_t owner) {
4174         LDKCResult_TransactionNoneZ* owner_conv = (LDKCResult_TransactionNoneZ*)untag_ptr(owner);
4175         LDKTransaction ret_var = CResult_TransactionNoneZ_get_ok(owner_conv);
4176         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
4177         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
4178         return ret_arr;
4179 }
4180
4181 static inline void CResult_TransactionNoneZ_get_err(LDKCResult_TransactionNoneZ *NONNULL_PTR owner){
4182 CHECK(!owner->result_ok);
4183         return *owner->contents.err;
4184 }
4185 void  __attribute__((export_name("TS_CResult_TransactionNoneZ_get_err"))) TS_CResult_TransactionNoneZ_get_err(uint64_t owner) {
4186         LDKCResult_TransactionNoneZ* owner_conv = (LDKCResult_TransactionNoneZ*)untag_ptr(owner);
4187         CResult_TransactionNoneZ_get_err(owner_conv);
4188 }
4189
4190 uint32_t __attribute__((export_name("TS_LDKCOption_u16Z_ty_from_ptr"))) TS_LDKCOption_u16Z_ty_from_ptr(uint64_t ptr) {
4191         LDKCOption_u16Z *obj = (LDKCOption_u16Z*)untag_ptr(ptr);
4192         switch(obj->tag) {
4193                 case LDKCOption_u16Z_Some: return 0;
4194                 case LDKCOption_u16Z_None: return 1;
4195                 default: abort();
4196         }
4197 }
4198 int16_t __attribute__((export_name("TS_LDKCOption_u16Z_Some_get_some"))) TS_LDKCOption_u16Z_Some_get_some(uint64_t ptr) {
4199         LDKCOption_u16Z *obj = (LDKCOption_u16Z*)untag_ptr(ptr);
4200         assert(obj->tag == LDKCOption_u16Z_Some);
4201                         int16_t some_conv = obj->some;
4202         return some_conv;
4203 }
4204 uint32_t __attribute__((export_name("TS_LDKAPIError_ty_from_ptr"))) TS_LDKAPIError_ty_from_ptr(uint64_t ptr) {
4205         LDKAPIError *obj = (LDKAPIError*)untag_ptr(ptr);
4206         switch(obj->tag) {
4207                 case LDKAPIError_APIMisuseError: return 0;
4208                 case LDKAPIError_FeeRateTooHigh: return 1;
4209                 case LDKAPIError_RouteError: return 2;
4210                 case LDKAPIError_ChannelUnavailable: return 3;
4211                 case LDKAPIError_MonitorUpdateFailed: return 4;
4212                 case LDKAPIError_IncompatibleShutdownScript: return 5;
4213                 default: abort();
4214         }
4215 }
4216 jstring __attribute__((export_name("TS_LDKAPIError_APIMisuseError_get_err"))) TS_LDKAPIError_APIMisuseError_get_err(uint64_t ptr) {
4217         LDKAPIError *obj = (LDKAPIError*)untag_ptr(ptr);
4218         assert(obj->tag == LDKAPIError_APIMisuseError);
4219                         LDKStr err_str = obj->api_misuse_error.err;
4220                         jstring err_conv = str_ref_to_ts(err_str.chars, err_str.len);
4221         return err_conv;
4222 }
4223 jstring __attribute__((export_name("TS_LDKAPIError_FeeRateTooHigh_get_err"))) TS_LDKAPIError_FeeRateTooHigh_get_err(uint64_t ptr) {
4224         LDKAPIError *obj = (LDKAPIError*)untag_ptr(ptr);
4225         assert(obj->tag == LDKAPIError_FeeRateTooHigh);
4226                         LDKStr err_str = obj->fee_rate_too_high.err;
4227                         jstring err_conv = str_ref_to_ts(err_str.chars, err_str.len);
4228         return err_conv;
4229 }
4230 int32_t __attribute__((export_name("TS_LDKAPIError_FeeRateTooHigh_get_feerate"))) TS_LDKAPIError_FeeRateTooHigh_get_feerate(uint64_t ptr) {
4231         LDKAPIError *obj = (LDKAPIError*)untag_ptr(ptr);
4232         assert(obj->tag == LDKAPIError_FeeRateTooHigh);
4233                         int32_t feerate_conv = obj->fee_rate_too_high.feerate;
4234         return feerate_conv;
4235 }
4236 jstring __attribute__((export_name("TS_LDKAPIError_RouteError_get_err"))) TS_LDKAPIError_RouteError_get_err(uint64_t ptr) {
4237         LDKAPIError *obj = (LDKAPIError*)untag_ptr(ptr);
4238         assert(obj->tag == LDKAPIError_RouteError);
4239                         LDKStr err_str = obj->route_error.err;
4240                         jstring err_conv = str_ref_to_ts(err_str.chars, err_str.len);
4241         return err_conv;
4242 }
4243 jstring __attribute__((export_name("TS_LDKAPIError_ChannelUnavailable_get_err"))) TS_LDKAPIError_ChannelUnavailable_get_err(uint64_t ptr) {
4244         LDKAPIError *obj = (LDKAPIError*)untag_ptr(ptr);
4245         assert(obj->tag == LDKAPIError_ChannelUnavailable);
4246                         LDKStr err_str = obj->channel_unavailable.err;
4247                         jstring err_conv = str_ref_to_ts(err_str.chars, err_str.len);
4248         return err_conv;
4249 }
4250 uint64_t __attribute__((export_name("TS_LDKAPIError_IncompatibleShutdownScript_get_script"))) TS_LDKAPIError_IncompatibleShutdownScript_get_script(uint64_t ptr) {
4251         LDKAPIError *obj = (LDKAPIError*)untag_ptr(ptr);
4252         assert(obj->tag == LDKAPIError_IncompatibleShutdownScript);
4253                         LDKShutdownScript script_var = obj->incompatible_shutdown_script.script;
4254                         uint64_t script_ref = 0;
4255                         CHECK_INNER_FIELD_ACCESS_OR_NULL(script_var);
4256                         script_ref = tag_ptr(script_var.inner, false);
4257         return script_ref;
4258 }
4259 static inline void CResult_NoneAPIErrorZ_get_ok(LDKCResult_NoneAPIErrorZ *NONNULL_PTR owner){
4260 CHECK(owner->result_ok);
4261         return *owner->contents.result;
4262 }
4263 void  __attribute__((export_name("TS_CResult_NoneAPIErrorZ_get_ok"))) TS_CResult_NoneAPIErrorZ_get_ok(uint64_t owner) {
4264         LDKCResult_NoneAPIErrorZ* owner_conv = (LDKCResult_NoneAPIErrorZ*)untag_ptr(owner);
4265         CResult_NoneAPIErrorZ_get_ok(owner_conv);
4266 }
4267
4268 static inline struct LDKAPIError CResult_NoneAPIErrorZ_get_err(LDKCResult_NoneAPIErrorZ *NONNULL_PTR owner){
4269 CHECK(!owner->result_ok);
4270         return APIError_clone(&*owner->contents.err);
4271 }
4272 uint64_t  __attribute__((export_name("TS_CResult_NoneAPIErrorZ_get_err"))) TS_CResult_NoneAPIErrorZ_get_err(uint64_t owner) {
4273         LDKCResult_NoneAPIErrorZ* owner_conv = (LDKCResult_NoneAPIErrorZ*)untag_ptr(owner);
4274         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
4275         *ret_copy = CResult_NoneAPIErrorZ_get_err(owner_conv);
4276         uint64_t ret_ref = tag_ptr(ret_copy, true);
4277         return ret_ref;
4278 }
4279
4280 static inline LDKCVec_CResult_NoneAPIErrorZZ CVec_CResult_NoneAPIErrorZZ_clone(const LDKCVec_CResult_NoneAPIErrorZZ *orig) {
4281         LDKCVec_CResult_NoneAPIErrorZZ ret = { .data = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ) * orig->datalen, "LDKCVec_CResult_NoneAPIErrorZZ clone bytes"), .datalen = orig->datalen };
4282         for (size_t i = 0; i < ret.datalen; i++) {
4283                 ret.data[i] = CResult_NoneAPIErrorZ_clone(&orig->data[i]);
4284         }
4285         return ret;
4286 }
4287 static inline LDKCVec_APIErrorZ CVec_APIErrorZ_clone(const LDKCVec_APIErrorZ *orig) {
4288         LDKCVec_APIErrorZ ret = { .data = MALLOC(sizeof(LDKAPIError) * orig->datalen, "LDKCVec_APIErrorZ clone bytes"), .datalen = orig->datalen };
4289         for (size_t i = 0; i < ret.datalen; i++) {
4290                 ret.data[i] = APIError_clone(&orig->data[i]);
4291         }
4292         return ret;
4293 }
4294 static inline struct LDKThirtyTwoBytes CResult__u832APIErrorZ_get_ok(LDKCResult__u832APIErrorZ *NONNULL_PTR owner){
4295 CHECK(owner->result_ok);
4296         return ThirtyTwoBytes_clone(&*owner->contents.result);
4297 }
4298 int8_tArray  __attribute__((export_name("TS_CResult__u832APIErrorZ_get_ok"))) TS_CResult__u832APIErrorZ_get_ok(uint64_t owner) {
4299         LDKCResult__u832APIErrorZ* owner_conv = (LDKCResult__u832APIErrorZ*)untag_ptr(owner);
4300         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
4301         memcpy(ret_arr->elems, CResult__u832APIErrorZ_get_ok(owner_conv).data, 32);
4302         return ret_arr;
4303 }
4304
4305 static inline struct LDKAPIError CResult__u832APIErrorZ_get_err(LDKCResult__u832APIErrorZ *NONNULL_PTR owner){
4306 CHECK(!owner->result_ok);
4307         return APIError_clone(&*owner->contents.err);
4308 }
4309 uint64_t  __attribute__((export_name("TS_CResult__u832APIErrorZ_get_err"))) TS_CResult__u832APIErrorZ_get_err(uint64_t owner) {
4310         LDKCResult__u832APIErrorZ* owner_conv = (LDKCResult__u832APIErrorZ*)untag_ptr(owner);
4311         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
4312         *ret_copy = CResult__u832APIErrorZ_get_err(owner_conv);
4313         uint64_t ret_ref = tag_ptr(ret_copy, true);
4314         return ret_ref;
4315 }
4316
4317 uint32_t __attribute__((export_name("TS_LDKPaymentSendFailure_ty_from_ptr"))) TS_LDKPaymentSendFailure_ty_from_ptr(uint64_t ptr) {
4318         LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)untag_ptr(ptr);
4319         switch(obj->tag) {
4320                 case LDKPaymentSendFailure_ParameterError: return 0;
4321                 case LDKPaymentSendFailure_PathParameterError: return 1;
4322                 case LDKPaymentSendFailure_AllFailedRetrySafe: return 2;
4323                 case LDKPaymentSendFailure_PartialFailure: return 3;
4324                 default: abort();
4325         }
4326 }
4327 uint64_t __attribute__((export_name("TS_LDKPaymentSendFailure_ParameterError_get_parameter_error"))) TS_LDKPaymentSendFailure_ParameterError_get_parameter_error(uint64_t ptr) {
4328         LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)untag_ptr(ptr);
4329         assert(obj->tag == LDKPaymentSendFailure_ParameterError);
4330                         uint64_t parameter_error_ref = tag_ptr(&obj->parameter_error, false);
4331         return parameter_error_ref;
4332 }
4333 uint64_tArray __attribute__((export_name("TS_LDKPaymentSendFailure_PathParameterError_get_path_parameter_error"))) TS_LDKPaymentSendFailure_PathParameterError_get_path_parameter_error(uint64_t ptr) {
4334         LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)untag_ptr(ptr);
4335         assert(obj->tag == LDKPaymentSendFailure_PathParameterError);
4336                         LDKCVec_CResult_NoneAPIErrorZZ path_parameter_error_var = obj->path_parameter_error;
4337                         uint64_tArray path_parameter_error_arr = NULL;
4338                         path_parameter_error_arr = init_uint64_tArray(path_parameter_error_var.datalen, __LINE__);
4339                         uint64_t *path_parameter_error_arr_ptr = (uint64_t*)(((uint8_t*)path_parameter_error_arr) + 8);
4340                         for (size_t w = 0; w < path_parameter_error_var.datalen; w++) {
4341                                 LDKCResult_NoneAPIErrorZ* path_parameter_error_conv_22_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
4342                                 *path_parameter_error_conv_22_conv = path_parameter_error_var.data[w];
4343                                 *path_parameter_error_conv_22_conv = CResult_NoneAPIErrorZ_clone(path_parameter_error_conv_22_conv);
4344                                 path_parameter_error_arr_ptr[w] = tag_ptr(path_parameter_error_conv_22_conv, true);
4345                         }
4346                         
4347         return path_parameter_error_arr;
4348 }
4349 uint64_tArray __attribute__((export_name("TS_LDKPaymentSendFailure_AllFailedRetrySafe_get_all_failed_retry_safe"))) TS_LDKPaymentSendFailure_AllFailedRetrySafe_get_all_failed_retry_safe(uint64_t ptr) {
4350         LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)untag_ptr(ptr);
4351         assert(obj->tag == LDKPaymentSendFailure_AllFailedRetrySafe);
4352                         LDKCVec_APIErrorZ all_failed_retry_safe_var = obj->all_failed_retry_safe;
4353                         uint64_tArray all_failed_retry_safe_arr = NULL;
4354                         all_failed_retry_safe_arr = init_uint64_tArray(all_failed_retry_safe_var.datalen, __LINE__);
4355                         uint64_t *all_failed_retry_safe_arr_ptr = (uint64_t*)(((uint8_t*)all_failed_retry_safe_arr) + 8);
4356                         for (size_t k = 0; k < all_failed_retry_safe_var.datalen; k++) {
4357                                 uint64_t all_failed_retry_safe_conv_10_ref = tag_ptr(&all_failed_retry_safe_var.data[k], false);
4358                                 all_failed_retry_safe_arr_ptr[k] = all_failed_retry_safe_conv_10_ref;
4359                         }
4360                         
4361         return all_failed_retry_safe_arr;
4362 }
4363 uint64_tArray __attribute__((export_name("TS_LDKPaymentSendFailure_PartialFailure_get_results"))) TS_LDKPaymentSendFailure_PartialFailure_get_results(uint64_t ptr) {
4364         LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)untag_ptr(ptr);
4365         assert(obj->tag == LDKPaymentSendFailure_PartialFailure);
4366                         LDKCVec_CResult_NoneAPIErrorZZ results_var = obj->partial_failure.results;
4367                         uint64_tArray results_arr = NULL;
4368                         results_arr = init_uint64_tArray(results_var.datalen, __LINE__);
4369                         uint64_t *results_arr_ptr = (uint64_t*)(((uint8_t*)results_arr) + 8);
4370                         for (size_t w = 0; w < results_var.datalen; w++) {
4371                                 LDKCResult_NoneAPIErrorZ* results_conv_22_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
4372                                 *results_conv_22_conv = results_var.data[w];
4373                                 *results_conv_22_conv = CResult_NoneAPIErrorZ_clone(results_conv_22_conv);
4374                                 results_arr_ptr[w] = tag_ptr(results_conv_22_conv, true);
4375                         }
4376                         
4377         return results_arr;
4378 }
4379 uint64_t __attribute__((export_name("TS_LDKPaymentSendFailure_PartialFailure_get_failed_paths_retry"))) TS_LDKPaymentSendFailure_PartialFailure_get_failed_paths_retry(uint64_t ptr) {
4380         LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)untag_ptr(ptr);
4381         assert(obj->tag == LDKPaymentSendFailure_PartialFailure);
4382                         LDKRouteParameters failed_paths_retry_var = obj->partial_failure.failed_paths_retry;
4383                         uint64_t failed_paths_retry_ref = 0;
4384                         CHECK_INNER_FIELD_ACCESS_OR_NULL(failed_paths_retry_var);
4385                         failed_paths_retry_ref = tag_ptr(failed_paths_retry_var.inner, false);
4386         return failed_paths_retry_ref;
4387 }
4388 int8_tArray __attribute__((export_name("TS_LDKPaymentSendFailure_PartialFailure_get_payment_id"))) TS_LDKPaymentSendFailure_PartialFailure_get_payment_id(uint64_t ptr) {
4389         LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)untag_ptr(ptr);
4390         assert(obj->tag == LDKPaymentSendFailure_PartialFailure);
4391                         int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
4392                         memcpy(payment_id_arr->elems, obj->partial_failure.payment_id.data, 32);
4393         return payment_id_arr;
4394 }
4395 static inline struct LDKThirtyTwoBytes CResult_PaymentIdPaymentSendFailureZ_get_ok(LDKCResult_PaymentIdPaymentSendFailureZ *NONNULL_PTR owner){
4396 CHECK(owner->result_ok);
4397         return ThirtyTwoBytes_clone(&*owner->contents.result);
4398 }
4399 int8_tArray  __attribute__((export_name("TS_CResult_PaymentIdPaymentSendFailureZ_get_ok"))) TS_CResult_PaymentIdPaymentSendFailureZ_get_ok(uint64_t owner) {
4400         LDKCResult_PaymentIdPaymentSendFailureZ* owner_conv = (LDKCResult_PaymentIdPaymentSendFailureZ*)untag_ptr(owner);
4401         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
4402         memcpy(ret_arr->elems, CResult_PaymentIdPaymentSendFailureZ_get_ok(owner_conv).data, 32);
4403         return ret_arr;
4404 }
4405
4406 static inline struct LDKPaymentSendFailure CResult_PaymentIdPaymentSendFailureZ_get_err(LDKCResult_PaymentIdPaymentSendFailureZ *NONNULL_PTR owner){
4407 CHECK(!owner->result_ok);
4408         return PaymentSendFailure_clone(&*owner->contents.err);
4409 }
4410 uint64_t  __attribute__((export_name("TS_CResult_PaymentIdPaymentSendFailureZ_get_err"))) TS_CResult_PaymentIdPaymentSendFailureZ_get_err(uint64_t owner) {
4411         LDKCResult_PaymentIdPaymentSendFailureZ* owner_conv = (LDKCResult_PaymentIdPaymentSendFailureZ*)untag_ptr(owner);
4412         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
4413         *ret_copy = CResult_PaymentIdPaymentSendFailureZ_get_err(owner_conv);
4414         uint64_t ret_ref = tag_ptr(ret_copy, true);
4415         return ret_ref;
4416 }
4417
4418 static inline void CResult_NonePaymentSendFailureZ_get_ok(LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR owner){
4419 CHECK(owner->result_ok);
4420         return *owner->contents.result;
4421 }
4422 void  __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_get_ok"))) TS_CResult_NonePaymentSendFailureZ_get_ok(uint64_t owner) {
4423         LDKCResult_NonePaymentSendFailureZ* owner_conv = (LDKCResult_NonePaymentSendFailureZ*)untag_ptr(owner);
4424         CResult_NonePaymentSendFailureZ_get_ok(owner_conv);
4425 }
4426
4427 static inline struct LDKPaymentSendFailure CResult_NonePaymentSendFailureZ_get_err(LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR owner){
4428 CHECK(!owner->result_ok);
4429         return PaymentSendFailure_clone(&*owner->contents.err);
4430 }
4431 uint64_t  __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_get_err"))) TS_CResult_NonePaymentSendFailureZ_get_err(uint64_t owner) {
4432         LDKCResult_NonePaymentSendFailureZ* owner_conv = (LDKCResult_NonePaymentSendFailureZ*)untag_ptr(owner);
4433         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
4434         *ret_copy = CResult_NonePaymentSendFailureZ_get_err(owner_conv);
4435         uint64_t ret_ref = tag_ptr(ret_copy, true);
4436         return ret_ref;
4437 }
4438
4439 static inline struct LDKThirtyTwoBytes C2Tuple_PaymentHashPaymentIdZ_get_a(LDKC2Tuple_PaymentHashPaymentIdZ *NONNULL_PTR owner){
4440         return ThirtyTwoBytes_clone(&owner->a);
4441 }
4442 int8_tArray  __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentIdZ_get_a"))) TS_C2Tuple_PaymentHashPaymentIdZ_get_a(uint64_t owner) {
4443         LDKC2Tuple_PaymentHashPaymentIdZ* owner_conv = (LDKC2Tuple_PaymentHashPaymentIdZ*)untag_ptr(owner);
4444         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
4445         memcpy(ret_arr->elems, C2Tuple_PaymentHashPaymentIdZ_get_a(owner_conv).data, 32);
4446         return ret_arr;
4447 }
4448
4449 static inline struct LDKThirtyTwoBytes C2Tuple_PaymentHashPaymentIdZ_get_b(LDKC2Tuple_PaymentHashPaymentIdZ *NONNULL_PTR owner){
4450         return ThirtyTwoBytes_clone(&owner->b);
4451 }
4452 int8_tArray  __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentIdZ_get_b"))) TS_C2Tuple_PaymentHashPaymentIdZ_get_b(uint64_t owner) {
4453         LDKC2Tuple_PaymentHashPaymentIdZ* owner_conv = (LDKC2Tuple_PaymentHashPaymentIdZ*)untag_ptr(owner);
4454         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
4455         memcpy(ret_arr->elems, C2Tuple_PaymentHashPaymentIdZ_get_b(owner_conv).data, 32);
4456         return ret_arr;
4457 }
4458
4459 static inline struct LDKC2Tuple_PaymentHashPaymentIdZ CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_ok(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ *NONNULL_PTR owner){
4460 CHECK(owner->result_ok);
4461         return C2Tuple_PaymentHashPaymentIdZ_clone(&*owner->contents.result);
4462 }
4463 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_ok"))) TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_ok(uint64_t owner) {
4464         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* owner_conv = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)untag_ptr(owner);
4465         LDKC2Tuple_PaymentHashPaymentIdZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentIdZ), "LDKC2Tuple_PaymentHashPaymentIdZ");
4466         *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_ok(owner_conv);
4467         return tag_ptr(ret_conv, true);
4468 }
4469
4470 static inline struct LDKPaymentSendFailure CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_err(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ *NONNULL_PTR owner){
4471 CHECK(!owner->result_ok);
4472         return PaymentSendFailure_clone(&*owner->contents.err);
4473 }
4474 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_err"))) TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_err(uint64_t owner) {
4475         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* owner_conv = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)untag_ptr(owner);
4476         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
4477         *ret_copy = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_err(owner_conv);
4478         uint64_t ret_ref = tag_ptr(ret_copy, true);
4479         return ret_ref;
4480 }
4481
4482 static inline LDKCVec_ThirtyTwoBytesZ CVec_ThirtyTwoBytesZ_clone(const LDKCVec_ThirtyTwoBytesZ *orig) {
4483         LDKCVec_ThirtyTwoBytesZ ret = { .data = MALLOC(sizeof(LDKThirtyTwoBytes) * orig->datalen, "LDKCVec_ThirtyTwoBytesZ clone bytes"), .datalen = orig->datalen };
4484         for (size_t i = 0; i < ret.datalen; i++) {
4485                 ret.data[i] = ThirtyTwoBytes_clone(&orig->data[i]);
4486         }
4487         return ret;
4488 }
4489 static inline struct LDKThirtyTwoBytes C2Tuple_PaymentHashPaymentSecretZ_get_a(LDKC2Tuple_PaymentHashPaymentSecretZ *NONNULL_PTR owner){
4490         return ThirtyTwoBytes_clone(&owner->a);
4491 }
4492 int8_tArray  __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentSecretZ_get_a"))) TS_C2Tuple_PaymentHashPaymentSecretZ_get_a(uint64_t owner) {
4493         LDKC2Tuple_PaymentHashPaymentSecretZ* owner_conv = (LDKC2Tuple_PaymentHashPaymentSecretZ*)untag_ptr(owner);
4494         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
4495         memcpy(ret_arr->elems, C2Tuple_PaymentHashPaymentSecretZ_get_a(owner_conv).data, 32);
4496         return ret_arr;
4497 }
4498
4499 static inline struct LDKThirtyTwoBytes C2Tuple_PaymentHashPaymentSecretZ_get_b(LDKC2Tuple_PaymentHashPaymentSecretZ *NONNULL_PTR owner){
4500         return ThirtyTwoBytes_clone(&owner->b);
4501 }
4502 int8_tArray  __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentSecretZ_get_b"))) TS_C2Tuple_PaymentHashPaymentSecretZ_get_b(uint64_t owner) {
4503         LDKC2Tuple_PaymentHashPaymentSecretZ* owner_conv = (LDKC2Tuple_PaymentHashPaymentSecretZ*)untag_ptr(owner);
4504         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
4505         memcpy(ret_arr->elems, C2Tuple_PaymentHashPaymentSecretZ_get_b(owner_conv).data, 32);
4506         return ret_arr;
4507 }
4508
4509 static inline struct LDKC2Tuple_PaymentHashPaymentSecretZ CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_ok(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ *NONNULL_PTR owner){
4510 CHECK(owner->result_ok);
4511         return C2Tuple_PaymentHashPaymentSecretZ_clone(&*owner->contents.result);
4512 }
4513 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_ok"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_ok(uint64_t owner) {
4514         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* owner_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)untag_ptr(owner);
4515         LDKC2Tuple_PaymentHashPaymentSecretZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
4516         *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_ok(owner_conv);
4517         return tag_ptr(ret_conv, true);
4518 }
4519
4520 static inline void CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_err(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ *NONNULL_PTR owner){
4521 CHECK(!owner->result_ok);
4522         return *owner->contents.err;
4523 }
4524 void  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_err"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_err(uint64_t owner) {
4525         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* owner_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)untag_ptr(owner);
4526         CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_err(owner_conv);
4527 }
4528
4529 static inline struct LDKC2Tuple_PaymentHashPaymentSecretZ CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_get_ok(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ *NONNULL_PTR owner){
4530 CHECK(owner->result_ok);
4531         return C2Tuple_PaymentHashPaymentSecretZ_clone(&*owner->contents.result);
4532 }
4533 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_get_ok"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_get_ok(uint64_t owner) {
4534         LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* owner_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)untag_ptr(owner);
4535         LDKC2Tuple_PaymentHashPaymentSecretZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
4536         *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_get_ok(owner_conv);
4537         return tag_ptr(ret_conv, true);
4538 }
4539
4540 static inline struct LDKAPIError CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_get_err(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ *NONNULL_PTR owner){
4541 CHECK(!owner->result_ok);
4542         return APIError_clone(&*owner->contents.err);
4543 }
4544 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_get_err"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_get_err(uint64_t owner) {
4545         LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* owner_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)untag_ptr(owner);
4546         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
4547         *ret_copy = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_get_err(owner_conv);
4548         uint64_t ret_ref = tag_ptr(ret_copy, true);
4549         return ret_ref;
4550 }
4551
4552 static inline struct LDKThirtyTwoBytes CResult_PaymentSecretNoneZ_get_ok(LDKCResult_PaymentSecretNoneZ *NONNULL_PTR owner){
4553 CHECK(owner->result_ok);
4554         return ThirtyTwoBytes_clone(&*owner->contents.result);
4555 }
4556 int8_tArray  __attribute__((export_name("TS_CResult_PaymentSecretNoneZ_get_ok"))) TS_CResult_PaymentSecretNoneZ_get_ok(uint64_t owner) {
4557         LDKCResult_PaymentSecretNoneZ* owner_conv = (LDKCResult_PaymentSecretNoneZ*)untag_ptr(owner);
4558         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
4559         memcpy(ret_arr->elems, CResult_PaymentSecretNoneZ_get_ok(owner_conv).data, 32);
4560         return ret_arr;
4561 }
4562
4563 static inline void CResult_PaymentSecretNoneZ_get_err(LDKCResult_PaymentSecretNoneZ *NONNULL_PTR owner){
4564 CHECK(!owner->result_ok);
4565         return *owner->contents.err;
4566 }
4567 void  __attribute__((export_name("TS_CResult_PaymentSecretNoneZ_get_err"))) TS_CResult_PaymentSecretNoneZ_get_err(uint64_t owner) {
4568         LDKCResult_PaymentSecretNoneZ* owner_conv = (LDKCResult_PaymentSecretNoneZ*)untag_ptr(owner);
4569         CResult_PaymentSecretNoneZ_get_err(owner_conv);
4570 }
4571
4572 static inline struct LDKThirtyTwoBytes CResult_PaymentSecretAPIErrorZ_get_ok(LDKCResult_PaymentSecretAPIErrorZ *NONNULL_PTR owner){
4573 CHECK(owner->result_ok);
4574         return ThirtyTwoBytes_clone(&*owner->contents.result);
4575 }
4576 int8_tArray  __attribute__((export_name("TS_CResult_PaymentSecretAPIErrorZ_get_ok"))) TS_CResult_PaymentSecretAPIErrorZ_get_ok(uint64_t owner) {
4577         LDKCResult_PaymentSecretAPIErrorZ* owner_conv = (LDKCResult_PaymentSecretAPIErrorZ*)untag_ptr(owner);
4578         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
4579         memcpy(ret_arr->elems, CResult_PaymentSecretAPIErrorZ_get_ok(owner_conv).data, 32);
4580         return ret_arr;
4581 }
4582
4583 static inline struct LDKAPIError CResult_PaymentSecretAPIErrorZ_get_err(LDKCResult_PaymentSecretAPIErrorZ *NONNULL_PTR owner){
4584 CHECK(!owner->result_ok);
4585         return APIError_clone(&*owner->contents.err);
4586 }
4587 uint64_t  __attribute__((export_name("TS_CResult_PaymentSecretAPIErrorZ_get_err"))) TS_CResult_PaymentSecretAPIErrorZ_get_err(uint64_t owner) {
4588         LDKCResult_PaymentSecretAPIErrorZ* owner_conv = (LDKCResult_PaymentSecretAPIErrorZ*)untag_ptr(owner);
4589         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
4590         *ret_copy = CResult_PaymentSecretAPIErrorZ_get_err(owner_conv);
4591         uint64_t ret_ref = tag_ptr(ret_copy, true);
4592         return ret_ref;
4593 }
4594
4595 static inline struct LDKThirtyTwoBytes CResult_PaymentPreimageAPIErrorZ_get_ok(LDKCResult_PaymentPreimageAPIErrorZ *NONNULL_PTR owner){
4596 CHECK(owner->result_ok);
4597         return ThirtyTwoBytes_clone(&*owner->contents.result);
4598 }
4599 int8_tArray  __attribute__((export_name("TS_CResult_PaymentPreimageAPIErrorZ_get_ok"))) TS_CResult_PaymentPreimageAPIErrorZ_get_ok(uint64_t owner) {
4600         LDKCResult_PaymentPreimageAPIErrorZ* owner_conv = (LDKCResult_PaymentPreimageAPIErrorZ*)untag_ptr(owner);
4601         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
4602         memcpy(ret_arr->elems, CResult_PaymentPreimageAPIErrorZ_get_ok(owner_conv).data, 32);
4603         return ret_arr;
4604 }
4605
4606 static inline struct LDKAPIError CResult_PaymentPreimageAPIErrorZ_get_err(LDKCResult_PaymentPreimageAPIErrorZ *NONNULL_PTR owner){
4607 CHECK(!owner->result_ok);
4608         return APIError_clone(&*owner->contents.err);
4609 }
4610 uint64_t  __attribute__((export_name("TS_CResult_PaymentPreimageAPIErrorZ_get_err"))) TS_CResult_PaymentPreimageAPIErrorZ_get_err(uint64_t owner) {
4611         LDKCResult_PaymentPreimageAPIErrorZ* owner_conv = (LDKCResult_PaymentPreimageAPIErrorZ*)untag_ptr(owner);
4612         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
4613         *ret_copy = CResult_PaymentPreimageAPIErrorZ_get_err(owner_conv);
4614         uint64_t ret_ref = tag_ptr(ret_copy, true);
4615         return ret_ref;
4616 }
4617
4618 static inline struct LDKCounterpartyForwardingInfo CResult_CounterpartyForwardingInfoDecodeErrorZ_get_ok(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ *NONNULL_PTR owner){
4619 CHECK(owner->result_ok);
4620         return CounterpartyForwardingInfo_clone(&*owner->contents.result);
4621 }
4622 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_get_ok"))) TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_get_ok(uint64_t owner) {
4623         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)untag_ptr(owner);
4624         LDKCounterpartyForwardingInfo ret_var = CResult_CounterpartyForwardingInfoDecodeErrorZ_get_ok(owner_conv);
4625         uint64_t ret_ref = 0;
4626         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4627         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4628         return ret_ref;
4629 }
4630
4631 static inline struct LDKDecodeError CResult_CounterpartyForwardingInfoDecodeErrorZ_get_err(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ *NONNULL_PTR owner){
4632 CHECK(!owner->result_ok);
4633         return DecodeError_clone(&*owner->contents.err);
4634 }
4635 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_get_err"))) TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_get_err(uint64_t owner) {
4636         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)untag_ptr(owner);
4637         LDKDecodeError ret_var = CResult_CounterpartyForwardingInfoDecodeErrorZ_get_err(owner_conv);
4638         uint64_t ret_ref = 0;
4639         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4640         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4641         return ret_ref;
4642 }
4643
4644 static inline struct LDKChannelCounterparty CResult_ChannelCounterpartyDecodeErrorZ_get_ok(LDKCResult_ChannelCounterpartyDecodeErrorZ *NONNULL_PTR owner){
4645 CHECK(owner->result_ok);
4646         return ChannelCounterparty_clone(&*owner->contents.result);
4647 }
4648 uint64_t  __attribute__((export_name("TS_CResult_ChannelCounterpartyDecodeErrorZ_get_ok"))) TS_CResult_ChannelCounterpartyDecodeErrorZ_get_ok(uint64_t owner) {
4649         LDKCResult_ChannelCounterpartyDecodeErrorZ* owner_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)untag_ptr(owner);
4650         LDKChannelCounterparty ret_var = CResult_ChannelCounterpartyDecodeErrorZ_get_ok(owner_conv);
4651         uint64_t ret_ref = 0;
4652         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4653         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4654         return ret_ref;
4655 }
4656
4657 static inline struct LDKDecodeError CResult_ChannelCounterpartyDecodeErrorZ_get_err(LDKCResult_ChannelCounterpartyDecodeErrorZ *NONNULL_PTR owner){
4658 CHECK(!owner->result_ok);
4659         return DecodeError_clone(&*owner->contents.err);
4660 }
4661 uint64_t  __attribute__((export_name("TS_CResult_ChannelCounterpartyDecodeErrorZ_get_err"))) TS_CResult_ChannelCounterpartyDecodeErrorZ_get_err(uint64_t owner) {
4662         LDKCResult_ChannelCounterpartyDecodeErrorZ* owner_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)untag_ptr(owner);
4663         LDKDecodeError ret_var = CResult_ChannelCounterpartyDecodeErrorZ_get_err(owner_conv);
4664         uint64_t ret_ref = 0;
4665         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4666         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4667         return ret_ref;
4668 }
4669
4670 static inline struct LDKChannelDetails CResult_ChannelDetailsDecodeErrorZ_get_ok(LDKCResult_ChannelDetailsDecodeErrorZ *NONNULL_PTR owner){
4671 CHECK(owner->result_ok);
4672         return ChannelDetails_clone(&*owner->contents.result);
4673 }
4674 uint64_t  __attribute__((export_name("TS_CResult_ChannelDetailsDecodeErrorZ_get_ok"))) TS_CResult_ChannelDetailsDecodeErrorZ_get_ok(uint64_t owner) {
4675         LDKCResult_ChannelDetailsDecodeErrorZ* owner_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)untag_ptr(owner);
4676         LDKChannelDetails ret_var = CResult_ChannelDetailsDecodeErrorZ_get_ok(owner_conv);
4677         uint64_t ret_ref = 0;
4678         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4679         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4680         return ret_ref;
4681 }
4682
4683 static inline struct LDKDecodeError CResult_ChannelDetailsDecodeErrorZ_get_err(LDKCResult_ChannelDetailsDecodeErrorZ *NONNULL_PTR owner){
4684 CHECK(!owner->result_ok);
4685         return DecodeError_clone(&*owner->contents.err);
4686 }
4687 uint64_t  __attribute__((export_name("TS_CResult_ChannelDetailsDecodeErrorZ_get_err"))) TS_CResult_ChannelDetailsDecodeErrorZ_get_err(uint64_t owner) {
4688         LDKCResult_ChannelDetailsDecodeErrorZ* owner_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)untag_ptr(owner);
4689         LDKDecodeError ret_var = CResult_ChannelDetailsDecodeErrorZ_get_err(owner_conv);
4690         uint64_t ret_ref = 0;
4691         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4692         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4693         return ret_ref;
4694 }
4695
4696 static inline struct LDKPhantomRouteHints CResult_PhantomRouteHintsDecodeErrorZ_get_ok(LDKCResult_PhantomRouteHintsDecodeErrorZ *NONNULL_PTR owner){
4697 CHECK(owner->result_ok);
4698         return PhantomRouteHints_clone(&*owner->contents.result);
4699 }
4700 uint64_t  __attribute__((export_name("TS_CResult_PhantomRouteHintsDecodeErrorZ_get_ok"))) TS_CResult_PhantomRouteHintsDecodeErrorZ_get_ok(uint64_t owner) {
4701         LDKCResult_PhantomRouteHintsDecodeErrorZ* owner_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)untag_ptr(owner);
4702         LDKPhantomRouteHints ret_var = CResult_PhantomRouteHintsDecodeErrorZ_get_ok(owner_conv);
4703         uint64_t ret_ref = 0;
4704         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4705         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4706         return ret_ref;
4707 }
4708
4709 static inline struct LDKDecodeError CResult_PhantomRouteHintsDecodeErrorZ_get_err(LDKCResult_PhantomRouteHintsDecodeErrorZ *NONNULL_PTR owner){
4710 CHECK(!owner->result_ok);
4711         return DecodeError_clone(&*owner->contents.err);
4712 }
4713 uint64_t  __attribute__((export_name("TS_CResult_PhantomRouteHintsDecodeErrorZ_get_err"))) TS_CResult_PhantomRouteHintsDecodeErrorZ_get_err(uint64_t owner) {
4714         LDKCResult_PhantomRouteHintsDecodeErrorZ* owner_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)untag_ptr(owner);
4715         LDKDecodeError ret_var = CResult_PhantomRouteHintsDecodeErrorZ_get_err(owner_conv);
4716         uint64_t ret_ref = 0;
4717         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4718         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4719         return ret_ref;
4720 }
4721
4722 static inline LDKCVec_ChannelMonitorZ CVec_ChannelMonitorZ_clone(const LDKCVec_ChannelMonitorZ *orig) {
4723         LDKCVec_ChannelMonitorZ ret = { .data = MALLOC(sizeof(LDKChannelMonitor) * orig->datalen, "LDKCVec_ChannelMonitorZ clone bytes"), .datalen = orig->datalen };
4724         for (size_t i = 0; i < ret.datalen; i++) {
4725                 ret.data[i] = ChannelMonitor_clone(&orig->data[i]);
4726         }
4727         return ret;
4728 }
4729 typedef struct LDKWatch_JCalls {
4730         atomic_size_t refcnt;
4731         uint32_t instance_ptr;
4732 } LDKWatch_JCalls;
4733 static void LDKWatch_JCalls_free(void* this_arg) {
4734         LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
4735         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4736                 FREE(j_calls);
4737         }
4738 }
4739 LDKCResult_NoneChannelMonitorUpdateErrZ watch_channel_LDKWatch_jcall(const void* this_arg, LDKOutPoint funding_txo, LDKChannelMonitor monitor) {
4740         LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
4741         LDKOutPoint funding_txo_var = funding_txo;
4742         uint64_t funding_txo_ref = 0;
4743         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_var);
4744         funding_txo_ref = tag_ptr(funding_txo_var.inner, funding_txo_var.is_owned);
4745         LDKChannelMonitor monitor_var = monitor;
4746         uint64_t monitor_ref = 0;
4747         CHECK_INNER_FIELD_ACCESS_OR_NULL(monitor_var);
4748         monitor_ref = tag_ptr(monitor_var.inner, monitor_var.is_owned);
4749         uint32_t ret = js_invoke_function_bbuuuu(j_calls->instance_ptr, 16, funding_txo_ref, monitor_ref, 0, 0, 0, 0);
4750         void* ret_ptr = untag_ptr(ret);
4751         CHECK_ACCESS(ret_ptr);
4752         LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(ret_ptr);
4753         FREE(untag_ptr(ret));
4754         return ret_conv;
4755 }
4756 LDKCResult_NoneChannelMonitorUpdateErrZ update_channel_LDKWatch_jcall(const void* this_arg, LDKOutPoint funding_txo, LDKChannelMonitorUpdate update) {
4757         LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
4758         LDKOutPoint funding_txo_var = funding_txo;
4759         uint64_t funding_txo_ref = 0;
4760         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_var);
4761         funding_txo_ref = tag_ptr(funding_txo_var.inner, funding_txo_var.is_owned);
4762         LDKChannelMonitorUpdate update_var = update;
4763         uint64_t update_ref = 0;
4764         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_var);
4765         update_ref = tag_ptr(update_var.inner, update_var.is_owned);
4766         uint32_t ret = js_invoke_function_bbuuuu(j_calls->instance_ptr, 17, funding_txo_ref, update_ref, 0, 0, 0, 0);
4767         void* ret_ptr = untag_ptr(ret);
4768         CHECK_ACCESS(ret_ptr);
4769         LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(ret_ptr);
4770         FREE(untag_ptr(ret));
4771         return ret_conv;
4772 }
4773 LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ release_pending_monitor_events_LDKWatch_jcall(const void* this_arg) {
4774         LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
4775         uint64_tArray ret = (uint64_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 18, 0, 0, 0, 0, 0, 0);
4776         LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ ret_constr;
4777         ret_constr.datalen = ret->arr_len;
4778         if (ret_constr.datalen > 0)
4779                 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ), "LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ Elements");
4780         else
4781                 ret_constr.data = NULL;
4782         uint64_t* ret_vals = ret->elems;
4783         for (size_t x = 0; x < ret_constr.datalen; x++) {
4784                 uint64_t ret_conv_49 = ret_vals[x];
4785                 void* ret_conv_49_ptr = untag_ptr(ret_conv_49);
4786                 CHECK_ACCESS(ret_conv_49_ptr);
4787                 LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ ret_conv_49_conv = *(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)(ret_conv_49_ptr);
4788                 FREE(untag_ptr(ret_conv_49));
4789                 ret_constr.data[x] = ret_conv_49_conv;
4790         }
4791         FREE(ret);
4792         return ret_constr;
4793 }
4794 static void LDKWatch_JCalls_cloned(LDKWatch* new_obj) {
4795         LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) new_obj->this_arg;
4796         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
4797 }
4798 static inline LDKWatch LDKWatch_init (JSValue o) {
4799         LDKWatch_JCalls *calls = MALLOC(sizeof(LDKWatch_JCalls), "LDKWatch_JCalls");
4800         atomic_init(&calls->refcnt, 1);
4801         calls->instance_ptr = o;
4802
4803         LDKWatch ret = {
4804                 .this_arg = (void*) calls,
4805                 .watch_channel = watch_channel_LDKWatch_jcall,
4806                 .update_channel = update_channel_LDKWatch_jcall,
4807                 .release_pending_monitor_events = release_pending_monitor_events_LDKWatch_jcall,
4808                 .free = LDKWatch_JCalls_free,
4809         };
4810         return ret;
4811 }
4812 uint64_t  __attribute__((export_name("TS_LDKWatch_new"))) TS_LDKWatch_new(JSValue o) {
4813         LDKWatch *res_ptr = MALLOC(sizeof(LDKWatch), "LDKWatch");
4814         *res_ptr = LDKWatch_init(o);
4815         return tag_ptr(res_ptr, true);
4816 }
4817 uint64_t  __attribute__((export_name("TS_Watch_watch_channel"))) TS_Watch_watch_channel(uint64_t this_arg, uint64_t funding_txo, uint64_t monitor) {
4818         void* this_arg_ptr = untag_ptr(this_arg);
4819         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4820         LDKWatch* this_arg_conv = (LDKWatch*)this_arg_ptr;
4821         LDKOutPoint funding_txo_conv;
4822         funding_txo_conv.inner = untag_ptr(funding_txo);
4823         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
4824         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
4825         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
4826         LDKChannelMonitor monitor_conv;
4827         monitor_conv.inner = untag_ptr(monitor);
4828         monitor_conv.is_owned = ptr_is_owned(monitor);
4829         CHECK_INNER_FIELD_ACCESS_OR_NULL(monitor_conv);
4830         monitor_conv = ChannelMonitor_clone(&monitor_conv);
4831         LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
4832         *ret_conv = (this_arg_conv->watch_channel)(this_arg_conv->this_arg, funding_txo_conv, monitor_conv);
4833         return tag_ptr(ret_conv, true);
4834 }
4835
4836 uint64_t  __attribute__((export_name("TS_Watch_update_channel"))) TS_Watch_update_channel(uint64_t this_arg, uint64_t funding_txo, uint64_t update) {
4837         void* this_arg_ptr = untag_ptr(this_arg);
4838         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4839         LDKWatch* this_arg_conv = (LDKWatch*)this_arg_ptr;
4840         LDKOutPoint funding_txo_conv;
4841         funding_txo_conv.inner = untag_ptr(funding_txo);
4842         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
4843         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
4844         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
4845         LDKChannelMonitorUpdate update_conv;
4846         update_conv.inner = untag_ptr(update);
4847         update_conv.is_owned = ptr_is_owned(update);
4848         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_conv);
4849         update_conv = ChannelMonitorUpdate_clone(&update_conv);
4850         LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
4851         *ret_conv = (this_arg_conv->update_channel)(this_arg_conv->this_arg, funding_txo_conv, update_conv);
4852         return tag_ptr(ret_conv, true);
4853 }
4854
4855 uint64_tArray  __attribute__((export_name("TS_Watch_release_pending_monitor_events"))) TS_Watch_release_pending_monitor_events(uint64_t this_arg) {
4856         void* this_arg_ptr = untag_ptr(this_arg);
4857         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4858         LDKWatch* this_arg_conv = (LDKWatch*)this_arg_ptr;
4859         LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ ret_var = (this_arg_conv->release_pending_monitor_events)(this_arg_conv->this_arg);
4860         uint64_tArray ret_arr = NULL;
4861         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
4862         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
4863         for (size_t x = 0; x < ret_var.datalen; x++) {
4864                 LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* ret_conv_49_conv = MALLOC(sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ), "LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ");
4865                 *ret_conv_49_conv = ret_var.data[x];
4866                 ret_arr_ptr[x] = tag_ptr(ret_conv_49_conv, true);
4867         }
4868         
4869         FREE(ret_var.data);
4870         return ret_arr;
4871 }
4872
4873 typedef struct LDKBroadcasterInterface_JCalls {
4874         atomic_size_t refcnt;
4875         uint32_t instance_ptr;
4876 } LDKBroadcasterInterface_JCalls;
4877 static void LDKBroadcasterInterface_JCalls_free(void* this_arg) {
4878         LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
4879         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4880                 FREE(j_calls);
4881         }
4882 }
4883 void broadcast_transaction_LDKBroadcasterInterface_jcall(const void* this_arg, LDKTransaction tx) {
4884         LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
4885         LDKTransaction tx_var = tx;
4886         int8_tArray tx_arr = init_int8_tArray(tx_var.datalen, __LINE__);
4887         memcpy(tx_arr->elems, tx_var.data, tx_var.datalen);
4888         Transaction_free(tx_var);
4889         js_invoke_function_uuuuuu(j_calls->instance_ptr, 19, (uint32_t)tx_arr, 0, 0, 0, 0, 0);
4890 }
4891 static void LDKBroadcasterInterface_JCalls_cloned(LDKBroadcasterInterface* new_obj) {
4892         LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) new_obj->this_arg;
4893         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
4894 }
4895 static inline LDKBroadcasterInterface LDKBroadcasterInterface_init (JSValue o) {
4896         LDKBroadcasterInterface_JCalls *calls = MALLOC(sizeof(LDKBroadcasterInterface_JCalls), "LDKBroadcasterInterface_JCalls");
4897         atomic_init(&calls->refcnt, 1);
4898         calls->instance_ptr = o;
4899
4900         LDKBroadcasterInterface ret = {
4901                 .this_arg = (void*) calls,
4902                 .broadcast_transaction = broadcast_transaction_LDKBroadcasterInterface_jcall,
4903                 .free = LDKBroadcasterInterface_JCalls_free,
4904         };
4905         return ret;
4906 }
4907 uint64_t  __attribute__((export_name("TS_LDKBroadcasterInterface_new"))) TS_LDKBroadcasterInterface_new(JSValue o) {
4908         LDKBroadcasterInterface *res_ptr = MALLOC(sizeof(LDKBroadcasterInterface), "LDKBroadcasterInterface");
4909         *res_ptr = LDKBroadcasterInterface_init(o);
4910         return tag_ptr(res_ptr, true);
4911 }
4912 void  __attribute__((export_name("TS_BroadcasterInterface_broadcast_transaction"))) TS_BroadcasterInterface_broadcast_transaction(uint64_t this_arg, int8_tArray tx) {
4913         void* this_arg_ptr = untag_ptr(this_arg);
4914         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4915         LDKBroadcasterInterface* this_arg_conv = (LDKBroadcasterInterface*)this_arg_ptr;
4916         LDKTransaction tx_ref;
4917         tx_ref.datalen = tx->arr_len;
4918         tx_ref.data = MALLOC(tx_ref.datalen, "LDKTransaction Bytes");
4919         memcpy(tx_ref.data, tx->elems, tx_ref.datalen); FREE(tx);
4920         tx_ref.data_is_owned = true;
4921         (this_arg_conv->broadcast_transaction)(this_arg_conv->this_arg, tx_ref);
4922 }
4923
4924 typedef struct LDKKeysInterface_JCalls {
4925         atomic_size_t refcnt;
4926         uint32_t instance_ptr;
4927 } LDKKeysInterface_JCalls;
4928 static void LDKKeysInterface_JCalls_free(void* this_arg) {
4929         LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
4930         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4931                 FREE(j_calls);
4932         }
4933 }
4934 LDKCResult_SecretKeyNoneZ get_node_secret_LDKKeysInterface_jcall(const void* this_arg, LDKRecipient recipient) {
4935         LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
4936         uint32_t recipient_conv = LDKRecipient_to_js(recipient);
4937         uint32_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 20, recipient_conv, 0, 0, 0, 0, 0);
4938         void* ret_ptr = untag_ptr(ret);
4939         CHECK_ACCESS(ret_ptr);
4940         LDKCResult_SecretKeyNoneZ ret_conv = *(LDKCResult_SecretKeyNoneZ*)(ret_ptr);
4941         FREE(untag_ptr(ret));
4942         return ret_conv;
4943 }
4944 LDKCVec_u8Z get_destination_script_LDKKeysInterface_jcall(const void* this_arg) {
4945         LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
4946         int8_tArray ret = (int8_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 21, 0, 0, 0, 0, 0, 0);
4947         LDKCVec_u8Z ret_ref;
4948         ret_ref.datalen = ret->arr_len;
4949         ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
4950         memcpy(ret_ref.data, ret->elems, ret_ref.datalen); FREE(ret);
4951         return ret_ref;
4952 }
4953 LDKShutdownScript get_shutdown_scriptpubkey_LDKKeysInterface_jcall(const void* this_arg) {
4954         LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
4955         uint32_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 22, 0, 0, 0, 0, 0, 0);
4956         LDKShutdownScript ret_conv;
4957         ret_conv.inner = untag_ptr(ret);
4958         ret_conv.is_owned = ptr_is_owned(ret);
4959         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
4960         return ret_conv;
4961 }
4962 LDKSign get_channel_signer_LDKKeysInterface_jcall(const void* this_arg, bool inbound, uint64_t channel_value_satoshis) {
4963         LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
4964         jboolean inbound_conv = inbound;
4965         int64_t channel_value_satoshis_conv = channel_value_satoshis;
4966         uint32_t ret = js_invoke_function_ubuuuu(j_calls->instance_ptr, 23, inbound_conv, channel_value_satoshis_conv, 0, 0, 0, 0);
4967         void* ret_ptr = untag_ptr(ret);
4968         CHECK_ACCESS(ret_ptr);
4969         LDKSign ret_conv = *(LDKSign*)(ret_ptr);
4970         FREE(untag_ptr(ret));
4971         return ret_conv;
4972 }
4973 LDKThirtyTwoBytes get_secure_random_bytes_LDKKeysInterface_jcall(const void* this_arg) {
4974         LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
4975         int8_tArray ret = (int8_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 24, 0, 0, 0, 0, 0, 0);
4976         LDKThirtyTwoBytes ret_ref;
4977         CHECK(ret->arr_len == 32);
4978         memcpy(ret_ref.data, ret->elems, 32); FREE(ret);
4979         return ret_ref;
4980 }
4981 LDKCResult_SignDecodeErrorZ read_chan_signer_LDKKeysInterface_jcall(const void* this_arg, LDKu8slice reader) {
4982         LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
4983         LDKu8slice reader_var = reader;
4984         int8_tArray reader_arr = init_int8_tArray(reader_var.datalen, __LINE__);
4985         memcpy(reader_arr->elems, reader_var.data, reader_var.datalen);
4986         uint32_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 25, (uint32_t)reader_arr, 0, 0, 0, 0, 0);
4987         void* ret_ptr = untag_ptr(ret);
4988         CHECK_ACCESS(ret_ptr);
4989         LDKCResult_SignDecodeErrorZ ret_conv = *(LDKCResult_SignDecodeErrorZ*)(ret_ptr);
4990         FREE(untag_ptr(ret));
4991         return ret_conv;
4992 }
4993 LDKCResult_RecoverableSignatureNoneZ sign_invoice_LDKKeysInterface_jcall(const void* this_arg, LDKu8slice hrp_bytes, LDKCVec_u5Z invoice_data, LDKRecipient receipient) {
4994         LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
4995         LDKu8slice hrp_bytes_var = hrp_bytes;
4996         int8_tArray hrp_bytes_arr = init_int8_tArray(hrp_bytes_var.datalen, __LINE__);
4997         memcpy(hrp_bytes_arr->elems, hrp_bytes_var.data, hrp_bytes_var.datalen);
4998         LDKCVec_u5Z invoice_data_var = invoice_data;
4999         ptrArray invoice_data_arr = NULL;
5000         invoice_data_arr = init_ptrArray(invoice_data_var.datalen, __LINE__);
5001         int8_t *invoice_data_arr_ptr = (int8_t*)(((uint8_t*)invoice_data_arr) + 8);
5002         for (size_t h = 0; h < invoice_data_var.datalen; h++) {
5003                 uint8_t invoice_data_conv_7_val = invoice_data_var.data[h]._0;
5004                 invoice_data_arr_ptr[h] = invoice_data_conv_7_val;
5005         }
5006         
5007         FREE(invoice_data_var.data);
5008         uint32_t receipient_conv = LDKRecipient_to_js(receipient);
5009         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);
5010         void* ret_ptr = untag_ptr(ret);
5011         CHECK_ACCESS(ret_ptr);
5012         LDKCResult_RecoverableSignatureNoneZ ret_conv = *(LDKCResult_RecoverableSignatureNoneZ*)(ret_ptr);
5013         FREE(untag_ptr(ret));
5014         return ret_conv;
5015 }
5016 LDKThirtyTwoBytes get_inbound_payment_key_material_LDKKeysInterface_jcall(const void* this_arg) {
5017         LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
5018         int8_tArray ret = (int8_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 27, 0, 0, 0, 0, 0, 0);
5019         LDKThirtyTwoBytes ret_ref;
5020         CHECK(ret->arr_len == 32);
5021         memcpy(ret_ref.data, ret->elems, 32); FREE(ret);
5022         return ret_ref;
5023 }
5024 static void LDKKeysInterface_JCalls_cloned(LDKKeysInterface* new_obj) {
5025         LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) new_obj->this_arg;
5026         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5027 }
5028 static inline LDKKeysInterface LDKKeysInterface_init (JSValue o) {
5029         LDKKeysInterface_JCalls *calls = MALLOC(sizeof(LDKKeysInterface_JCalls), "LDKKeysInterface_JCalls");
5030         atomic_init(&calls->refcnt, 1);
5031         calls->instance_ptr = o;
5032
5033         LDKKeysInterface ret = {
5034                 .this_arg = (void*) calls,
5035                 .get_node_secret = get_node_secret_LDKKeysInterface_jcall,
5036                 .get_destination_script = get_destination_script_LDKKeysInterface_jcall,
5037                 .get_shutdown_scriptpubkey = get_shutdown_scriptpubkey_LDKKeysInterface_jcall,
5038                 .get_channel_signer = get_channel_signer_LDKKeysInterface_jcall,
5039                 .get_secure_random_bytes = get_secure_random_bytes_LDKKeysInterface_jcall,
5040                 .read_chan_signer = read_chan_signer_LDKKeysInterface_jcall,
5041                 .sign_invoice = sign_invoice_LDKKeysInterface_jcall,
5042                 .get_inbound_payment_key_material = get_inbound_payment_key_material_LDKKeysInterface_jcall,
5043                 .free = LDKKeysInterface_JCalls_free,
5044         };
5045         return ret;
5046 }
5047 uint64_t  __attribute__((export_name("TS_LDKKeysInterface_new"))) TS_LDKKeysInterface_new(JSValue o) {
5048         LDKKeysInterface *res_ptr = MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface");
5049         *res_ptr = LDKKeysInterface_init(o);
5050         return tag_ptr(res_ptr, true);
5051 }
5052 uint64_t  __attribute__((export_name("TS_KeysInterface_get_node_secret"))) TS_KeysInterface_get_node_secret(uint64_t this_arg, uint32_t recipient) {
5053         void* this_arg_ptr = untag_ptr(this_arg);
5054         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5055         LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
5056         LDKRecipient recipient_conv = LDKRecipient_from_js(recipient);
5057         LDKCResult_SecretKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyNoneZ), "LDKCResult_SecretKeyNoneZ");
5058         *ret_conv = (this_arg_conv->get_node_secret)(this_arg_conv->this_arg, recipient_conv);
5059         return tag_ptr(ret_conv, true);
5060 }
5061
5062 int8_tArray  __attribute__((export_name("TS_KeysInterface_get_destination_script"))) TS_KeysInterface_get_destination_script(uint64_t this_arg) {
5063         void* this_arg_ptr = untag_ptr(this_arg);
5064         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5065         LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
5066         LDKCVec_u8Z ret_var = (this_arg_conv->get_destination_script)(this_arg_conv->this_arg);
5067         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
5068         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
5069         CVec_u8Z_free(ret_var);
5070         return ret_arr;
5071 }
5072
5073 uint64_t  __attribute__((export_name("TS_KeysInterface_get_shutdown_scriptpubkey"))) TS_KeysInterface_get_shutdown_scriptpubkey(uint64_t this_arg) {
5074         void* this_arg_ptr = untag_ptr(this_arg);
5075         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5076         LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
5077         LDKShutdownScript ret_var = (this_arg_conv->get_shutdown_scriptpubkey)(this_arg_conv->this_arg);
5078         uint64_t ret_ref = 0;
5079         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5080         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5081         return ret_ref;
5082 }
5083
5084 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) {
5085         void* this_arg_ptr = untag_ptr(this_arg);
5086         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5087         LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
5088         LDKSign* ret_ret = MALLOC(sizeof(LDKSign), "LDKSign");
5089         *ret_ret = (this_arg_conv->get_channel_signer)(this_arg_conv->this_arg, inbound, channel_value_satoshis);
5090         return tag_ptr(ret_ret, true);
5091 }
5092
5093 int8_tArray  __attribute__((export_name("TS_KeysInterface_get_secure_random_bytes"))) TS_KeysInterface_get_secure_random_bytes(uint64_t this_arg) {
5094         void* this_arg_ptr = untag_ptr(this_arg);
5095         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5096         LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
5097         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
5098         memcpy(ret_arr->elems, (this_arg_conv->get_secure_random_bytes)(this_arg_conv->this_arg).data, 32);
5099         return ret_arr;
5100 }
5101
5102 uint64_t  __attribute__((export_name("TS_KeysInterface_read_chan_signer"))) TS_KeysInterface_read_chan_signer(uint64_t this_arg, int8_tArray reader) {
5103         void* this_arg_ptr = untag_ptr(this_arg);
5104         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5105         LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
5106         LDKu8slice reader_ref;
5107         reader_ref.datalen = reader->arr_len;
5108         reader_ref.data = reader->elems;
5109         LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
5110         *ret_conv = (this_arg_conv->read_chan_signer)(this_arg_conv->this_arg, reader_ref);
5111         FREE(reader);
5112         return tag_ptr(ret_conv, true);
5113 }
5114
5115 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) {
5116         void* this_arg_ptr = untag_ptr(this_arg);
5117         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5118         LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
5119         LDKu8slice hrp_bytes_ref;
5120         hrp_bytes_ref.datalen = hrp_bytes->arr_len;
5121         hrp_bytes_ref.data = hrp_bytes->elems;
5122         LDKCVec_u5Z invoice_data_constr;
5123         invoice_data_constr.datalen = invoice_data->arr_len;
5124         if (invoice_data_constr.datalen > 0)
5125                 invoice_data_constr.data = MALLOC(invoice_data_constr.datalen * sizeof(LDKu5), "LDKCVec_u5Z Elements");
5126         else
5127                 invoice_data_constr.data = NULL;
5128         int8_t* invoice_data_vals = (void*) invoice_data->elems;
5129         for (size_t h = 0; h < invoice_data_constr.datalen; h++) {
5130                 int8_t invoice_data_conv_7 = invoice_data_vals[h];
5131                 
5132                 invoice_data_constr.data[h] = (LDKu5){ ._0 = invoice_data_conv_7 };
5133         }
5134         FREE(invoice_data);
5135         LDKRecipient receipient_conv = LDKRecipient_from_js(receipient);
5136         LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
5137         *ret_conv = (this_arg_conv->sign_invoice)(this_arg_conv->this_arg, hrp_bytes_ref, invoice_data_constr, receipient_conv);
5138         FREE(hrp_bytes);
5139         return tag_ptr(ret_conv, true);
5140 }
5141
5142 int8_tArray  __attribute__((export_name("TS_KeysInterface_get_inbound_payment_key_material"))) TS_KeysInterface_get_inbound_payment_key_material(uint64_t this_arg) {
5143         void* this_arg_ptr = untag_ptr(this_arg);
5144         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5145         LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
5146         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
5147         memcpy(ret_arr->elems, (this_arg_conv->get_inbound_payment_key_material)(this_arg_conv->this_arg).data, 32);
5148         return ret_arr;
5149 }
5150
5151 typedef struct LDKFeeEstimator_JCalls {
5152         atomic_size_t refcnt;
5153         uint32_t instance_ptr;
5154 } LDKFeeEstimator_JCalls;
5155 static void LDKFeeEstimator_JCalls_free(void* this_arg) {
5156         LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
5157         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5158                 FREE(j_calls);
5159         }
5160 }
5161 uint32_t get_est_sat_per_1000_weight_LDKFeeEstimator_jcall(const void* this_arg, LDKConfirmationTarget confirmation_target) {
5162         LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
5163         uint32_t confirmation_target_conv = LDKConfirmationTarget_to_js(confirmation_target);
5164         return js_invoke_function_uuuuuu(j_calls->instance_ptr, 28, confirmation_target_conv, 0, 0, 0, 0, 0);
5165 }
5166 static void LDKFeeEstimator_JCalls_cloned(LDKFeeEstimator* new_obj) {
5167         LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) new_obj->this_arg;
5168         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5169 }
5170 static inline LDKFeeEstimator LDKFeeEstimator_init (JSValue o) {
5171         LDKFeeEstimator_JCalls *calls = MALLOC(sizeof(LDKFeeEstimator_JCalls), "LDKFeeEstimator_JCalls");
5172         atomic_init(&calls->refcnt, 1);
5173         calls->instance_ptr = o;
5174
5175         LDKFeeEstimator ret = {
5176                 .this_arg = (void*) calls,
5177                 .get_est_sat_per_1000_weight = get_est_sat_per_1000_weight_LDKFeeEstimator_jcall,
5178                 .free = LDKFeeEstimator_JCalls_free,
5179         };
5180         return ret;
5181 }
5182 uint64_t  __attribute__((export_name("TS_LDKFeeEstimator_new"))) TS_LDKFeeEstimator_new(JSValue o) {
5183         LDKFeeEstimator *res_ptr = MALLOC(sizeof(LDKFeeEstimator), "LDKFeeEstimator");
5184         *res_ptr = LDKFeeEstimator_init(o);
5185         return tag_ptr(res_ptr, true);
5186 }
5187 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) {
5188         void* this_arg_ptr = untag_ptr(this_arg);
5189         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5190         LDKFeeEstimator* this_arg_conv = (LDKFeeEstimator*)this_arg_ptr;
5191         LDKConfirmationTarget confirmation_target_conv = LDKConfirmationTarget_from_js(confirmation_target);
5192         int32_t ret_conv = (this_arg_conv->get_est_sat_per_1000_weight)(this_arg_conv->this_arg, confirmation_target_conv);
5193         return ret_conv;
5194 }
5195
5196 static inline struct LDKThirtyTwoBytes C2Tuple_BlockHashChannelManagerZ_get_a(LDKC2Tuple_BlockHashChannelManagerZ *NONNULL_PTR owner){
5197         return ThirtyTwoBytes_clone(&owner->a);
5198 }
5199 int8_tArray  __attribute__((export_name("TS_C2Tuple_BlockHashChannelManagerZ_get_a"))) TS_C2Tuple_BlockHashChannelManagerZ_get_a(uint64_t owner) {
5200         LDKC2Tuple_BlockHashChannelManagerZ* owner_conv = (LDKC2Tuple_BlockHashChannelManagerZ*)untag_ptr(owner);
5201         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
5202         memcpy(ret_arr->elems, C2Tuple_BlockHashChannelManagerZ_get_a(owner_conv).data, 32);
5203         return ret_arr;
5204 }
5205
5206 static inline struct LDKChannelManager *C2Tuple_BlockHashChannelManagerZ_get_b(LDKC2Tuple_BlockHashChannelManagerZ *NONNULL_PTR owner){
5207         return &owner->b;
5208 }
5209 uint64_t  __attribute__((export_name("TS_C2Tuple_BlockHashChannelManagerZ_get_b"))) TS_C2Tuple_BlockHashChannelManagerZ_get_b(uint64_t owner) {
5210         LDKC2Tuple_BlockHashChannelManagerZ* owner_conv = (LDKC2Tuple_BlockHashChannelManagerZ*)untag_ptr(owner);
5211         LDKChannelManager ret_var = *C2Tuple_BlockHashChannelManagerZ_get_b(owner_conv);
5212         uint64_t ret_ref = 0;
5213         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5214         ret_ref = tag_ptr(ret_var.inner, false);
5215         return ret_ref;
5216 }
5217
5218 static inline struct LDKC2Tuple_BlockHashChannelManagerZ *CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_ok(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ *NONNULL_PTR owner){
5219 CHECK(owner->result_ok);
5220         return &*owner->contents.result;
5221 }
5222 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_ok"))) TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_ok(uint64_t owner) {
5223         LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)untag_ptr(owner);
5224         uint64_t ret_ret = tag_ptr(CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_ok(owner_conv), false);
5225         return ret_ret;
5226 }
5227
5228 static inline struct LDKDecodeError CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_err(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ *NONNULL_PTR owner){
5229 CHECK(!owner->result_ok);
5230         return DecodeError_clone(&*owner->contents.err);
5231 }
5232 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_err"))) TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_err(uint64_t owner) {
5233         LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)untag_ptr(owner);
5234         LDKDecodeError ret_var = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_err(owner_conv);
5235         uint64_t ret_ref = 0;
5236         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5237         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5238         return ret_ref;
5239 }
5240
5241 static inline struct LDKChannelConfig CResult_ChannelConfigDecodeErrorZ_get_ok(LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR owner){
5242 CHECK(owner->result_ok);
5243         return ChannelConfig_clone(&*owner->contents.result);
5244 }
5245 uint64_t  __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_get_ok"))) TS_CResult_ChannelConfigDecodeErrorZ_get_ok(uint64_t owner) {
5246         LDKCResult_ChannelConfigDecodeErrorZ* owner_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)untag_ptr(owner);
5247         LDKChannelConfig ret_var = CResult_ChannelConfigDecodeErrorZ_get_ok(owner_conv);
5248         uint64_t ret_ref = 0;
5249         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5250         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5251         return ret_ref;
5252 }
5253
5254 static inline struct LDKDecodeError CResult_ChannelConfigDecodeErrorZ_get_err(LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR owner){
5255 CHECK(!owner->result_ok);
5256         return DecodeError_clone(&*owner->contents.err);
5257 }
5258 uint64_t  __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_get_err"))) TS_CResult_ChannelConfigDecodeErrorZ_get_err(uint64_t owner) {
5259         LDKCResult_ChannelConfigDecodeErrorZ* owner_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)untag_ptr(owner);
5260         LDKDecodeError ret_var = CResult_ChannelConfigDecodeErrorZ_get_err(owner_conv);
5261         uint64_t ret_ref = 0;
5262         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5263         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5264         return ret_ref;
5265 }
5266
5267 static inline struct LDKOutPoint CResult_OutPointDecodeErrorZ_get_ok(LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR owner){
5268 CHECK(owner->result_ok);
5269         return OutPoint_clone(&*owner->contents.result);
5270 }
5271 uint64_t  __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_get_ok"))) TS_CResult_OutPointDecodeErrorZ_get_ok(uint64_t owner) {
5272         LDKCResult_OutPointDecodeErrorZ* owner_conv = (LDKCResult_OutPointDecodeErrorZ*)untag_ptr(owner);
5273         LDKOutPoint ret_var = CResult_OutPointDecodeErrorZ_get_ok(owner_conv);
5274         uint64_t ret_ref = 0;
5275         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5276         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5277         return ret_ref;
5278 }
5279
5280 static inline struct LDKDecodeError CResult_OutPointDecodeErrorZ_get_err(LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR owner){
5281 CHECK(!owner->result_ok);
5282         return DecodeError_clone(&*owner->contents.err);
5283 }
5284 uint64_t  __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_get_err"))) TS_CResult_OutPointDecodeErrorZ_get_err(uint64_t owner) {
5285         LDKCResult_OutPointDecodeErrorZ* owner_conv = (LDKCResult_OutPointDecodeErrorZ*)untag_ptr(owner);
5286         LDKDecodeError ret_var = CResult_OutPointDecodeErrorZ_get_err(owner_conv);
5287         uint64_t ret_ref = 0;
5288         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5289         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5290         return ret_ref;
5291 }
5292
5293 typedef struct LDKType_JCalls {
5294         atomic_size_t refcnt;
5295         uint32_t instance_ptr;
5296 } LDKType_JCalls;
5297 static void LDKType_JCalls_free(void* this_arg) {
5298         LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
5299         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5300                 FREE(j_calls);
5301         }
5302 }
5303 uint16_t type_id_LDKType_jcall(const void* this_arg) {
5304         LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
5305         return js_invoke_function_uuuuuu(j_calls->instance_ptr, 29, 0, 0, 0, 0, 0, 0);
5306 }
5307 LDKStr debug_str_LDKType_jcall(const void* this_arg) {
5308         LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
5309         jstring ret = (jstring)js_invoke_function_uuuuuu(j_calls->instance_ptr, 30, 0, 0, 0, 0, 0, 0);
5310         LDKStr ret_conv = str_ref_to_owned_c(ret);
5311         return ret_conv;
5312 }
5313 LDKCVec_u8Z write_LDKType_jcall(const void* this_arg) {
5314         LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
5315         int8_tArray ret = (int8_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 31, 0, 0, 0, 0, 0, 0);
5316         LDKCVec_u8Z ret_ref;
5317         ret_ref.datalen = ret->arr_len;
5318         ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
5319         memcpy(ret_ref.data, ret->elems, ret_ref.datalen); FREE(ret);
5320         return ret_ref;
5321 }
5322 static void LDKType_JCalls_cloned(LDKType* new_obj) {
5323         LDKType_JCalls *j_calls = (LDKType_JCalls*) new_obj->this_arg;
5324         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5325 }
5326 static inline LDKType LDKType_init (JSValue o) {
5327         LDKType_JCalls *calls = MALLOC(sizeof(LDKType_JCalls), "LDKType_JCalls");
5328         atomic_init(&calls->refcnt, 1);
5329         calls->instance_ptr = o;
5330
5331         LDKType ret = {
5332                 .this_arg = (void*) calls,
5333                 .type_id = type_id_LDKType_jcall,
5334                 .debug_str = debug_str_LDKType_jcall,
5335                 .write = write_LDKType_jcall,
5336                 .cloned = LDKType_JCalls_cloned,
5337                 .free = LDKType_JCalls_free,
5338         };
5339         return ret;
5340 }
5341 uint64_t  __attribute__((export_name("TS_LDKType_new"))) TS_LDKType_new(JSValue o) {
5342         LDKType *res_ptr = MALLOC(sizeof(LDKType), "LDKType");
5343         *res_ptr = LDKType_init(o);
5344         return tag_ptr(res_ptr, true);
5345 }
5346 int16_t  __attribute__((export_name("TS_Type_type_id"))) TS_Type_type_id(uint64_t this_arg) {
5347         void* this_arg_ptr = untag_ptr(this_arg);
5348         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5349         LDKType* this_arg_conv = (LDKType*)this_arg_ptr;
5350         int16_t ret_conv = (this_arg_conv->type_id)(this_arg_conv->this_arg);
5351         return ret_conv;
5352 }
5353
5354 jstring  __attribute__((export_name("TS_Type_debug_str"))) TS_Type_debug_str(uint64_t this_arg) {
5355         void* this_arg_ptr = untag_ptr(this_arg);
5356         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5357         LDKType* this_arg_conv = (LDKType*)this_arg_ptr;
5358         LDKStr ret_str = (this_arg_conv->debug_str)(this_arg_conv->this_arg);
5359         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
5360         Str_free(ret_str);
5361         return ret_conv;
5362 }
5363
5364 int8_tArray  __attribute__((export_name("TS_Type_write"))) TS_Type_write(uint64_t this_arg) {
5365         void* this_arg_ptr = untag_ptr(this_arg);
5366         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5367         LDKType* this_arg_conv = (LDKType*)this_arg_ptr;
5368         LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
5369         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
5370         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
5371         CVec_u8Z_free(ret_var);
5372         return ret_arr;
5373 }
5374
5375 uint32_t __attribute__((export_name("TS_LDKCOption_TypeZ_ty_from_ptr"))) TS_LDKCOption_TypeZ_ty_from_ptr(uint64_t ptr) {
5376         LDKCOption_TypeZ *obj = (LDKCOption_TypeZ*)untag_ptr(ptr);
5377         switch(obj->tag) {
5378                 case LDKCOption_TypeZ_Some: return 0;
5379                 case LDKCOption_TypeZ_None: return 1;
5380                 default: abort();
5381         }
5382 }
5383 uint64_t __attribute__((export_name("TS_LDKCOption_TypeZ_Some_get_some"))) TS_LDKCOption_TypeZ_Some_get_some(uint64_t ptr) {
5384         LDKCOption_TypeZ *obj = (LDKCOption_TypeZ*)untag_ptr(ptr);
5385         assert(obj->tag == LDKCOption_TypeZ_Some);
5386                         LDKType* some_ret = MALLOC(sizeof(LDKType), "LDKType");
5387                         *some_ret = Type_clone(&obj->some);
5388         return tag_ptr(some_ret, true);
5389 }
5390 static inline struct LDKCOption_TypeZ CResult_COption_TypeZDecodeErrorZ_get_ok(LDKCResult_COption_TypeZDecodeErrorZ *NONNULL_PTR owner){
5391 CHECK(owner->result_ok);
5392         return COption_TypeZ_clone(&*owner->contents.result);
5393 }
5394 uint64_t  __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_get_ok"))) TS_CResult_COption_TypeZDecodeErrorZ_get_ok(uint64_t owner) {
5395         LDKCResult_COption_TypeZDecodeErrorZ* owner_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)untag_ptr(owner);
5396         LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
5397         *ret_copy = CResult_COption_TypeZDecodeErrorZ_get_ok(owner_conv);
5398         uint64_t ret_ref = tag_ptr(ret_copy, true);
5399         return ret_ref;
5400 }
5401
5402 static inline struct LDKDecodeError CResult_COption_TypeZDecodeErrorZ_get_err(LDKCResult_COption_TypeZDecodeErrorZ *NONNULL_PTR owner){
5403 CHECK(!owner->result_ok);
5404         return DecodeError_clone(&*owner->contents.err);
5405 }
5406 uint64_t  __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_get_err"))) TS_CResult_COption_TypeZDecodeErrorZ_get_err(uint64_t owner) {
5407         LDKCResult_COption_TypeZDecodeErrorZ* owner_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)untag_ptr(owner);
5408         LDKDecodeError ret_var = CResult_COption_TypeZDecodeErrorZ_get_err(owner_conv);
5409         uint64_t ret_ref = 0;
5410         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5411         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5412         return ret_ref;
5413 }
5414
5415 uint32_t __attribute__((export_name("TS_LDKPaymentError_ty_from_ptr"))) TS_LDKPaymentError_ty_from_ptr(uint64_t ptr) {
5416         LDKPaymentError *obj = (LDKPaymentError*)untag_ptr(ptr);
5417         switch(obj->tag) {
5418                 case LDKPaymentError_Invoice: return 0;
5419                 case LDKPaymentError_Routing: return 1;
5420                 case LDKPaymentError_Sending: return 2;
5421                 default: abort();
5422         }
5423 }
5424 jstring __attribute__((export_name("TS_LDKPaymentError_Invoice_get_invoice"))) TS_LDKPaymentError_Invoice_get_invoice(uint64_t ptr) {
5425         LDKPaymentError *obj = (LDKPaymentError*)untag_ptr(ptr);
5426         assert(obj->tag == LDKPaymentError_Invoice);
5427                         LDKStr invoice_str = obj->invoice;
5428                         jstring invoice_conv = str_ref_to_ts(invoice_str.chars, invoice_str.len);
5429         return invoice_conv;
5430 }
5431 uint64_t __attribute__((export_name("TS_LDKPaymentError_Routing_get_routing"))) TS_LDKPaymentError_Routing_get_routing(uint64_t ptr) {
5432         LDKPaymentError *obj = (LDKPaymentError*)untag_ptr(ptr);
5433         assert(obj->tag == LDKPaymentError_Routing);
5434                         LDKLightningError routing_var = obj->routing;
5435                         uint64_t routing_ref = 0;
5436                         CHECK_INNER_FIELD_ACCESS_OR_NULL(routing_var);
5437                         routing_ref = tag_ptr(routing_var.inner, false);
5438         return routing_ref;
5439 }
5440 uint64_t __attribute__((export_name("TS_LDKPaymentError_Sending_get_sending"))) TS_LDKPaymentError_Sending_get_sending(uint64_t ptr) {
5441         LDKPaymentError *obj = (LDKPaymentError*)untag_ptr(ptr);
5442         assert(obj->tag == LDKPaymentError_Sending);
5443                         uint64_t sending_ref = tag_ptr(&obj->sending, false);
5444         return sending_ref;
5445 }
5446 static inline struct LDKThirtyTwoBytes CResult_PaymentIdPaymentErrorZ_get_ok(LDKCResult_PaymentIdPaymentErrorZ *NONNULL_PTR owner){
5447 CHECK(owner->result_ok);
5448         return ThirtyTwoBytes_clone(&*owner->contents.result);
5449 }
5450 int8_tArray  __attribute__((export_name("TS_CResult_PaymentIdPaymentErrorZ_get_ok"))) TS_CResult_PaymentIdPaymentErrorZ_get_ok(uint64_t owner) {
5451         LDKCResult_PaymentIdPaymentErrorZ* owner_conv = (LDKCResult_PaymentIdPaymentErrorZ*)untag_ptr(owner);
5452         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
5453         memcpy(ret_arr->elems, CResult_PaymentIdPaymentErrorZ_get_ok(owner_conv).data, 32);
5454         return ret_arr;
5455 }
5456
5457 static inline struct LDKPaymentError CResult_PaymentIdPaymentErrorZ_get_err(LDKCResult_PaymentIdPaymentErrorZ *NONNULL_PTR owner){
5458 CHECK(!owner->result_ok);
5459         return PaymentError_clone(&*owner->contents.err);
5460 }
5461 uint64_t  __attribute__((export_name("TS_CResult_PaymentIdPaymentErrorZ_get_err"))) TS_CResult_PaymentIdPaymentErrorZ_get_err(uint64_t owner) {
5462         LDKCResult_PaymentIdPaymentErrorZ* owner_conv = (LDKCResult_PaymentIdPaymentErrorZ*)untag_ptr(owner);
5463         LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
5464         *ret_copy = CResult_PaymentIdPaymentErrorZ_get_err(owner_conv);
5465         uint64_t ret_ref = tag_ptr(ret_copy, true);
5466         return ret_ref;
5467 }
5468
5469 uint32_t __attribute__((export_name("TS_LDKParseError_ty_from_ptr"))) TS_LDKParseError_ty_from_ptr(uint64_t ptr) {
5470         LDKParseError *obj = (LDKParseError*)untag_ptr(ptr);
5471         switch(obj->tag) {
5472                 case LDKParseError_Bech32Error: return 0;
5473                 case LDKParseError_ParseAmountError: return 1;
5474                 case LDKParseError_MalformedSignature: return 2;
5475                 case LDKParseError_BadPrefix: return 3;
5476                 case LDKParseError_UnknownCurrency: return 4;
5477                 case LDKParseError_UnknownSiPrefix: return 5;
5478                 case LDKParseError_MalformedHRP: return 6;
5479                 case LDKParseError_TooShortDataPart: return 7;
5480                 case LDKParseError_UnexpectedEndOfTaggedFields: return 8;
5481                 case LDKParseError_DescriptionDecodeError: return 9;
5482                 case LDKParseError_PaddingError: return 10;
5483                 case LDKParseError_IntegerOverflowError: return 11;
5484                 case LDKParseError_InvalidSegWitProgramLength: return 12;
5485                 case LDKParseError_InvalidPubKeyHashLength: return 13;
5486                 case LDKParseError_InvalidScriptHashLength: return 14;
5487                 case LDKParseError_InvalidRecoveryId: return 15;
5488                 case LDKParseError_InvalidSliceLength: return 16;
5489                 case LDKParseError_Skip: return 17;
5490                 default: abort();
5491         }
5492 }
5493 uint64_t __attribute__((export_name("TS_LDKParseError_Bech32Error_get_bech32_error"))) TS_LDKParseError_Bech32Error_get_bech32_error(uint64_t ptr) {
5494         LDKParseError *obj = (LDKParseError*)untag_ptr(ptr);
5495         assert(obj->tag == LDKParseError_Bech32Error);
5496                         uint64_t bech32_error_ref = tag_ptr(&obj->bech32_error, false);
5497         return bech32_error_ref;
5498 }
5499 int32_t __attribute__((export_name("TS_LDKParseError_ParseAmountError_get_parse_amount_error"))) TS_LDKParseError_ParseAmountError_get_parse_amount_error(uint64_t ptr) {
5500         LDKParseError *obj = (LDKParseError*)untag_ptr(ptr);
5501         assert(obj->tag == LDKParseError_ParseAmountError);
5502                         /*obj->parse_amount_error*/
5503         return 0;
5504 }
5505 uint32_t __attribute__((export_name("TS_LDKParseError_MalformedSignature_get_malformed_signature"))) TS_LDKParseError_MalformedSignature_get_malformed_signature(uint64_t ptr) {
5506         LDKParseError *obj = (LDKParseError*)untag_ptr(ptr);
5507         assert(obj->tag == LDKParseError_MalformedSignature);
5508                         uint32_t malformed_signature_conv = LDKSecp256k1Error_to_js(obj->malformed_signature);
5509         return malformed_signature_conv;
5510 }
5511 int32_t __attribute__((export_name("TS_LDKParseError_DescriptionDecodeError_get_description_decode_error"))) TS_LDKParseError_DescriptionDecodeError_get_description_decode_error(uint64_t ptr) {
5512         LDKParseError *obj = (LDKParseError*)untag_ptr(ptr);
5513         assert(obj->tag == LDKParseError_DescriptionDecodeError);
5514                         /*obj->description_decode_error*/
5515         return 0;
5516 }
5517 jstring __attribute__((export_name("TS_LDKParseError_InvalidSliceLength_get_invalid_slice_length"))) TS_LDKParseError_InvalidSliceLength_get_invalid_slice_length(uint64_t ptr) {
5518         LDKParseError *obj = (LDKParseError*)untag_ptr(ptr);
5519         assert(obj->tag == LDKParseError_InvalidSliceLength);
5520                         LDKStr invalid_slice_length_str = obj->invalid_slice_length;
5521                         jstring invalid_slice_length_conv = str_ref_to_ts(invalid_slice_length_str.chars, invalid_slice_length_str.len);
5522         return invalid_slice_length_conv;
5523 }
5524 static inline enum LDKSiPrefix CResult_SiPrefixParseErrorZ_get_ok(LDKCResult_SiPrefixParseErrorZ *NONNULL_PTR owner){
5525 CHECK(owner->result_ok);
5526         return SiPrefix_clone(&*owner->contents.result);
5527 }
5528 uint32_t  __attribute__((export_name("TS_CResult_SiPrefixParseErrorZ_get_ok"))) TS_CResult_SiPrefixParseErrorZ_get_ok(uint64_t owner) {
5529         LDKCResult_SiPrefixParseErrorZ* owner_conv = (LDKCResult_SiPrefixParseErrorZ*)untag_ptr(owner);
5530         uint32_t ret_conv = LDKSiPrefix_to_js(CResult_SiPrefixParseErrorZ_get_ok(owner_conv));
5531         return ret_conv;
5532 }
5533
5534 static inline struct LDKParseError CResult_SiPrefixParseErrorZ_get_err(LDKCResult_SiPrefixParseErrorZ *NONNULL_PTR owner){
5535 CHECK(!owner->result_ok);
5536         return ParseError_clone(&*owner->contents.err);
5537 }
5538 uint64_t  __attribute__((export_name("TS_CResult_SiPrefixParseErrorZ_get_err"))) TS_CResult_SiPrefixParseErrorZ_get_err(uint64_t owner) {
5539         LDKCResult_SiPrefixParseErrorZ* owner_conv = (LDKCResult_SiPrefixParseErrorZ*)untag_ptr(owner);
5540         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
5541         *ret_copy = CResult_SiPrefixParseErrorZ_get_err(owner_conv);
5542         uint64_t ret_ref = tag_ptr(ret_copy, true);
5543         return ret_ref;
5544 }
5545
5546 uint32_t __attribute__((export_name("TS_LDKParseOrSemanticError_ty_from_ptr"))) TS_LDKParseOrSemanticError_ty_from_ptr(uint64_t ptr) {
5547         LDKParseOrSemanticError *obj = (LDKParseOrSemanticError*)untag_ptr(ptr);
5548         switch(obj->tag) {
5549                 case LDKParseOrSemanticError_ParseError: return 0;
5550                 case LDKParseOrSemanticError_SemanticError: return 1;
5551                 default: abort();
5552         }
5553 }
5554 uint64_t __attribute__((export_name("TS_LDKParseOrSemanticError_ParseError_get_parse_error"))) TS_LDKParseOrSemanticError_ParseError_get_parse_error(uint64_t ptr) {
5555         LDKParseOrSemanticError *obj = (LDKParseOrSemanticError*)untag_ptr(ptr);
5556         assert(obj->tag == LDKParseOrSemanticError_ParseError);
5557                         uint64_t parse_error_ref = tag_ptr(&obj->parse_error, false);
5558         return parse_error_ref;
5559 }
5560 uint32_t __attribute__((export_name("TS_LDKParseOrSemanticError_SemanticError_get_semantic_error"))) TS_LDKParseOrSemanticError_SemanticError_get_semantic_error(uint64_t ptr) {
5561         LDKParseOrSemanticError *obj = (LDKParseOrSemanticError*)untag_ptr(ptr);
5562         assert(obj->tag == LDKParseOrSemanticError_SemanticError);
5563                         uint32_t semantic_error_conv = LDKSemanticError_to_js(obj->semantic_error);
5564         return semantic_error_conv;
5565 }
5566 static inline struct LDKInvoice CResult_InvoiceParseOrSemanticErrorZ_get_ok(LDKCResult_InvoiceParseOrSemanticErrorZ *NONNULL_PTR owner){
5567 CHECK(owner->result_ok);
5568         return Invoice_clone(&*owner->contents.result);
5569 }
5570 uint64_t  __attribute__((export_name("TS_CResult_InvoiceParseOrSemanticErrorZ_get_ok"))) TS_CResult_InvoiceParseOrSemanticErrorZ_get_ok(uint64_t owner) {
5571         LDKCResult_InvoiceParseOrSemanticErrorZ* owner_conv = (LDKCResult_InvoiceParseOrSemanticErrorZ*)untag_ptr(owner);
5572         LDKInvoice ret_var = CResult_InvoiceParseOrSemanticErrorZ_get_ok(owner_conv);
5573         uint64_t ret_ref = 0;
5574         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5575         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5576         return ret_ref;
5577 }
5578
5579 static inline struct LDKParseOrSemanticError CResult_InvoiceParseOrSemanticErrorZ_get_err(LDKCResult_InvoiceParseOrSemanticErrorZ *NONNULL_PTR owner){
5580 CHECK(!owner->result_ok);
5581         return ParseOrSemanticError_clone(&*owner->contents.err);
5582 }
5583 uint64_t  __attribute__((export_name("TS_CResult_InvoiceParseOrSemanticErrorZ_get_err"))) TS_CResult_InvoiceParseOrSemanticErrorZ_get_err(uint64_t owner) {
5584         LDKCResult_InvoiceParseOrSemanticErrorZ* owner_conv = (LDKCResult_InvoiceParseOrSemanticErrorZ*)untag_ptr(owner);
5585         LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
5586         *ret_copy = CResult_InvoiceParseOrSemanticErrorZ_get_err(owner_conv);
5587         uint64_t ret_ref = tag_ptr(ret_copy, true);
5588         return ret_ref;
5589 }
5590
5591 static inline struct LDKSignedRawInvoice CResult_SignedRawInvoiceParseErrorZ_get_ok(LDKCResult_SignedRawInvoiceParseErrorZ *NONNULL_PTR owner){
5592 CHECK(owner->result_ok);
5593         return SignedRawInvoice_clone(&*owner->contents.result);
5594 }
5595 uint64_t  __attribute__((export_name("TS_CResult_SignedRawInvoiceParseErrorZ_get_ok"))) TS_CResult_SignedRawInvoiceParseErrorZ_get_ok(uint64_t owner) {
5596         LDKCResult_SignedRawInvoiceParseErrorZ* owner_conv = (LDKCResult_SignedRawInvoiceParseErrorZ*)untag_ptr(owner);
5597         LDKSignedRawInvoice ret_var = CResult_SignedRawInvoiceParseErrorZ_get_ok(owner_conv);
5598         uint64_t ret_ref = 0;
5599         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5600         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5601         return ret_ref;
5602 }
5603
5604 static inline struct LDKParseError CResult_SignedRawInvoiceParseErrorZ_get_err(LDKCResult_SignedRawInvoiceParseErrorZ *NONNULL_PTR owner){
5605 CHECK(!owner->result_ok);
5606         return ParseError_clone(&*owner->contents.err);
5607 }
5608 uint64_t  __attribute__((export_name("TS_CResult_SignedRawInvoiceParseErrorZ_get_err"))) TS_CResult_SignedRawInvoiceParseErrorZ_get_err(uint64_t owner) {
5609         LDKCResult_SignedRawInvoiceParseErrorZ* owner_conv = (LDKCResult_SignedRawInvoiceParseErrorZ*)untag_ptr(owner);
5610         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
5611         *ret_copy = CResult_SignedRawInvoiceParseErrorZ_get_err(owner_conv);
5612         uint64_t ret_ref = tag_ptr(ret_copy, true);
5613         return ret_ref;
5614 }
5615
5616 static inline struct LDKRawInvoice C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_a(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *NONNULL_PTR owner){
5617         return RawInvoice_clone(&owner->a);
5618 }
5619 uint64_t  __attribute__((export_name("TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_a"))) TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_a(uint64_t owner) {
5620         LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* owner_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)untag_ptr(owner);
5621         LDKRawInvoice ret_var = C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_a(owner_conv);
5622         uint64_t ret_ref = 0;
5623         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5624         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5625         return ret_ref;
5626 }
5627
5628 static inline struct LDKThirtyTwoBytes C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_b(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *NONNULL_PTR owner){
5629         return ThirtyTwoBytes_clone(&owner->b);
5630 }
5631 int8_tArray  __attribute__((export_name("TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_b"))) TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_b(uint64_t owner) {
5632         LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* owner_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)untag_ptr(owner);
5633         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
5634         memcpy(ret_arr->elems, C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_b(owner_conv).data, 32);
5635         return ret_arr;
5636 }
5637
5638 static inline struct LDKInvoiceSignature C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_c(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *NONNULL_PTR owner){
5639         return InvoiceSignature_clone(&owner->c);
5640 }
5641 uint64_t  __attribute__((export_name("TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_c"))) TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_c(uint64_t owner) {
5642         LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* owner_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)untag_ptr(owner);
5643         LDKInvoiceSignature ret_var = C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_c(owner_conv);
5644         uint64_t ret_ref = 0;
5645         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5646         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5647         return ret_ref;
5648 }
5649
5650 static inline struct LDKPayeePubKey CResult_PayeePubKeyErrorZ_get_ok(LDKCResult_PayeePubKeyErrorZ *NONNULL_PTR owner){
5651 CHECK(owner->result_ok);
5652         return PayeePubKey_clone(&*owner->contents.result);
5653 }
5654 uint64_t  __attribute__((export_name("TS_CResult_PayeePubKeyErrorZ_get_ok"))) TS_CResult_PayeePubKeyErrorZ_get_ok(uint64_t owner) {
5655         LDKCResult_PayeePubKeyErrorZ* owner_conv = (LDKCResult_PayeePubKeyErrorZ*)untag_ptr(owner);
5656         LDKPayeePubKey ret_var = CResult_PayeePubKeyErrorZ_get_ok(owner_conv);
5657         uint64_t ret_ref = 0;
5658         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5659         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5660         return ret_ref;
5661 }
5662
5663 static inline enum LDKSecp256k1Error CResult_PayeePubKeyErrorZ_get_err(LDKCResult_PayeePubKeyErrorZ *NONNULL_PTR owner){
5664 CHECK(!owner->result_ok);
5665         return *owner->contents.err;
5666 }
5667 uint32_t  __attribute__((export_name("TS_CResult_PayeePubKeyErrorZ_get_err"))) TS_CResult_PayeePubKeyErrorZ_get_err(uint64_t owner) {
5668         LDKCResult_PayeePubKeyErrorZ* owner_conv = (LDKCResult_PayeePubKeyErrorZ*)untag_ptr(owner);
5669         uint32_t ret_conv = LDKSecp256k1Error_to_js(CResult_PayeePubKeyErrorZ_get_err(owner_conv));
5670         return ret_conv;
5671 }
5672
5673 static inline LDKCVec_PrivateRouteZ CVec_PrivateRouteZ_clone(const LDKCVec_PrivateRouteZ *orig) {
5674         LDKCVec_PrivateRouteZ ret = { .data = MALLOC(sizeof(LDKPrivateRoute) * orig->datalen, "LDKCVec_PrivateRouteZ clone bytes"), .datalen = orig->datalen };
5675         for (size_t i = 0; i < ret.datalen; i++) {
5676                 ret.data[i] = PrivateRoute_clone(&orig->data[i]);
5677         }
5678         return ret;
5679 }
5680 static inline struct LDKPositiveTimestamp CResult_PositiveTimestampCreationErrorZ_get_ok(LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR owner){
5681 CHECK(owner->result_ok);
5682         return PositiveTimestamp_clone(&*owner->contents.result);
5683 }
5684 uint64_t  __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_get_ok"))) TS_CResult_PositiveTimestampCreationErrorZ_get_ok(uint64_t owner) {
5685         LDKCResult_PositiveTimestampCreationErrorZ* owner_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)untag_ptr(owner);
5686         LDKPositiveTimestamp ret_var = CResult_PositiveTimestampCreationErrorZ_get_ok(owner_conv);
5687         uint64_t ret_ref = 0;
5688         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5689         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5690         return ret_ref;
5691 }
5692
5693 static inline enum LDKCreationError CResult_PositiveTimestampCreationErrorZ_get_err(LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR owner){
5694 CHECK(!owner->result_ok);
5695         return CreationError_clone(&*owner->contents.err);
5696 }
5697 uint32_t  __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_get_err"))) TS_CResult_PositiveTimestampCreationErrorZ_get_err(uint64_t owner) {
5698         LDKCResult_PositiveTimestampCreationErrorZ* owner_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)untag_ptr(owner);
5699         uint32_t ret_conv = LDKCreationError_to_js(CResult_PositiveTimestampCreationErrorZ_get_err(owner_conv));
5700         return ret_conv;
5701 }
5702
5703 static inline void CResult_NoneSemanticErrorZ_get_ok(LDKCResult_NoneSemanticErrorZ *NONNULL_PTR owner){
5704 CHECK(owner->result_ok);
5705         return *owner->contents.result;
5706 }
5707 void  __attribute__((export_name("TS_CResult_NoneSemanticErrorZ_get_ok"))) TS_CResult_NoneSemanticErrorZ_get_ok(uint64_t owner) {
5708         LDKCResult_NoneSemanticErrorZ* owner_conv = (LDKCResult_NoneSemanticErrorZ*)untag_ptr(owner);
5709         CResult_NoneSemanticErrorZ_get_ok(owner_conv);
5710 }
5711
5712 static inline enum LDKSemanticError CResult_NoneSemanticErrorZ_get_err(LDKCResult_NoneSemanticErrorZ *NONNULL_PTR owner){
5713 CHECK(!owner->result_ok);
5714         return SemanticError_clone(&*owner->contents.err);
5715 }
5716 uint32_t  __attribute__((export_name("TS_CResult_NoneSemanticErrorZ_get_err"))) TS_CResult_NoneSemanticErrorZ_get_err(uint64_t owner) {
5717         LDKCResult_NoneSemanticErrorZ* owner_conv = (LDKCResult_NoneSemanticErrorZ*)untag_ptr(owner);
5718         uint32_t ret_conv = LDKSemanticError_to_js(CResult_NoneSemanticErrorZ_get_err(owner_conv));
5719         return ret_conv;
5720 }
5721
5722 static inline struct LDKInvoice CResult_InvoiceSemanticErrorZ_get_ok(LDKCResult_InvoiceSemanticErrorZ *NONNULL_PTR owner){
5723 CHECK(owner->result_ok);
5724         return Invoice_clone(&*owner->contents.result);
5725 }
5726 uint64_t  __attribute__((export_name("TS_CResult_InvoiceSemanticErrorZ_get_ok"))) TS_CResult_InvoiceSemanticErrorZ_get_ok(uint64_t owner) {
5727         LDKCResult_InvoiceSemanticErrorZ* owner_conv = (LDKCResult_InvoiceSemanticErrorZ*)untag_ptr(owner);
5728         LDKInvoice ret_var = CResult_InvoiceSemanticErrorZ_get_ok(owner_conv);
5729         uint64_t ret_ref = 0;
5730         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5731         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5732         return ret_ref;
5733 }
5734
5735 static inline enum LDKSemanticError CResult_InvoiceSemanticErrorZ_get_err(LDKCResult_InvoiceSemanticErrorZ *NONNULL_PTR owner){
5736 CHECK(!owner->result_ok);
5737         return SemanticError_clone(&*owner->contents.err);
5738 }
5739 uint32_t  __attribute__((export_name("TS_CResult_InvoiceSemanticErrorZ_get_err"))) TS_CResult_InvoiceSemanticErrorZ_get_err(uint64_t owner) {
5740         LDKCResult_InvoiceSemanticErrorZ* owner_conv = (LDKCResult_InvoiceSemanticErrorZ*)untag_ptr(owner);
5741         uint32_t ret_conv = LDKSemanticError_to_js(CResult_InvoiceSemanticErrorZ_get_err(owner_conv));
5742         return ret_conv;
5743 }
5744
5745 static inline struct LDKDescription CResult_DescriptionCreationErrorZ_get_ok(LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR owner){
5746 CHECK(owner->result_ok);
5747         return Description_clone(&*owner->contents.result);
5748 }
5749 uint64_t  __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_get_ok"))) TS_CResult_DescriptionCreationErrorZ_get_ok(uint64_t owner) {
5750         LDKCResult_DescriptionCreationErrorZ* owner_conv = (LDKCResult_DescriptionCreationErrorZ*)untag_ptr(owner);
5751         LDKDescription ret_var = CResult_DescriptionCreationErrorZ_get_ok(owner_conv);
5752         uint64_t ret_ref = 0;
5753         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5754         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5755         return ret_ref;
5756 }
5757
5758 static inline enum LDKCreationError CResult_DescriptionCreationErrorZ_get_err(LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR owner){
5759 CHECK(!owner->result_ok);
5760         return CreationError_clone(&*owner->contents.err);
5761 }
5762 uint32_t  __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_get_err"))) TS_CResult_DescriptionCreationErrorZ_get_err(uint64_t owner) {
5763         LDKCResult_DescriptionCreationErrorZ* owner_conv = (LDKCResult_DescriptionCreationErrorZ*)untag_ptr(owner);
5764         uint32_t ret_conv = LDKCreationError_to_js(CResult_DescriptionCreationErrorZ_get_err(owner_conv));
5765         return ret_conv;
5766 }
5767
5768 static inline struct LDKPrivateRoute CResult_PrivateRouteCreationErrorZ_get_ok(LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR owner){
5769 CHECK(owner->result_ok);
5770         return PrivateRoute_clone(&*owner->contents.result);
5771 }
5772 uint64_t  __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_get_ok"))) TS_CResult_PrivateRouteCreationErrorZ_get_ok(uint64_t owner) {
5773         LDKCResult_PrivateRouteCreationErrorZ* owner_conv = (LDKCResult_PrivateRouteCreationErrorZ*)untag_ptr(owner);
5774         LDKPrivateRoute ret_var = CResult_PrivateRouteCreationErrorZ_get_ok(owner_conv);
5775         uint64_t ret_ref = 0;
5776         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5777         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5778         return ret_ref;
5779 }
5780
5781 static inline enum LDKCreationError CResult_PrivateRouteCreationErrorZ_get_err(LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR owner){
5782 CHECK(!owner->result_ok);
5783         return CreationError_clone(&*owner->contents.err);
5784 }
5785 uint32_t  __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_get_err"))) TS_CResult_PrivateRouteCreationErrorZ_get_err(uint64_t owner) {
5786         LDKCResult_PrivateRouteCreationErrorZ* owner_conv = (LDKCResult_PrivateRouteCreationErrorZ*)untag_ptr(owner);
5787         uint32_t ret_conv = LDKCreationError_to_js(CResult_PrivateRouteCreationErrorZ_get_err(owner_conv));
5788         return ret_conv;
5789 }
5790
5791 static inline struct LDKStr CResult_StringErrorZ_get_ok(LDKCResult_StringErrorZ *NONNULL_PTR owner){
5792 CHECK(owner->result_ok);
5793         return *owner->contents.result;
5794 }
5795 jstring  __attribute__((export_name("TS_CResult_StringErrorZ_get_ok"))) TS_CResult_StringErrorZ_get_ok(uint64_t owner) {
5796         LDKCResult_StringErrorZ* owner_conv = (LDKCResult_StringErrorZ*)untag_ptr(owner);
5797         LDKStr ret_str = CResult_StringErrorZ_get_ok(owner_conv);
5798         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
5799         return ret_conv;
5800 }
5801
5802 static inline enum LDKSecp256k1Error CResult_StringErrorZ_get_err(LDKCResult_StringErrorZ *NONNULL_PTR owner){
5803 CHECK(!owner->result_ok);
5804         return *owner->contents.err;
5805 }
5806 uint32_t  __attribute__((export_name("TS_CResult_StringErrorZ_get_err"))) TS_CResult_StringErrorZ_get_err(uint64_t owner) {
5807         LDKCResult_StringErrorZ* owner_conv = (LDKCResult_StringErrorZ*)untag_ptr(owner);
5808         uint32_t ret_conv = LDKSecp256k1Error_to_js(CResult_StringErrorZ_get_err(owner_conv));
5809         return ret_conv;
5810 }
5811
5812 static inline struct LDKChannelMonitorUpdate CResult_ChannelMonitorUpdateDecodeErrorZ_get_ok(LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR owner){
5813 CHECK(owner->result_ok);
5814         return ChannelMonitorUpdate_clone(&*owner->contents.result);
5815 }
5816 uint64_t  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_get_ok"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_get_ok(uint64_t owner) {
5817         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)untag_ptr(owner);
5818         LDKChannelMonitorUpdate ret_var = CResult_ChannelMonitorUpdateDecodeErrorZ_get_ok(owner_conv);
5819         uint64_t ret_ref = 0;
5820         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5821         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5822         return ret_ref;
5823 }
5824
5825 static inline struct LDKDecodeError CResult_ChannelMonitorUpdateDecodeErrorZ_get_err(LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR owner){
5826 CHECK(!owner->result_ok);
5827         return DecodeError_clone(&*owner->contents.err);
5828 }
5829 uint64_t  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_get_err"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_get_err(uint64_t owner) {
5830         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)untag_ptr(owner);
5831         LDKDecodeError ret_var = CResult_ChannelMonitorUpdateDecodeErrorZ_get_err(owner_conv);
5832         uint64_t ret_ref = 0;
5833         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5834         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5835         return ret_ref;
5836 }
5837
5838 uint32_t __attribute__((export_name("TS_LDKCOption_MonitorEventZ_ty_from_ptr"))) TS_LDKCOption_MonitorEventZ_ty_from_ptr(uint64_t ptr) {
5839         LDKCOption_MonitorEventZ *obj = (LDKCOption_MonitorEventZ*)untag_ptr(ptr);
5840         switch(obj->tag) {
5841                 case LDKCOption_MonitorEventZ_Some: return 0;
5842                 case LDKCOption_MonitorEventZ_None: return 1;
5843                 default: abort();
5844         }
5845 }
5846 uint64_t __attribute__((export_name("TS_LDKCOption_MonitorEventZ_Some_get_some"))) TS_LDKCOption_MonitorEventZ_Some_get_some(uint64_t ptr) {
5847         LDKCOption_MonitorEventZ *obj = (LDKCOption_MonitorEventZ*)untag_ptr(ptr);
5848         assert(obj->tag == LDKCOption_MonitorEventZ_Some);
5849                         uint64_t some_ref = tag_ptr(&obj->some, false);
5850         return some_ref;
5851 }
5852 static inline struct LDKCOption_MonitorEventZ CResult_COption_MonitorEventZDecodeErrorZ_get_ok(LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR owner){
5853 CHECK(owner->result_ok);
5854         return COption_MonitorEventZ_clone(&*owner->contents.result);
5855 }
5856 uint64_t  __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_get_ok"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_get_ok(uint64_t owner) {
5857         LDKCResult_COption_MonitorEventZDecodeErrorZ* owner_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)untag_ptr(owner);
5858         LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
5859         *ret_copy = CResult_COption_MonitorEventZDecodeErrorZ_get_ok(owner_conv);
5860         uint64_t ret_ref = tag_ptr(ret_copy, true);
5861         return ret_ref;
5862 }
5863
5864 static inline struct LDKDecodeError CResult_COption_MonitorEventZDecodeErrorZ_get_err(LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR owner){
5865 CHECK(!owner->result_ok);
5866         return DecodeError_clone(&*owner->contents.err);
5867 }
5868 uint64_t  __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_get_err"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_get_err(uint64_t owner) {
5869         LDKCResult_COption_MonitorEventZDecodeErrorZ* owner_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)untag_ptr(owner);
5870         LDKDecodeError ret_var = CResult_COption_MonitorEventZDecodeErrorZ_get_err(owner_conv);
5871         uint64_t ret_ref = 0;
5872         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5873         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5874         return ret_ref;
5875 }
5876
5877 static inline struct LDKHTLCUpdate CResult_HTLCUpdateDecodeErrorZ_get_ok(LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR owner){
5878 CHECK(owner->result_ok);
5879         return HTLCUpdate_clone(&*owner->contents.result);
5880 }
5881 uint64_t  __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_get_ok"))) TS_CResult_HTLCUpdateDecodeErrorZ_get_ok(uint64_t owner) {
5882         LDKCResult_HTLCUpdateDecodeErrorZ* owner_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)untag_ptr(owner);
5883         LDKHTLCUpdate ret_var = CResult_HTLCUpdateDecodeErrorZ_get_ok(owner_conv);
5884         uint64_t ret_ref = 0;
5885         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5886         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5887         return ret_ref;
5888 }
5889
5890 static inline struct LDKDecodeError CResult_HTLCUpdateDecodeErrorZ_get_err(LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR owner){
5891 CHECK(!owner->result_ok);
5892         return DecodeError_clone(&*owner->contents.err);
5893 }
5894 uint64_t  __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_get_err"))) TS_CResult_HTLCUpdateDecodeErrorZ_get_err(uint64_t owner) {
5895         LDKCResult_HTLCUpdateDecodeErrorZ* owner_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)untag_ptr(owner);
5896         LDKDecodeError ret_var = CResult_HTLCUpdateDecodeErrorZ_get_err(owner_conv);
5897         uint64_t ret_ref = 0;
5898         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5899         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5900         return ret_ref;
5901 }
5902
5903 static inline struct LDKOutPoint C2Tuple_OutPointScriptZ_get_a(LDKC2Tuple_OutPointScriptZ *NONNULL_PTR owner){
5904         return OutPoint_clone(&owner->a);
5905 }
5906 uint64_t  __attribute__((export_name("TS_C2Tuple_OutPointScriptZ_get_a"))) TS_C2Tuple_OutPointScriptZ_get_a(uint64_t owner) {
5907         LDKC2Tuple_OutPointScriptZ* owner_conv = (LDKC2Tuple_OutPointScriptZ*)untag_ptr(owner);
5908         LDKOutPoint ret_var = C2Tuple_OutPointScriptZ_get_a(owner_conv);
5909         uint64_t ret_ref = 0;
5910         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5911         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5912         return ret_ref;
5913 }
5914
5915 static inline struct LDKCVec_u8Z C2Tuple_OutPointScriptZ_get_b(LDKC2Tuple_OutPointScriptZ *NONNULL_PTR owner){
5916         return CVec_u8Z_clone(&owner->b);
5917 }
5918 int8_tArray  __attribute__((export_name("TS_C2Tuple_OutPointScriptZ_get_b"))) TS_C2Tuple_OutPointScriptZ_get_b(uint64_t owner) {
5919         LDKC2Tuple_OutPointScriptZ* owner_conv = (LDKC2Tuple_OutPointScriptZ*)untag_ptr(owner);
5920         LDKCVec_u8Z ret_var = C2Tuple_OutPointScriptZ_get_b(owner_conv);
5921         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
5922         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
5923         CVec_u8Z_free(ret_var);
5924         return ret_arr;
5925 }
5926
5927 static inline uint32_t C2Tuple_u32ScriptZ_get_a(LDKC2Tuple_u32ScriptZ *NONNULL_PTR owner){
5928         return owner->a;
5929 }
5930 int32_t  __attribute__((export_name("TS_C2Tuple_u32ScriptZ_get_a"))) TS_C2Tuple_u32ScriptZ_get_a(uint64_t owner) {
5931         LDKC2Tuple_u32ScriptZ* owner_conv = (LDKC2Tuple_u32ScriptZ*)untag_ptr(owner);
5932         int32_t ret_conv = C2Tuple_u32ScriptZ_get_a(owner_conv);
5933         return ret_conv;
5934 }
5935
5936 static inline struct LDKCVec_u8Z C2Tuple_u32ScriptZ_get_b(LDKC2Tuple_u32ScriptZ *NONNULL_PTR owner){
5937         return CVec_u8Z_clone(&owner->b);
5938 }
5939 int8_tArray  __attribute__((export_name("TS_C2Tuple_u32ScriptZ_get_b"))) TS_C2Tuple_u32ScriptZ_get_b(uint64_t owner) {
5940         LDKC2Tuple_u32ScriptZ* owner_conv = (LDKC2Tuple_u32ScriptZ*)untag_ptr(owner);
5941         LDKCVec_u8Z ret_var = C2Tuple_u32ScriptZ_get_b(owner_conv);
5942         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
5943         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
5944         CVec_u8Z_free(ret_var);
5945         return ret_arr;
5946 }
5947
5948 static inline LDKCVec_C2Tuple_u32ScriptZZ CVec_C2Tuple_u32ScriptZZ_clone(const LDKCVec_C2Tuple_u32ScriptZZ *orig) {
5949         LDKCVec_C2Tuple_u32ScriptZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ) * orig->datalen, "LDKCVec_C2Tuple_u32ScriptZZ clone bytes"), .datalen = orig->datalen };
5950         for (size_t i = 0; i < ret.datalen; i++) {
5951                 ret.data[i] = C2Tuple_u32ScriptZ_clone(&orig->data[i]);
5952         }
5953         return ret;
5954 }
5955 static inline struct LDKThirtyTwoBytes C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_a(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *NONNULL_PTR owner){
5956         return ThirtyTwoBytes_clone(&owner->a);
5957 }
5958 int8_tArray  __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_a"))) TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_a(uint64_t owner) {
5959         LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* owner_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)untag_ptr(owner);
5960         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
5961         memcpy(ret_arr->elems, C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_a(owner_conv).data, 32);
5962         return ret_arr;
5963 }
5964
5965 static inline struct LDKCVec_C2Tuple_u32ScriptZZ C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_b(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *NONNULL_PTR owner){
5966         return CVec_C2Tuple_u32ScriptZZ_clone(&owner->b);
5967 }
5968 uint64_tArray  __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_b"))) TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_b(uint64_t owner) {
5969         LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* owner_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)untag_ptr(owner);
5970         LDKCVec_C2Tuple_u32ScriptZZ ret_var = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_b(owner_conv);
5971         uint64_tArray ret_arr = NULL;
5972         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
5973         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
5974         for (size_t v = 0; v < ret_var.datalen; v++) {
5975                 LDKC2Tuple_u32ScriptZ* ret_conv_21_conv = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
5976                 *ret_conv_21_conv = ret_var.data[v];
5977                 ret_arr_ptr[v] = tag_ptr(ret_conv_21_conv, true);
5978         }
5979         
5980         FREE(ret_var.data);
5981         return ret_arr;
5982 }
5983
5984 static inline LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_clone(const LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ *orig) {
5985         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 };
5986         for (size_t i = 0; i < ret.datalen; i++) {
5987                 ret.data[i] = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(&orig->data[i]);
5988         }
5989         return ret;
5990 }
5991 static inline LDKCVec_EventZ CVec_EventZ_clone(const LDKCVec_EventZ *orig) {
5992         LDKCVec_EventZ ret = { .data = MALLOC(sizeof(LDKEvent) * orig->datalen, "LDKCVec_EventZ clone bytes"), .datalen = orig->datalen };
5993         for (size_t i = 0; i < ret.datalen; i++) {
5994                 ret.data[i] = Event_clone(&orig->data[i]);
5995         }
5996         return ret;
5997 }
5998 static inline uint32_t C2Tuple_u32TxOutZ_get_a(LDKC2Tuple_u32TxOutZ *NONNULL_PTR owner){
5999         return owner->a;
6000 }
6001 int32_t  __attribute__((export_name("TS_C2Tuple_u32TxOutZ_get_a"))) TS_C2Tuple_u32TxOutZ_get_a(uint64_t owner) {
6002         LDKC2Tuple_u32TxOutZ* owner_conv = (LDKC2Tuple_u32TxOutZ*)untag_ptr(owner);
6003         int32_t ret_conv = C2Tuple_u32TxOutZ_get_a(owner_conv);
6004         return ret_conv;
6005 }
6006
6007 static inline struct LDKTxOut C2Tuple_u32TxOutZ_get_b(LDKC2Tuple_u32TxOutZ *NONNULL_PTR owner){
6008         return TxOut_clone(&owner->b);
6009 }
6010 uint64_t  __attribute__((export_name("TS_C2Tuple_u32TxOutZ_get_b"))) TS_C2Tuple_u32TxOutZ_get_b(uint64_t owner) {
6011         LDKC2Tuple_u32TxOutZ* owner_conv = (LDKC2Tuple_u32TxOutZ*)untag_ptr(owner);
6012         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
6013         *ret_ref = C2Tuple_u32TxOutZ_get_b(owner_conv);
6014         return tag_ptr(ret_ref, true);
6015 }
6016
6017 static inline LDKCVec_C2Tuple_u32TxOutZZ CVec_C2Tuple_u32TxOutZZ_clone(const LDKCVec_C2Tuple_u32TxOutZZ *orig) {
6018         LDKCVec_C2Tuple_u32TxOutZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ) * orig->datalen, "LDKCVec_C2Tuple_u32TxOutZZ clone bytes"), .datalen = orig->datalen };
6019         for (size_t i = 0; i < ret.datalen; i++) {
6020                 ret.data[i] = C2Tuple_u32TxOutZ_clone(&orig->data[i]);
6021         }
6022         return ret;
6023 }
6024 static inline struct LDKThirtyTwoBytes C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_a(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR owner){
6025         return ThirtyTwoBytes_clone(&owner->a);
6026 }
6027 int8_tArray  __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_a"))) TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_a(uint64_t owner) {
6028         LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* owner_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)untag_ptr(owner);
6029         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
6030         memcpy(ret_arr->elems, C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_a(owner_conv).data, 32);
6031         return ret_arr;
6032 }
6033
6034 static inline struct LDKCVec_C2Tuple_u32TxOutZZ C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_b(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR owner){
6035         return CVec_C2Tuple_u32TxOutZZ_clone(&owner->b);
6036 }
6037 uint64_tArray  __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_b"))) TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_b(uint64_t owner) {
6038         LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* owner_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)untag_ptr(owner);
6039         LDKCVec_C2Tuple_u32TxOutZZ ret_var = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_b(owner_conv);
6040         uint64_tArray ret_arr = NULL;
6041         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
6042         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
6043         for (size_t u = 0; u < ret_var.datalen; u++) {
6044                 LDKC2Tuple_u32TxOutZ* ret_conv_20_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
6045                 *ret_conv_20_conv = ret_var.data[u];
6046                 ret_arr_ptr[u] = tag_ptr(ret_conv_20_conv, true);
6047         }
6048         
6049         FREE(ret_var.data);
6050         return ret_arr;
6051 }
6052
6053 static inline LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_clone(const LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ *orig) {
6054         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 };
6055         for (size_t i = 0; i < ret.datalen; i++) {
6056                 ret.data[i] = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(&orig->data[i]);
6057         }
6058         return ret;
6059 }
6060 uint32_t __attribute__((export_name("TS_LDKBalance_ty_from_ptr"))) TS_LDKBalance_ty_from_ptr(uint64_t ptr) {
6061         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
6062         switch(obj->tag) {
6063                 case LDKBalance_ClaimableOnChannelClose: return 0;
6064                 case LDKBalance_ClaimableAwaitingConfirmations: return 1;
6065                 case LDKBalance_ContentiousClaimable: return 2;
6066                 case LDKBalance_MaybeClaimableHTLCAwaitingTimeout: return 3;
6067                 default: abort();
6068         }
6069 }
6070 int64_t __attribute__((export_name("TS_LDKBalance_ClaimableOnChannelClose_get_claimable_amount_satoshis"))) TS_LDKBalance_ClaimableOnChannelClose_get_claimable_amount_satoshis(uint64_t ptr) {
6071         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
6072         assert(obj->tag == LDKBalance_ClaimableOnChannelClose);
6073                         int64_t claimable_amount_satoshis_conv = obj->claimable_on_channel_close.claimable_amount_satoshis;
6074         return claimable_amount_satoshis_conv;
6075 }
6076 int64_t __attribute__((export_name("TS_LDKBalance_ClaimableAwaitingConfirmations_get_claimable_amount_satoshis"))) TS_LDKBalance_ClaimableAwaitingConfirmations_get_claimable_amount_satoshis(uint64_t ptr) {
6077         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
6078         assert(obj->tag == LDKBalance_ClaimableAwaitingConfirmations);
6079                         int64_t claimable_amount_satoshis_conv = obj->claimable_awaiting_confirmations.claimable_amount_satoshis;
6080         return claimable_amount_satoshis_conv;
6081 }
6082 int32_t __attribute__((export_name("TS_LDKBalance_ClaimableAwaitingConfirmations_get_confirmation_height"))) TS_LDKBalance_ClaimableAwaitingConfirmations_get_confirmation_height(uint64_t ptr) {
6083         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
6084         assert(obj->tag == LDKBalance_ClaimableAwaitingConfirmations);
6085                         int32_t confirmation_height_conv = obj->claimable_awaiting_confirmations.confirmation_height;
6086         return confirmation_height_conv;
6087 }
6088 int64_t __attribute__((export_name("TS_LDKBalance_ContentiousClaimable_get_claimable_amount_satoshis"))) TS_LDKBalance_ContentiousClaimable_get_claimable_amount_satoshis(uint64_t ptr) {
6089         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
6090         assert(obj->tag == LDKBalance_ContentiousClaimable);
6091                         int64_t claimable_amount_satoshis_conv = obj->contentious_claimable.claimable_amount_satoshis;
6092         return claimable_amount_satoshis_conv;
6093 }
6094 int32_t __attribute__((export_name("TS_LDKBalance_ContentiousClaimable_get_timeout_height"))) TS_LDKBalance_ContentiousClaimable_get_timeout_height(uint64_t ptr) {
6095         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
6096         assert(obj->tag == LDKBalance_ContentiousClaimable);
6097                         int32_t timeout_height_conv = obj->contentious_claimable.timeout_height;
6098         return timeout_height_conv;
6099 }
6100 int64_t __attribute__((export_name("TS_LDKBalance_MaybeClaimableHTLCAwaitingTimeout_get_claimable_amount_satoshis"))) TS_LDKBalance_MaybeClaimableHTLCAwaitingTimeout_get_claimable_amount_satoshis(uint64_t ptr) {
6101         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
6102         assert(obj->tag == LDKBalance_MaybeClaimableHTLCAwaitingTimeout);
6103                         int64_t claimable_amount_satoshis_conv = obj->maybe_claimable_htlc_awaiting_timeout.claimable_amount_satoshis;
6104         return claimable_amount_satoshis_conv;
6105 }
6106 int32_t __attribute__((export_name("TS_LDKBalance_MaybeClaimableHTLCAwaitingTimeout_get_claimable_height"))) TS_LDKBalance_MaybeClaimableHTLCAwaitingTimeout_get_claimable_height(uint64_t ptr) {
6107         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
6108         assert(obj->tag == LDKBalance_MaybeClaimableHTLCAwaitingTimeout);
6109                         int32_t claimable_height_conv = obj->maybe_claimable_htlc_awaiting_timeout.claimable_height;
6110         return claimable_height_conv;
6111 }
6112 static inline LDKCVec_BalanceZ CVec_BalanceZ_clone(const LDKCVec_BalanceZ *orig) {
6113         LDKCVec_BalanceZ ret = { .data = MALLOC(sizeof(LDKBalance) * orig->datalen, "LDKCVec_BalanceZ clone bytes"), .datalen = orig->datalen };
6114         for (size_t i = 0; i < ret.datalen; i++) {
6115                 ret.data[i] = Balance_clone(&orig->data[i]);
6116         }
6117         return ret;
6118 }
6119 static inline struct LDKThirtyTwoBytes C2Tuple_BlockHashChannelMonitorZ_get_a(LDKC2Tuple_BlockHashChannelMonitorZ *NONNULL_PTR owner){
6120         return ThirtyTwoBytes_clone(&owner->a);
6121 }
6122 int8_tArray  __attribute__((export_name("TS_C2Tuple_BlockHashChannelMonitorZ_get_a"))) TS_C2Tuple_BlockHashChannelMonitorZ_get_a(uint64_t owner) {
6123         LDKC2Tuple_BlockHashChannelMonitorZ* owner_conv = (LDKC2Tuple_BlockHashChannelMonitorZ*)untag_ptr(owner);
6124         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
6125         memcpy(ret_arr->elems, C2Tuple_BlockHashChannelMonitorZ_get_a(owner_conv).data, 32);
6126         return ret_arr;
6127 }
6128
6129 static inline struct LDKChannelMonitor C2Tuple_BlockHashChannelMonitorZ_get_b(LDKC2Tuple_BlockHashChannelMonitorZ *NONNULL_PTR owner){
6130         return ChannelMonitor_clone(&owner->b);
6131 }
6132 uint64_t  __attribute__((export_name("TS_C2Tuple_BlockHashChannelMonitorZ_get_b"))) TS_C2Tuple_BlockHashChannelMonitorZ_get_b(uint64_t owner) {
6133         LDKC2Tuple_BlockHashChannelMonitorZ* owner_conv = (LDKC2Tuple_BlockHashChannelMonitorZ*)untag_ptr(owner);
6134         LDKChannelMonitor ret_var = C2Tuple_BlockHashChannelMonitorZ_get_b(owner_conv);
6135         uint64_t ret_ref = 0;
6136         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6137         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6138         return ret_ref;
6139 }
6140
6141 static inline struct LDKC2Tuple_BlockHashChannelMonitorZ CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_ok(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *NONNULL_PTR owner){
6142 CHECK(owner->result_ok);
6143         return C2Tuple_BlockHashChannelMonitorZ_clone(&*owner->contents.result);
6144 }
6145 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_ok"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_ok(uint64_t owner) {
6146         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)untag_ptr(owner);
6147         LDKC2Tuple_BlockHashChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
6148         *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_ok(owner_conv);
6149         return tag_ptr(ret_conv, true);
6150 }
6151
6152 static inline struct LDKDecodeError CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_err(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *NONNULL_PTR owner){
6153 CHECK(!owner->result_ok);
6154         return DecodeError_clone(&*owner->contents.err);
6155 }
6156 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_err"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_err(uint64_t owner) {
6157         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)untag_ptr(owner);
6158         LDKDecodeError ret_var = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_err(owner_conv);
6159         uint64_t ret_ref = 0;
6160         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6161         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6162         return ret_ref;
6163 }
6164
6165 static inline struct LDKPublicKey C2Tuple_PublicKeyTypeZ_get_a(LDKC2Tuple_PublicKeyTypeZ *NONNULL_PTR owner){
6166         return owner->a;
6167 }
6168 int8_tArray  __attribute__((export_name("TS_C2Tuple_PublicKeyTypeZ_get_a"))) TS_C2Tuple_PublicKeyTypeZ_get_a(uint64_t owner) {
6169         LDKC2Tuple_PublicKeyTypeZ* owner_conv = (LDKC2Tuple_PublicKeyTypeZ*)untag_ptr(owner);
6170         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
6171         memcpy(ret_arr->elems, C2Tuple_PublicKeyTypeZ_get_a(owner_conv).compressed_form, 33);
6172         return ret_arr;
6173 }
6174
6175 static inline struct LDKType C2Tuple_PublicKeyTypeZ_get_b(LDKC2Tuple_PublicKeyTypeZ *NONNULL_PTR owner){
6176         return Type_clone(&owner->b);
6177 }
6178 uint64_t  __attribute__((export_name("TS_C2Tuple_PublicKeyTypeZ_get_b"))) TS_C2Tuple_PublicKeyTypeZ_get_b(uint64_t owner) {
6179         LDKC2Tuple_PublicKeyTypeZ* owner_conv = (LDKC2Tuple_PublicKeyTypeZ*)untag_ptr(owner);
6180         LDKType* ret_ret = MALLOC(sizeof(LDKType), "LDKType");
6181         *ret_ret = C2Tuple_PublicKeyTypeZ_get_b(owner_conv);
6182         return tag_ptr(ret_ret, true);
6183 }
6184
6185 static inline LDKCVec_C2Tuple_PublicKeyTypeZZ CVec_C2Tuple_PublicKeyTypeZZ_clone(const LDKCVec_C2Tuple_PublicKeyTypeZZ *orig) {
6186         LDKCVec_C2Tuple_PublicKeyTypeZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ) * orig->datalen, "LDKCVec_C2Tuple_PublicKeyTypeZZ clone bytes"), .datalen = orig->datalen };
6187         for (size_t i = 0; i < ret.datalen; i++) {
6188                 ret.data[i] = C2Tuple_PublicKeyTypeZ_clone(&orig->data[i]);
6189         }
6190         return ret;
6191 }
6192 uint32_t __attribute__((export_name("TS_LDKCOption_NetAddressZ_ty_from_ptr"))) TS_LDKCOption_NetAddressZ_ty_from_ptr(uint64_t ptr) {
6193         LDKCOption_NetAddressZ *obj = (LDKCOption_NetAddressZ*)untag_ptr(ptr);
6194         switch(obj->tag) {
6195                 case LDKCOption_NetAddressZ_Some: return 0;
6196                 case LDKCOption_NetAddressZ_None: return 1;
6197                 default: abort();
6198         }
6199 }
6200 uint64_t __attribute__((export_name("TS_LDKCOption_NetAddressZ_Some_get_some"))) TS_LDKCOption_NetAddressZ_Some_get_some(uint64_t ptr) {
6201         LDKCOption_NetAddressZ *obj = (LDKCOption_NetAddressZ*)untag_ptr(ptr);
6202         assert(obj->tag == LDKCOption_NetAddressZ_Some);
6203                         uint64_t some_ref = tag_ptr(&obj->some, false);
6204         return some_ref;
6205 }
6206 static inline struct LDKCVec_u8Z CResult_CVec_u8ZPeerHandleErrorZ_get_ok(LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR owner){
6207 CHECK(owner->result_ok);
6208         return CVec_u8Z_clone(&*owner->contents.result);
6209 }
6210 int8_tArray  __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_get_ok"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_get_ok(uint64_t owner) {
6211         LDKCResult_CVec_u8ZPeerHandleErrorZ* owner_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)untag_ptr(owner);
6212         LDKCVec_u8Z ret_var = CResult_CVec_u8ZPeerHandleErrorZ_get_ok(owner_conv);
6213         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
6214         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
6215         CVec_u8Z_free(ret_var);
6216         return ret_arr;
6217 }
6218
6219 static inline struct LDKPeerHandleError CResult_CVec_u8ZPeerHandleErrorZ_get_err(LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR owner){
6220 CHECK(!owner->result_ok);
6221         return PeerHandleError_clone(&*owner->contents.err);
6222 }
6223 uint64_t  __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_get_err"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_get_err(uint64_t owner) {
6224         LDKCResult_CVec_u8ZPeerHandleErrorZ* owner_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)untag_ptr(owner);
6225         LDKPeerHandleError ret_var = CResult_CVec_u8ZPeerHandleErrorZ_get_err(owner_conv);
6226         uint64_t ret_ref = 0;
6227         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6228         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6229         return ret_ref;
6230 }
6231
6232 static inline void CResult_NonePeerHandleErrorZ_get_ok(LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR owner){
6233 CHECK(owner->result_ok);
6234         return *owner->contents.result;
6235 }
6236 void  __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_get_ok"))) TS_CResult_NonePeerHandleErrorZ_get_ok(uint64_t owner) {
6237         LDKCResult_NonePeerHandleErrorZ* owner_conv = (LDKCResult_NonePeerHandleErrorZ*)untag_ptr(owner);
6238         CResult_NonePeerHandleErrorZ_get_ok(owner_conv);
6239 }
6240
6241 static inline struct LDKPeerHandleError CResult_NonePeerHandleErrorZ_get_err(LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR owner){
6242 CHECK(!owner->result_ok);
6243         return PeerHandleError_clone(&*owner->contents.err);
6244 }
6245 uint64_t  __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_get_err"))) TS_CResult_NonePeerHandleErrorZ_get_err(uint64_t owner) {
6246         LDKCResult_NonePeerHandleErrorZ* owner_conv = (LDKCResult_NonePeerHandleErrorZ*)untag_ptr(owner);
6247         LDKPeerHandleError ret_var = CResult_NonePeerHandleErrorZ_get_err(owner_conv);
6248         uint64_t ret_ref = 0;
6249         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6250         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6251         return ret_ref;
6252 }
6253
6254 static inline bool CResult_boolPeerHandleErrorZ_get_ok(LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR owner){
6255 CHECK(owner->result_ok);
6256         return *owner->contents.result;
6257 }
6258 jboolean  __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_get_ok"))) TS_CResult_boolPeerHandleErrorZ_get_ok(uint64_t owner) {
6259         LDKCResult_boolPeerHandleErrorZ* owner_conv = (LDKCResult_boolPeerHandleErrorZ*)untag_ptr(owner);
6260         jboolean ret_conv = CResult_boolPeerHandleErrorZ_get_ok(owner_conv);
6261         return ret_conv;
6262 }
6263
6264 static inline struct LDKPeerHandleError CResult_boolPeerHandleErrorZ_get_err(LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR owner){
6265 CHECK(!owner->result_ok);
6266         return PeerHandleError_clone(&*owner->contents.err);
6267 }
6268 uint64_t  __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_get_err"))) TS_CResult_boolPeerHandleErrorZ_get_err(uint64_t owner) {
6269         LDKCResult_boolPeerHandleErrorZ* owner_conv = (LDKCResult_boolPeerHandleErrorZ*)untag_ptr(owner);
6270         LDKPeerHandleError ret_var = CResult_boolPeerHandleErrorZ_get_err(owner_conv);
6271         uint64_t ret_ref = 0;
6272         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6273         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6274         return ret_ref;
6275 }
6276
6277 static inline void CResult_NoneErrorZ_get_ok(LDKCResult_NoneErrorZ *NONNULL_PTR owner){
6278 CHECK(owner->result_ok);
6279         return *owner->contents.result;
6280 }
6281 void  __attribute__((export_name("TS_CResult_NoneErrorZ_get_ok"))) TS_CResult_NoneErrorZ_get_ok(uint64_t owner) {
6282         LDKCResult_NoneErrorZ* owner_conv = (LDKCResult_NoneErrorZ*)untag_ptr(owner);
6283         CResult_NoneErrorZ_get_ok(owner_conv);
6284 }
6285
6286 static inline enum LDKIOError CResult_NoneErrorZ_get_err(LDKCResult_NoneErrorZ *NONNULL_PTR owner){
6287 CHECK(!owner->result_ok);
6288         return *owner->contents.err;
6289 }
6290 uint32_t  __attribute__((export_name("TS_CResult_NoneErrorZ_get_err"))) TS_CResult_NoneErrorZ_get_err(uint64_t owner) {
6291         LDKCResult_NoneErrorZ* owner_conv = (LDKCResult_NoneErrorZ*)untag_ptr(owner);
6292         uint32_t ret_conv = LDKIOError_to_js(CResult_NoneErrorZ_get_err(owner_conv));
6293         return ret_conv;
6294 }
6295
6296 static inline struct LDKNetAddress CResult_NetAddressDecodeErrorZ_get_ok(LDKCResult_NetAddressDecodeErrorZ *NONNULL_PTR owner){
6297 CHECK(owner->result_ok);
6298         return NetAddress_clone(&*owner->contents.result);
6299 }
6300 uint64_t  __attribute__((export_name("TS_CResult_NetAddressDecodeErrorZ_get_ok"))) TS_CResult_NetAddressDecodeErrorZ_get_ok(uint64_t owner) {
6301         LDKCResult_NetAddressDecodeErrorZ* owner_conv = (LDKCResult_NetAddressDecodeErrorZ*)untag_ptr(owner);
6302         LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
6303         *ret_copy = CResult_NetAddressDecodeErrorZ_get_ok(owner_conv);
6304         uint64_t ret_ref = tag_ptr(ret_copy, true);
6305         return ret_ref;
6306 }
6307
6308 static inline struct LDKDecodeError CResult_NetAddressDecodeErrorZ_get_err(LDKCResult_NetAddressDecodeErrorZ *NONNULL_PTR owner){
6309 CHECK(!owner->result_ok);
6310         return DecodeError_clone(&*owner->contents.err);
6311 }
6312 uint64_t  __attribute__((export_name("TS_CResult_NetAddressDecodeErrorZ_get_err"))) TS_CResult_NetAddressDecodeErrorZ_get_err(uint64_t owner) {
6313         LDKCResult_NetAddressDecodeErrorZ* owner_conv = (LDKCResult_NetAddressDecodeErrorZ*)untag_ptr(owner);
6314         LDKDecodeError ret_var = CResult_NetAddressDecodeErrorZ_get_err(owner_conv);
6315         uint64_t ret_ref = 0;
6316         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6317         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6318         return ret_ref;
6319 }
6320
6321 static inline LDKCVec_UpdateAddHTLCZ CVec_UpdateAddHTLCZ_clone(const LDKCVec_UpdateAddHTLCZ *orig) {
6322         LDKCVec_UpdateAddHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateAddHTLC) * orig->datalen, "LDKCVec_UpdateAddHTLCZ clone bytes"), .datalen = orig->datalen };
6323         for (size_t i = 0; i < ret.datalen; i++) {
6324                 ret.data[i] = UpdateAddHTLC_clone(&orig->data[i]);
6325         }
6326         return ret;
6327 }
6328 static inline LDKCVec_UpdateFulfillHTLCZ CVec_UpdateFulfillHTLCZ_clone(const LDKCVec_UpdateFulfillHTLCZ *orig) {
6329         LDKCVec_UpdateFulfillHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFulfillHTLC) * orig->datalen, "LDKCVec_UpdateFulfillHTLCZ clone bytes"), .datalen = orig->datalen };
6330         for (size_t i = 0; i < ret.datalen; i++) {
6331                 ret.data[i] = UpdateFulfillHTLC_clone(&orig->data[i]);
6332         }
6333         return ret;
6334 }
6335 static inline LDKCVec_UpdateFailHTLCZ CVec_UpdateFailHTLCZ_clone(const LDKCVec_UpdateFailHTLCZ *orig) {
6336         LDKCVec_UpdateFailHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFailHTLC) * orig->datalen, "LDKCVec_UpdateFailHTLCZ clone bytes"), .datalen = orig->datalen };
6337         for (size_t i = 0; i < ret.datalen; i++) {
6338                 ret.data[i] = UpdateFailHTLC_clone(&orig->data[i]);
6339         }
6340         return ret;
6341 }
6342 static inline LDKCVec_UpdateFailMalformedHTLCZ CVec_UpdateFailMalformedHTLCZ_clone(const LDKCVec_UpdateFailMalformedHTLCZ *orig) {
6343         LDKCVec_UpdateFailMalformedHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFailMalformedHTLC) * orig->datalen, "LDKCVec_UpdateFailMalformedHTLCZ clone bytes"), .datalen = orig->datalen };
6344         for (size_t i = 0; i < ret.datalen; i++) {
6345                 ret.data[i] = UpdateFailMalformedHTLC_clone(&orig->data[i]);
6346         }
6347         return ret;
6348 }
6349 static inline struct LDKAcceptChannel CResult_AcceptChannelDecodeErrorZ_get_ok(LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR owner){
6350 CHECK(owner->result_ok);
6351         return AcceptChannel_clone(&*owner->contents.result);
6352 }
6353 uint64_t  __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_get_ok"))) TS_CResult_AcceptChannelDecodeErrorZ_get_ok(uint64_t owner) {
6354         LDKCResult_AcceptChannelDecodeErrorZ* owner_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)untag_ptr(owner);
6355         LDKAcceptChannel ret_var = CResult_AcceptChannelDecodeErrorZ_get_ok(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 struct LDKDecodeError CResult_AcceptChannelDecodeErrorZ_get_err(LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR owner){
6363 CHECK(!owner->result_ok);
6364         return DecodeError_clone(&*owner->contents.err);
6365 }
6366 uint64_t  __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_get_err"))) TS_CResult_AcceptChannelDecodeErrorZ_get_err(uint64_t owner) {
6367         LDKCResult_AcceptChannelDecodeErrorZ* owner_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)untag_ptr(owner);
6368         LDKDecodeError ret_var = CResult_AcceptChannelDecodeErrorZ_get_err(owner_conv);
6369         uint64_t ret_ref = 0;
6370         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6371         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6372         return ret_ref;
6373 }
6374
6375 static inline struct LDKAnnouncementSignatures CResult_AnnouncementSignaturesDecodeErrorZ_get_ok(LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR owner){
6376 CHECK(owner->result_ok);
6377         return AnnouncementSignatures_clone(&*owner->contents.result);
6378 }
6379 uint64_t  __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_get_ok"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_get_ok(uint64_t owner) {
6380         LDKCResult_AnnouncementSignaturesDecodeErrorZ* owner_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)untag_ptr(owner);
6381         LDKAnnouncementSignatures ret_var = CResult_AnnouncementSignaturesDecodeErrorZ_get_ok(owner_conv);
6382         uint64_t ret_ref = 0;
6383         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6384         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6385         return ret_ref;
6386 }
6387
6388 static inline struct LDKDecodeError CResult_AnnouncementSignaturesDecodeErrorZ_get_err(LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR owner){
6389 CHECK(!owner->result_ok);
6390         return DecodeError_clone(&*owner->contents.err);
6391 }
6392 uint64_t  __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_get_err"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_get_err(uint64_t owner) {
6393         LDKCResult_AnnouncementSignaturesDecodeErrorZ* owner_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)untag_ptr(owner);
6394         LDKDecodeError ret_var = CResult_AnnouncementSignaturesDecodeErrorZ_get_err(owner_conv);
6395         uint64_t ret_ref = 0;
6396         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6397         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6398         return ret_ref;
6399 }
6400
6401 static inline struct LDKChannelReestablish CResult_ChannelReestablishDecodeErrorZ_get_ok(LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR owner){
6402 CHECK(owner->result_ok);
6403         return ChannelReestablish_clone(&*owner->contents.result);
6404 }
6405 uint64_t  __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_get_ok"))) TS_CResult_ChannelReestablishDecodeErrorZ_get_ok(uint64_t owner) {
6406         LDKCResult_ChannelReestablishDecodeErrorZ* owner_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)untag_ptr(owner);
6407         LDKChannelReestablish ret_var = CResult_ChannelReestablishDecodeErrorZ_get_ok(owner_conv);
6408         uint64_t ret_ref = 0;
6409         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6410         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6411         return ret_ref;
6412 }
6413
6414 static inline struct LDKDecodeError CResult_ChannelReestablishDecodeErrorZ_get_err(LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR owner){
6415 CHECK(!owner->result_ok);
6416         return DecodeError_clone(&*owner->contents.err);
6417 }
6418 uint64_t  __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_get_err"))) TS_CResult_ChannelReestablishDecodeErrorZ_get_err(uint64_t owner) {
6419         LDKCResult_ChannelReestablishDecodeErrorZ* owner_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)untag_ptr(owner);
6420         LDKDecodeError ret_var = CResult_ChannelReestablishDecodeErrorZ_get_err(owner_conv);
6421         uint64_t ret_ref = 0;
6422         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6423         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6424         return ret_ref;
6425 }
6426
6427 static inline struct LDKClosingSigned CResult_ClosingSignedDecodeErrorZ_get_ok(LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR owner){
6428 CHECK(owner->result_ok);
6429         return ClosingSigned_clone(&*owner->contents.result);
6430 }
6431 uint64_t  __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_get_ok"))) TS_CResult_ClosingSignedDecodeErrorZ_get_ok(uint64_t owner) {
6432         LDKCResult_ClosingSignedDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)untag_ptr(owner);
6433         LDKClosingSigned ret_var = CResult_ClosingSignedDecodeErrorZ_get_ok(owner_conv);
6434         uint64_t ret_ref = 0;
6435         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6436         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6437         return ret_ref;
6438 }
6439
6440 static inline struct LDKDecodeError CResult_ClosingSignedDecodeErrorZ_get_err(LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR owner){
6441 CHECK(!owner->result_ok);
6442         return DecodeError_clone(&*owner->contents.err);
6443 }
6444 uint64_t  __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_get_err"))) TS_CResult_ClosingSignedDecodeErrorZ_get_err(uint64_t owner) {
6445         LDKCResult_ClosingSignedDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)untag_ptr(owner);
6446         LDKDecodeError ret_var = CResult_ClosingSignedDecodeErrorZ_get_err(owner_conv);
6447         uint64_t ret_ref = 0;
6448         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6449         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6450         return ret_ref;
6451 }
6452
6453 static inline struct LDKClosingSignedFeeRange CResult_ClosingSignedFeeRangeDecodeErrorZ_get_ok(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR owner){
6454 CHECK(owner->result_ok);
6455         return ClosingSignedFeeRange_clone(&*owner->contents.result);
6456 }
6457 uint64_t  __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_get_ok"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_get_ok(uint64_t owner) {
6458         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)untag_ptr(owner);
6459         LDKClosingSignedFeeRange ret_var = CResult_ClosingSignedFeeRangeDecodeErrorZ_get_ok(owner_conv);
6460         uint64_t ret_ref = 0;
6461         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6462         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6463         return ret_ref;
6464 }
6465
6466 static inline struct LDKDecodeError CResult_ClosingSignedFeeRangeDecodeErrorZ_get_err(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR owner){
6467 CHECK(!owner->result_ok);
6468         return DecodeError_clone(&*owner->contents.err);
6469 }
6470 uint64_t  __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_get_err"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_get_err(uint64_t owner) {
6471         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)untag_ptr(owner);
6472         LDKDecodeError ret_var = CResult_ClosingSignedFeeRangeDecodeErrorZ_get_err(owner_conv);
6473         uint64_t ret_ref = 0;
6474         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6475         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6476         return ret_ref;
6477 }
6478
6479 static inline struct LDKCommitmentSigned CResult_CommitmentSignedDecodeErrorZ_get_ok(LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR owner){
6480 CHECK(owner->result_ok);
6481         return CommitmentSigned_clone(&*owner->contents.result);
6482 }
6483 uint64_t  __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_get_ok"))) TS_CResult_CommitmentSignedDecodeErrorZ_get_ok(uint64_t owner) {
6484         LDKCResult_CommitmentSignedDecodeErrorZ* owner_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)untag_ptr(owner);
6485         LDKCommitmentSigned ret_var = CResult_CommitmentSignedDecodeErrorZ_get_ok(owner_conv);
6486         uint64_t ret_ref = 0;
6487         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6488         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6489         return ret_ref;
6490 }
6491
6492 static inline struct LDKDecodeError CResult_CommitmentSignedDecodeErrorZ_get_err(LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR owner){
6493 CHECK(!owner->result_ok);
6494         return DecodeError_clone(&*owner->contents.err);
6495 }
6496 uint64_t  __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_get_err"))) TS_CResult_CommitmentSignedDecodeErrorZ_get_err(uint64_t owner) {
6497         LDKCResult_CommitmentSignedDecodeErrorZ* owner_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)untag_ptr(owner);
6498         LDKDecodeError ret_var = CResult_CommitmentSignedDecodeErrorZ_get_err(owner_conv);
6499         uint64_t ret_ref = 0;
6500         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6501         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6502         return ret_ref;
6503 }
6504
6505 static inline struct LDKFundingCreated CResult_FundingCreatedDecodeErrorZ_get_ok(LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR owner){
6506 CHECK(owner->result_ok);
6507         return FundingCreated_clone(&*owner->contents.result);
6508 }
6509 uint64_t  __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_get_ok"))) TS_CResult_FundingCreatedDecodeErrorZ_get_ok(uint64_t owner) {
6510         LDKCResult_FundingCreatedDecodeErrorZ* owner_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)untag_ptr(owner);
6511         LDKFundingCreated ret_var = CResult_FundingCreatedDecodeErrorZ_get_ok(owner_conv);
6512         uint64_t ret_ref = 0;
6513         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6514         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6515         return ret_ref;
6516 }
6517
6518 static inline struct LDKDecodeError CResult_FundingCreatedDecodeErrorZ_get_err(LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR owner){
6519 CHECK(!owner->result_ok);
6520         return DecodeError_clone(&*owner->contents.err);
6521 }
6522 uint64_t  __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_get_err"))) TS_CResult_FundingCreatedDecodeErrorZ_get_err(uint64_t owner) {
6523         LDKCResult_FundingCreatedDecodeErrorZ* owner_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)untag_ptr(owner);
6524         LDKDecodeError ret_var = CResult_FundingCreatedDecodeErrorZ_get_err(owner_conv);
6525         uint64_t ret_ref = 0;
6526         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6527         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6528         return ret_ref;
6529 }
6530
6531 static inline struct LDKFundingSigned CResult_FundingSignedDecodeErrorZ_get_ok(LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR owner){
6532 CHECK(owner->result_ok);
6533         return FundingSigned_clone(&*owner->contents.result);
6534 }
6535 uint64_t  __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_get_ok"))) TS_CResult_FundingSignedDecodeErrorZ_get_ok(uint64_t owner) {
6536         LDKCResult_FundingSignedDecodeErrorZ* owner_conv = (LDKCResult_FundingSignedDecodeErrorZ*)untag_ptr(owner);
6537         LDKFundingSigned ret_var = CResult_FundingSignedDecodeErrorZ_get_ok(owner_conv);
6538         uint64_t ret_ref = 0;
6539         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6540         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6541         return ret_ref;
6542 }
6543
6544 static inline struct LDKDecodeError CResult_FundingSignedDecodeErrorZ_get_err(LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR owner){
6545 CHECK(!owner->result_ok);
6546         return DecodeError_clone(&*owner->contents.err);
6547 }
6548 uint64_t  __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_get_err"))) TS_CResult_FundingSignedDecodeErrorZ_get_err(uint64_t owner) {
6549         LDKCResult_FundingSignedDecodeErrorZ* owner_conv = (LDKCResult_FundingSignedDecodeErrorZ*)untag_ptr(owner);
6550         LDKDecodeError ret_var = CResult_FundingSignedDecodeErrorZ_get_err(owner_conv);
6551         uint64_t ret_ref = 0;
6552         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6553         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6554         return ret_ref;
6555 }
6556
6557 static inline struct LDKChannelReady CResult_ChannelReadyDecodeErrorZ_get_ok(LDKCResult_ChannelReadyDecodeErrorZ *NONNULL_PTR owner){
6558 CHECK(owner->result_ok);
6559         return ChannelReady_clone(&*owner->contents.result);
6560 }
6561 uint64_t  __attribute__((export_name("TS_CResult_ChannelReadyDecodeErrorZ_get_ok"))) TS_CResult_ChannelReadyDecodeErrorZ_get_ok(uint64_t owner) {
6562         LDKCResult_ChannelReadyDecodeErrorZ* owner_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)untag_ptr(owner);
6563         LDKChannelReady ret_var = CResult_ChannelReadyDecodeErrorZ_get_ok(owner_conv);
6564         uint64_t ret_ref = 0;
6565         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6566         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6567         return ret_ref;
6568 }
6569
6570 static inline struct LDKDecodeError CResult_ChannelReadyDecodeErrorZ_get_err(LDKCResult_ChannelReadyDecodeErrorZ *NONNULL_PTR owner){
6571 CHECK(!owner->result_ok);
6572         return DecodeError_clone(&*owner->contents.err);
6573 }
6574 uint64_t  __attribute__((export_name("TS_CResult_ChannelReadyDecodeErrorZ_get_err"))) TS_CResult_ChannelReadyDecodeErrorZ_get_err(uint64_t owner) {
6575         LDKCResult_ChannelReadyDecodeErrorZ* owner_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)untag_ptr(owner);
6576         LDKDecodeError ret_var = CResult_ChannelReadyDecodeErrorZ_get_err(owner_conv);
6577         uint64_t ret_ref = 0;
6578         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6579         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6580         return ret_ref;
6581 }
6582
6583 static inline struct LDKInit CResult_InitDecodeErrorZ_get_ok(LDKCResult_InitDecodeErrorZ *NONNULL_PTR owner){
6584 CHECK(owner->result_ok);
6585         return Init_clone(&*owner->contents.result);
6586 }
6587 uint64_t  __attribute__((export_name("TS_CResult_InitDecodeErrorZ_get_ok"))) TS_CResult_InitDecodeErrorZ_get_ok(uint64_t owner) {
6588         LDKCResult_InitDecodeErrorZ* owner_conv = (LDKCResult_InitDecodeErrorZ*)untag_ptr(owner);
6589         LDKInit ret_var = CResult_InitDecodeErrorZ_get_ok(owner_conv);
6590         uint64_t ret_ref = 0;
6591         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6592         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6593         return ret_ref;
6594 }
6595
6596 static inline struct LDKDecodeError CResult_InitDecodeErrorZ_get_err(LDKCResult_InitDecodeErrorZ *NONNULL_PTR owner){
6597 CHECK(!owner->result_ok);
6598         return DecodeError_clone(&*owner->contents.err);
6599 }
6600 uint64_t  __attribute__((export_name("TS_CResult_InitDecodeErrorZ_get_err"))) TS_CResult_InitDecodeErrorZ_get_err(uint64_t owner) {
6601         LDKCResult_InitDecodeErrorZ* owner_conv = (LDKCResult_InitDecodeErrorZ*)untag_ptr(owner);
6602         LDKDecodeError ret_var = CResult_InitDecodeErrorZ_get_err(owner_conv);
6603         uint64_t ret_ref = 0;
6604         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6605         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6606         return ret_ref;
6607 }
6608
6609 static inline struct LDKOpenChannel CResult_OpenChannelDecodeErrorZ_get_ok(LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR owner){
6610 CHECK(owner->result_ok);
6611         return OpenChannel_clone(&*owner->contents.result);
6612 }
6613 uint64_t  __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_get_ok"))) TS_CResult_OpenChannelDecodeErrorZ_get_ok(uint64_t owner) {
6614         LDKCResult_OpenChannelDecodeErrorZ* owner_conv = (LDKCResult_OpenChannelDecodeErrorZ*)untag_ptr(owner);
6615         LDKOpenChannel ret_var = CResult_OpenChannelDecodeErrorZ_get_ok(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 LDKDecodeError CResult_OpenChannelDecodeErrorZ_get_err(LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR owner){
6623 CHECK(!owner->result_ok);
6624         return DecodeError_clone(&*owner->contents.err);
6625 }
6626 uint64_t  __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_get_err"))) TS_CResult_OpenChannelDecodeErrorZ_get_err(uint64_t owner) {
6627         LDKCResult_OpenChannelDecodeErrorZ* owner_conv = (LDKCResult_OpenChannelDecodeErrorZ*)untag_ptr(owner);
6628         LDKDecodeError ret_var = CResult_OpenChannelDecodeErrorZ_get_err(owner_conv);
6629         uint64_t ret_ref = 0;
6630         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6631         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6632         return ret_ref;
6633 }
6634
6635 static inline struct LDKRevokeAndACK CResult_RevokeAndACKDecodeErrorZ_get_ok(LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR owner){
6636 CHECK(owner->result_ok);
6637         return RevokeAndACK_clone(&*owner->contents.result);
6638 }
6639 uint64_t  __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_get_ok"))) TS_CResult_RevokeAndACKDecodeErrorZ_get_ok(uint64_t owner) {
6640         LDKCResult_RevokeAndACKDecodeErrorZ* owner_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)untag_ptr(owner);
6641         LDKRevokeAndACK ret_var = CResult_RevokeAndACKDecodeErrorZ_get_ok(owner_conv);
6642         uint64_t ret_ref = 0;
6643         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6644         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6645         return ret_ref;
6646 }
6647
6648 static inline struct LDKDecodeError CResult_RevokeAndACKDecodeErrorZ_get_err(LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR owner){
6649 CHECK(!owner->result_ok);
6650         return DecodeError_clone(&*owner->contents.err);
6651 }
6652 uint64_t  __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_get_err"))) TS_CResult_RevokeAndACKDecodeErrorZ_get_err(uint64_t owner) {
6653         LDKCResult_RevokeAndACKDecodeErrorZ* owner_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)untag_ptr(owner);
6654         LDKDecodeError ret_var = CResult_RevokeAndACKDecodeErrorZ_get_err(owner_conv);
6655         uint64_t ret_ref = 0;
6656         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6657         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6658         return ret_ref;
6659 }
6660
6661 static inline struct LDKShutdown CResult_ShutdownDecodeErrorZ_get_ok(LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR owner){
6662 CHECK(owner->result_ok);
6663         return Shutdown_clone(&*owner->contents.result);
6664 }
6665 uint64_t  __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_get_ok"))) TS_CResult_ShutdownDecodeErrorZ_get_ok(uint64_t owner) {
6666         LDKCResult_ShutdownDecodeErrorZ* owner_conv = (LDKCResult_ShutdownDecodeErrorZ*)untag_ptr(owner);
6667         LDKShutdown ret_var = CResult_ShutdownDecodeErrorZ_get_ok(owner_conv);
6668         uint64_t ret_ref = 0;
6669         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6670         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6671         return ret_ref;
6672 }
6673
6674 static inline struct LDKDecodeError CResult_ShutdownDecodeErrorZ_get_err(LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR owner){
6675 CHECK(!owner->result_ok);
6676         return DecodeError_clone(&*owner->contents.err);
6677 }
6678 uint64_t  __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_get_err"))) TS_CResult_ShutdownDecodeErrorZ_get_err(uint64_t owner) {
6679         LDKCResult_ShutdownDecodeErrorZ* owner_conv = (LDKCResult_ShutdownDecodeErrorZ*)untag_ptr(owner);
6680         LDKDecodeError ret_var = CResult_ShutdownDecodeErrorZ_get_err(owner_conv);
6681         uint64_t ret_ref = 0;
6682         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6683         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6684         return ret_ref;
6685 }
6686
6687 static inline struct LDKUpdateFailHTLC CResult_UpdateFailHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR owner){
6688 CHECK(owner->result_ok);
6689         return UpdateFailHTLC_clone(&*owner->contents.result);
6690 }
6691 uint64_t  __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_get_ok"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_get_ok(uint64_t owner) {
6692         LDKCResult_UpdateFailHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)untag_ptr(owner);
6693         LDKUpdateFailHTLC ret_var = CResult_UpdateFailHTLCDecodeErrorZ_get_ok(owner_conv);
6694         uint64_t ret_ref = 0;
6695         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6696         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6697         return ret_ref;
6698 }
6699
6700 static inline struct LDKDecodeError CResult_UpdateFailHTLCDecodeErrorZ_get_err(LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR owner){
6701 CHECK(!owner->result_ok);
6702         return DecodeError_clone(&*owner->contents.err);
6703 }
6704 uint64_t  __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_get_err"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_get_err(uint64_t owner) {
6705         LDKCResult_UpdateFailHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)untag_ptr(owner);
6706         LDKDecodeError ret_var = CResult_UpdateFailHTLCDecodeErrorZ_get_err(owner_conv);
6707         uint64_t ret_ref = 0;
6708         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6709         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6710         return ret_ref;
6711 }
6712
6713 static inline struct LDKUpdateFailMalformedHTLC CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR owner){
6714 CHECK(owner->result_ok);
6715         return UpdateFailMalformedHTLC_clone(&*owner->contents.result);
6716 }
6717 uint64_t  __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_ok"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_ok(uint64_t owner) {
6718         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)untag_ptr(owner);
6719         LDKUpdateFailMalformedHTLC ret_var = CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_ok(owner_conv);
6720         uint64_t ret_ref = 0;
6721         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6722         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6723         return ret_ref;
6724 }
6725
6726 static inline struct LDKDecodeError CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_err(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR owner){
6727 CHECK(!owner->result_ok);
6728         return DecodeError_clone(&*owner->contents.err);
6729 }
6730 uint64_t  __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_err"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_err(uint64_t owner) {
6731         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)untag_ptr(owner);
6732         LDKDecodeError ret_var = CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_err(owner_conv);
6733         uint64_t ret_ref = 0;
6734         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6735         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6736         return ret_ref;
6737 }
6738
6739 static inline struct LDKUpdateFee CResult_UpdateFeeDecodeErrorZ_get_ok(LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR owner){
6740 CHECK(owner->result_ok);
6741         return UpdateFee_clone(&*owner->contents.result);
6742 }
6743 uint64_t  __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_get_ok"))) TS_CResult_UpdateFeeDecodeErrorZ_get_ok(uint64_t owner) {
6744         LDKCResult_UpdateFeeDecodeErrorZ* owner_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)untag_ptr(owner);
6745         LDKUpdateFee ret_var = CResult_UpdateFeeDecodeErrorZ_get_ok(owner_conv);
6746         uint64_t ret_ref = 0;
6747         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6748         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6749         return ret_ref;
6750 }
6751
6752 static inline struct LDKDecodeError CResult_UpdateFeeDecodeErrorZ_get_err(LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR owner){
6753 CHECK(!owner->result_ok);
6754         return DecodeError_clone(&*owner->contents.err);
6755 }
6756 uint64_t  __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_get_err"))) TS_CResult_UpdateFeeDecodeErrorZ_get_err(uint64_t owner) {
6757         LDKCResult_UpdateFeeDecodeErrorZ* owner_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)untag_ptr(owner);
6758         LDKDecodeError ret_var = CResult_UpdateFeeDecodeErrorZ_get_err(owner_conv);
6759         uint64_t ret_ref = 0;
6760         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6761         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6762         return ret_ref;
6763 }
6764
6765 static inline struct LDKUpdateFulfillHTLC CResult_UpdateFulfillHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR owner){
6766 CHECK(owner->result_ok);
6767         return UpdateFulfillHTLC_clone(&*owner->contents.result);
6768 }
6769 uint64_t  __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_get_ok"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_get_ok(uint64_t owner) {
6770         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)untag_ptr(owner);
6771         LDKUpdateFulfillHTLC ret_var = CResult_UpdateFulfillHTLCDecodeErrorZ_get_ok(owner_conv);
6772         uint64_t ret_ref = 0;
6773         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6774         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6775         return ret_ref;
6776 }
6777
6778 static inline struct LDKDecodeError CResult_UpdateFulfillHTLCDecodeErrorZ_get_err(LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR owner){
6779 CHECK(!owner->result_ok);
6780         return DecodeError_clone(&*owner->contents.err);
6781 }
6782 uint64_t  __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_get_err"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_get_err(uint64_t owner) {
6783         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)untag_ptr(owner);
6784         LDKDecodeError ret_var = CResult_UpdateFulfillHTLCDecodeErrorZ_get_err(owner_conv);
6785         uint64_t ret_ref = 0;
6786         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6787         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6788         return ret_ref;
6789 }
6790
6791 static inline struct LDKUpdateAddHTLC CResult_UpdateAddHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR owner){
6792 CHECK(owner->result_ok);
6793         return UpdateAddHTLC_clone(&*owner->contents.result);
6794 }
6795 uint64_t  __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_get_ok"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_get_ok(uint64_t owner) {
6796         LDKCResult_UpdateAddHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)untag_ptr(owner);
6797         LDKUpdateAddHTLC ret_var = CResult_UpdateAddHTLCDecodeErrorZ_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_UpdateAddHTLCDecodeErrorZ_get_err(LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR owner){
6805 CHECK(!owner->result_ok);
6806         return DecodeError_clone(&*owner->contents.err);
6807 }
6808 uint64_t  __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_get_err"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_get_err(uint64_t owner) {
6809         LDKCResult_UpdateAddHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)untag_ptr(owner);
6810         LDKDecodeError ret_var = CResult_UpdateAddHTLCDecodeErrorZ_get_err(owner_conv);
6811         uint64_t ret_ref = 0;
6812         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6813         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6814         return ret_ref;
6815 }
6816
6817 static inline struct LDKPing CResult_PingDecodeErrorZ_get_ok(LDKCResult_PingDecodeErrorZ *NONNULL_PTR owner){
6818 CHECK(owner->result_ok);
6819         return Ping_clone(&*owner->contents.result);
6820 }
6821 uint64_t  __attribute__((export_name("TS_CResult_PingDecodeErrorZ_get_ok"))) TS_CResult_PingDecodeErrorZ_get_ok(uint64_t owner) {
6822         LDKCResult_PingDecodeErrorZ* owner_conv = (LDKCResult_PingDecodeErrorZ*)untag_ptr(owner);
6823         LDKPing ret_var = CResult_PingDecodeErrorZ_get_ok(owner_conv);
6824         uint64_t ret_ref = 0;
6825         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6826         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6827         return ret_ref;
6828 }
6829
6830 static inline struct LDKDecodeError CResult_PingDecodeErrorZ_get_err(LDKCResult_PingDecodeErrorZ *NONNULL_PTR owner){
6831 CHECK(!owner->result_ok);
6832         return DecodeError_clone(&*owner->contents.err);
6833 }
6834 uint64_t  __attribute__((export_name("TS_CResult_PingDecodeErrorZ_get_err"))) TS_CResult_PingDecodeErrorZ_get_err(uint64_t owner) {
6835         LDKCResult_PingDecodeErrorZ* owner_conv = (LDKCResult_PingDecodeErrorZ*)untag_ptr(owner);
6836         LDKDecodeError ret_var = CResult_PingDecodeErrorZ_get_err(owner_conv);
6837         uint64_t ret_ref = 0;
6838         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6839         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6840         return ret_ref;
6841 }
6842
6843 static inline struct LDKPong CResult_PongDecodeErrorZ_get_ok(LDKCResult_PongDecodeErrorZ *NONNULL_PTR owner){
6844 CHECK(owner->result_ok);
6845         return Pong_clone(&*owner->contents.result);
6846 }
6847 uint64_t  __attribute__((export_name("TS_CResult_PongDecodeErrorZ_get_ok"))) TS_CResult_PongDecodeErrorZ_get_ok(uint64_t owner) {
6848         LDKCResult_PongDecodeErrorZ* owner_conv = (LDKCResult_PongDecodeErrorZ*)untag_ptr(owner);
6849         LDKPong ret_var = CResult_PongDecodeErrorZ_get_ok(owner_conv);
6850         uint64_t ret_ref = 0;
6851         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6852         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6853         return ret_ref;
6854 }
6855
6856 static inline struct LDKDecodeError CResult_PongDecodeErrorZ_get_err(LDKCResult_PongDecodeErrorZ *NONNULL_PTR owner){
6857 CHECK(!owner->result_ok);
6858         return DecodeError_clone(&*owner->contents.err);
6859 }
6860 uint64_t  __attribute__((export_name("TS_CResult_PongDecodeErrorZ_get_err"))) TS_CResult_PongDecodeErrorZ_get_err(uint64_t owner) {
6861         LDKCResult_PongDecodeErrorZ* owner_conv = (LDKCResult_PongDecodeErrorZ*)untag_ptr(owner);
6862         LDKDecodeError ret_var = CResult_PongDecodeErrorZ_get_err(owner_conv);
6863         uint64_t ret_ref = 0;
6864         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6865         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6866         return ret_ref;
6867 }
6868
6869 static inline struct LDKUnsignedChannelAnnouncement CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_ok(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
6870 CHECK(owner->result_ok);
6871         return UnsignedChannelAnnouncement_clone(&*owner->contents.result);
6872 }
6873 uint64_t  __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_ok"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_ok(uint64_t owner) {
6874         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)untag_ptr(owner);
6875         LDKUnsignedChannelAnnouncement ret_var = CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_ok(owner_conv);
6876         uint64_t ret_ref = 0;
6877         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6878         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6879         return ret_ref;
6880 }
6881
6882 static inline struct LDKDecodeError CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_err(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
6883 CHECK(!owner->result_ok);
6884         return DecodeError_clone(&*owner->contents.err);
6885 }
6886 uint64_t  __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_err"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_err(uint64_t owner) {
6887         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)untag_ptr(owner);
6888         LDKDecodeError ret_var = CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_err(owner_conv);
6889         uint64_t ret_ref = 0;
6890         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6891         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6892         return ret_ref;
6893 }
6894
6895 static inline struct LDKChannelAnnouncement CResult_ChannelAnnouncementDecodeErrorZ_get_ok(LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
6896 CHECK(owner->result_ok);
6897         return ChannelAnnouncement_clone(&*owner->contents.result);
6898 }
6899 uint64_t  __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_get_ok"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_get_ok(uint64_t owner) {
6900         LDKCResult_ChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)untag_ptr(owner);
6901         LDKChannelAnnouncement ret_var = CResult_ChannelAnnouncementDecodeErrorZ_get_ok(owner_conv);
6902         uint64_t ret_ref = 0;
6903         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6904         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6905         return ret_ref;
6906 }
6907
6908 static inline struct LDKDecodeError CResult_ChannelAnnouncementDecodeErrorZ_get_err(LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
6909 CHECK(!owner->result_ok);
6910         return DecodeError_clone(&*owner->contents.err);
6911 }
6912 uint64_t  __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_get_err"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_get_err(uint64_t owner) {
6913         LDKCResult_ChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)untag_ptr(owner);
6914         LDKDecodeError ret_var = CResult_ChannelAnnouncementDecodeErrorZ_get_err(owner_conv);
6915         uint64_t ret_ref = 0;
6916         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6917         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6918         return ret_ref;
6919 }
6920
6921 static inline struct LDKUnsignedChannelUpdate CResult_UnsignedChannelUpdateDecodeErrorZ_get_ok(LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
6922 CHECK(owner->result_ok);
6923         return UnsignedChannelUpdate_clone(&*owner->contents.result);
6924 }
6925 uint64_t  __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_get_ok"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_get_ok(uint64_t owner) {
6926         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)untag_ptr(owner);
6927         LDKUnsignedChannelUpdate ret_var = CResult_UnsignedChannelUpdateDecodeErrorZ_get_ok(owner_conv);
6928         uint64_t ret_ref = 0;
6929         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6930         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6931         return ret_ref;
6932 }
6933
6934 static inline struct LDKDecodeError CResult_UnsignedChannelUpdateDecodeErrorZ_get_err(LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
6935 CHECK(!owner->result_ok);
6936         return DecodeError_clone(&*owner->contents.err);
6937 }
6938 uint64_t  __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_get_err"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_get_err(uint64_t owner) {
6939         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)untag_ptr(owner);
6940         LDKDecodeError ret_var = CResult_UnsignedChannelUpdateDecodeErrorZ_get_err(owner_conv);
6941         uint64_t ret_ref = 0;
6942         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6943         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6944         return ret_ref;
6945 }
6946
6947 static inline struct LDKChannelUpdate CResult_ChannelUpdateDecodeErrorZ_get_ok(LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
6948 CHECK(owner->result_ok);
6949         return ChannelUpdate_clone(&*owner->contents.result);
6950 }
6951 uint64_t  __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_get_ok"))) TS_CResult_ChannelUpdateDecodeErrorZ_get_ok(uint64_t owner) {
6952         LDKCResult_ChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)untag_ptr(owner);
6953         LDKChannelUpdate ret_var = CResult_ChannelUpdateDecodeErrorZ_get_ok(owner_conv);
6954         uint64_t ret_ref = 0;
6955         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6956         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6957         return ret_ref;
6958 }
6959
6960 static inline struct LDKDecodeError CResult_ChannelUpdateDecodeErrorZ_get_err(LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
6961 CHECK(!owner->result_ok);
6962         return DecodeError_clone(&*owner->contents.err);
6963 }
6964 uint64_t  __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_get_err"))) TS_CResult_ChannelUpdateDecodeErrorZ_get_err(uint64_t owner) {
6965         LDKCResult_ChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)untag_ptr(owner);
6966         LDKDecodeError ret_var = CResult_ChannelUpdateDecodeErrorZ_get_err(owner_conv);
6967         uint64_t ret_ref = 0;
6968         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6969         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6970         return ret_ref;
6971 }
6972
6973 static inline struct LDKErrorMessage CResult_ErrorMessageDecodeErrorZ_get_ok(LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR owner){
6974 CHECK(owner->result_ok);
6975         return ErrorMessage_clone(&*owner->contents.result);
6976 }
6977 uint64_t  __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_get_ok"))) TS_CResult_ErrorMessageDecodeErrorZ_get_ok(uint64_t owner) {
6978         LDKCResult_ErrorMessageDecodeErrorZ* owner_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)untag_ptr(owner);
6979         LDKErrorMessage ret_var = CResult_ErrorMessageDecodeErrorZ_get_ok(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 LDKDecodeError CResult_ErrorMessageDecodeErrorZ_get_err(LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR owner){
6987 CHECK(!owner->result_ok);
6988         return DecodeError_clone(&*owner->contents.err);
6989 }
6990 uint64_t  __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_get_err"))) TS_CResult_ErrorMessageDecodeErrorZ_get_err(uint64_t owner) {
6991         LDKCResult_ErrorMessageDecodeErrorZ* owner_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)untag_ptr(owner);
6992         LDKDecodeError ret_var = CResult_ErrorMessageDecodeErrorZ_get_err(owner_conv);
6993         uint64_t ret_ref = 0;
6994         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6995         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6996         return ret_ref;
6997 }
6998
6999 static inline struct LDKWarningMessage CResult_WarningMessageDecodeErrorZ_get_ok(LDKCResult_WarningMessageDecodeErrorZ *NONNULL_PTR owner){
7000 CHECK(owner->result_ok);
7001         return WarningMessage_clone(&*owner->contents.result);
7002 }
7003 uint64_t  __attribute__((export_name("TS_CResult_WarningMessageDecodeErrorZ_get_ok"))) TS_CResult_WarningMessageDecodeErrorZ_get_ok(uint64_t owner) {
7004         LDKCResult_WarningMessageDecodeErrorZ* owner_conv = (LDKCResult_WarningMessageDecodeErrorZ*)untag_ptr(owner);
7005         LDKWarningMessage ret_var = CResult_WarningMessageDecodeErrorZ_get_ok(owner_conv);
7006         uint64_t ret_ref = 0;
7007         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7008         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7009         return ret_ref;
7010 }
7011
7012 static inline struct LDKDecodeError CResult_WarningMessageDecodeErrorZ_get_err(LDKCResult_WarningMessageDecodeErrorZ *NONNULL_PTR owner){
7013 CHECK(!owner->result_ok);
7014         return DecodeError_clone(&*owner->contents.err);
7015 }
7016 uint64_t  __attribute__((export_name("TS_CResult_WarningMessageDecodeErrorZ_get_err"))) TS_CResult_WarningMessageDecodeErrorZ_get_err(uint64_t owner) {
7017         LDKCResult_WarningMessageDecodeErrorZ* owner_conv = (LDKCResult_WarningMessageDecodeErrorZ*)untag_ptr(owner);
7018         LDKDecodeError ret_var = CResult_WarningMessageDecodeErrorZ_get_err(owner_conv);
7019         uint64_t ret_ref = 0;
7020         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7021         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7022         return ret_ref;
7023 }
7024
7025 static inline struct LDKUnsignedNodeAnnouncement CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_ok(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
7026 CHECK(owner->result_ok);
7027         return UnsignedNodeAnnouncement_clone(&*owner->contents.result);
7028 }
7029 uint64_t  __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_ok"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_ok(uint64_t owner) {
7030         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)untag_ptr(owner);
7031         LDKUnsignedNodeAnnouncement ret_var = CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_ok(owner_conv);
7032         uint64_t ret_ref = 0;
7033         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7034         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7035         return ret_ref;
7036 }
7037
7038 static inline struct LDKDecodeError CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_err(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
7039 CHECK(!owner->result_ok);
7040         return DecodeError_clone(&*owner->contents.err);
7041 }
7042 uint64_t  __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_err"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_err(uint64_t owner) {
7043         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)untag_ptr(owner);
7044         LDKDecodeError ret_var = CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_err(owner_conv);
7045         uint64_t ret_ref = 0;
7046         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7047         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7048         return ret_ref;
7049 }
7050
7051 static inline struct LDKNodeAnnouncement CResult_NodeAnnouncementDecodeErrorZ_get_ok(LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
7052 CHECK(owner->result_ok);
7053         return NodeAnnouncement_clone(&*owner->contents.result);
7054 }
7055 uint64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_get_ok"))) TS_CResult_NodeAnnouncementDecodeErrorZ_get_ok(uint64_t owner) {
7056         LDKCResult_NodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)untag_ptr(owner);
7057         LDKNodeAnnouncement ret_var = CResult_NodeAnnouncementDecodeErrorZ_get_ok(owner_conv);
7058         uint64_t ret_ref = 0;
7059         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7060         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7061         return ret_ref;
7062 }
7063
7064 static inline struct LDKDecodeError CResult_NodeAnnouncementDecodeErrorZ_get_err(LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
7065 CHECK(!owner->result_ok);
7066         return DecodeError_clone(&*owner->contents.err);
7067 }
7068 uint64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_get_err"))) TS_CResult_NodeAnnouncementDecodeErrorZ_get_err(uint64_t owner) {
7069         LDKCResult_NodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)untag_ptr(owner);
7070         LDKDecodeError ret_var = CResult_NodeAnnouncementDecodeErrorZ_get_err(owner_conv);
7071         uint64_t ret_ref = 0;
7072         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7073         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7074         return ret_ref;
7075 }
7076
7077 static inline struct LDKQueryShortChannelIds CResult_QueryShortChannelIdsDecodeErrorZ_get_ok(LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR owner){
7078 CHECK(owner->result_ok);
7079         return QueryShortChannelIds_clone(&*owner->contents.result);
7080 }
7081 uint64_t  __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_get_ok"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_get_ok(uint64_t owner) {
7082         LDKCResult_QueryShortChannelIdsDecodeErrorZ* owner_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)untag_ptr(owner);
7083         LDKQueryShortChannelIds ret_var = CResult_QueryShortChannelIdsDecodeErrorZ_get_ok(owner_conv);
7084         uint64_t ret_ref = 0;
7085         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7086         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7087         return ret_ref;
7088 }
7089
7090 static inline struct LDKDecodeError CResult_QueryShortChannelIdsDecodeErrorZ_get_err(LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR owner){
7091 CHECK(!owner->result_ok);
7092         return DecodeError_clone(&*owner->contents.err);
7093 }
7094 uint64_t  __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_get_err"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_get_err(uint64_t owner) {
7095         LDKCResult_QueryShortChannelIdsDecodeErrorZ* owner_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)untag_ptr(owner);
7096         LDKDecodeError ret_var = CResult_QueryShortChannelIdsDecodeErrorZ_get_err(owner_conv);
7097         uint64_t ret_ref = 0;
7098         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7099         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7100         return ret_ref;
7101 }
7102
7103 static inline struct LDKReplyShortChannelIdsEnd CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_ok(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR owner){
7104 CHECK(owner->result_ok);
7105         return ReplyShortChannelIdsEnd_clone(&*owner->contents.result);
7106 }
7107 uint64_t  __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_ok"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_ok(uint64_t owner) {
7108         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* owner_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)untag_ptr(owner);
7109         LDKReplyShortChannelIdsEnd ret_var = CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_ok(owner_conv);
7110         uint64_t ret_ref = 0;
7111         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7112         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7113         return ret_ref;
7114 }
7115
7116 static inline struct LDKDecodeError CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_err(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR owner){
7117 CHECK(!owner->result_ok);
7118         return DecodeError_clone(&*owner->contents.err);
7119 }
7120 uint64_t  __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_err"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_err(uint64_t owner) {
7121         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* owner_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)untag_ptr(owner);
7122         LDKDecodeError ret_var = CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_err(owner_conv);
7123         uint64_t ret_ref = 0;
7124         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7125         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7126         return ret_ref;
7127 }
7128
7129 static inline struct LDKQueryChannelRange CResult_QueryChannelRangeDecodeErrorZ_get_ok(LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR owner){
7130 CHECK(owner->result_ok);
7131         return QueryChannelRange_clone(&*owner->contents.result);
7132 }
7133 uint64_t  __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_get_ok"))) TS_CResult_QueryChannelRangeDecodeErrorZ_get_ok(uint64_t owner) {
7134         LDKCResult_QueryChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)untag_ptr(owner);
7135         LDKQueryChannelRange ret_var = CResult_QueryChannelRangeDecodeErrorZ_get_ok(owner_conv);
7136         uint64_t ret_ref = 0;
7137         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7138         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7139         return ret_ref;
7140 }
7141
7142 static inline struct LDKDecodeError CResult_QueryChannelRangeDecodeErrorZ_get_err(LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR owner){
7143 CHECK(!owner->result_ok);
7144         return DecodeError_clone(&*owner->contents.err);
7145 }
7146 uint64_t  __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_get_err"))) TS_CResult_QueryChannelRangeDecodeErrorZ_get_err(uint64_t owner) {
7147         LDKCResult_QueryChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)untag_ptr(owner);
7148         LDKDecodeError ret_var = CResult_QueryChannelRangeDecodeErrorZ_get_err(owner_conv);
7149         uint64_t ret_ref = 0;
7150         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7151         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7152         return ret_ref;
7153 }
7154
7155 static inline struct LDKReplyChannelRange CResult_ReplyChannelRangeDecodeErrorZ_get_ok(LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR owner){
7156 CHECK(owner->result_ok);
7157         return ReplyChannelRange_clone(&*owner->contents.result);
7158 }
7159 uint64_t  __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_get_ok"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_get_ok(uint64_t owner) {
7160         LDKCResult_ReplyChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)untag_ptr(owner);
7161         LDKReplyChannelRange ret_var = CResult_ReplyChannelRangeDecodeErrorZ_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_ReplyChannelRangeDecodeErrorZ_get_err(LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR owner){
7169 CHECK(!owner->result_ok);
7170         return DecodeError_clone(&*owner->contents.err);
7171 }
7172 uint64_t  __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_get_err"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_get_err(uint64_t owner) {
7173         LDKCResult_ReplyChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)untag_ptr(owner);
7174         LDKDecodeError ret_var = CResult_ReplyChannelRangeDecodeErrorZ_get_err(owner_conv);
7175         uint64_t ret_ref = 0;
7176         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7177         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7178         return ret_ref;
7179 }
7180
7181 static inline struct LDKGossipTimestampFilter CResult_GossipTimestampFilterDecodeErrorZ_get_ok(LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR owner){
7182 CHECK(owner->result_ok);
7183         return GossipTimestampFilter_clone(&*owner->contents.result);
7184 }
7185 uint64_t  __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_get_ok"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_get_ok(uint64_t owner) {
7186         LDKCResult_GossipTimestampFilterDecodeErrorZ* owner_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)untag_ptr(owner);
7187         LDKGossipTimestampFilter ret_var = CResult_GossipTimestampFilterDecodeErrorZ_get_ok(owner_conv);
7188         uint64_t ret_ref = 0;
7189         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7190         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7191         return ret_ref;
7192 }
7193
7194 static inline struct LDKDecodeError CResult_GossipTimestampFilterDecodeErrorZ_get_err(LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR owner){
7195 CHECK(!owner->result_ok);
7196         return DecodeError_clone(&*owner->contents.err);
7197 }
7198 uint64_t  __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_get_err"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_get_err(uint64_t owner) {
7199         LDKCResult_GossipTimestampFilterDecodeErrorZ* owner_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)untag_ptr(owner);
7200         LDKDecodeError ret_var = CResult_GossipTimestampFilterDecodeErrorZ_get_err(owner_conv);
7201         uint64_t ret_ref = 0;
7202         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7203         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7204         return ret_ref;
7205 }
7206
7207 uint32_t __attribute__((export_name("TS_LDKSignOrCreationError_ty_from_ptr"))) TS_LDKSignOrCreationError_ty_from_ptr(uint64_t ptr) {
7208         LDKSignOrCreationError *obj = (LDKSignOrCreationError*)untag_ptr(ptr);
7209         switch(obj->tag) {
7210                 case LDKSignOrCreationError_SignError: return 0;
7211                 case LDKSignOrCreationError_CreationError: return 1;
7212                 default: abort();
7213         }
7214 }
7215 uint32_t __attribute__((export_name("TS_LDKSignOrCreationError_CreationError_get_creation_error"))) TS_LDKSignOrCreationError_CreationError_get_creation_error(uint64_t ptr) {
7216         LDKSignOrCreationError *obj = (LDKSignOrCreationError*)untag_ptr(ptr);
7217         assert(obj->tag == LDKSignOrCreationError_CreationError);
7218                         uint32_t creation_error_conv = LDKCreationError_to_js(obj->creation_error);
7219         return creation_error_conv;
7220 }
7221 static inline struct LDKInvoice CResult_InvoiceSignOrCreationErrorZ_get_ok(LDKCResult_InvoiceSignOrCreationErrorZ *NONNULL_PTR owner){
7222 CHECK(owner->result_ok);
7223         return Invoice_clone(&*owner->contents.result);
7224 }
7225 uint64_t  __attribute__((export_name("TS_CResult_InvoiceSignOrCreationErrorZ_get_ok"))) TS_CResult_InvoiceSignOrCreationErrorZ_get_ok(uint64_t owner) {
7226         LDKCResult_InvoiceSignOrCreationErrorZ* owner_conv = (LDKCResult_InvoiceSignOrCreationErrorZ*)untag_ptr(owner);
7227         LDKInvoice ret_var = CResult_InvoiceSignOrCreationErrorZ_get_ok(owner_conv);
7228         uint64_t ret_ref = 0;
7229         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7230         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7231         return ret_ref;
7232 }
7233
7234 static inline struct LDKSignOrCreationError CResult_InvoiceSignOrCreationErrorZ_get_err(LDKCResult_InvoiceSignOrCreationErrorZ *NONNULL_PTR owner){
7235 CHECK(!owner->result_ok);
7236         return SignOrCreationError_clone(&*owner->contents.err);
7237 }
7238 uint64_t  __attribute__((export_name("TS_CResult_InvoiceSignOrCreationErrorZ_get_err"))) TS_CResult_InvoiceSignOrCreationErrorZ_get_err(uint64_t owner) {
7239         LDKCResult_InvoiceSignOrCreationErrorZ* owner_conv = (LDKCResult_InvoiceSignOrCreationErrorZ*)untag_ptr(owner);
7240         LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
7241         *ret_copy = CResult_InvoiceSignOrCreationErrorZ_get_err(owner_conv);
7242         uint64_t ret_ref = tag_ptr(ret_copy, true);
7243         return ret_ref;
7244 }
7245
7246 typedef struct LDKFilter_JCalls {
7247         atomic_size_t refcnt;
7248         uint32_t instance_ptr;
7249 } LDKFilter_JCalls;
7250 static void LDKFilter_JCalls_free(void* this_arg) {
7251         LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
7252         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
7253                 FREE(j_calls);
7254         }
7255 }
7256 void register_tx_LDKFilter_jcall(const void* this_arg, const uint8_t (* txid)[32], LDKu8slice script_pubkey) {
7257         LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
7258         int8_tArray txid_arr = init_int8_tArray(32, __LINE__);
7259         memcpy(txid_arr->elems, *txid, 32);
7260         LDKu8slice script_pubkey_var = script_pubkey;
7261         int8_tArray script_pubkey_arr = init_int8_tArray(script_pubkey_var.datalen, __LINE__);
7262         memcpy(script_pubkey_arr->elems, script_pubkey_var.data, script_pubkey_var.datalen);
7263         js_invoke_function_uuuuuu(j_calls->instance_ptr, 32, (uint32_t)txid_arr, (uint32_t)script_pubkey_arr, 0, 0, 0, 0);
7264 }
7265 LDKCOption_C2Tuple_usizeTransactionZZ register_output_LDKFilter_jcall(const void* this_arg, LDKWatchedOutput output) {
7266         LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
7267         LDKWatchedOutput output_var = output;
7268         uint64_t output_ref = 0;
7269         CHECK_INNER_FIELD_ACCESS_OR_NULL(output_var);
7270         output_ref = tag_ptr(output_var.inner, output_var.is_owned);
7271         uint32_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 33, output_ref, 0, 0, 0, 0, 0);
7272         void* ret_ptr = untag_ptr(ret);
7273         CHECK_ACCESS(ret_ptr);
7274         LDKCOption_C2Tuple_usizeTransactionZZ ret_conv = *(LDKCOption_C2Tuple_usizeTransactionZZ*)(ret_ptr);
7275         FREE(untag_ptr(ret));
7276         return ret_conv;
7277 }
7278 static void LDKFilter_JCalls_cloned(LDKFilter* new_obj) {
7279         LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) new_obj->this_arg;
7280         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
7281 }
7282 static inline LDKFilter LDKFilter_init (JSValue o) {
7283         LDKFilter_JCalls *calls = MALLOC(sizeof(LDKFilter_JCalls), "LDKFilter_JCalls");
7284         atomic_init(&calls->refcnt, 1);
7285         calls->instance_ptr = o;
7286
7287         LDKFilter ret = {
7288                 .this_arg = (void*) calls,
7289                 .register_tx = register_tx_LDKFilter_jcall,
7290                 .register_output = register_output_LDKFilter_jcall,
7291                 .free = LDKFilter_JCalls_free,
7292         };
7293         return ret;
7294 }
7295 uint64_t  __attribute__((export_name("TS_LDKFilter_new"))) TS_LDKFilter_new(JSValue o) {
7296         LDKFilter *res_ptr = MALLOC(sizeof(LDKFilter), "LDKFilter");
7297         *res_ptr = LDKFilter_init(o);
7298         return tag_ptr(res_ptr, true);
7299 }
7300 void  __attribute__((export_name("TS_Filter_register_tx"))) TS_Filter_register_tx(uint64_t this_arg, int8_tArray txid, int8_tArray script_pubkey) {
7301         void* this_arg_ptr = untag_ptr(this_arg);
7302         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
7303         LDKFilter* this_arg_conv = (LDKFilter*)this_arg_ptr;
7304         unsigned char txid_arr[32];
7305         CHECK(txid->arr_len == 32);
7306         memcpy(txid_arr, txid->elems, 32); FREE(txid);
7307         unsigned char (*txid_ref)[32] = &txid_arr;
7308         LDKu8slice script_pubkey_ref;
7309         script_pubkey_ref.datalen = script_pubkey->arr_len;
7310         script_pubkey_ref.data = script_pubkey->elems;
7311         (this_arg_conv->register_tx)(this_arg_conv->this_arg, txid_ref, script_pubkey_ref);
7312         FREE(script_pubkey);
7313 }
7314
7315 uint64_t  __attribute__((export_name("TS_Filter_register_output"))) TS_Filter_register_output(uint64_t this_arg, uint64_t output) {
7316         void* this_arg_ptr = untag_ptr(this_arg);
7317         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
7318         LDKFilter* this_arg_conv = (LDKFilter*)this_arg_ptr;
7319         LDKWatchedOutput output_conv;
7320         output_conv.inner = untag_ptr(output);
7321         output_conv.is_owned = ptr_is_owned(output);
7322         CHECK_INNER_FIELD_ACCESS_OR_NULL(output_conv);
7323         output_conv = WatchedOutput_clone(&output_conv);
7324         LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
7325         *ret_copy = (this_arg_conv->register_output)(this_arg_conv->this_arg, output_conv);
7326         uint64_t ret_ref = tag_ptr(ret_copy, true);
7327         return ret_ref;
7328 }
7329
7330 uint32_t __attribute__((export_name("TS_LDKCOption_FilterZ_ty_from_ptr"))) TS_LDKCOption_FilterZ_ty_from_ptr(uint64_t ptr) {
7331         LDKCOption_FilterZ *obj = (LDKCOption_FilterZ*)untag_ptr(ptr);
7332         switch(obj->tag) {
7333                 case LDKCOption_FilterZ_Some: return 0;
7334                 case LDKCOption_FilterZ_None: return 1;
7335                 default: abort();
7336         }
7337 }
7338 uint64_t __attribute__((export_name("TS_LDKCOption_FilterZ_Some_get_some"))) TS_LDKCOption_FilterZ_Some_get_some(uint64_t ptr) {
7339         LDKCOption_FilterZ *obj = (LDKCOption_FilterZ*)untag_ptr(ptr);
7340         assert(obj->tag == LDKCOption_FilterZ_Some);
7341                         LDKFilter* some_ret = MALLOC(sizeof(LDKFilter), "LDKFilter");
7342                         *some_ret = obj->some;
7343                         // WARNING: We likely need to clone here, but no clone is available, so we just do it for Java instances
7344                         if ((*some_ret).free == LDKFilter_JCalls_free) {
7345                                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
7346                                 LDKFilter_JCalls_cloned(&(*some_ret));
7347                         }
7348         return tag_ptr(some_ret, true);
7349 }
7350 static inline struct LDKLockedChannelMonitor *CResult_LockedChannelMonitorNoneZ_get_ok(LDKCResult_LockedChannelMonitorNoneZ *NONNULL_PTR owner){
7351 CHECK(owner->result_ok);
7352         return &*owner->contents.result;
7353 }
7354 uint64_t  __attribute__((export_name("TS_CResult_LockedChannelMonitorNoneZ_get_ok"))) TS_CResult_LockedChannelMonitorNoneZ_get_ok(uint64_t owner) {
7355         LDKCResult_LockedChannelMonitorNoneZ* owner_conv = (LDKCResult_LockedChannelMonitorNoneZ*)untag_ptr(owner);
7356         LDKLockedChannelMonitor ret_var = *CResult_LockedChannelMonitorNoneZ_get_ok(owner_conv);
7357         uint64_t ret_ref = 0;
7358         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7359         ret_ref = tag_ptr(ret_var.inner, false);
7360         return ret_ref;
7361 }
7362
7363 static inline void CResult_LockedChannelMonitorNoneZ_get_err(LDKCResult_LockedChannelMonitorNoneZ *NONNULL_PTR owner){
7364 CHECK(!owner->result_ok);
7365         return *owner->contents.err;
7366 }
7367 void  __attribute__((export_name("TS_CResult_LockedChannelMonitorNoneZ_get_err"))) TS_CResult_LockedChannelMonitorNoneZ_get_err(uint64_t owner) {
7368         LDKCResult_LockedChannelMonitorNoneZ* owner_conv = (LDKCResult_LockedChannelMonitorNoneZ*)untag_ptr(owner);
7369         CResult_LockedChannelMonitorNoneZ_get_err(owner_conv);
7370 }
7371
7372 static inline LDKCVec_OutPointZ CVec_OutPointZ_clone(const LDKCVec_OutPointZ *orig) {
7373         LDKCVec_OutPointZ ret = { .data = MALLOC(sizeof(LDKOutPoint) * orig->datalen, "LDKCVec_OutPointZ clone bytes"), .datalen = orig->datalen };
7374         for (size_t i = 0; i < ret.datalen; i++) {
7375                 ret.data[i] = OutPoint_clone(&orig->data[i]);
7376         }
7377         return ret;
7378 }
7379 typedef struct LDKMessageSendEventsProvider_JCalls {
7380         atomic_size_t refcnt;
7381         uint32_t instance_ptr;
7382 } LDKMessageSendEventsProvider_JCalls;
7383 static void LDKMessageSendEventsProvider_JCalls_free(void* this_arg) {
7384         LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
7385         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
7386                 FREE(j_calls);
7387         }
7388 }
7389 LDKCVec_MessageSendEventZ get_and_clear_pending_msg_events_LDKMessageSendEventsProvider_jcall(const void* this_arg) {
7390         LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
7391         uint64_tArray ret = (uint64_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 34, 0, 0, 0, 0, 0, 0);
7392         LDKCVec_MessageSendEventZ ret_constr;
7393         ret_constr.datalen = ret->arr_len;
7394         if (ret_constr.datalen > 0)
7395                 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
7396         else
7397                 ret_constr.data = NULL;
7398         uint64_t* ret_vals = ret->elems;
7399         for (size_t s = 0; s < ret_constr.datalen; s++) {
7400                 uint64_t ret_conv_18 = ret_vals[s];
7401                 void* ret_conv_18_ptr = untag_ptr(ret_conv_18);
7402                 CHECK_ACCESS(ret_conv_18_ptr);
7403                 LDKMessageSendEvent ret_conv_18_conv = *(LDKMessageSendEvent*)(ret_conv_18_ptr);
7404                 FREE(untag_ptr(ret_conv_18));
7405                 ret_constr.data[s] = ret_conv_18_conv;
7406         }
7407         FREE(ret);
7408         return ret_constr;
7409 }
7410 static void LDKMessageSendEventsProvider_JCalls_cloned(LDKMessageSendEventsProvider* new_obj) {
7411         LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) new_obj->this_arg;
7412         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
7413 }
7414 static inline LDKMessageSendEventsProvider LDKMessageSendEventsProvider_init (JSValue o) {
7415         LDKMessageSendEventsProvider_JCalls *calls = MALLOC(sizeof(LDKMessageSendEventsProvider_JCalls), "LDKMessageSendEventsProvider_JCalls");
7416         atomic_init(&calls->refcnt, 1);
7417         calls->instance_ptr = o;
7418
7419         LDKMessageSendEventsProvider ret = {
7420                 .this_arg = (void*) calls,
7421                 .get_and_clear_pending_msg_events = get_and_clear_pending_msg_events_LDKMessageSendEventsProvider_jcall,
7422                 .free = LDKMessageSendEventsProvider_JCalls_free,
7423         };
7424         return ret;
7425 }
7426 uint64_t  __attribute__((export_name("TS_LDKMessageSendEventsProvider_new"))) TS_LDKMessageSendEventsProvider_new(JSValue o) {
7427         LDKMessageSendEventsProvider *res_ptr = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
7428         *res_ptr = LDKMessageSendEventsProvider_init(o);
7429         return tag_ptr(res_ptr, true);
7430 }
7431 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) {
7432         void* this_arg_ptr = untag_ptr(this_arg);
7433         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
7434         LDKMessageSendEventsProvider* this_arg_conv = (LDKMessageSendEventsProvider*)this_arg_ptr;
7435         LDKCVec_MessageSendEventZ ret_var = (this_arg_conv->get_and_clear_pending_msg_events)(this_arg_conv->this_arg);
7436         uint64_tArray ret_arr = NULL;
7437         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
7438         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
7439         for (size_t s = 0; s < ret_var.datalen; s++) {
7440                 LDKMessageSendEvent *ret_conv_18_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
7441                 *ret_conv_18_copy = ret_var.data[s];
7442                 uint64_t ret_conv_18_ref = tag_ptr(ret_conv_18_copy, true);
7443                 ret_arr_ptr[s] = ret_conv_18_ref;
7444         }
7445         
7446         FREE(ret_var.data);
7447         return ret_arr;
7448 }
7449
7450 typedef struct LDKEventHandler_JCalls {
7451         atomic_size_t refcnt;
7452         uint32_t instance_ptr;
7453 } LDKEventHandler_JCalls;
7454 static void LDKEventHandler_JCalls_free(void* this_arg) {
7455         LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) this_arg;
7456         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
7457                 FREE(j_calls);
7458         }
7459 }
7460 void handle_event_LDKEventHandler_jcall(const void* this_arg, const LDKEvent * event) {
7461         LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) this_arg;
7462         LDKEvent *ret_event = MALLOC(sizeof(LDKEvent), "LDKEvent ret conversion");
7463         *ret_event = Event_clone(event);
7464         uint64_t ref_event = tag_ptr(ret_event, true);
7465         js_invoke_function_buuuuu(j_calls->instance_ptr, 35, ref_event, 0, 0, 0, 0, 0);
7466 }
7467 static void LDKEventHandler_JCalls_cloned(LDKEventHandler* new_obj) {
7468         LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) new_obj->this_arg;
7469         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
7470 }
7471 static inline LDKEventHandler LDKEventHandler_init (JSValue o) {
7472         LDKEventHandler_JCalls *calls = MALLOC(sizeof(LDKEventHandler_JCalls), "LDKEventHandler_JCalls");
7473         atomic_init(&calls->refcnt, 1);
7474         calls->instance_ptr = o;
7475
7476         LDKEventHandler ret = {
7477                 .this_arg = (void*) calls,
7478                 .handle_event = handle_event_LDKEventHandler_jcall,
7479                 .free = LDKEventHandler_JCalls_free,
7480         };
7481         return ret;
7482 }
7483 uint64_t  __attribute__((export_name("TS_LDKEventHandler_new"))) TS_LDKEventHandler_new(JSValue o) {
7484         LDKEventHandler *res_ptr = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
7485         *res_ptr = LDKEventHandler_init(o);
7486         return tag_ptr(res_ptr, true);
7487 }
7488 void  __attribute__((export_name("TS_EventHandler_handle_event"))) TS_EventHandler_handle_event(uint64_t this_arg, uint64_t event) {
7489         void* this_arg_ptr = untag_ptr(this_arg);
7490         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
7491         LDKEventHandler* this_arg_conv = (LDKEventHandler*)this_arg_ptr;
7492         LDKEvent* event_conv = (LDKEvent*)untag_ptr(event);
7493         (this_arg_conv->handle_event)(this_arg_conv->this_arg, event_conv);
7494 }
7495
7496 typedef struct LDKEventsProvider_JCalls {
7497         atomic_size_t refcnt;
7498         uint32_t instance_ptr;
7499 } LDKEventsProvider_JCalls;
7500 static void LDKEventsProvider_JCalls_free(void* this_arg) {
7501         LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
7502         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
7503                 FREE(j_calls);
7504         }
7505 }
7506 void process_pending_events_LDKEventsProvider_jcall(const void* this_arg, LDKEventHandler handler) {
7507         LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
7508         LDKEventHandler* handler_ret = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
7509         *handler_ret = handler;
7510         js_invoke_function_buuuuu(j_calls->instance_ptr, 36, tag_ptr(handler_ret, true), 0, 0, 0, 0, 0);
7511 }
7512 static void LDKEventsProvider_JCalls_cloned(LDKEventsProvider* new_obj) {
7513         LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) new_obj->this_arg;
7514         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
7515 }
7516 static inline LDKEventsProvider LDKEventsProvider_init (JSValue o) {
7517         LDKEventsProvider_JCalls *calls = MALLOC(sizeof(LDKEventsProvider_JCalls), "LDKEventsProvider_JCalls");
7518         atomic_init(&calls->refcnt, 1);
7519         calls->instance_ptr = o;
7520
7521         LDKEventsProvider ret = {
7522                 .this_arg = (void*) calls,
7523                 .process_pending_events = process_pending_events_LDKEventsProvider_jcall,
7524                 .free = LDKEventsProvider_JCalls_free,
7525         };
7526         return ret;
7527 }
7528 uint64_t  __attribute__((export_name("TS_LDKEventsProvider_new"))) TS_LDKEventsProvider_new(JSValue o) {
7529         LDKEventsProvider *res_ptr = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
7530         *res_ptr = LDKEventsProvider_init(o);
7531         return tag_ptr(res_ptr, true);
7532 }
7533 void  __attribute__((export_name("TS_EventsProvider_process_pending_events"))) TS_EventsProvider_process_pending_events(uint64_t this_arg, uint64_t handler) {
7534         void* this_arg_ptr = untag_ptr(this_arg);
7535         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
7536         LDKEventsProvider* this_arg_conv = (LDKEventsProvider*)this_arg_ptr;
7537         void* handler_ptr = untag_ptr(handler);
7538         CHECK_ACCESS(handler_ptr);
7539         LDKEventHandler handler_conv = *(LDKEventHandler*)(handler_ptr);
7540         if (handler_conv.free == LDKEventHandler_JCalls_free) {
7541                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
7542                 LDKEventHandler_JCalls_cloned(&handler_conv);
7543         }
7544         (this_arg_conv->process_pending_events)(this_arg_conv->this_arg, handler_conv);
7545 }
7546
7547 typedef struct LDKScore_JCalls {
7548         atomic_size_t refcnt;
7549         uint32_t instance_ptr;
7550 } LDKScore_JCalls;
7551 static void LDKScore_JCalls_free(void* this_arg) {
7552         LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
7553         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
7554                 FREE(j_calls);
7555         }
7556 }
7557 uint64_t channel_penalty_msat_LDKScore_jcall(const void* this_arg, uint64_t short_channel_id, const LDKNodeId * source, const LDKNodeId * target, LDKChannelUsage usage) {
7558         LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
7559         int64_t short_channel_id_conv = short_channel_id;
7560         LDKNodeId source_var = *source;
7561         uint64_t source_ref = 0;
7562         source_var = NodeId_clone(&source_var);
7563         CHECK_INNER_FIELD_ACCESS_OR_NULL(source_var);
7564         source_ref = tag_ptr(source_var.inner, source_var.is_owned);
7565         LDKNodeId target_var = *target;
7566         uint64_t target_ref = 0;
7567         target_var = NodeId_clone(&target_var);
7568         CHECK_INNER_FIELD_ACCESS_OR_NULL(target_var);
7569         target_ref = tag_ptr(target_var.inner, target_var.is_owned);
7570         LDKChannelUsage usage_var = usage;
7571         uint64_t usage_ref = 0;
7572         CHECK_INNER_FIELD_ACCESS_OR_NULL(usage_var);
7573         usage_ref = tag_ptr(usage_var.inner, usage_var.is_owned);
7574         return js_invoke_function_bbbbuu(j_calls->instance_ptr, 37, short_channel_id_conv, source_ref, target_ref, usage_ref, 0, 0);
7575 }
7576 void payment_path_failed_LDKScore_jcall(void* this_arg, LDKCVec_RouteHopZ path, uint64_t short_channel_id) {
7577         LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
7578         LDKCVec_RouteHopZ path_var = path;
7579         uint64_tArray path_arr = NULL;
7580         path_arr = init_uint64_tArray(path_var.datalen, __LINE__);
7581         uint64_t *path_arr_ptr = (uint64_t*)(((uint8_t*)path_arr) + 8);
7582         for (size_t k = 0; k < path_var.datalen; k++) {
7583                 LDKRouteHop path_conv_10_var = path_var.data[k];
7584                 uint64_t path_conv_10_ref = 0;
7585                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var);
7586                 path_conv_10_ref = tag_ptr(path_conv_10_var.inner, path_conv_10_var.is_owned);
7587                 path_arr_ptr[k] = path_conv_10_ref;
7588         }
7589         
7590         FREE(path_var.data);
7591         int64_t short_channel_id_conv = short_channel_id;
7592         js_invoke_function_ubuuuu(j_calls->instance_ptr, 38, (uint32_t)path_arr, short_channel_id_conv, 0, 0, 0, 0);
7593 }
7594 void payment_path_successful_LDKScore_jcall(void* this_arg, LDKCVec_RouteHopZ path) {
7595         LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
7596         LDKCVec_RouteHopZ path_var = path;
7597         uint64_tArray path_arr = NULL;
7598         path_arr = init_uint64_tArray(path_var.datalen, __LINE__);
7599         uint64_t *path_arr_ptr = (uint64_t*)(((uint8_t*)path_arr) + 8);
7600         for (size_t k = 0; k < path_var.datalen; k++) {
7601                 LDKRouteHop path_conv_10_var = path_var.data[k];
7602                 uint64_t path_conv_10_ref = 0;
7603                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var);
7604                 path_conv_10_ref = tag_ptr(path_conv_10_var.inner, path_conv_10_var.is_owned);
7605                 path_arr_ptr[k] = path_conv_10_ref;
7606         }
7607         
7608         FREE(path_var.data);
7609         js_invoke_function_uuuuuu(j_calls->instance_ptr, 39, (uint32_t)path_arr, 0, 0, 0, 0, 0);
7610 }
7611 void probe_failed_LDKScore_jcall(void* this_arg, LDKCVec_RouteHopZ path, uint64_t short_channel_id) {
7612         LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
7613         LDKCVec_RouteHopZ path_var = path;
7614         uint64_tArray path_arr = NULL;
7615         path_arr = init_uint64_tArray(path_var.datalen, __LINE__);
7616         uint64_t *path_arr_ptr = (uint64_t*)(((uint8_t*)path_arr) + 8);
7617         for (size_t k = 0; k < path_var.datalen; k++) {
7618                 LDKRouteHop path_conv_10_var = path_var.data[k];
7619                 uint64_t path_conv_10_ref = 0;
7620                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var);
7621                 path_conv_10_ref = tag_ptr(path_conv_10_var.inner, path_conv_10_var.is_owned);
7622                 path_arr_ptr[k] = path_conv_10_ref;
7623         }
7624         
7625         FREE(path_var.data);
7626         int64_t short_channel_id_conv = short_channel_id;
7627         js_invoke_function_ubuuuu(j_calls->instance_ptr, 40, (uint32_t)path_arr, short_channel_id_conv, 0, 0, 0, 0);
7628 }
7629 void probe_successful_LDKScore_jcall(void* this_arg, LDKCVec_RouteHopZ path) {
7630         LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
7631         LDKCVec_RouteHopZ path_var = path;
7632         uint64_tArray path_arr = NULL;
7633         path_arr = init_uint64_tArray(path_var.datalen, __LINE__);
7634         uint64_t *path_arr_ptr = (uint64_t*)(((uint8_t*)path_arr) + 8);
7635         for (size_t k = 0; k < path_var.datalen; k++) {
7636                 LDKRouteHop path_conv_10_var = path_var.data[k];
7637                 uint64_t path_conv_10_ref = 0;
7638                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var);
7639                 path_conv_10_ref = tag_ptr(path_conv_10_var.inner, path_conv_10_var.is_owned);
7640                 path_arr_ptr[k] = path_conv_10_ref;
7641         }
7642         
7643         FREE(path_var.data);
7644         js_invoke_function_uuuuuu(j_calls->instance_ptr, 41, (uint32_t)path_arr, 0, 0, 0, 0, 0);
7645 }
7646 LDKCVec_u8Z write_LDKScore_jcall(const void* this_arg) {
7647         LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
7648         int8_tArray ret = (int8_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 42, 0, 0, 0, 0, 0, 0);
7649         LDKCVec_u8Z ret_ref;
7650         ret_ref.datalen = ret->arr_len;
7651         ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
7652         memcpy(ret_ref.data, ret->elems, ret_ref.datalen); FREE(ret);
7653         return ret_ref;
7654 }
7655 static void LDKScore_JCalls_cloned(LDKScore* new_obj) {
7656         LDKScore_JCalls *j_calls = (LDKScore_JCalls*) new_obj->this_arg;
7657         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
7658 }
7659 static inline LDKScore LDKScore_init (JSValue o) {
7660         LDKScore_JCalls *calls = MALLOC(sizeof(LDKScore_JCalls), "LDKScore_JCalls");
7661         atomic_init(&calls->refcnt, 1);
7662         calls->instance_ptr = o;
7663
7664         LDKScore ret = {
7665                 .this_arg = (void*) calls,
7666                 .channel_penalty_msat = channel_penalty_msat_LDKScore_jcall,
7667                 .payment_path_failed = payment_path_failed_LDKScore_jcall,
7668                 .payment_path_successful = payment_path_successful_LDKScore_jcall,
7669                 .probe_failed = probe_failed_LDKScore_jcall,
7670                 .probe_successful = probe_successful_LDKScore_jcall,
7671                 .write = write_LDKScore_jcall,
7672                 .free = LDKScore_JCalls_free,
7673         };
7674         return ret;
7675 }
7676 uint64_t  __attribute__((export_name("TS_LDKScore_new"))) TS_LDKScore_new(JSValue o) {
7677         LDKScore *res_ptr = MALLOC(sizeof(LDKScore), "LDKScore");
7678         *res_ptr = LDKScore_init(o);
7679         return tag_ptr(res_ptr, true);
7680 }
7681 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) {
7682         void* this_arg_ptr = untag_ptr(this_arg);
7683         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
7684         LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
7685         LDKNodeId source_conv;
7686         source_conv.inner = untag_ptr(source);
7687         source_conv.is_owned = ptr_is_owned(source);
7688         CHECK_INNER_FIELD_ACCESS_OR_NULL(source_conv);
7689         source_conv.is_owned = false;
7690         LDKNodeId target_conv;
7691         target_conv.inner = untag_ptr(target);
7692         target_conv.is_owned = ptr_is_owned(target);
7693         CHECK_INNER_FIELD_ACCESS_OR_NULL(target_conv);
7694         target_conv.is_owned = false;
7695         LDKChannelUsage usage_conv;
7696         usage_conv.inner = untag_ptr(usage);
7697         usage_conv.is_owned = ptr_is_owned(usage);
7698         CHECK_INNER_FIELD_ACCESS_OR_NULL(usage_conv);
7699         usage_conv = ChannelUsage_clone(&usage_conv);
7700         int64_t ret_conv = (this_arg_conv->channel_penalty_msat)(this_arg_conv->this_arg, short_channel_id, &source_conv, &target_conv, usage_conv);
7701         return ret_conv;
7702 }
7703
7704 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) {
7705         void* this_arg_ptr = untag_ptr(this_arg);
7706         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
7707         LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
7708         LDKCVec_RouteHopZ path_constr;
7709         path_constr.datalen = path->arr_len;
7710         if (path_constr.datalen > 0)
7711                 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
7712         else
7713                 path_constr.data = NULL;
7714         uint64_t* path_vals = path->elems;
7715         for (size_t k = 0; k < path_constr.datalen; k++) {
7716                 uint64_t path_conv_10 = path_vals[k];
7717                 LDKRouteHop path_conv_10_conv;
7718                 path_conv_10_conv.inner = untag_ptr(path_conv_10);
7719                 path_conv_10_conv.is_owned = ptr_is_owned(path_conv_10);
7720                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
7721                 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
7722                 path_constr.data[k] = path_conv_10_conv;
7723         }
7724         FREE(path);
7725         (this_arg_conv->payment_path_failed)(this_arg_conv->this_arg, path_constr, short_channel_id);
7726 }
7727
7728 void  __attribute__((export_name("TS_Score_payment_path_successful"))) TS_Score_payment_path_successful(uint64_t this_arg, uint64_tArray path) {
7729         void* this_arg_ptr = untag_ptr(this_arg);
7730         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
7731         LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
7732         LDKCVec_RouteHopZ path_constr;
7733         path_constr.datalen = path->arr_len;
7734         if (path_constr.datalen > 0)
7735                 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
7736         else
7737                 path_constr.data = NULL;
7738         uint64_t* path_vals = path->elems;
7739         for (size_t k = 0; k < path_constr.datalen; k++) {
7740                 uint64_t path_conv_10 = path_vals[k];
7741                 LDKRouteHop path_conv_10_conv;
7742                 path_conv_10_conv.inner = untag_ptr(path_conv_10);
7743                 path_conv_10_conv.is_owned = ptr_is_owned(path_conv_10);
7744                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
7745                 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
7746                 path_constr.data[k] = path_conv_10_conv;
7747         }
7748         FREE(path);
7749         (this_arg_conv->payment_path_successful)(this_arg_conv->this_arg, path_constr);
7750 }
7751
7752 void  __attribute__((export_name("TS_Score_probe_failed"))) TS_Score_probe_failed(uint64_t this_arg, uint64_tArray path, int64_t short_channel_id) {
7753         void* this_arg_ptr = untag_ptr(this_arg);
7754         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
7755         LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
7756         LDKCVec_RouteHopZ path_constr;
7757         path_constr.datalen = path->arr_len;
7758         if (path_constr.datalen > 0)
7759                 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
7760         else
7761                 path_constr.data = NULL;
7762         uint64_t* path_vals = path->elems;
7763         for (size_t k = 0; k < path_constr.datalen; k++) {
7764                 uint64_t path_conv_10 = path_vals[k];
7765                 LDKRouteHop path_conv_10_conv;
7766                 path_conv_10_conv.inner = untag_ptr(path_conv_10);
7767                 path_conv_10_conv.is_owned = ptr_is_owned(path_conv_10);
7768                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
7769                 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
7770                 path_constr.data[k] = path_conv_10_conv;
7771         }
7772         FREE(path);
7773         (this_arg_conv->probe_failed)(this_arg_conv->this_arg, path_constr, short_channel_id);
7774 }
7775
7776 void  __attribute__((export_name("TS_Score_probe_successful"))) TS_Score_probe_successful(uint64_t this_arg, uint64_tArray path) {
7777         void* this_arg_ptr = untag_ptr(this_arg);
7778         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
7779         LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
7780         LDKCVec_RouteHopZ path_constr;
7781         path_constr.datalen = path->arr_len;
7782         if (path_constr.datalen > 0)
7783                 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
7784         else
7785                 path_constr.data = NULL;
7786         uint64_t* path_vals = path->elems;
7787         for (size_t k = 0; k < path_constr.datalen; k++) {
7788                 uint64_t path_conv_10 = path_vals[k];
7789                 LDKRouteHop path_conv_10_conv;
7790                 path_conv_10_conv.inner = untag_ptr(path_conv_10);
7791                 path_conv_10_conv.is_owned = ptr_is_owned(path_conv_10);
7792                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
7793                 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
7794                 path_constr.data[k] = path_conv_10_conv;
7795         }
7796         FREE(path);
7797         (this_arg_conv->probe_successful)(this_arg_conv->this_arg, path_constr);
7798 }
7799
7800 int8_tArray  __attribute__((export_name("TS_Score_write"))) TS_Score_write(uint64_t this_arg) {
7801         void* this_arg_ptr = untag_ptr(this_arg);
7802         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
7803         LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
7804         LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
7805         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
7806         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
7807         CVec_u8Z_free(ret_var);
7808         return ret_arr;
7809 }
7810
7811 typedef struct LDKPersister_JCalls {
7812         atomic_size_t refcnt;
7813         uint32_t instance_ptr;
7814 } LDKPersister_JCalls;
7815 static void LDKPersister_JCalls_free(void* this_arg) {
7816         LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) this_arg;
7817         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
7818                 FREE(j_calls);
7819         }
7820 }
7821 LDKCResult_NoneErrorZ persist_manager_LDKPersister_jcall(const void* this_arg, const LDKChannelManager * channel_manager) {
7822         LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) this_arg;
7823         LDKChannelManager channel_manager_var = *channel_manager;
7824         uint64_t channel_manager_ref = 0;
7825         // WARNING: we may need a move here but no clone is available for LDKChannelManager
7826         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_manager_var);
7827         channel_manager_ref = tag_ptr(channel_manager_var.inner, channel_manager_var.is_owned);
7828         uint32_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 43, channel_manager_ref, 0, 0, 0, 0, 0);
7829         void* ret_ptr = untag_ptr(ret);
7830         CHECK_ACCESS(ret_ptr);
7831         LDKCResult_NoneErrorZ ret_conv = *(LDKCResult_NoneErrorZ*)(ret_ptr);
7832         FREE(untag_ptr(ret));
7833         return ret_conv;
7834 }
7835 LDKCResult_NoneErrorZ persist_graph_LDKPersister_jcall(const void* this_arg, const LDKNetworkGraph * network_graph) {
7836         LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) this_arg;
7837         LDKNetworkGraph network_graph_var = *network_graph;
7838         uint64_t network_graph_ref = 0;
7839         // WARNING: we may need a move here but no clone is available for LDKNetworkGraph
7840         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_var);
7841         network_graph_ref = tag_ptr(network_graph_var.inner, network_graph_var.is_owned);
7842         uint32_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 44, network_graph_ref, 0, 0, 0, 0, 0);
7843         void* ret_ptr = untag_ptr(ret);
7844         CHECK_ACCESS(ret_ptr);
7845         LDKCResult_NoneErrorZ ret_conv = *(LDKCResult_NoneErrorZ*)(ret_ptr);
7846         FREE(untag_ptr(ret));
7847         return ret_conv;
7848 }
7849 LDKCResult_NoneErrorZ persist_scorer_LDKPersister_jcall(const void* this_arg, const LDKMultiThreadedLockableScore * scorer) {
7850         LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) this_arg;
7851         LDKMultiThreadedLockableScore scorer_var = *scorer;
7852         uint64_t scorer_ref = 0;
7853         // WARNING: we may need a move here but no clone is available for LDKMultiThreadedLockableScore
7854         CHECK_INNER_FIELD_ACCESS_OR_NULL(scorer_var);
7855         scorer_ref = tag_ptr(scorer_var.inner, scorer_var.is_owned);
7856         uint32_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 45, scorer_ref, 0, 0, 0, 0, 0);
7857         void* ret_ptr = untag_ptr(ret);
7858         CHECK_ACCESS(ret_ptr);
7859         LDKCResult_NoneErrorZ ret_conv = *(LDKCResult_NoneErrorZ*)(ret_ptr);
7860         FREE(untag_ptr(ret));
7861         return ret_conv;
7862 }
7863 static void LDKPersister_JCalls_cloned(LDKPersister* new_obj) {
7864         LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) new_obj->this_arg;
7865         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
7866 }
7867 static inline LDKPersister LDKPersister_init (JSValue o) {
7868         LDKPersister_JCalls *calls = MALLOC(sizeof(LDKPersister_JCalls), "LDKPersister_JCalls");
7869         atomic_init(&calls->refcnt, 1);
7870         calls->instance_ptr = o;
7871
7872         LDKPersister ret = {
7873                 .this_arg = (void*) calls,
7874                 .persist_manager = persist_manager_LDKPersister_jcall,
7875                 .persist_graph = persist_graph_LDKPersister_jcall,
7876                 .persist_scorer = persist_scorer_LDKPersister_jcall,
7877                 .free = LDKPersister_JCalls_free,
7878         };
7879         return ret;
7880 }
7881 uint64_t  __attribute__((export_name("TS_LDKPersister_new"))) TS_LDKPersister_new(JSValue o) {
7882         LDKPersister *res_ptr = MALLOC(sizeof(LDKPersister), "LDKPersister");
7883         *res_ptr = LDKPersister_init(o);
7884         return tag_ptr(res_ptr, true);
7885 }
7886 uint64_t  __attribute__((export_name("TS_Persister_persist_manager"))) TS_Persister_persist_manager(uint64_t this_arg, uint64_t channel_manager) {
7887         void* this_arg_ptr = untag_ptr(this_arg);
7888         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
7889         LDKPersister* this_arg_conv = (LDKPersister*)this_arg_ptr;
7890         LDKChannelManager channel_manager_conv;
7891         channel_manager_conv.inner = untag_ptr(channel_manager);
7892         channel_manager_conv.is_owned = ptr_is_owned(channel_manager);
7893         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_manager_conv);
7894         channel_manager_conv.is_owned = false;
7895         LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
7896         *ret_conv = (this_arg_conv->persist_manager)(this_arg_conv->this_arg, &channel_manager_conv);
7897         return tag_ptr(ret_conv, true);
7898 }
7899
7900 uint64_t  __attribute__((export_name("TS_Persister_persist_graph"))) TS_Persister_persist_graph(uint64_t this_arg, uint64_t network_graph) {
7901         void* this_arg_ptr = untag_ptr(this_arg);
7902         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
7903         LDKPersister* this_arg_conv = (LDKPersister*)this_arg_ptr;
7904         LDKNetworkGraph network_graph_conv;
7905         network_graph_conv.inner = untag_ptr(network_graph);
7906         network_graph_conv.is_owned = ptr_is_owned(network_graph);
7907         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
7908         network_graph_conv.is_owned = false;
7909         LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
7910         *ret_conv = (this_arg_conv->persist_graph)(this_arg_conv->this_arg, &network_graph_conv);
7911         return tag_ptr(ret_conv, true);
7912 }
7913
7914 uint64_t  __attribute__((export_name("TS_Persister_persist_scorer"))) TS_Persister_persist_scorer(uint64_t this_arg, uint64_t scorer) {
7915         void* this_arg_ptr = untag_ptr(this_arg);
7916         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
7917         LDKPersister* this_arg_conv = (LDKPersister*)this_arg_ptr;
7918         LDKMultiThreadedLockableScore scorer_conv;
7919         scorer_conv.inner = untag_ptr(scorer);
7920         scorer_conv.is_owned = ptr_is_owned(scorer);
7921         CHECK_INNER_FIELD_ACCESS_OR_NULL(scorer_conv);
7922         scorer_conv.is_owned = false;
7923         LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
7924         *ret_conv = (this_arg_conv->persist_scorer)(this_arg_conv->this_arg, &scorer_conv);
7925         return tag_ptr(ret_conv, true);
7926 }
7927
7928 typedef struct LDKListen_JCalls {
7929         atomic_size_t refcnt;
7930         uint32_t instance_ptr;
7931 } LDKListen_JCalls;
7932 static void LDKListen_JCalls_free(void* this_arg) {
7933         LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
7934         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
7935                 FREE(j_calls);
7936         }
7937 }
7938 void filtered_block_connected_LDKListen_jcall(const void* this_arg, const uint8_t (* header)[80], LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height) {
7939         LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
7940         int8_tArray header_arr = init_int8_tArray(80, __LINE__);
7941         memcpy(header_arr->elems, *header, 80);
7942         LDKCVec_C2Tuple_usizeTransactionZZ txdata_var = txdata;
7943         uint64_tArray txdata_arr = NULL;
7944         txdata_arr = init_uint64_tArray(txdata_var.datalen, __LINE__);
7945         uint64_t *txdata_arr_ptr = (uint64_t*)(((uint8_t*)txdata_arr) + 8);
7946         for (size_t c = 0; c < txdata_var.datalen; c++) {
7947                 LDKC2Tuple_usizeTransactionZ* txdata_conv_28_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
7948                 *txdata_conv_28_conv = txdata_var.data[c];
7949                 txdata_arr_ptr[c] = tag_ptr(txdata_conv_28_conv, true);
7950         }
7951         
7952         FREE(txdata_var.data);
7953         int32_t height_conv = height;
7954         js_invoke_function_uuuuuu(j_calls->instance_ptr, 46, (uint32_t)header_arr, (uint32_t)txdata_arr, height_conv, 0, 0, 0);
7955 }
7956 void block_connected_LDKListen_jcall(const void* this_arg, LDKu8slice block, uint32_t height) {
7957         LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
7958         LDKu8slice block_var = block;
7959         int8_tArray block_arr = init_int8_tArray(block_var.datalen, __LINE__);
7960         memcpy(block_arr->elems, block_var.data, block_var.datalen);
7961         int32_t height_conv = height;
7962         js_invoke_function_uuuuuu(j_calls->instance_ptr, 47, (uint32_t)block_arr, height_conv, 0, 0, 0, 0);
7963 }
7964 void block_disconnected_LDKListen_jcall(const void* this_arg, const uint8_t (* header)[80], uint32_t height) {
7965         LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
7966         int8_tArray header_arr = init_int8_tArray(80, __LINE__);
7967         memcpy(header_arr->elems, *header, 80);
7968         int32_t height_conv = height;
7969         js_invoke_function_uuuuuu(j_calls->instance_ptr, 48, (uint32_t)header_arr, height_conv, 0, 0, 0, 0);
7970 }
7971 static void LDKListen_JCalls_cloned(LDKListen* new_obj) {
7972         LDKListen_JCalls *j_calls = (LDKListen_JCalls*) new_obj->this_arg;
7973         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
7974 }
7975 static inline LDKListen LDKListen_init (JSValue o) {
7976         LDKListen_JCalls *calls = MALLOC(sizeof(LDKListen_JCalls), "LDKListen_JCalls");
7977         atomic_init(&calls->refcnt, 1);
7978         calls->instance_ptr = o;
7979
7980         LDKListen ret = {
7981                 .this_arg = (void*) calls,
7982                 .filtered_block_connected = filtered_block_connected_LDKListen_jcall,
7983                 .block_connected = block_connected_LDKListen_jcall,
7984                 .block_disconnected = block_disconnected_LDKListen_jcall,
7985                 .free = LDKListen_JCalls_free,
7986         };
7987         return ret;
7988 }
7989 uint64_t  __attribute__((export_name("TS_LDKListen_new"))) TS_LDKListen_new(JSValue o) {
7990         LDKListen *res_ptr = MALLOC(sizeof(LDKListen), "LDKListen");
7991         *res_ptr = LDKListen_init(o);
7992         return tag_ptr(res_ptr, true);
7993 }
7994 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) {
7995         void* this_arg_ptr = untag_ptr(this_arg);
7996         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
7997         LDKListen* this_arg_conv = (LDKListen*)this_arg_ptr;
7998         unsigned char header_arr[80];
7999         CHECK(header->arr_len == 80);
8000         memcpy(header_arr, header->elems, 80); FREE(header);
8001         unsigned char (*header_ref)[80] = &header_arr;
8002         LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
8003         txdata_constr.datalen = txdata->arr_len;
8004         if (txdata_constr.datalen > 0)
8005                 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
8006         else
8007                 txdata_constr.data = NULL;
8008         uint64_t* txdata_vals = txdata->elems;
8009         for (size_t c = 0; c < txdata_constr.datalen; c++) {
8010                 uint64_t txdata_conv_28 = txdata_vals[c];
8011                 void* txdata_conv_28_ptr = untag_ptr(txdata_conv_28);
8012                 CHECK_ACCESS(txdata_conv_28_ptr);
8013                 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
8014                 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)untag_ptr(txdata_conv_28));
8015                 txdata_constr.data[c] = txdata_conv_28_conv;
8016         }
8017         FREE(txdata);
8018         (this_arg_conv->filtered_block_connected)(this_arg_conv->this_arg, header_ref, txdata_constr, height);
8019 }
8020
8021 void  __attribute__((export_name("TS_Listen_block_connected"))) TS_Listen_block_connected(uint64_t this_arg, int8_tArray block, int32_t height) {
8022         void* this_arg_ptr = untag_ptr(this_arg);
8023         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8024         LDKListen* this_arg_conv = (LDKListen*)this_arg_ptr;
8025         LDKu8slice block_ref;
8026         block_ref.datalen = block->arr_len;
8027         block_ref.data = block->elems;
8028         (this_arg_conv->block_connected)(this_arg_conv->this_arg, block_ref, height);
8029         FREE(block);
8030 }
8031
8032 void  __attribute__((export_name("TS_Listen_block_disconnected"))) TS_Listen_block_disconnected(uint64_t this_arg, int8_tArray header, int32_t height) {
8033         void* this_arg_ptr = untag_ptr(this_arg);
8034         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8035         LDKListen* this_arg_conv = (LDKListen*)this_arg_ptr;
8036         unsigned char header_arr[80];
8037         CHECK(header->arr_len == 80);
8038         memcpy(header_arr, header->elems, 80); FREE(header);
8039         unsigned char (*header_ref)[80] = &header_arr;
8040         (this_arg_conv->block_disconnected)(this_arg_conv->this_arg, header_ref, height);
8041 }
8042
8043 typedef struct LDKConfirm_JCalls {
8044         atomic_size_t refcnt;
8045         uint32_t instance_ptr;
8046 } LDKConfirm_JCalls;
8047 static void LDKConfirm_JCalls_free(void* this_arg) {
8048         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
8049         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
8050                 FREE(j_calls);
8051         }
8052 }
8053 void transactions_confirmed_LDKConfirm_jcall(const void* this_arg, const uint8_t (* header)[80], LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height) {
8054         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
8055         int8_tArray header_arr = init_int8_tArray(80, __LINE__);
8056         memcpy(header_arr->elems, *header, 80);
8057         LDKCVec_C2Tuple_usizeTransactionZZ txdata_var = txdata;
8058         uint64_tArray txdata_arr = NULL;
8059         txdata_arr = init_uint64_tArray(txdata_var.datalen, __LINE__);
8060         uint64_t *txdata_arr_ptr = (uint64_t*)(((uint8_t*)txdata_arr) + 8);
8061         for (size_t c = 0; c < txdata_var.datalen; c++) {
8062                 LDKC2Tuple_usizeTransactionZ* txdata_conv_28_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
8063                 *txdata_conv_28_conv = txdata_var.data[c];
8064                 txdata_arr_ptr[c] = tag_ptr(txdata_conv_28_conv, true);
8065         }
8066         
8067         FREE(txdata_var.data);
8068         int32_t height_conv = height;
8069         js_invoke_function_uuuuuu(j_calls->instance_ptr, 49, (uint32_t)header_arr, (uint32_t)txdata_arr, height_conv, 0, 0, 0);
8070 }
8071 void transaction_unconfirmed_LDKConfirm_jcall(const void* this_arg, const uint8_t (* txid)[32]) {
8072         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
8073         int8_tArray txid_arr = init_int8_tArray(32, __LINE__);
8074         memcpy(txid_arr->elems, *txid, 32);
8075         js_invoke_function_uuuuuu(j_calls->instance_ptr, 50, (uint32_t)txid_arr, 0, 0, 0, 0, 0);
8076 }
8077 void best_block_updated_LDKConfirm_jcall(const void* this_arg, const uint8_t (* header)[80], uint32_t height) {
8078         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
8079         int8_tArray header_arr = init_int8_tArray(80, __LINE__);
8080         memcpy(header_arr->elems, *header, 80);
8081         int32_t height_conv = height;
8082         js_invoke_function_uuuuuu(j_calls->instance_ptr, 51, (uint32_t)header_arr, height_conv, 0, 0, 0, 0);
8083 }
8084 LDKCVec_TxidZ get_relevant_txids_LDKConfirm_jcall(const void* this_arg) {
8085         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
8086         ptrArray ret = (ptrArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 52, 0, 0, 0, 0, 0, 0);
8087         LDKCVec_TxidZ ret_constr;
8088         ret_constr.datalen = ret->arr_len;
8089         if (ret_constr.datalen > 0)
8090                 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_TxidZ Elements");
8091         else
8092                 ret_constr.data = NULL;
8093         int8_tArray* ret_vals = (void*) ret->elems;
8094         for (size_t m = 0; m < ret_constr.datalen; m++) {
8095                 int8_tArray ret_conv_12 = ret_vals[m];
8096                 LDKThirtyTwoBytes ret_conv_12_ref;
8097                 CHECK(ret_conv_12->arr_len == 32);
8098                 memcpy(ret_conv_12_ref.data, ret_conv_12->elems, 32); FREE(ret_conv_12);
8099                 ret_constr.data[m] = ret_conv_12_ref;
8100         }
8101         FREE(ret);
8102         return ret_constr;
8103 }
8104 static void LDKConfirm_JCalls_cloned(LDKConfirm* new_obj) {
8105         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) new_obj->this_arg;
8106         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
8107 }
8108 static inline LDKConfirm LDKConfirm_init (JSValue o) {
8109         LDKConfirm_JCalls *calls = MALLOC(sizeof(LDKConfirm_JCalls), "LDKConfirm_JCalls");
8110         atomic_init(&calls->refcnt, 1);
8111         calls->instance_ptr = o;
8112
8113         LDKConfirm ret = {
8114                 .this_arg = (void*) calls,
8115                 .transactions_confirmed = transactions_confirmed_LDKConfirm_jcall,
8116                 .transaction_unconfirmed = transaction_unconfirmed_LDKConfirm_jcall,
8117                 .best_block_updated = best_block_updated_LDKConfirm_jcall,
8118                 .get_relevant_txids = get_relevant_txids_LDKConfirm_jcall,
8119                 .free = LDKConfirm_JCalls_free,
8120         };
8121         return ret;
8122 }
8123 uint64_t  __attribute__((export_name("TS_LDKConfirm_new"))) TS_LDKConfirm_new(JSValue o) {
8124         LDKConfirm *res_ptr = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
8125         *res_ptr = LDKConfirm_init(o);
8126         return tag_ptr(res_ptr, true);
8127 }
8128 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) {
8129         void* this_arg_ptr = untag_ptr(this_arg);
8130         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8131         LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
8132         unsigned char header_arr[80];
8133         CHECK(header->arr_len == 80);
8134         memcpy(header_arr, header->elems, 80); FREE(header);
8135         unsigned char (*header_ref)[80] = &header_arr;
8136         LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
8137         txdata_constr.datalen = txdata->arr_len;
8138         if (txdata_constr.datalen > 0)
8139                 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
8140         else
8141                 txdata_constr.data = NULL;
8142         uint64_t* txdata_vals = txdata->elems;
8143         for (size_t c = 0; c < txdata_constr.datalen; c++) {
8144                 uint64_t txdata_conv_28 = txdata_vals[c];
8145                 void* txdata_conv_28_ptr = untag_ptr(txdata_conv_28);
8146                 CHECK_ACCESS(txdata_conv_28_ptr);
8147                 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
8148                 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)untag_ptr(txdata_conv_28));
8149                 txdata_constr.data[c] = txdata_conv_28_conv;
8150         }
8151         FREE(txdata);
8152         (this_arg_conv->transactions_confirmed)(this_arg_conv->this_arg, header_ref, txdata_constr, height);
8153 }
8154
8155 void  __attribute__((export_name("TS_Confirm_transaction_unconfirmed"))) TS_Confirm_transaction_unconfirmed(uint64_t this_arg, int8_tArray txid) {
8156         void* this_arg_ptr = untag_ptr(this_arg);
8157         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8158         LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
8159         unsigned char txid_arr[32];
8160         CHECK(txid->arr_len == 32);
8161         memcpy(txid_arr, txid->elems, 32); FREE(txid);
8162         unsigned char (*txid_ref)[32] = &txid_arr;
8163         (this_arg_conv->transaction_unconfirmed)(this_arg_conv->this_arg, txid_ref);
8164 }
8165
8166 void  __attribute__((export_name("TS_Confirm_best_block_updated"))) TS_Confirm_best_block_updated(uint64_t this_arg, int8_tArray header, int32_t height) {
8167         void* this_arg_ptr = untag_ptr(this_arg);
8168         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8169         LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
8170         unsigned char header_arr[80];
8171         CHECK(header->arr_len == 80);
8172         memcpy(header_arr, header->elems, 80); FREE(header);
8173         unsigned char (*header_ref)[80] = &header_arr;
8174         (this_arg_conv->best_block_updated)(this_arg_conv->this_arg, header_ref, height);
8175 }
8176
8177 ptrArray  __attribute__((export_name("TS_Confirm_get_relevant_txids"))) TS_Confirm_get_relevant_txids(uint64_t this_arg) {
8178         void* this_arg_ptr = untag_ptr(this_arg);
8179         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8180         LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
8181         LDKCVec_TxidZ ret_var = (this_arg_conv->get_relevant_txids)(this_arg_conv->this_arg);
8182         ptrArray ret_arr = NULL;
8183         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
8184         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
8185         for (size_t m = 0; m < ret_var.datalen; m++) {
8186                 int8_tArray ret_conv_12_arr = init_int8_tArray(32, __LINE__);
8187                 memcpy(ret_conv_12_arr->elems, ret_var.data[m].data, 32);
8188                 ret_arr_ptr[m] = ret_conv_12_arr;
8189         }
8190         
8191         FREE(ret_var.data);
8192         return ret_arr;
8193 }
8194
8195 typedef struct LDKPersist_JCalls {
8196         atomic_size_t refcnt;
8197         uint32_t instance_ptr;
8198 } LDKPersist_JCalls;
8199 static void LDKPersist_JCalls_free(void* this_arg) {
8200         LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
8201         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
8202                 FREE(j_calls);
8203         }
8204 }
8205 LDKCResult_NoneChannelMonitorUpdateErrZ persist_new_channel_LDKPersist_jcall(const void* this_arg, LDKOutPoint channel_id, const LDKChannelMonitor * data, LDKMonitorUpdateId update_id) {
8206         LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
8207         LDKOutPoint channel_id_var = channel_id;
8208         uint64_t channel_id_ref = 0;
8209         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_var);
8210         channel_id_ref = tag_ptr(channel_id_var.inner, channel_id_var.is_owned);
8211         LDKChannelMonitor data_var = *data;
8212         uint64_t data_ref = 0;
8213         data_var = ChannelMonitor_clone(&data_var);
8214         CHECK_INNER_FIELD_ACCESS_OR_NULL(data_var);
8215         data_ref = tag_ptr(data_var.inner, data_var.is_owned);
8216         LDKMonitorUpdateId update_id_var = update_id;
8217         uint64_t update_id_ref = 0;
8218         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_var);
8219         update_id_ref = tag_ptr(update_id_var.inner, update_id_var.is_owned);
8220         uint32_t ret = js_invoke_function_bbbuuu(j_calls->instance_ptr, 53, channel_id_ref, data_ref, update_id_ref, 0, 0, 0);
8221         void* ret_ptr = untag_ptr(ret);
8222         CHECK_ACCESS(ret_ptr);
8223         LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(ret_ptr);
8224         FREE(untag_ptr(ret));
8225         return ret_conv;
8226 }
8227 LDKCResult_NoneChannelMonitorUpdateErrZ update_persisted_channel_LDKPersist_jcall(const void* this_arg, LDKOutPoint channel_id, const LDKChannelMonitorUpdate * update, const LDKChannelMonitor * data, LDKMonitorUpdateId update_id) {
8228         LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
8229         LDKOutPoint channel_id_var = channel_id;
8230         uint64_t channel_id_ref = 0;
8231         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_var);
8232         channel_id_ref = tag_ptr(channel_id_var.inner, channel_id_var.is_owned);
8233         LDKChannelMonitorUpdate update_var = *update;
8234         uint64_t update_ref = 0;
8235         update_var = ChannelMonitorUpdate_clone(&update_var);
8236         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_var);
8237         update_ref = tag_ptr(update_var.inner, update_var.is_owned);
8238         LDKChannelMonitor data_var = *data;
8239         uint64_t data_ref = 0;
8240         data_var = ChannelMonitor_clone(&data_var);
8241         CHECK_INNER_FIELD_ACCESS_OR_NULL(data_var);
8242         data_ref = tag_ptr(data_var.inner, data_var.is_owned);
8243         LDKMonitorUpdateId update_id_var = update_id;
8244         uint64_t update_id_ref = 0;
8245         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_var);
8246         update_id_ref = tag_ptr(update_id_var.inner, update_id_var.is_owned);
8247         uint32_t ret = js_invoke_function_bbbbuu(j_calls->instance_ptr, 54, channel_id_ref, update_ref, data_ref, update_id_ref, 0, 0);
8248         void* ret_ptr = untag_ptr(ret);
8249         CHECK_ACCESS(ret_ptr);
8250         LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(ret_ptr);
8251         FREE(untag_ptr(ret));
8252         return ret_conv;
8253 }
8254 static void LDKPersist_JCalls_cloned(LDKPersist* new_obj) {
8255         LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) new_obj->this_arg;
8256         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
8257 }
8258 static inline LDKPersist LDKPersist_init (JSValue o) {
8259         LDKPersist_JCalls *calls = MALLOC(sizeof(LDKPersist_JCalls), "LDKPersist_JCalls");
8260         atomic_init(&calls->refcnt, 1);
8261         calls->instance_ptr = o;
8262
8263         LDKPersist ret = {
8264                 .this_arg = (void*) calls,
8265                 .persist_new_channel = persist_new_channel_LDKPersist_jcall,
8266                 .update_persisted_channel = update_persisted_channel_LDKPersist_jcall,
8267                 .free = LDKPersist_JCalls_free,
8268         };
8269         return ret;
8270 }
8271 uint64_t  __attribute__((export_name("TS_LDKPersist_new"))) TS_LDKPersist_new(JSValue o) {
8272         LDKPersist *res_ptr = MALLOC(sizeof(LDKPersist), "LDKPersist");
8273         *res_ptr = LDKPersist_init(o);
8274         return tag_ptr(res_ptr, true);
8275 }
8276 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) {
8277         void* this_arg_ptr = untag_ptr(this_arg);
8278         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8279         LDKPersist* this_arg_conv = (LDKPersist*)this_arg_ptr;
8280         LDKOutPoint channel_id_conv;
8281         channel_id_conv.inner = untag_ptr(channel_id);
8282         channel_id_conv.is_owned = ptr_is_owned(channel_id);
8283         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_conv);
8284         channel_id_conv = OutPoint_clone(&channel_id_conv);
8285         LDKChannelMonitor data_conv;
8286         data_conv.inner = untag_ptr(data);
8287         data_conv.is_owned = ptr_is_owned(data);
8288         CHECK_INNER_FIELD_ACCESS_OR_NULL(data_conv);
8289         data_conv.is_owned = false;
8290         LDKMonitorUpdateId update_id_conv;
8291         update_id_conv.inner = untag_ptr(update_id);
8292         update_id_conv.is_owned = ptr_is_owned(update_id);
8293         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_conv);
8294         update_id_conv = MonitorUpdateId_clone(&update_id_conv);
8295         LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
8296         *ret_conv = (this_arg_conv->persist_new_channel)(this_arg_conv->this_arg, channel_id_conv, &data_conv, update_id_conv);
8297         return tag_ptr(ret_conv, true);
8298 }
8299
8300 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) {
8301         void* this_arg_ptr = untag_ptr(this_arg);
8302         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8303         LDKPersist* this_arg_conv = (LDKPersist*)this_arg_ptr;
8304         LDKOutPoint channel_id_conv;
8305         channel_id_conv.inner = untag_ptr(channel_id);
8306         channel_id_conv.is_owned = ptr_is_owned(channel_id);
8307         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_conv);
8308         channel_id_conv = OutPoint_clone(&channel_id_conv);
8309         LDKChannelMonitorUpdate update_conv;
8310         update_conv.inner = untag_ptr(update);
8311         update_conv.is_owned = ptr_is_owned(update);
8312         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_conv);
8313         update_conv.is_owned = false;
8314         LDKChannelMonitor data_conv;
8315         data_conv.inner = untag_ptr(data);
8316         data_conv.is_owned = ptr_is_owned(data);
8317         CHECK_INNER_FIELD_ACCESS_OR_NULL(data_conv);
8318         data_conv.is_owned = false;
8319         LDKMonitorUpdateId update_id_conv;
8320         update_id_conv.inner = untag_ptr(update_id);
8321         update_id_conv.is_owned = ptr_is_owned(update_id);
8322         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_conv);
8323         update_id_conv = MonitorUpdateId_clone(&update_id_conv);
8324         LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
8325         *ret_conv = (this_arg_conv->update_persisted_channel)(this_arg_conv->this_arg, channel_id_conv, &update_conv, &data_conv, update_id_conv);
8326         return tag_ptr(ret_conv, true);
8327 }
8328
8329 typedef struct LDKChannelMessageHandler_JCalls {
8330         atomic_size_t refcnt;
8331         uint32_t instance_ptr;
8332         LDKMessageSendEventsProvider_JCalls* MessageSendEventsProvider;
8333 } LDKChannelMessageHandler_JCalls;
8334 static void LDKChannelMessageHandler_JCalls_free(void* this_arg) {
8335         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
8336         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
8337                 FREE(j_calls);
8338         }
8339 }
8340 void handle_open_channel_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKInitFeatures their_features, const LDKOpenChannel * msg) {
8341         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
8342         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
8343         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
8344         LDKInitFeatures their_features_var = their_features;
8345         uint64_t their_features_ref = 0;
8346         CHECK_INNER_FIELD_ACCESS_OR_NULL(their_features_var);
8347         their_features_ref = tag_ptr(their_features_var.inner, their_features_var.is_owned);
8348         LDKOpenChannel msg_var = *msg;
8349         uint64_t msg_ref = 0;
8350         msg_var = OpenChannel_clone(&msg_var);
8351         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
8352         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
8353         js_invoke_function_ubbuuu(j_calls->instance_ptr, 55, (uint32_t)their_node_id_arr, their_features_ref, msg_ref, 0, 0, 0);
8354 }
8355 void handle_accept_channel_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKInitFeatures their_features, const LDKAcceptChannel * msg) {
8356         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
8357         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
8358         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
8359         LDKInitFeatures their_features_var = their_features;
8360         uint64_t their_features_ref = 0;
8361         CHECK_INNER_FIELD_ACCESS_OR_NULL(their_features_var);
8362         their_features_ref = tag_ptr(their_features_var.inner, their_features_var.is_owned);
8363         LDKAcceptChannel msg_var = *msg;
8364         uint64_t msg_ref = 0;
8365         msg_var = AcceptChannel_clone(&msg_var);
8366         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
8367         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
8368         js_invoke_function_ubbuuu(j_calls->instance_ptr, 56, (uint32_t)their_node_id_arr, their_features_ref, msg_ref, 0, 0, 0);
8369 }
8370 void handle_funding_created_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingCreated * msg) {
8371         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
8372         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
8373         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
8374         LDKFundingCreated msg_var = *msg;
8375         uint64_t msg_ref = 0;
8376         msg_var = FundingCreated_clone(&msg_var);
8377         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
8378         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
8379         js_invoke_function_ubuuuu(j_calls->instance_ptr, 57, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
8380 }
8381 void handle_funding_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingSigned * msg) {
8382         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
8383         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
8384         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
8385         LDKFundingSigned msg_var = *msg;
8386         uint64_t msg_ref = 0;
8387         msg_var = FundingSigned_clone(&msg_var);
8388         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
8389         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
8390         js_invoke_function_ubuuuu(j_calls->instance_ptr, 58, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
8391 }
8392 void handle_channel_ready_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelReady * msg) {
8393         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
8394         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
8395         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
8396         LDKChannelReady msg_var = *msg;
8397         uint64_t msg_ref = 0;
8398         msg_var = ChannelReady_clone(&msg_var);
8399         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
8400         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
8401         js_invoke_function_ubuuuu(j_calls->instance_ptr, 59, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
8402 }
8403 void handle_shutdown_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInitFeatures * their_features, const LDKShutdown * msg) {
8404         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
8405         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
8406         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
8407         LDKInitFeatures their_features_var = *their_features;
8408         uint64_t their_features_ref = 0;
8409         their_features_var = InitFeatures_clone(&their_features_var);
8410         CHECK_INNER_FIELD_ACCESS_OR_NULL(their_features_var);
8411         their_features_ref = tag_ptr(their_features_var.inner, their_features_var.is_owned);
8412         LDKShutdown msg_var = *msg;
8413         uint64_t msg_ref = 0;
8414         msg_var = Shutdown_clone(&msg_var);
8415         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
8416         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
8417         js_invoke_function_ubbuuu(j_calls->instance_ptr, 60, (uint32_t)their_node_id_arr, their_features_ref, msg_ref, 0, 0, 0);
8418 }
8419 void handle_closing_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKClosingSigned * msg) {
8420         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
8421         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
8422         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
8423         LDKClosingSigned msg_var = *msg;
8424         uint64_t msg_ref = 0;
8425         msg_var = ClosingSigned_clone(&msg_var);
8426         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
8427         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
8428         js_invoke_function_ubuuuu(j_calls->instance_ptr, 61, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
8429 }
8430 void handle_update_add_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateAddHTLC * msg) {
8431         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
8432         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
8433         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
8434         LDKUpdateAddHTLC msg_var = *msg;
8435         uint64_t msg_ref = 0;
8436         msg_var = UpdateAddHTLC_clone(&msg_var);
8437         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
8438         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
8439         js_invoke_function_ubuuuu(j_calls->instance_ptr, 62, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
8440 }
8441 void handle_update_fulfill_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFulfillHTLC * msg) {
8442         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
8443         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
8444         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
8445         LDKUpdateFulfillHTLC msg_var = *msg;
8446         uint64_t msg_ref = 0;
8447         msg_var = UpdateFulfillHTLC_clone(&msg_var);
8448         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
8449         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
8450         js_invoke_function_ubuuuu(j_calls->instance_ptr, 63, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
8451 }
8452 void handle_update_fail_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailHTLC * msg) {
8453         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
8454         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
8455         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
8456         LDKUpdateFailHTLC msg_var = *msg;
8457         uint64_t msg_ref = 0;
8458         msg_var = UpdateFailHTLC_clone(&msg_var);
8459         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
8460         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
8461         js_invoke_function_ubuuuu(j_calls->instance_ptr, 64, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
8462 }
8463 void handle_update_fail_malformed_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailMalformedHTLC * msg) {
8464         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
8465         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
8466         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
8467         LDKUpdateFailMalformedHTLC msg_var = *msg;
8468         uint64_t msg_ref = 0;
8469         msg_var = UpdateFailMalformedHTLC_clone(&msg_var);
8470         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
8471         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
8472         js_invoke_function_ubuuuu(j_calls->instance_ptr, 65, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
8473 }
8474 void handle_commitment_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKCommitmentSigned * msg) {
8475         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
8476         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
8477         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
8478         LDKCommitmentSigned msg_var = *msg;
8479         uint64_t msg_ref = 0;
8480         msg_var = CommitmentSigned_clone(&msg_var);
8481         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
8482         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
8483         js_invoke_function_ubuuuu(j_calls->instance_ptr, 66, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
8484 }
8485 void handle_revoke_and_ack_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKRevokeAndACK * msg) {
8486         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
8487         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
8488         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
8489         LDKRevokeAndACK msg_var = *msg;
8490         uint64_t msg_ref = 0;
8491         msg_var = RevokeAndACK_clone(&msg_var);
8492         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
8493         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
8494         js_invoke_function_ubuuuu(j_calls->instance_ptr, 67, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
8495 }
8496 void handle_update_fee_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFee * msg) {
8497         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
8498         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
8499         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
8500         LDKUpdateFee msg_var = *msg;
8501         uint64_t msg_ref = 0;
8502         msg_var = UpdateFee_clone(&msg_var);
8503         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
8504         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
8505         js_invoke_function_ubuuuu(j_calls->instance_ptr, 68, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
8506 }
8507 void handle_announcement_signatures_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKAnnouncementSignatures * msg) {
8508         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
8509         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
8510         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
8511         LDKAnnouncementSignatures msg_var = *msg;
8512         uint64_t msg_ref = 0;
8513         msg_var = AnnouncementSignatures_clone(&msg_var);
8514         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
8515         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
8516         js_invoke_function_ubuuuu(j_calls->instance_ptr, 69, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
8517 }
8518 void peer_disconnected_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, bool no_connection_possible) {
8519         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
8520         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
8521         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
8522         jboolean no_connection_possible_conv = no_connection_possible;
8523         js_invoke_function_uuuuuu(j_calls->instance_ptr, 70, (uint32_t)their_node_id_arr, no_connection_possible_conv, 0, 0, 0, 0);
8524 }
8525 void peer_connected_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * msg) {
8526         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
8527         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
8528         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
8529         LDKInit msg_var = *msg;
8530         uint64_t msg_ref = 0;
8531         msg_var = Init_clone(&msg_var);
8532         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
8533         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
8534         js_invoke_function_ubuuuu(j_calls->instance_ptr, 71, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
8535 }
8536 void handle_channel_reestablish_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelReestablish * msg) {
8537         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
8538         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
8539         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
8540         LDKChannelReestablish msg_var = *msg;
8541         uint64_t msg_ref = 0;
8542         msg_var = ChannelReestablish_clone(&msg_var);
8543         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
8544         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
8545         js_invoke_function_ubuuuu(j_calls->instance_ptr, 72, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
8546 }
8547 void handle_channel_update_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelUpdate * msg) {
8548         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
8549         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
8550         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
8551         LDKChannelUpdate msg_var = *msg;
8552         uint64_t msg_ref = 0;
8553         msg_var = ChannelUpdate_clone(&msg_var);
8554         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
8555         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
8556         js_invoke_function_ubuuuu(j_calls->instance_ptr, 73, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
8557 }
8558 void handle_error_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKErrorMessage * msg) {
8559         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
8560         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
8561         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
8562         LDKErrorMessage msg_var = *msg;
8563         uint64_t msg_ref = 0;
8564         msg_var = ErrorMessage_clone(&msg_var);
8565         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
8566         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
8567         js_invoke_function_ubuuuu(j_calls->instance_ptr, 74, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
8568 }
8569 static void LDKChannelMessageHandler_JCalls_cloned(LDKChannelMessageHandler* new_obj) {
8570         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) new_obj->this_arg;
8571         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
8572         atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
8573 }
8574 static inline LDKChannelMessageHandler LDKChannelMessageHandler_init (JSValue o, JSValue MessageSendEventsProvider) {
8575         LDKChannelMessageHandler_JCalls *calls = MALLOC(sizeof(LDKChannelMessageHandler_JCalls), "LDKChannelMessageHandler_JCalls");
8576         atomic_init(&calls->refcnt, 1);
8577         calls->instance_ptr = o;
8578
8579         LDKChannelMessageHandler ret = {
8580                 .this_arg = (void*) calls,
8581                 .handle_open_channel = handle_open_channel_LDKChannelMessageHandler_jcall,
8582                 .handle_accept_channel = handle_accept_channel_LDKChannelMessageHandler_jcall,
8583                 .handle_funding_created = handle_funding_created_LDKChannelMessageHandler_jcall,
8584                 .handle_funding_signed = handle_funding_signed_LDKChannelMessageHandler_jcall,
8585                 .handle_channel_ready = handle_channel_ready_LDKChannelMessageHandler_jcall,
8586                 .handle_shutdown = handle_shutdown_LDKChannelMessageHandler_jcall,
8587                 .handle_closing_signed = handle_closing_signed_LDKChannelMessageHandler_jcall,
8588                 .handle_update_add_htlc = handle_update_add_htlc_LDKChannelMessageHandler_jcall,
8589                 .handle_update_fulfill_htlc = handle_update_fulfill_htlc_LDKChannelMessageHandler_jcall,
8590                 .handle_update_fail_htlc = handle_update_fail_htlc_LDKChannelMessageHandler_jcall,
8591                 .handle_update_fail_malformed_htlc = handle_update_fail_malformed_htlc_LDKChannelMessageHandler_jcall,
8592                 .handle_commitment_signed = handle_commitment_signed_LDKChannelMessageHandler_jcall,
8593                 .handle_revoke_and_ack = handle_revoke_and_ack_LDKChannelMessageHandler_jcall,
8594                 .handle_update_fee = handle_update_fee_LDKChannelMessageHandler_jcall,
8595                 .handle_announcement_signatures = handle_announcement_signatures_LDKChannelMessageHandler_jcall,
8596                 .peer_disconnected = peer_disconnected_LDKChannelMessageHandler_jcall,
8597                 .peer_connected = peer_connected_LDKChannelMessageHandler_jcall,
8598                 .handle_channel_reestablish = handle_channel_reestablish_LDKChannelMessageHandler_jcall,
8599                 .handle_channel_update = handle_channel_update_LDKChannelMessageHandler_jcall,
8600                 .handle_error = handle_error_LDKChannelMessageHandler_jcall,
8601                 .free = LDKChannelMessageHandler_JCalls_free,
8602                 .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(MessageSendEventsProvider),
8603         };
8604         calls->MessageSendEventsProvider = ret.MessageSendEventsProvider.this_arg;
8605         return ret;
8606 }
8607 uint64_t  __attribute__((export_name("TS_LDKChannelMessageHandler_new"))) TS_LDKChannelMessageHandler_new(JSValue o, JSValue MessageSendEventsProvider) {
8608         LDKChannelMessageHandler *res_ptr = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
8609         *res_ptr = LDKChannelMessageHandler_init(o, MessageSendEventsProvider);
8610         return tag_ptr(res_ptr, true);
8611 }
8612 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) {
8613         void* this_arg_ptr = untag_ptr(this_arg);
8614         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8615         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
8616         LDKPublicKey their_node_id_ref;
8617         CHECK(their_node_id->arr_len == 33);
8618         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
8619         LDKInitFeatures their_features_conv;
8620         their_features_conv.inner = untag_ptr(their_features);
8621         their_features_conv.is_owned = ptr_is_owned(their_features);
8622         CHECK_INNER_FIELD_ACCESS_OR_NULL(their_features_conv);
8623         their_features_conv = InitFeatures_clone(&their_features_conv);
8624         LDKOpenChannel msg_conv;
8625         msg_conv.inner = untag_ptr(msg);
8626         msg_conv.is_owned = ptr_is_owned(msg);
8627         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
8628         msg_conv.is_owned = false;
8629         (this_arg_conv->handle_open_channel)(this_arg_conv->this_arg, their_node_id_ref, their_features_conv, &msg_conv);
8630 }
8631
8632 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) {
8633         void* this_arg_ptr = untag_ptr(this_arg);
8634         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8635         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
8636         LDKPublicKey their_node_id_ref;
8637         CHECK(their_node_id->arr_len == 33);
8638         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
8639         LDKInitFeatures their_features_conv;
8640         their_features_conv.inner = untag_ptr(their_features);
8641         their_features_conv.is_owned = ptr_is_owned(their_features);
8642         CHECK_INNER_FIELD_ACCESS_OR_NULL(their_features_conv);
8643         their_features_conv = InitFeatures_clone(&their_features_conv);
8644         LDKAcceptChannel msg_conv;
8645         msg_conv.inner = untag_ptr(msg);
8646         msg_conv.is_owned = ptr_is_owned(msg);
8647         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
8648         msg_conv.is_owned = false;
8649         (this_arg_conv->handle_accept_channel)(this_arg_conv->this_arg, their_node_id_ref, their_features_conv, &msg_conv);
8650 }
8651
8652 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) {
8653         void* this_arg_ptr = untag_ptr(this_arg);
8654         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8655         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
8656         LDKPublicKey their_node_id_ref;
8657         CHECK(their_node_id->arr_len == 33);
8658         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
8659         LDKFundingCreated msg_conv;
8660         msg_conv.inner = untag_ptr(msg);
8661         msg_conv.is_owned = ptr_is_owned(msg);
8662         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
8663         msg_conv.is_owned = false;
8664         (this_arg_conv->handle_funding_created)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
8665 }
8666
8667 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) {
8668         void* this_arg_ptr = untag_ptr(this_arg);
8669         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8670         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
8671         LDKPublicKey their_node_id_ref;
8672         CHECK(their_node_id->arr_len == 33);
8673         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
8674         LDKFundingSigned msg_conv;
8675         msg_conv.inner = untag_ptr(msg);
8676         msg_conv.is_owned = ptr_is_owned(msg);
8677         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
8678         msg_conv.is_owned = false;
8679         (this_arg_conv->handle_funding_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
8680 }
8681
8682 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) {
8683         void* this_arg_ptr = untag_ptr(this_arg);
8684         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8685         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
8686         LDKPublicKey their_node_id_ref;
8687         CHECK(their_node_id->arr_len == 33);
8688         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
8689         LDKChannelReady msg_conv;
8690         msg_conv.inner = untag_ptr(msg);
8691         msg_conv.is_owned = ptr_is_owned(msg);
8692         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
8693         msg_conv.is_owned = false;
8694         (this_arg_conv->handle_channel_ready)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
8695 }
8696
8697 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) {
8698         void* this_arg_ptr = untag_ptr(this_arg);
8699         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8700         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
8701         LDKPublicKey their_node_id_ref;
8702         CHECK(their_node_id->arr_len == 33);
8703         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
8704         LDKInitFeatures their_features_conv;
8705         their_features_conv.inner = untag_ptr(their_features);
8706         their_features_conv.is_owned = ptr_is_owned(their_features);
8707         CHECK_INNER_FIELD_ACCESS_OR_NULL(their_features_conv);
8708         their_features_conv.is_owned = false;
8709         LDKShutdown msg_conv;
8710         msg_conv.inner = untag_ptr(msg);
8711         msg_conv.is_owned = ptr_is_owned(msg);
8712         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
8713         msg_conv.is_owned = false;
8714         (this_arg_conv->handle_shutdown)(this_arg_conv->this_arg, their_node_id_ref, &their_features_conv, &msg_conv);
8715 }
8716
8717 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) {
8718         void* this_arg_ptr = untag_ptr(this_arg);
8719         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8720         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
8721         LDKPublicKey their_node_id_ref;
8722         CHECK(their_node_id->arr_len == 33);
8723         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
8724         LDKClosingSigned msg_conv;
8725         msg_conv.inner = untag_ptr(msg);
8726         msg_conv.is_owned = ptr_is_owned(msg);
8727         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
8728         msg_conv.is_owned = false;
8729         (this_arg_conv->handle_closing_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
8730 }
8731
8732 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) {
8733         void* this_arg_ptr = untag_ptr(this_arg);
8734         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8735         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
8736         LDKPublicKey their_node_id_ref;
8737         CHECK(their_node_id->arr_len == 33);
8738         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
8739         LDKUpdateAddHTLC msg_conv;
8740         msg_conv.inner = untag_ptr(msg);
8741         msg_conv.is_owned = ptr_is_owned(msg);
8742         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
8743         msg_conv.is_owned = false;
8744         (this_arg_conv->handle_update_add_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
8745 }
8746
8747 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) {
8748         void* this_arg_ptr = untag_ptr(this_arg);
8749         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8750         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
8751         LDKPublicKey their_node_id_ref;
8752         CHECK(their_node_id->arr_len == 33);
8753         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
8754         LDKUpdateFulfillHTLC msg_conv;
8755         msg_conv.inner = untag_ptr(msg);
8756         msg_conv.is_owned = ptr_is_owned(msg);
8757         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
8758         msg_conv.is_owned = false;
8759         (this_arg_conv->handle_update_fulfill_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
8760 }
8761
8762 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) {
8763         void* this_arg_ptr = untag_ptr(this_arg);
8764         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8765         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
8766         LDKPublicKey their_node_id_ref;
8767         CHECK(their_node_id->arr_len == 33);
8768         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
8769         LDKUpdateFailHTLC msg_conv;
8770         msg_conv.inner = untag_ptr(msg);
8771         msg_conv.is_owned = ptr_is_owned(msg);
8772         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
8773         msg_conv.is_owned = false;
8774         (this_arg_conv->handle_update_fail_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
8775 }
8776
8777 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) {
8778         void* this_arg_ptr = untag_ptr(this_arg);
8779         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8780         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
8781         LDKPublicKey their_node_id_ref;
8782         CHECK(their_node_id->arr_len == 33);
8783         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
8784         LDKUpdateFailMalformedHTLC msg_conv;
8785         msg_conv.inner = untag_ptr(msg);
8786         msg_conv.is_owned = ptr_is_owned(msg);
8787         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
8788         msg_conv.is_owned = false;
8789         (this_arg_conv->handle_update_fail_malformed_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
8790 }
8791
8792 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) {
8793         void* this_arg_ptr = untag_ptr(this_arg);
8794         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8795         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
8796         LDKPublicKey their_node_id_ref;
8797         CHECK(their_node_id->arr_len == 33);
8798         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
8799         LDKCommitmentSigned msg_conv;
8800         msg_conv.inner = untag_ptr(msg);
8801         msg_conv.is_owned = ptr_is_owned(msg);
8802         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
8803         msg_conv.is_owned = false;
8804         (this_arg_conv->handle_commitment_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
8805 }
8806
8807 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) {
8808         void* this_arg_ptr = untag_ptr(this_arg);
8809         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8810         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
8811         LDKPublicKey their_node_id_ref;
8812         CHECK(their_node_id->arr_len == 33);
8813         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
8814         LDKRevokeAndACK msg_conv;
8815         msg_conv.inner = untag_ptr(msg);
8816         msg_conv.is_owned = ptr_is_owned(msg);
8817         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
8818         msg_conv.is_owned = false;
8819         (this_arg_conv->handle_revoke_and_ack)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
8820 }
8821
8822 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) {
8823         void* this_arg_ptr = untag_ptr(this_arg);
8824         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8825         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
8826         LDKPublicKey their_node_id_ref;
8827         CHECK(their_node_id->arr_len == 33);
8828         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
8829         LDKUpdateFee msg_conv;
8830         msg_conv.inner = untag_ptr(msg);
8831         msg_conv.is_owned = ptr_is_owned(msg);
8832         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
8833         msg_conv.is_owned = false;
8834         (this_arg_conv->handle_update_fee)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
8835 }
8836
8837 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) {
8838         void* this_arg_ptr = untag_ptr(this_arg);
8839         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8840         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
8841         LDKPublicKey their_node_id_ref;
8842         CHECK(their_node_id->arr_len == 33);
8843         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
8844         LDKAnnouncementSignatures msg_conv;
8845         msg_conv.inner = untag_ptr(msg);
8846         msg_conv.is_owned = ptr_is_owned(msg);
8847         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
8848         msg_conv.is_owned = false;
8849         (this_arg_conv->handle_announcement_signatures)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
8850 }
8851
8852 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) {
8853         void* this_arg_ptr = untag_ptr(this_arg);
8854         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8855         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
8856         LDKPublicKey their_node_id_ref;
8857         CHECK(their_node_id->arr_len == 33);
8858         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
8859         (this_arg_conv->peer_disconnected)(this_arg_conv->this_arg, their_node_id_ref, no_connection_possible);
8860 }
8861
8862 void  __attribute__((export_name("TS_ChannelMessageHandler_peer_connected"))) TS_ChannelMessageHandler_peer_connected(uint64_t this_arg, int8_tArray their_node_id, uint64_t msg) {
8863         void* this_arg_ptr = untag_ptr(this_arg);
8864         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8865         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
8866         LDKPublicKey their_node_id_ref;
8867         CHECK(their_node_id->arr_len == 33);
8868         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
8869         LDKInit msg_conv;
8870         msg_conv.inner = untag_ptr(msg);
8871         msg_conv.is_owned = ptr_is_owned(msg);
8872         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
8873         msg_conv.is_owned = false;
8874         (this_arg_conv->peer_connected)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
8875 }
8876
8877 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) {
8878         void* this_arg_ptr = untag_ptr(this_arg);
8879         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8880         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
8881         LDKPublicKey their_node_id_ref;
8882         CHECK(their_node_id->arr_len == 33);
8883         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
8884         LDKChannelReestablish msg_conv;
8885         msg_conv.inner = untag_ptr(msg);
8886         msg_conv.is_owned = ptr_is_owned(msg);
8887         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
8888         msg_conv.is_owned = false;
8889         (this_arg_conv->handle_channel_reestablish)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
8890 }
8891
8892 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) {
8893         void* this_arg_ptr = untag_ptr(this_arg);
8894         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8895         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
8896         LDKPublicKey their_node_id_ref;
8897         CHECK(their_node_id->arr_len == 33);
8898         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
8899         LDKChannelUpdate msg_conv;
8900         msg_conv.inner = untag_ptr(msg);
8901         msg_conv.is_owned = ptr_is_owned(msg);
8902         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
8903         msg_conv.is_owned = false;
8904         (this_arg_conv->handle_channel_update)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
8905 }
8906
8907 void  __attribute__((export_name("TS_ChannelMessageHandler_handle_error"))) TS_ChannelMessageHandler_handle_error(uint64_t this_arg, int8_tArray their_node_id, uint64_t msg) {
8908         void* this_arg_ptr = untag_ptr(this_arg);
8909         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8910         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
8911         LDKPublicKey their_node_id_ref;
8912         CHECK(their_node_id->arr_len == 33);
8913         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
8914         LDKErrorMessage msg_conv;
8915         msg_conv.inner = untag_ptr(msg);
8916         msg_conv.is_owned = ptr_is_owned(msg);
8917         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
8918         msg_conv.is_owned = false;
8919         (this_arg_conv->handle_error)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
8920 }
8921
8922 typedef struct LDKRoutingMessageHandler_JCalls {
8923         atomic_size_t refcnt;
8924         uint32_t instance_ptr;
8925         LDKMessageSendEventsProvider_JCalls* MessageSendEventsProvider;
8926 } LDKRoutingMessageHandler_JCalls;
8927 static void LDKRoutingMessageHandler_JCalls_free(void* this_arg) {
8928         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
8929         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
8930                 FREE(j_calls);
8931         }
8932 }
8933 LDKCResult_boolLightningErrorZ handle_node_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKNodeAnnouncement * msg) {
8934         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
8935         LDKNodeAnnouncement msg_var = *msg;
8936         uint64_t msg_ref = 0;
8937         msg_var = NodeAnnouncement_clone(&msg_var);
8938         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
8939         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
8940         uint32_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 75, msg_ref, 0, 0, 0, 0, 0);
8941         void* ret_ptr = untag_ptr(ret);
8942         CHECK_ACCESS(ret_ptr);
8943         LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(ret_ptr);
8944         FREE(untag_ptr(ret));
8945         return ret_conv;
8946 }
8947 LDKCResult_boolLightningErrorZ handle_channel_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKChannelAnnouncement * msg) {
8948         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
8949         LDKChannelAnnouncement msg_var = *msg;
8950         uint64_t msg_ref = 0;
8951         msg_var = ChannelAnnouncement_clone(&msg_var);
8952         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
8953         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
8954         uint32_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 76, msg_ref, 0, 0, 0, 0, 0);
8955         void* ret_ptr = untag_ptr(ret);
8956         CHECK_ACCESS(ret_ptr);
8957         LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(ret_ptr);
8958         FREE(untag_ptr(ret));
8959         return ret_conv;
8960 }
8961 LDKCResult_boolLightningErrorZ handle_channel_update_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKChannelUpdate * msg) {
8962         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
8963         LDKChannelUpdate msg_var = *msg;
8964         uint64_t msg_ref = 0;
8965         msg_var = ChannelUpdate_clone(&msg_var);
8966         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
8967         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
8968         uint32_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 77, msg_ref, 0, 0, 0, 0, 0);
8969         void* ret_ptr = untag_ptr(ret);
8970         CHECK_ACCESS(ret_ptr);
8971         LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(ret_ptr);
8972         FREE(untag_ptr(ret));
8973         return ret_conv;
8974 }
8975 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ get_next_channel_announcements_LDKRoutingMessageHandler_jcall(const void* this_arg, uint64_t starting_point, uint8_t batch_amount) {
8976         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
8977         int64_t starting_point_conv = starting_point;
8978         int8_t batch_amount_conv = batch_amount;
8979         uint64_tArray ret = (uint64_tArray)js_invoke_function_buuuuu(j_calls->instance_ptr, 78, starting_point_conv, batch_amount_conv, 0, 0, 0, 0);
8980         LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret_constr;
8981         ret_constr.datalen = ret->arr_len;
8982         if (ret_constr.datalen > 0)
8983                 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ Elements");
8984         else
8985                 ret_constr.data = NULL;
8986         uint64_t* ret_vals = ret->elems;
8987         for (size_t h = 0; h < ret_constr.datalen; h++) {
8988                 uint64_t ret_conv_59 = ret_vals[h];
8989                 void* ret_conv_59_ptr = untag_ptr(ret_conv_59);
8990                 CHECK_ACCESS(ret_conv_59_ptr);
8991                 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ ret_conv_59_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(ret_conv_59_ptr);
8992                 FREE(untag_ptr(ret_conv_59));
8993                 ret_constr.data[h] = ret_conv_59_conv;
8994         }
8995         FREE(ret);
8996         return ret_constr;
8997 }
8998 LDKCVec_NodeAnnouncementZ get_next_node_announcements_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey starting_point, uint8_t batch_amount) {
8999         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
9000         int8_tArray starting_point_arr = init_int8_tArray(33, __LINE__);
9001         memcpy(starting_point_arr->elems, starting_point.compressed_form, 33);
9002         int8_t batch_amount_conv = batch_amount;
9003         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);
9004         LDKCVec_NodeAnnouncementZ ret_constr;
9005         ret_constr.datalen = ret->arr_len;
9006         if (ret_constr.datalen > 0)
9007                 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKNodeAnnouncement), "LDKCVec_NodeAnnouncementZ Elements");
9008         else
9009                 ret_constr.data = NULL;
9010         uint64_t* ret_vals = ret->elems;
9011         for (size_t s = 0; s < ret_constr.datalen; s++) {
9012                 uint64_t ret_conv_18 = ret_vals[s];
9013                 LDKNodeAnnouncement ret_conv_18_conv;
9014                 ret_conv_18_conv.inner = untag_ptr(ret_conv_18);
9015                 ret_conv_18_conv.is_owned = ptr_is_owned(ret_conv_18);
9016                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_18_conv);
9017                 ret_constr.data[s] = ret_conv_18_conv;
9018         }
9019         FREE(ret);
9020         return ret_constr;
9021 }
9022 void peer_connected_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * init) {
9023         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
9024         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9025         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9026         LDKInit init_var = *init;
9027         uint64_t init_ref = 0;
9028         init_var = Init_clone(&init_var);
9029         CHECK_INNER_FIELD_ACCESS_OR_NULL(init_var);
9030         init_ref = tag_ptr(init_var.inner, init_var.is_owned);
9031         js_invoke_function_ubuuuu(j_calls->instance_ptr, 80, (uint32_t)their_node_id_arr, init_ref, 0, 0, 0, 0);
9032 }
9033 LDKCResult_NoneLightningErrorZ handle_reply_channel_range_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKReplyChannelRange msg) {
9034         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
9035         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9036         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9037         LDKReplyChannelRange msg_var = msg;
9038         uint64_t msg_ref = 0;
9039         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9040         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
9041         uint32_t ret = js_invoke_function_ubuuuu(j_calls->instance_ptr, 81, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
9042         void* ret_ptr = untag_ptr(ret);
9043         CHECK_ACCESS(ret_ptr);
9044         LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
9045         FREE(untag_ptr(ret));
9046         return ret_conv;
9047 }
9048 LDKCResult_NoneLightningErrorZ handle_reply_short_channel_ids_end_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKReplyShortChannelIdsEnd msg) {
9049         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
9050         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9051         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9052         LDKReplyShortChannelIdsEnd msg_var = msg;
9053         uint64_t msg_ref = 0;
9054         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9055         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
9056         uint32_t ret = js_invoke_function_ubuuuu(j_calls->instance_ptr, 82, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
9057         void* ret_ptr = untag_ptr(ret);
9058         CHECK_ACCESS(ret_ptr);
9059         LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
9060         FREE(untag_ptr(ret));
9061         return ret_conv;
9062 }
9063 LDKCResult_NoneLightningErrorZ handle_query_channel_range_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKQueryChannelRange msg) {
9064         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
9065         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9066         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9067         LDKQueryChannelRange msg_var = msg;
9068         uint64_t msg_ref = 0;
9069         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9070         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
9071         uint32_t ret = js_invoke_function_ubuuuu(j_calls->instance_ptr, 83, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
9072         void* ret_ptr = untag_ptr(ret);
9073         CHECK_ACCESS(ret_ptr);
9074         LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
9075         FREE(untag_ptr(ret));
9076         return ret_conv;
9077 }
9078 LDKCResult_NoneLightningErrorZ handle_query_short_channel_ids_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKQueryShortChannelIds msg) {
9079         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
9080         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9081         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9082         LDKQueryShortChannelIds msg_var = msg;
9083         uint64_t msg_ref = 0;
9084         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9085         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
9086         uint32_t ret = js_invoke_function_ubuuuu(j_calls->instance_ptr, 84, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
9087         void* ret_ptr = untag_ptr(ret);
9088         CHECK_ACCESS(ret_ptr);
9089         LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
9090         FREE(untag_ptr(ret));
9091         return ret_conv;
9092 }
9093 static void LDKRoutingMessageHandler_JCalls_cloned(LDKRoutingMessageHandler* new_obj) {
9094         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) new_obj->this_arg;
9095         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
9096         atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
9097 }
9098 static inline LDKRoutingMessageHandler LDKRoutingMessageHandler_init (JSValue o, JSValue MessageSendEventsProvider) {
9099         LDKRoutingMessageHandler_JCalls *calls = MALLOC(sizeof(LDKRoutingMessageHandler_JCalls), "LDKRoutingMessageHandler_JCalls");
9100         atomic_init(&calls->refcnt, 1);
9101         calls->instance_ptr = o;
9102
9103         LDKRoutingMessageHandler ret = {
9104                 .this_arg = (void*) calls,
9105                 .handle_node_announcement = handle_node_announcement_LDKRoutingMessageHandler_jcall,
9106                 .handle_channel_announcement = handle_channel_announcement_LDKRoutingMessageHandler_jcall,
9107                 .handle_channel_update = handle_channel_update_LDKRoutingMessageHandler_jcall,
9108                 .get_next_channel_announcements = get_next_channel_announcements_LDKRoutingMessageHandler_jcall,
9109                 .get_next_node_announcements = get_next_node_announcements_LDKRoutingMessageHandler_jcall,
9110                 .peer_connected = peer_connected_LDKRoutingMessageHandler_jcall,
9111                 .handle_reply_channel_range = handle_reply_channel_range_LDKRoutingMessageHandler_jcall,
9112                 .handle_reply_short_channel_ids_end = handle_reply_short_channel_ids_end_LDKRoutingMessageHandler_jcall,
9113                 .handle_query_channel_range = handle_query_channel_range_LDKRoutingMessageHandler_jcall,
9114                 .handle_query_short_channel_ids = handle_query_short_channel_ids_LDKRoutingMessageHandler_jcall,
9115                 .free = LDKRoutingMessageHandler_JCalls_free,
9116                 .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(MessageSendEventsProvider),
9117         };
9118         calls->MessageSendEventsProvider = ret.MessageSendEventsProvider.this_arg;
9119         return ret;
9120 }
9121 uint64_t  __attribute__((export_name("TS_LDKRoutingMessageHandler_new"))) TS_LDKRoutingMessageHandler_new(JSValue o, JSValue MessageSendEventsProvider) {
9122         LDKRoutingMessageHandler *res_ptr = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
9123         *res_ptr = LDKRoutingMessageHandler_init(o, MessageSendEventsProvider);
9124         return tag_ptr(res_ptr, true);
9125 }
9126 uint64_t  __attribute__((export_name("TS_RoutingMessageHandler_handle_node_announcement"))) TS_RoutingMessageHandler_handle_node_announcement(uint64_t this_arg, uint64_t msg) {
9127         void* this_arg_ptr = untag_ptr(this_arg);
9128         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9129         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
9130         LDKNodeAnnouncement msg_conv;
9131         msg_conv.inner = untag_ptr(msg);
9132         msg_conv.is_owned = ptr_is_owned(msg);
9133         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9134         msg_conv.is_owned = false;
9135         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
9136         *ret_conv = (this_arg_conv->handle_node_announcement)(this_arg_conv->this_arg, &msg_conv);
9137         return tag_ptr(ret_conv, true);
9138 }
9139
9140 uint64_t  __attribute__((export_name("TS_RoutingMessageHandler_handle_channel_announcement"))) TS_RoutingMessageHandler_handle_channel_announcement(uint64_t this_arg, uint64_t msg) {
9141         void* this_arg_ptr = untag_ptr(this_arg);
9142         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9143         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
9144         LDKChannelAnnouncement msg_conv;
9145         msg_conv.inner = untag_ptr(msg);
9146         msg_conv.is_owned = ptr_is_owned(msg);
9147         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9148         msg_conv.is_owned = false;
9149         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
9150         *ret_conv = (this_arg_conv->handle_channel_announcement)(this_arg_conv->this_arg, &msg_conv);
9151         return tag_ptr(ret_conv, true);
9152 }
9153
9154 uint64_t  __attribute__((export_name("TS_RoutingMessageHandler_handle_channel_update"))) TS_RoutingMessageHandler_handle_channel_update(uint64_t this_arg, uint64_t msg) {
9155         void* this_arg_ptr = untag_ptr(this_arg);
9156         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9157         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
9158         LDKChannelUpdate msg_conv;
9159         msg_conv.inner = untag_ptr(msg);
9160         msg_conv.is_owned = ptr_is_owned(msg);
9161         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9162         msg_conv.is_owned = false;
9163         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
9164         *ret_conv = (this_arg_conv->handle_channel_update)(this_arg_conv->this_arg, &msg_conv);
9165         return tag_ptr(ret_conv, true);
9166 }
9167
9168 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) {
9169         void* this_arg_ptr = untag_ptr(this_arg);
9170         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9171         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
9172         LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret_var = (this_arg_conv->get_next_channel_announcements)(this_arg_conv->this_arg, starting_point, batch_amount);
9173         uint64_tArray ret_arr = NULL;
9174         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
9175         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
9176         for (size_t h = 0; h < ret_var.datalen; h++) {
9177                 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv_59_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
9178                 *ret_conv_59_conv = ret_var.data[h];
9179                 ret_arr_ptr[h] = tag_ptr(ret_conv_59_conv, true);
9180         }
9181         
9182         FREE(ret_var.data);
9183         return ret_arr;
9184 }
9185
9186 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) {
9187         void* this_arg_ptr = untag_ptr(this_arg);
9188         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9189         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
9190         LDKPublicKey starting_point_ref;
9191         CHECK(starting_point->arr_len == 33);
9192         memcpy(starting_point_ref.compressed_form, starting_point->elems, 33); FREE(starting_point);
9193         LDKCVec_NodeAnnouncementZ ret_var = (this_arg_conv->get_next_node_announcements)(this_arg_conv->this_arg, starting_point_ref, batch_amount);
9194         uint64_tArray ret_arr = NULL;
9195         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
9196         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
9197         for (size_t s = 0; s < ret_var.datalen; s++) {
9198                 LDKNodeAnnouncement ret_conv_18_var = ret_var.data[s];
9199                 uint64_t ret_conv_18_ref = 0;
9200                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_18_var);
9201                 ret_conv_18_ref = tag_ptr(ret_conv_18_var.inner, ret_conv_18_var.is_owned);
9202                 ret_arr_ptr[s] = ret_conv_18_ref;
9203         }
9204         
9205         FREE(ret_var.data);
9206         return ret_arr;
9207 }
9208
9209 void  __attribute__((export_name("TS_RoutingMessageHandler_peer_connected"))) TS_RoutingMessageHandler_peer_connected(uint64_t this_arg, int8_tArray their_node_id, uint64_t init) {
9210         void* this_arg_ptr = untag_ptr(this_arg);
9211         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9212         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
9213         LDKPublicKey their_node_id_ref;
9214         CHECK(their_node_id->arr_len == 33);
9215         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9216         LDKInit init_conv;
9217         init_conv.inner = untag_ptr(init);
9218         init_conv.is_owned = ptr_is_owned(init);
9219         CHECK_INNER_FIELD_ACCESS_OR_NULL(init_conv);
9220         init_conv.is_owned = false;
9221         (this_arg_conv->peer_connected)(this_arg_conv->this_arg, their_node_id_ref, &init_conv);
9222 }
9223
9224 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) {
9225         void* this_arg_ptr = untag_ptr(this_arg);
9226         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9227         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
9228         LDKPublicKey their_node_id_ref;
9229         CHECK(their_node_id->arr_len == 33);
9230         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9231         LDKReplyChannelRange msg_conv;
9232         msg_conv.inner = untag_ptr(msg);
9233         msg_conv.is_owned = ptr_is_owned(msg);
9234         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9235         msg_conv = ReplyChannelRange_clone(&msg_conv);
9236         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
9237         *ret_conv = (this_arg_conv->handle_reply_channel_range)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
9238         return tag_ptr(ret_conv, true);
9239 }
9240
9241 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) {
9242         void* this_arg_ptr = untag_ptr(this_arg);
9243         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9244         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
9245         LDKPublicKey their_node_id_ref;
9246         CHECK(their_node_id->arr_len == 33);
9247         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9248         LDKReplyShortChannelIdsEnd msg_conv;
9249         msg_conv.inner = untag_ptr(msg);
9250         msg_conv.is_owned = ptr_is_owned(msg);
9251         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9252         msg_conv = ReplyShortChannelIdsEnd_clone(&msg_conv);
9253         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
9254         *ret_conv = (this_arg_conv->handle_reply_short_channel_ids_end)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
9255         return tag_ptr(ret_conv, true);
9256 }
9257
9258 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) {
9259         void* this_arg_ptr = untag_ptr(this_arg);
9260         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9261         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
9262         LDKPublicKey their_node_id_ref;
9263         CHECK(their_node_id->arr_len == 33);
9264         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9265         LDKQueryChannelRange msg_conv;
9266         msg_conv.inner = untag_ptr(msg);
9267         msg_conv.is_owned = ptr_is_owned(msg);
9268         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9269         msg_conv = QueryChannelRange_clone(&msg_conv);
9270         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
9271         *ret_conv = (this_arg_conv->handle_query_channel_range)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
9272         return tag_ptr(ret_conv, true);
9273 }
9274
9275 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) {
9276         void* this_arg_ptr = untag_ptr(this_arg);
9277         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9278         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
9279         LDKPublicKey their_node_id_ref;
9280         CHECK(their_node_id->arr_len == 33);
9281         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9282         LDKQueryShortChannelIds msg_conv;
9283         msg_conv.inner = untag_ptr(msg);
9284         msg_conv.is_owned = ptr_is_owned(msg);
9285         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9286         msg_conv = QueryShortChannelIds_clone(&msg_conv);
9287         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
9288         *ret_conv = (this_arg_conv->handle_query_short_channel_ids)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
9289         return tag_ptr(ret_conv, true);
9290 }
9291
9292 typedef struct LDKCustomMessageReader_JCalls {
9293         atomic_size_t refcnt;
9294         uint32_t instance_ptr;
9295 } LDKCustomMessageReader_JCalls;
9296 static void LDKCustomMessageReader_JCalls_free(void* this_arg) {
9297         LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) this_arg;
9298         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
9299                 FREE(j_calls);
9300         }
9301 }
9302 LDKCResult_COption_TypeZDecodeErrorZ read_LDKCustomMessageReader_jcall(const void* this_arg, uint16_t message_type, LDKu8slice buffer) {
9303         LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) this_arg;
9304         int16_t message_type_conv = message_type;
9305         LDKu8slice buffer_var = buffer;
9306         int8_tArray buffer_arr = init_int8_tArray(buffer_var.datalen, __LINE__);
9307         memcpy(buffer_arr->elems, buffer_var.data, buffer_var.datalen);
9308         uint32_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 85, message_type_conv, (uint32_t)buffer_arr, 0, 0, 0, 0);
9309         void* ret_ptr = untag_ptr(ret);
9310         CHECK_ACCESS(ret_ptr);
9311         LDKCResult_COption_TypeZDecodeErrorZ ret_conv = *(LDKCResult_COption_TypeZDecodeErrorZ*)(ret_ptr);
9312         FREE(untag_ptr(ret));
9313         return ret_conv;
9314 }
9315 static void LDKCustomMessageReader_JCalls_cloned(LDKCustomMessageReader* new_obj) {
9316         LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) new_obj->this_arg;
9317         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
9318 }
9319 static inline LDKCustomMessageReader LDKCustomMessageReader_init (JSValue o) {
9320         LDKCustomMessageReader_JCalls *calls = MALLOC(sizeof(LDKCustomMessageReader_JCalls), "LDKCustomMessageReader_JCalls");
9321         atomic_init(&calls->refcnt, 1);
9322         calls->instance_ptr = o;
9323
9324         LDKCustomMessageReader ret = {
9325                 .this_arg = (void*) calls,
9326                 .read = read_LDKCustomMessageReader_jcall,
9327                 .free = LDKCustomMessageReader_JCalls_free,
9328         };
9329         return ret;
9330 }
9331 uint64_t  __attribute__((export_name("TS_LDKCustomMessageReader_new"))) TS_LDKCustomMessageReader_new(JSValue o) {
9332         LDKCustomMessageReader *res_ptr = MALLOC(sizeof(LDKCustomMessageReader), "LDKCustomMessageReader");
9333         *res_ptr = LDKCustomMessageReader_init(o);
9334         return tag_ptr(res_ptr, true);
9335 }
9336 uint64_t  __attribute__((export_name("TS_CustomMessageReader_read"))) TS_CustomMessageReader_read(uint64_t this_arg, int16_t message_type, int8_tArray buffer) {
9337         void* this_arg_ptr = untag_ptr(this_arg);
9338         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9339         LDKCustomMessageReader* this_arg_conv = (LDKCustomMessageReader*)this_arg_ptr;
9340         LDKu8slice buffer_ref;
9341         buffer_ref.datalen = buffer->arr_len;
9342         buffer_ref.data = buffer->elems;
9343         LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
9344         *ret_conv = (this_arg_conv->read)(this_arg_conv->this_arg, message_type, buffer_ref);
9345         FREE(buffer);
9346         return tag_ptr(ret_conv, true);
9347 }
9348
9349 typedef struct LDKCustomMessageHandler_JCalls {
9350         atomic_size_t refcnt;
9351         uint32_t instance_ptr;
9352         LDKCustomMessageReader_JCalls* CustomMessageReader;
9353 } LDKCustomMessageHandler_JCalls;
9354 static void LDKCustomMessageHandler_JCalls_free(void* this_arg) {
9355         LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
9356         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
9357                 FREE(j_calls);
9358         }
9359 }
9360 LDKCResult_NoneLightningErrorZ handle_custom_message_LDKCustomMessageHandler_jcall(const void* this_arg, LDKType msg, LDKPublicKey sender_node_id) {
9361         LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
9362         LDKType* msg_ret = MALLOC(sizeof(LDKType), "LDKType");
9363         *msg_ret = msg;
9364         int8_tArray sender_node_id_arr = init_int8_tArray(33, __LINE__);
9365         memcpy(sender_node_id_arr->elems, sender_node_id.compressed_form, 33);
9366         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);
9367         void* ret_ptr = untag_ptr(ret);
9368         CHECK_ACCESS(ret_ptr);
9369         LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
9370         FREE(untag_ptr(ret));
9371         return ret_conv;
9372 }
9373 LDKCVec_C2Tuple_PublicKeyTypeZZ get_and_clear_pending_msg_LDKCustomMessageHandler_jcall(const void* this_arg) {
9374         LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
9375         uint64_tArray ret = (uint64_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 87, 0, 0, 0, 0, 0, 0);
9376         LDKCVec_C2Tuple_PublicKeyTypeZZ ret_constr;
9377         ret_constr.datalen = ret->arr_len;
9378         if (ret_constr.datalen > 0)
9379                 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKCVec_C2Tuple_PublicKeyTypeZZ Elements");
9380         else
9381                 ret_constr.data = NULL;
9382         uint64_t* ret_vals = ret->elems;
9383         for (size_t z = 0; z < ret_constr.datalen; z++) {
9384                 uint64_t ret_conv_25 = ret_vals[z];
9385                 void* ret_conv_25_ptr = untag_ptr(ret_conv_25);
9386                 CHECK_ACCESS(ret_conv_25_ptr);
9387                 LDKC2Tuple_PublicKeyTypeZ ret_conv_25_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(ret_conv_25_ptr);
9388                 FREE(untag_ptr(ret_conv_25));
9389                 ret_constr.data[z] = ret_conv_25_conv;
9390         }
9391         FREE(ret);
9392         return ret_constr;
9393 }
9394 static void LDKCustomMessageHandler_JCalls_cloned(LDKCustomMessageHandler* new_obj) {
9395         LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) new_obj->this_arg;
9396         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
9397         atomic_fetch_add_explicit(&j_calls->CustomMessageReader->refcnt, 1, memory_order_release);
9398 }
9399 static inline LDKCustomMessageHandler LDKCustomMessageHandler_init (JSValue o, JSValue CustomMessageReader) {
9400         LDKCustomMessageHandler_JCalls *calls = MALLOC(sizeof(LDKCustomMessageHandler_JCalls), "LDKCustomMessageHandler_JCalls");
9401         atomic_init(&calls->refcnt, 1);
9402         calls->instance_ptr = o;
9403
9404         LDKCustomMessageHandler ret = {
9405                 .this_arg = (void*) calls,
9406                 .handle_custom_message = handle_custom_message_LDKCustomMessageHandler_jcall,
9407                 .get_and_clear_pending_msg = get_and_clear_pending_msg_LDKCustomMessageHandler_jcall,
9408                 .free = LDKCustomMessageHandler_JCalls_free,
9409                 .CustomMessageReader = LDKCustomMessageReader_init(CustomMessageReader),
9410         };
9411         calls->CustomMessageReader = ret.CustomMessageReader.this_arg;
9412         return ret;
9413 }
9414 uint64_t  __attribute__((export_name("TS_LDKCustomMessageHandler_new"))) TS_LDKCustomMessageHandler_new(JSValue o, JSValue CustomMessageReader) {
9415         LDKCustomMessageHandler *res_ptr = MALLOC(sizeof(LDKCustomMessageHandler), "LDKCustomMessageHandler");
9416         *res_ptr = LDKCustomMessageHandler_init(o, CustomMessageReader);
9417         return tag_ptr(res_ptr, true);
9418 }
9419 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) {
9420         void* this_arg_ptr = untag_ptr(this_arg);
9421         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9422         LDKCustomMessageHandler* this_arg_conv = (LDKCustomMessageHandler*)this_arg_ptr;
9423         void* msg_ptr = untag_ptr(msg);
9424         CHECK_ACCESS(msg_ptr);
9425         LDKType msg_conv = *(LDKType*)(msg_ptr);
9426         if (msg_conv.free == LDKType_JCalls_free) {
9427                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
9428                 LDKType_JCalls_cloned(&msg_conv);
9429         }
9430         LDKPublicKey sender_node_id_ref;
9431         CHECK(sender_node_id->arr_len == 33);
9432         memcpy(sender_node_id_ref.compressed_form, sender_node_id->elems, 33); FREE(sender_node_id);
9433         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
9434         *ret_conv = (this_arg_conv->handle_custom_message)(this_arg_conv->this_arg, msg_conv, sender_node_id_ref);
9435         return tag_ptr(ret_conv, true);
9436 }
9437
9438 uint64_tArray  __attribute__((export_name("TS_CustomMessageHandler_get_and_clear_pending_msg"))) TS_CustomMessageHandler_get_and_clear_pending_msg(uint64_t this_arg) {
9439         void* this_arg_ptr = untag_ptr(this_arg);
9440         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9441         LDKCustomMessageHandler* this_arg_conv = (LDKCustomMessageHandler*)this_arg_ptr;
9442         LDKCVec_C2Tuple_PublicKeyTypeZZ ret_var = (this_arg_conv->get_and_clear_pending_msg)(this_arg_conv->this_arg);
9443         uint64_tArray ret_arr = NULL;
9444         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
9445         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
9446         for (size_t z = 0; z < ret_var.datalen; z++) {
9447                 LDKC2Tuple_PublicKeyTypeZ* ret_conv_25_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
9448                 *ret_conv_25_conv = ret_var.data[z];
9449                 ret_arr_ptr[z] = tag_ptr(ret_conv_25_conv, true);
9450         }
9451         
9452         FREE(ret_var.data);
9453         return ret_arr;
9454 }
9455
9456 typedef struct LDKSocketDescriptor_JCalls {
9457         atomic_size_t refcnt;
9458         uint32_t instance_ptr;
9459 } LDKSocketDescriptor_JCalls;
9460 static void LDKSocketDescriptor_JCalls_free(void* this_arg) {
9461         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
9462         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
9463                 FREE(j_calls);
9464         }
9465 }
9466 uintptr_t send_data_LDKSocketDescriptor_jcall(void* this_arg, LDKu8slice data, bool resume_read) {
9467         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
9468         LDKu8slice data_var = data;
9469         int8_tArray data_arr = init_int8_tArray(data_var.datalen, __LINE__);
9470         memcpy(data_arr->elems, data_var.data, data_var.datalen);
9471         jboolean resume_read_conv = resume_read;
9472         return js_invoke_function_uuuuuu(j_calls->instance_ptr, 88, (uint32_t)data_arr, resume_read_conv, 0, 0, 0, 0);
9473 }
9474 void disconnect_socket_LDKSocketDescriptor_jcall(void* this_arg) {
9475         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
9476         js_invoke_function_uuuuuu(j_calls->instance_ptr, 89, 0, 0, 0, 0, 0, 0);
9477 }
9478 bool eq_LDKSocketDescriptor_jcall(const void* this_arg, const LDKSocketDescriptor * other_arg) {
9479         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
9480         LDKSocketDescriptor *other_arg_clone = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
9481         *other_arg_clone = SocketDescriptor_clone(other_arg);
9482         return js_invoke_function_buuuuu(j_calls->instance_ptr, 90, tag_ptr(other_arg_clone, true), 0, 0, 0, 0, 0);
9483 }
9484 uint64_t hash_LDKSocketDescriptor_jcall(const void* this_arg) {
9485         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
9486         return js_invoke_function_uuuuuu(j_calls->instance_ptr, 91, 0, 0, 0, 0, 0, 0);
9487 }
9488 static void LDKSocketDescriptor_JCalls_cloned(LDKSocketDescriptor* new_obj) {
9489         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) new_obj->this_arg;
9490         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
9491 }
9492 static inline LDKSocketDescriptor LDKSocketDescriptor_init (JSValue o) {
9493         LDKSocketDescriptor_JCalls *calls = MALLOC(sizeof(LDKSocketDescriptor_JCalls), "LDKSocketDescriptor_JCalls");
9494         atomic_init(&calls->refcnt, 1);
9495         calls->instance_ptr = o;
9496
9497         LDKSocketDescriptor ret = {
9498                 .this_arg = (void*) calls,
9499                 .send_data = send_data_LDKSocketDescriptor_jcall,
9500                 .disconnect_socket = disconnect_socket_LDKSocketDescriptor_jcall,
9501                 .eq = eq_LDKSocketDescriptor_jcall,
9502                 .hash = hash_LDKSocketDescriptor_jcall,
9503                 .cloned = LDKSocketDescriptor_JCalls_cloned,
9504                 .free = LDKSocketDescriptor_JCalls_free,
9505         };
9506         return ret;
9507 }
9508 uint64_t  __attribute__((export_name("TS_LDKSocketDescriptor_new"))) TS_LDKSocketDescriptor_new(JSValue o) {
9509         LDKSocketDescriptor *res_ptr = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
9510         *res_ptr = LDKSocketDescriptor_init(o);
9511         return tag_ptr(res_ptr, true);
9512 }
9513 uint32_t  __attribute__((export_name("TS_SocketDescriptor_send_data"))) TS_SocketDescriptor_send_data(uint64_t this_arg, int8_tArray data, jboolean resume_read) {
9514         void* this_arg_ptr = untag_ptr(this_arg);
9515         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9516         LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg_ptr;
9517         LDKu8slice data_ref;
9518         data_ref.datalen = data->arr_len;
9519         data_ref.data = data->elems;
9520         uint32_t ret_conv = (this_arg_conv->send_data)(this_arg_conv->this_arg, data_ref, resume_read);
9521         FREE(data);
9522         return ret_conv;
9523 }
9524
9525 void  __attribute__((export_name("TS_SocketDescriptor_disconnect_socket"))) TS_SocketDescriptor_disconnect_socket(uint64_t this_arg) {
9526         void* this_arg_ptr = untag_ptr(this_arg);
9527         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9528         LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg_ptr;
9529         (this_arg_conv->disconnect_socket)(this_arg_conv->this_arg);
9530 }
9531
9532 int64_t  __attribute__((export_name("TS_SocketDescriptor_hash"))) TS_SocketDescriptor_hash(uint64_t this_arg) {
9533         void* this_arg_ptr = untag_ptr(this_arg);
9534         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9535         LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg_ptr;
9536         int64_t ret_conv = (this_arg_conv->hash)(this_arg_conv->this_arg);
9537         return ret_conv;
9538 }
9539
9540 uint32_t __attribute__((export_name("TS_LDKEffectiveCapacity_ty_from_ptr"))) TS_LDKEffectiveCapacity_ty_from_ptr(uint64_t ptr) {
9541         LDKEffectiveCapacity *obj = (LDKEffectiveCapacity*)untag_ptr(ptr);
9542         switch(obj->tag) {
9543                 case LDKEffectiveCapacity_ExactLiquidity: return 0;
9544                 case LDKEffectiveCapacity_MaximumHTLC: return 1;
9545                 case LDKEffectiveCapacity_Total: return 2;
9546                 case LDKEffectiveCapacity_Infinite: return 3;
9547                 case LDKEffectiveCapacity_Unknown: return 4;
9548                 default: abort();
9549         }
9550 }
9551 int64_t __attribute__((export_name("TS_LDKEffectiveCapacity_ExactLiquidity_get_liquidity_msat"))) TS_LDKEffectiveCapacity_ExactLiquidity_get_liquidity_msat(uint64_t ptr) {
9552         LDKEffectiveCapacity *obj = (LDKEffectiveCapacity*)untag_ptr(ptr);
9553         assert(obj->tag == LDKEffectiveCapacity_ExactLiquidity);
9554                         int64_t liquidity_msat_conv = obj->exact_liquidity.liquidity_msat;
9555         return liquidity_msat_conv;
9556 }
9557 int64_t __attribute__((export_name("TS_LDKEffectiveCapacity_MaximumHTLC_get_amount_msat"))) TS_LDKEffectiveCapacity_MaximumHTLC_get_amount_msat(uint64_t ptr) {
9558         LDKEffectiveCapacity *obj = (LDKEffectiveCapacity*)untag_ptr(ptr);
9559         assert(obj->tag == LDKEffectiveCapacity_MaximumHTLC);
9560                         int64_t amount_msat_conv = obj->maximum_htlc.amount_msat;
9561         return amount_msat_conv;
9562 }
9563 int64_t __attribute__((export_name("TS_LDKEffectiveCapacity_Total_get_capacity_msat"))) TS_LDKEffectiveCapacity_Total_get_capacity_msat(uint64_t ptr) {
9564         LDKEffectiveCapacity *obj = (LDKEffectiveCapacity*)untag_ptr(ptr);
9565         assert(obj->tag == LDKEffectiveCapacity_Total);
9566                         int64_t capacity_msat_conv = obj->total.capacity_msat;
9567         return capacity_msat_conv;
9568 }
9569 uint64_t __attribute__((export_name("TS_LDKEffectiveCapacity_Total_get_htlc_maximum_msat"))) TS_LDKEffectiveCapacity_Total_get_htlc_maximum_msat(uint64_t ptr) {
9570         LDKEffectiveCapacity *obj = (LDKEffectiveCapacity*)untag_ptr(ptr);
9571         assert(obj->tag == LDKEffectiveCapacity_Total);
9572                         uint64_t htlc_maximum_msat_ref = tag_ptr(&obj->total.htlc_maximum_msat, false);
9573         return htlc_maximum_msat_ref;
9574 }
9575 typedef struct LDKLockableScore_JCalls {
9576         atomic_size_t refcnt;
9577         uint32_t instance_ptr;
9578 } LDKLockableScore_JCalls;
9579 static void LDKLockableScore_JCalls_free(void* this_arg) {
9580         LDKLockableScore_JCalls *j_calls = (LDKLockableScore_JCalls*) this_arg;
9581         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
9582                 FREE(j_calls);
9583         }
9584 }
9585 LDKScore lock_LDKLockableScore_jcall(const void* this_arg) {
9586         LDKLockableScore_JCalls *j_calls = (LDKLockableScore_JCalls*) this_arg;
9587         uint32_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 92, 0, 0, 0, 0, 0, 0);
9588         void* ret_ptr = untag_ptr(ret);
9589         CHECK_ACCESS(ret_ptr);
9590         LDKScore ret_conv = *(LDKScore*)(ret_ptr);
9591         if (ret_conv.free == LDKScore_JCalls_free) {
9592                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
9593                 LDKScore_JCalls_cloned(&ret_conv);
9594         }// WARNING: we may need a move here but no clone is available for LDKScore
9595         
9596         return ret_conv;
9597 }
9598 static void LDKLockableScore_JCalls_cloned(LDKLockableScore* new_obj) {
9599         LDKLockableScore_JCalls *j_calls = (LDKLockableScore_JCalls*) new_obj->this_arg;
9600         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
9601 }
9602 static inline LDKLockableScore LDKLockableScore_init (JSValue o) {
9603         LDKLockableScore_JCalls *calls = MALLOC(sizeof(LDKLockableScore_JCalls), "LDKLockableScore_JCalls");
9604         atomic_init(&calls->refcnt, 1);
9605         calls->instance_ptr = o;
9606
9607         LDKLockableScore ret = {
9608                 .this_arg = (void*) calls,
9609                 .lock = lock_LDKLockableScore_jcall,
9610                 .free = LDKLockableScore_JCalls_free,
9611         };
9612         return ret;
9613 }
9614 uint64_t  __attribute__((export_name("TS_LDKLockableScore_new"))) TS_LDKLockableScore_new(JSValue o) {
9615         LDKLockableScore *res_ptr = MALLOC(sizeof(LDKLockableScore), "LDKLockableScore");
9616         *res_ptr = LDKLockableScore_init(o);
9617         return tag_ptr(res_ptr, true);
9618 }
9619 uint64_t  __attribute__((export_name("TS_LockableScore_lock"))) TS_LockableScore_lock(uint64_t this_arg) {
9620         void* this_arg_ptr = untag_ptr(this_arg);
9621         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9622         LDKLockableScore* this_arg_conv = (LDKLockableScore*)this_arg_ptr;
9623         LDKScore* ret_ret = MALLOC(sizeof(LDKScore), "LDKScore");
9624         *ret_ret = (this_arg_conv->lock)(this_arg_conv->this_arg);
9625         return tag_ptr(ret_ret, true);
9626 }
9627
9628 uint32_t __attribute__((export_name("TS_LDKFallback_ty_from_ptr"))) TS_LDKFallback_ty_from_ptr(uint64_t ptr) {
9629         LDKFallback *obj = (LDKFallback*)untag_ptr(ptr);
9630         switch(obj->tag) {
9631                 case LDKFallback_SegWitProgram: return 0;
9632                 case LDKFallback_PubKeyHash: return 1;
9633                 case LDKFallback_ScriptHash: return 2;
9634                 default: abort();
9635         }
9636 }
9637 int8_t __attribute__((export_name("TS_LDKFallback_SegWitProgram_get_version"))) TS_LDKFallback_SegWitProgram_get_version(uint64_t ptr) {
9638         LDKFallback *obj = (LDKFallback*)untag_ptr(ptr);
9639         assert(obj->tag == LDKFallback_SegWitProgram);
9640                         uint8_t version_val = obj->seg_wit_program.version._0;
9641         return version_val;
9642 }
9643 int8_tArray __attribute__((export_name("TS_LDKFallback_SegWitProgram_get_program"))) TS_LDKFallback_SegWitProgram_get_program(uint64_t ptr) {
9644         LDKFallback *obj = (LDKFallback*)untag_ptr(ptr);
9645         assert(obj->tag == LDKFallback_SegWitProgram);
9646                         LDKCVec_u8Z program_var = obj->seg_wit_program.program;
9647                         int8_tArray program_arr = init_int8_tArray(program_var.datalen, __LINE__);
9648                         memcpy(program_arr->elems, program_var.data, program_var.datalen);
9649         return program_arr;
9650 }
9651 int8_tArray __attribute__((export_name("TS_LDKFallback_PubKeyHash_get_pub_key_hash"))) TS_LDKFallback_PubKeyHash_get_pub_key_hash(uint64_t ptr) {
9652         LDKFallback *obj = (LDKFallback*)untag_ptr(ptr);
9653         assert(obj->tag == LDKFallback_PubKeyHash);
9654                         int8_tArray pub_key_hash_arr = init_int8_tArray(20, __LINE__);
9655                         memcpy(pub_key_hash_arr->elems, obj->pub_key_hash.data, 20);
9656         return pub_key_hash_arr;
9657 }
9658 int8_tArray __attribute__((export_name("TS_LDKFallback_ScriptHash_get_script_hash"))) TS_LDKFallback_ScriptHash_get_script_hash(uint64_t ptr) {
9659         LDKFallback *obj = (LDKFallback*)untag_ptr(ptr);
9660         assert(obj->tag == LDKFallback_ScriptHash);
9661                         int8_tArray script_hash_arr = init_int8_tArray(20, __LINE__);
9662                         memcpy(script_hash_arr->elems, obj->script_hash.data, 20);
9663         return script_hash_arr;
9664 }
9665 typedef struct LDKPayer_JCalls {
9666         atomic_size_t refcnt;
9667         uint32_t instance_ptr;
9668 } LDKPayer_JCalls;
9669 static void LDKPayer_JCalls_free(void* this_arg) {
9670         LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg;
9671         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
9672                 FREE(j_calls);
9673         }
9674 }
9675 LDKPublicKey node_id_LDKPayer_jcall(const void* this_arg) {
9676         LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg;
9677         int8_tArray ret = (int8_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 93, 0, 0, 0, 0, 0, 0);
9678         LDKPublicKey ret_ref;
9679         CHECK(ret->arr_len == 33);
9680         memcpy(ret_ref.compressed_form, ret->elems, 33); FREE(ret);
9681         return ret_ref;
9682 }
9683 LDKCVec_ChannelDetailsZ first_hops_LDKPayer_jcall(const void* this_arg) {
9684         LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg;
9685         uint64_tArray ret = (uint64_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 94, 0, 0, 0, 0, 0, 0);
9686         LDKCVec_ChannelDetailsZ ret_constr;
9687         ret_constr.datalen = ret->arr_len;
9688         if (ret_constr.datalen > 0)
9689                 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
9690         else
9691                 ret_constr.data = NULL;
9692         uint64_t* ret_vals = ret->elems;
9693         for (size_t q = 0; q < ret_constr.datalen; q++) {
9694                 uint64_t ret_conv_16 = ret_vals[q];
9695                 LDKChannelDetails ret_conv_16_conv;
9696                 ret_conv_16_conv.inner = untag_ptr(ret_conv_16);
9697                 ret_conv_16_conv.is_owned = ptr_is_owned(ret_conv_16);
9698                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_conv);
9699                 ret_constr.data[q] = ret_conv_16_conv;
9700         }
9701         FREE(ret);
9702         return ret_constr;
9703 }
9704 LDKCResult_PaymentIdPaymentSendFailureZ send_payment_LDKPayer_jcall(const void* this_arg, const LDKRoute * route, LDKThirtyTwoBytes payment_hash, LDKThirtyTwoBytes payment_secret) {
9705         LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg;
9706         LDKRoute route_var = *route;
9707         uint64_t route_ref = 0;
9708         route_var = Route_clone(&route_var);
9709         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_var);
9710         route_ref = tag_ptr(route_var.inner, route_var.is_owned);
9711         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
9712         memcpy(payment_hash_arr->elems, payment_hash.data, 32);
9713         int8_tArray payment_secret_arr = init_int8_tArray(32, __LINE__);
9714         memcpy(payment_secret_arr->elems, payment_secret.data, 32);
9715         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);
9716         void* ret_ptr = untag_ptr(ret);
9717         CHECK_ACCESS(ret_ptr);
9718         LDKCResult_PaymentIdPaymentSendFailureZ ret_conv = *(LDKCResult_PaymentIdPaymentSendFailureZ*)(ret_ptr);
9719         FREE(untag_ptr(ret));
9720         return ret_conv;
9721 }
9722 LDKCResult_PaymentIdPaymentSendFailureZ send_spontaneous_payment_LDKPayer_jcall(const void* this_arg, const LDKRoute * route, LDKThirtyTwoBytes payment_preimage) {
9723         LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg;
9724         LDKRoute route_var = *route;
9725         uint64_t route_ref = 0;
9726         route_var = Route_clone(&route_var);
9727         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_var);
9728         route_ref = tag_ptr(route_var.inner, route_var.is_owned);
9729         int8_tArray payment_preimage_arr = init_int8_tArray(32, __LINE__);
9730         memcpy(payment_preimage_arr->elems, payment_preimage.data, 32);
9731         uint32_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 96, route_ref, (uint32_t)payment_preimage_arr, 0, 0, 0, 0);
9732         void* ret_ptr = untag_ptr(ret);
9733         CHECK_ACCESS(ret_ptr);
9734         LDKCResult_PaymentIdPaymentSendFailureZ ret_conv = *(LDKCResult_PaymentIdPaymentSendFailureZ*)(ret_ptr);
9735         FREE(untag_ptr(ret));
9736         return ret_conv;
9737 }
9738 LDKCResult_NonePaymentSendFailureZ retry_payment_LDKPayer_jcall(const void* this_arg, const LDKRoute * route, LDKThirtyTwoBytes payment_id) {
9739         LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg;
9740         LDKRoute route_var = *route;
9741         uint64_t route_ref = 0;
9742         route_var = Route_clone(&route_var);
9743         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_var);
9744         route_ref = tag_ptr(route_var.inner, route_var.is_owned);
9745         int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
9746         memcpy(payment_id_arr->elems, payment_id.data, 32);
9747         uint32_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 97, route_ref, (uint32_t)payment_id_arr, 0, 0, 0, 0);
9748         void* ret_ptr = untag_ptr(ret);
9749         CHECK_ACCESS(ret_ptr);
9750         LDKCResult_NonePaymentSendFailureZ ret_conv = *(LDKCResult_NonePaymentSendFailureZ*)(ret_ptr);
9751         FREE(untag_ptr(ret));
9752         return ret_conv;
9753 }
9754 void abandon_payment_LDKPayer_jcall(const void* this_arg, LDKThirtyTwoBytes payment_id) {
9755         LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg;
9756         int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
9757         memcpy(payment_id_arr->elems, payment_id.data, 32);
9758         js_invoke_function_uuuuuu(j_calls->instance_ptr, 98, (uint32_t)payment_id_arr, 0, 0, 0, 0, 0);
9759 }
9760 static void LDKPayer_JCalls_cloned(LDKPayer* new_obj) {
9761         LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) new_obj->this_arg;
9762         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
9763 }
9764 static inline LDKPayer LDKPayer_init (JSValue o) {
9765         LDKPayer_JCalls *calls = MALLOC(sizeof(LDKPayer_JCalls), "LDKPayer_JCalls");
9766         atomic_init(&calls->refcnt, 1);
9767         calls->instance_ptr = o;
9768
9769         LDKPayer ret = {
9770                 .this_arg = (void*) calls,
9771                 .node_id = node_id_LDKPayer_jcall,
9772                 .first_hops = first_hops_LDKPayer_jcall,
9773                 .send_payment = send_payment_LDKPayer_jcall,
9774                 .send_spontaneous_payment = send_spontaneous_payment_LDKPayer_jcall,
9775                 .retry_payment = retry_payment_LDKPayer_jcall,
9776                 .abandon_payment = abandon_payment_LDKPayer_jcall,
9777                 .free = LDKPayer_JCalls_free,
9778         };
9779         return ret;
9780 }
9781 uint64_t  __attribute__((export_name("TS_LDKPayer_new"))) TS_LDKPayer_new(JSValue o) {
9782         LDKPayer *res_ptr = MALLOC(sizeof(LDKPayer), "LDKPayer");
9783         *res_ptr = LDKPayer_init(o);
9784         return tag_ptr(res_ptr, true);
9785 }
9786 int8_tArray  __attribute__((export_name("TS_Payer_node_id"))) TS_Payer_node_id(uint64_t this_arg) {
9787         void* this_arg_ptr = untag_ptr(this_arg);
9788         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9789         LDKPayer* this_arg_conv = (LDKPayer*)this_arg_ptr;
9790         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
9791         memcpy(ret_arr->elems, (this_arg_conv->node_id)(this_arg_conv->this_arg).compressed_form, 33);
9792         return ret_arr;
9793 }
9794
9795 uint64_tArray  __attribute__((export_name("TS_Payer_first_hops"))) TS_Payer_first_hops(uint64_t this_arg) {
9796         void* this_arg_ptr = untag_ptr(this_arg);
9797         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9798         LDKPayer* this_arg_conv = (LDKPayer*)this_arg_ptr;
9799         LDKCVec_ChannelDetailsZ ret_var = (this_arg_conv->first_hops)(this_arg_conv->this_arg);
9800         uint64_tArray ret_arr = NULL;
9801         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
9802         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
9803         for (size_t q = 0; q < ret_var.datalen; q++) {
9804                 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
9805                 uint64_t ret_conv_16_ref = 0;
9806                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
9807                 ret_conv_16_ref = tag_ptr(ret_conv_16_var.inner, ret_conv_16_var.is_owned);
9808                 ret_arr_ptr[q] = ret_conv_16_ref;
9809         }
9810         
9811         FREE(ret_var.data);
9812         return ret_arr;
9813 }
9814
9815 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) {
9816         void* this_arg_ptr = untag_ptr(this_arg);
9817         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9818         LDKPayer* this_arg_conv = (LDKPayer*)this_arg_ptr;
9819         LDKRoute route_conv;
9820         route_conv.inner = untag_ptr(route);
9821         route_conv.is_owned = ptr_is_owned(route);
9822         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
9823         route_conv.is_owned = false;
9824         LDKThirtyTwoBytes payment_hash_ref;
9825         CHECK(payment_hash->arr_len == 32);
9826         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
9827         LDKThirtyTwoBytes payment_secret_ref;
9828         CHECK(payment_secret->arr_len == 32);
9829         memcpy(payment_secret_ref.data, payment_secret->elems, 32); FREE(payment_secret);
9830         LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
9831         *ret_conv = (this_arg_conv->send_payment)(this_arg_conv->this_arg, &route_conv, payment_hash_ref, payment_secret_ref);
9832         return tag_ptr(ret_conv, true);
9833 }
9834
9835 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) {
9836         void* this_arg_ptr = untag_ptr(this_arg);
9837         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9838         LDKPayer* this_arg_conv = (LDKPayer*)this_arg_ptr;
9839         LDKRoute route_conv;
9840         route_conv.inner = untag_ptr(route);
9841         route_conv.is_owned = ptr_is_owned(route);
9842         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
9843         route_conv.is_owned = false;
9844         LDKThirtyTwoBytes payment_preimage_ref;
9845         CHECK(payment_preimage->arr_len == 32);
9846         memcpy(payment_preimage_ref.data, payment_preimage->elems, 32); FREE(payment_preimage);
9847         LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
9848         *ret_conv = (this_arg_conv->send_spontaneous_payment)(this_arg_conv->this_arg, &route_conv, payment_preimage_ref);
9849         return tag_ptr(ret_conv, true);
9850 }
9851
9852 uint64_t  __attribute__((export_name("TS_Payer_retry_payment"))) TS_Payer_retry_payment(uint64_t this_arg, uint64_t route, int8_tArray payment_id) {
9853         void* this_arg_ptr = untag_ptr(this_arg);
9854         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9855         LDKPayer* this_arg_conv = (LDKPayer*)this_arg_ptr;
9856         LDKRoute route_conv;
9857         route_conv.inner = untag_ptr(route);
9858         route_conv.is_owned = ptr_is_owned(route);
9859         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
9860         route_conv.is_owned = false;
9861         LDKThirtyTwoBytes payment_id_ref;
9862         CHECK(payment_id->arr_len == 32);
9863         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
9864         LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
9865         *ret_conv = (this_arg_conv->retry_payment)(this_arg_conv->this_arg, &route_conv, payment_id_ref);
9866         return tag_ptr(ret_conv, true);
9867 }
9868
9869 void  __attribute__((export_name("TS_Payer_abandon_payment"))) TS_Payer_abandon_payment(uint64_t this_arg, int8_tArray payment_id) {
9870         void* this_arg_ptr = untag_ptr(this_arg);
9871         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9872         LDKPayer* this_arg_conv = (LDKPayer*)this_arg_ptr;
9873         LDKThirtyTwoBytes payment_id_ref;
9874         CHECK(payment_id->arr_len == 32);
9875         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
9876         (this_arg_conv->abandon_payment)(this_arg_conv->this_arg, payment_id_ref);
9877 }
9878
9879 typedef struct LDKRouter_JCalls {
9880         atomic_size_t refcnt;
9881         uint32_t instance_ptr;
9882 } LDKRouter_JCalls;
9883 static void LDKRouter_JCalls_free(void* this_arg) {
9884         LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) this_arg;
9885         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
9886                 FREE(j_calls);
9887         }
9888 }
9889 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) {
9890         LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) this_arg;
9891         int8_tArray payer_arr = init_int8_tArray(33, __LINE__);
9892         memcpy(payer_arr->elems, payer.compressed_form, 33);
9893         LDKRouteParameters route_params_var = *route_params;
9894         uint64_t route_params_ref = 0;
9895         route_params_var = RouteParameters_clone(&route_params_var);
9896         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_var);
9897         route_params_ref = tag_ptr(route_params_var.inner, route_params_var.is_owned);
9898         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
9899         memcpy(payment_hash_arr->elems, *payment_hash, 32);
9900         LDKCVec_ChannelDetailsZ *first_hops_var_ptr = first_hops;
9901         uint64_tArray first_hops_arr = NULL;
9902         if (first_hops != NULL) {
9903                 LDKCVec_ChannelDetailsZ first_hops_var = *first_hops_var_ptr;
9904                 first_hops_arr = init_uint64_tArray(first_hops_var.datalen, __LINE__);
9905                 uint64_t *first_hops_arr_ptr = (uint64_t*)(((uint8_t*)first_hops_arr) + 8);
9906                 for (size_t q = 0; q < first_hops_var.datalen; q++) {
9907                         LDKChannelDetails first_hops_conv_16_var =      first_hops_var.data[q];
9908                         uint64_t first_hops_conv_16_ref = 0;
9909                         CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_var);
9910                         first_hops_conv_16_ref = tag_ptr(first_hops_conv_16_var.inner, first_hops_conv_16_var.is_owned);
9911                         first_hops_arr_ptr[q] = first_hops_conv_16_ref;
9912                 }
9913         
9914         }
9915         // WARNING: This object doesn't live past this scope, needs clone!
9916         uint64_t ret_scorer = tag_ptr(scorer, false);
9917         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);
9918         void* ret_ptr = untag_ptr(ret);
9919         CHECK_ACCESS(ret_ptr);
9920         LDKCResult_RouteLightningErrorZ ret_conv = *(LDKCResult_RouteLightningErrorZ*)(ret_ptr);
9921         FREE(untag_ptr(ret));
9922         return ret_conv;
9923 }
9924 static void LDKRouter_JCalls_cloned(LDKRouter* new_obj) {
9925         LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) new_obj->this_arg;
9926         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
9927 }
9928 static inline LDKRouter LDKRouter_init (JSValue o) {
9929         LDKRouter_JCalls *calls = MALLOC(sizeof(LDKRouter_JCalls), "LDKRouter_JCalls");
9930         atomic_init(&calls->refcnt, 1);
9931         calls->instance_ptr = o;
9932
9933         LDKRouter ret = {
9934                 .this_arg = (void*) calls,
9935                 .find_route = find_route_LDKRouter_jcall,
9936                 .free = LDKRouter_JCalls_free,
9937         };
9938         return ret;
9939 }
9940 uint64_t  __attribute__((export_name("TS_LDKRouter_new"))) TS_LDKRouter_new(JSValue o) {
9941         LDKRouter *res_ptr = MALLOC(sizeof(LDKRouter), "LDKRouter");
9942         *res_ptr = LDKRouter_init(o);
9943         return tag_ptr(res_ptr, true);
9944 }
9945 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) {
9946         void* this_arg_ptr = untag_ptr(this_arg);
9947         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9948         LDKRouter* this_arg_conv = (LDKRouter*)this_arg_ptr;
9949         LDKPublicKey payer_ref;
9950         CHECK(payer->arr_len == 33);
9951         memcpy(payer_ref.compressed_form, payer->elems, 33); FREE(payer);
9952         LDKRouteParameters route_params_conv;
9953         route_params_conv.inner = untag_ptr(route_params);
9954         route_params_conv.is_owned = ptr_is_owned(route_params);
9955         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
9956         route_params_conv.is_owned = false;
9957         unsigned char payment_hash_arr[32];
9958         CHECK(payment_hash->arr_len == 32);
9959         memcpy(payment_hash_arr, payment_hash->elems, 32); FREE(payment_hash);
9960         unsigned char (*payment_hash_ref)[32] = &payment_hash_arr;
9961         LDKCVec_ChannelDetailsZ first_hops_constr;
9962         LDKCVec_ChannelDetailsZ *first_hops_ptr = NULL;
9963         if (first_hops != 0) {
9964                 first_hops_constr.datalen = first_hops->arr_len;
9965                 if (first_hops_constr.datalen > 0)
9966                         first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
9967                 else
9968                         first_hops_constr.data = NULL;
9969                 uint64_t* first_hops_vals = first_hops->elems;
9970                 for (size_t q = 0; q < first_hops_constr.datalen; q++) {
9971                         uint64_t first_hops_conv_16 = first_hops_vals[q];
9972                         LDKChannelDetails first_hops_conv_16_conv;
9973                         first_hops_conv_16_conv.inner = untag_ptr(first_hops_conv_16);
9974                         first_hops_conv_16_conv.is_owned = ptr_is_owned(first_hops_conv_16);
9975                         CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_conv);
9976                         first_hops_conv_16_conv.is_owned = false;
9977                         first_hops_constr.data[q] = first_hops_conv_16_conv;
9978                 }
9979                 FREE(first_hops);
9980                 first_hops_ptr = &first_hops_constr;
9981         }
9982         void* scorer_ptr = untag_ptr(scorer);
9983         if (ptr_is_owned(scorer)) { CHECK_ACCESS(scorer_ptr); }
9984         LDKScore* scorer_conv = (LDKScore*)scorer_ptr;
9985         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
9986         *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);
9987         if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); }
9988         return tag_ptr(ret_conv, true);
9989 }
9990
9991 uint32_t __attribute__((export_name("TS_LDKRetry_ty_from_ptr"))) TS_LDKRetry_ty_from_ptr(uint64_t ptr) {
9992         LDKRetry *obj = (LDKRetry*)untag_ptr(ptr);
9993         switch(obj->tag) {
9994                 case LDKRetry_Attempts: return 0;
9995                 default: abort();
9996         }
9997 }
9998 uint32_t __attribute__((export_name("TS_LDKRetry_Attempts_get_attempts"))) TS_LDKRetry_Attempts_get_attempts(uint64_t ptr) {
9999         LDKRetry *obj = (LDKRetry*)untag_ptr(ptr);
10000         assert(obj->tag == LDKRetry_Attempts);
10001                         uint32_t attempts_conv = obj->attempts;
10002         return attempts_conv;
10003 }
10004 jstring  __attribute__((export_name("TS__ldk_get_compiled_version"))) TS__ldk_get_compiled_version() {
10005         LDKStr ret_str = _ldk_get_compiled_version();
10006         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
10007         Str_free(ret_str);
10008         return ret_conv;
10009 }
10010
10011 jstring  __attribute__((export_name("TS__ldk_c_bindings_get_compiled_version"))) TS__ldk_c_bindings_get_compiled_version() {
10012         LDKStr ret_str = _ldk_c_bindings_get_compiled_version();
10013         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
10014         Str_free(ret_str);
10015         return ret_conv;
10016 }
10017
10018 static inline uint64_t Bech32Error_clone_ptr(LDKBech32Error *NONNULL_PTR arg) {
10019         LDKBech32Error *ret_copy = MALLOC(sizeof(LDKBech32Error), "LDKBech32Error");
10020         *ret_copy = Bech32Error_clone(arg);
10021         uint64_t ret_ref = tag_ptr(ret_copy, true);
10022         return ret_ref;
10023 }
10024 int64_t  __attribute__((export_name("TS_Bech32Error_clone_ptr"))) TS_Bech32Error_clone_ptr(uint64_t arg) {
10025         LDKBech32Error* arg_conv = (LDKBech32Error*)untag_ptr(arg);
10026         int64_t ret_conv = Bech32Error_clone_ptr(arg_conv);
10027         return ret_conv;
10028 }
10029
10030 uint64_t  __attribute__((export_name("TS_Bech32Error_clone"))) TS_Bech32Error_clone(uint64_t orig) {
10031         LDKBech32Error* orig_conv = (LDKBech32Error*)untag_ptr(orig);
10032         LDKBech32Error *ret_copy = MALLOC(sizeof(LDKBech32Error), "LDKBech32Error");
10033         *ret_copy = Bech32Error_clone(orig_conv);
10034         uint64_t ret_ref = tag_ptr(ret_copy, true);
10035         return ret_ref;
10036 }
10037
10038 void  __attribute__((export_name("TS_Bech32Error_free"))) TS_Bech32Error_free(uint64_t o) {
10039         if (!ptr_is_owned(o)) return;
10040         void* o_ptr = untag_ptr(o);
10041         CHECK_ACCESS(o_ptr);
10042         LDKBech32Error o_conv = *(LDKBech32Error*)(o_ptr);
10043         FREE(untag_ptr(o));
10044         Bech32Error_free(o_conv);
10045 }
10046
10047 void  __attribute__((export_name("TS_Transaction_free"))) TS_Transaction_free(int8_tArray _res) {
10048         LDKTransaction _res_ref;
10049         _res_ref.datalen = _res->arr_len;
10050         _res_ref.data = MALLOC(_res_ref.datalen, "LDKTransaction Bytes");
10051         memcpy(_res_ref.data, _res->elems, _res_ref.datalen); FREE(_res);
10052         _res_ref.data_is_owned = true;
10053         Transaction_free(_res_ref);
10054 }
10055
10056 uint64_t  __attribute__((export_name("TS_TxOut_new"))) TS_TxOut_new(int8_tArray script_pubkey, int64_t value) {
10057         LDKCVec_u8Z script_pubkey_ref;
10058         script_pubkey_ref.datalen = script_pubkey->arr_len;
10059         script_pubkey_ref.data = MALLOC(script_pubkey_ref.datalen, "LDKCVec_u8Z Bytes");
10060         memcpy(script_pubkey_ref.data, script_pubkey->elems, script_pubkey_ref.datalen); FREE(script_pubkey);
10061         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
10062         *ret_ref = TxOut_new(script_pubkey_ref, value);
10063         return tag_ptr(ret_ref, true);
10064 }
10065
10066 void  __attribute__((export_name("TS_TxOut_free"))) TS_TxOut_free(uint64_t _res) {
10067         if (!ptr_is_owned(_res)) return;
10068         void* _res_ptr = untag_ptr(_res);
10069         CHECK_ACCESS(_res_ptr);
10070         LDKTxOut _res_conv = *(LDKTxOut*)(_res_ptr);
10071         FREE(untag_ptr(_res));
10072         TxOut_free(_res_conv);
10073 }
10074
10075 static inline uint64_t TxOut_clone_ptr(LDKTxOut *NONNULL_PTR arg) {
10076         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
10077         *ret_ref = TxOut_clone(arg);
10078         return tag_ptr(ret_ref, true);
10079 }
10080 int64_t  __attribute__((export_name("TS_TxOut_clone_ptr"))) TS_TxOut_clone_ptr(uint64_t arg) {
10081         LDKTxOut* arg_conv = (LDKTxOut*)untag_ptr(arg);
10082         int64_t ret_conv = TxOut_clone_ptr(arg_conv);
10083         return ret_conv;
10084 }
10085
10086 uint64_t  __attribute__((export_name("TS_TxOut_clone"))) TS_TxOut_clone(uint64_t orig) {
10087         LDKTxOut* orig_conv = (LDKTxOut*)untag_ptr(orig);
10088         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
10089         *ret_ref = TxOut_clone(orig_conv);
10090         return tag_ptr(ret_ref, true);
10091 }
10092
10093 void  __attribute__((export_name("TS_Str_free"))) TS_Str_free(jstring _res) {
10094         LDKStr dummy = { .chars = NULL, .len = 0, .chars_is_owned = false };
10095         Str_free(dummy);
10096 }
10097
10098 uint64_t  __attribute__((export_name("TS_CResult_NoneNoneZ_ok"))) TS_CResult_NoneNoneZ_ok() {
10099         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
10100         *ret_conv = CResult_NoneNoneZ_ok();
10101         return tag_ptr(ret_conv, true);
10102 }
10103
10104 uint64_t  __attribute__((export_name("TS_CResult_NoneNoneZ_err"))) TS_CResult_NoneNoneZ_err() {
10105         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
10106         *ret_conv = CResult_NoneNoneZ_err();
10107         return tag_ptr(ret_conv, true);
10108 }
10109
10110 jboolean  __attribute__((export_name("TS_CResult_NoneNoneZ_is_ok"))) TS_CResult_NoneNoneZ_is_ok(uint64_t o) {
10111         LDKCResult_NoneNoneZ* o_conv = (LDKCResult_NoneNoneZ*)untag_ptr(o);
10112         jboolean ret_conv = CResult_NoneNoneZ_is_ok(o_conv);
10113         return ret_conv;
10114 }
10115
10116 void  __attribute__((export_name("TS_CResult_NoneNoneZ_free"))) TS_CResult_NoneNoneZ_free(uint64_t _res) {
10117         if (!ptr_is_owned(_res)) return;
10118         void* _res_ptr = untag_ptr(_res);
10119         CHECK_ACCESS(_res_ptr);
10120         LDKCResult_NoneNoneZ _res_conv = *(LDKCResult_NoneNoneZ*)(_res_ptr);
10121         FREE(untag_ptr(_res));
10122         CResult_NoneNoneZ_free(_res_conv);
10123 }
10124
10125 static inline uint64_t CResult_NoneNoneZ_clone_ptr(LDKCResult_NoneNoneZ *NONNULL_PTR arg) {
10126         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
10127         *ret_conv = CResult_NoneNoneZ_clone(arg);
10128         return tag_ptr(ret_conv, true);
10129 }
10130 int64_t  __attribute__((export_name("TS_CResult_NoneNoneZ_clone_ptr"))) TS_CResult_NoneNoneZ_clone_ptr(uint64_t arg) {
10131         LDKCResult_NoneNoneZ* arg_conv = (LDKCResult_NoneNoneZ*)untag_ptr(arg);
10132         int64_t ret_conv = CResult_NoneNoneZ_clone_ptr(arg_conv);
10133         return ret_conv;
10134 }
10135
10136 uint64_t  __attribute__((export_name("TS_CResult_NoneNoneZ_clone"))) TS_CResult_NoneNoneZ_clone(uint64_t orig) {
10137         LDKCResult_NoneNoneZ* orig_conv = (LDKCResult_NoneNoneZ*)untag_ptr(orig);
10138         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
10139         *ret_conv = CResult_NoneNoneZ_clone(orig_conv);
10140         return tag_ptr(ret_conv, true);
10141 }
10142
10143 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_ok"))) TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_ok(uint64_t o) {
10144         LDKCounterpartyCommitmentSecrets o_conv;
10145         o_conv.inner = untag_ptr(o);
10146         o_conv.is_owned = ptr_is_owned(o);
10147         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
10148         o_conv = CounterpartyCommitmentSecrets_clone(&o_conv);
10149         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
10150         *ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_ok(o_conv);
10151         return tag_ptr(ret_conv, true);
10152 }
10153
10154 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_err"))) TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_err(uint64_t e) {
10155         LDKDecodeError e_conv;
10156         e_conv.inner = untag_ptr(e);
10157         e_conv.is_owned = ptr_is_owned(e);
10158         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
10159         e_conv = DecodeError_clone(&e_conv);
10160         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
10161         *ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_err(e_conv);
10162         return tag_ptr(ret_conv, true);
10163 }
10164
10165 jboolean  __attribute__((export_name("TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_is_ok"))) TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_is_ok(uint64_t o) {
10166         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* o_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)untag_ptr(o);
10167         jboolean ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_is_ok(o_conv);
10168         return ret_conv;
10169 }
10170
10171 void  __attribute__((export_name("TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_free"))) TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_free(uint64_t _res) {
10172         if (!ptr_is_owned(_res)) return;
10173         void* _res_ptr = untag_ptr(_res);
10174         CHECK_ACCESS(_res_ptr);
10175         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ _res_conv = *(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)(_res_ptr);
10176         FREE(untag_ptr(_res));
10177         CResult_CounterpartyCommitmentSecretsDecodeErrorZ_free(_res_conv);
10178 }
10179
10180 static inline uint64_t CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone_ptr(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ *NONNULL_PTR arg) {
10181         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
10182         *ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone(arg);
10183         return tag_ptr(ret_conv, true);
10184 }
10185 int64_t  __attribute__((export_name("TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone_ptr"))) TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone_ptr(uint64_t arg) {
10186         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* arg_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)untag_ptr(arg);
10187         int64_t ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone_ptr(arg_conv);
10188         return ret_conv;
10189 }
10190
10191 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone"))) TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone(uint64_t orig) {
10192         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* orig_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)untag_ptr(orig);
10193         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
10194         *ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone(orig_conv);
10195         return tag_ptr(ret_conv, true);
10196 }
10197
10198 uint64_t  __attribute__((export_name("TS_CResult_SecretKeyErrorZ_ok"))) TS_CResult_SecretKeyErrorZ_ok(int8_tArray o) {
10199         LDKSecretKey o_ref;
10200         CHECK(o->arr_len == 32);
10201         memcpy(o_ref.bytes, o->elems, 32); FREE(o);
10202         LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
10203         *ret_conv = CResult_SecretKeyErrorZ_ok(o_ref);
10204         return tag_ptr(ret_conv, true);
10205 }
10206
10207 uint64_t  __attribute__((export_name("TS_CResult_SecretKeyErrorZ_err"))) TS_CResult_SecretKeyErrorZ_err(uint32_t e) {
10208         LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_js(e);
10209         LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
10210         *ret_conv = CResult_SecretKeyErrorZ_err(e_conv);
10211         return tag_ptr(ret_conv, true);
10212 }
10213
10214 jboolean  __attribute__((export_name("TS_CResult_SecretKeyErrorZ_is_ok"))) TS_CResult_SecretKeyErrorZ_is_ok(uint64_t o) {
10215         LDKCResult_SecretKeyErrorZ* o_conv = (LDKCResult_SecretKeyErrorZ*)untag_ptr(o);
10216         jboolean ret_conv = CResult_SecretKeyErrorZ_is_ok(o_conv);
10217         return ret_conv;
10218 }
10219
10220 void  __attribute__((export_name("TS_CResult_SecretKeyErrorZ_free"))) TS_CResult_SecretKeyErrorZ_free(uint64_t _res) {
10221         if (!ptr_is_owned(_res)) return;
10222         void* _res_ptr = untag_ptr(_res);
10223         CHECK_ACCESS(_res_ptr);
10224         LDKCResult_SecretKeyErrorZ _res_conv = *(LDKCResult_SecretKeyErrorZ*)(_res_ptr);
10225         FREE(untag_ptr(_res));
10226         CResult_SecretKeyErrorZ_free(_res_conv);
10227 }
10228
10229 static inline uint64_t CResult_SecretKeyErrorZ_clone_ptr(LDKCResult_SecretKeyErrorZ *NONNULL_PTR arg) {
10230         LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
10231         *ret_conv = CResult_SecretKeyErrorZ_clone(arg);
10232         return tag_ptr(ret_conv, true);
10233 }
10234 int64_t  __attribute__((export_name("TS_CResult_SecretKeyErrorZ_clone_ptr"))) TS_CResult_SecretKeyErrorZ_clone_ptr(uint64_t arg) {
10235         LDKCResult_SecretKeyErrorZ* arg_conv = (LDKCResult_SecretKeyErrorZ*)untag_ptr(arg);
10236         int64_t ret_conv = CResult_SecretKeyErrorZ_clone_ptr(arg_conv);
10237         return ret_conv;
10238 }
10239
10240 uint64_t  __attribute__((export_name("TS_CResult_SecretKeyErrorZ_clone"))) TS_CResult_SecretKeyErrorZ_clone(uint64_t orig) {
10241         LDKCResult_SecretKeyErrorZ* orig_conv = (LDKCResult_SecretKeyErrorZ*)untag_ptr(orig);
10242         LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
10243         *ret_conv = CResult_SecretKeyErrorZ_clone(orig_conv);
10244         return tag_ptr(ret_conv, true);
10245 }
10246
10247 uint64_t  __attribute__((export_name("TS_CResult_PublicKeyErrorZ_ok"))) TS_CResult_PublicKeyErrorZ_ok(int8_tArray o) {
10248         LDKPublicKey o_ref;
10249         CHECK(o->arr_len == 33);
10250         memcpy(o_ref.compressed_form, o->elems, 33); FREE(o);
10251         LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
10252         *ret_conv = CResult_PublicKeyErrorZ_ok(o_ref);
10253         return tag_ptr(ret_conv, true);
10254 }
10255
10256 uint64_t  __attribute__((export_name("TS_CResult_PublicKeyErrorZ_err"))) TS_CResult_PublicKeyErrorZ_err(uint32_t e) {
10257         LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_js(e);
10258         LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
10259         *ret_conv = CResult_PublicKeyErrorZ_err(e_conv);
10260         return tag_ptr(ret_conv, true);
10261 }
10262
10263 jboolean  __attribute__((export_name("TS_CResult_PublicKeyErrorZ_is_ok"))) TS_CResult_PublicKeyErrorZ_is_ok(uint64_t o) {
10264         LDKCResult_PublicKeyErrorZ* o_conv = (LDKCResult_PublicKeyErrorZ*)untag_ptr(o);
10265         jboolean ret_conv = CResult_PublicKeyErrorZ_is_ok(o_conv);
10266         return ret_conv;
10267 }
10268
10269 void  __attribute__((export_name("TS_CResult_PublicKeyErrorZ_free"))) TS_CResult_PublicKeyErrorZ_free(uint64_t _res) {
10270         if (!ptr_is_owned(_res)) return;
10271         void* _res_ptr = untag_ptr(_res);
10272         CHECK_ACCESS(_res_ptr);
10273         LDKCResult_PublicKeyErrorZ _res_conv = *(LDKCResult_PublicKeyErrorZ*)(_res_ptr);
10274         FREE(untag_ptr(_res));
10275         CResult_PublicKeyErrorZ_free(_res_conv);
10276 }
10277
10278 static inline uint64_t CResult_PublicKeyErrorZ_clone_ptr(LDKCResult_PublicKeyErrorZ *NONNULL_PTR arg) {
10279         LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
10280         *ret_conv = CResult_PublicKeyErrorZ_clone(arg);
10281         return tag_ptr(ret_conv, true);
10282 }
10283 int64_t  __attribute__((export_name("TS_CResult_PublicKeyErrorZ_clone_ptr"))) TS_CResult_PublicKeyErrorZ_clone_ptr(uint64_t arg) {
10284         LDKCResult_PublicKeyErrorZ* arg_conv = (LDKCResult_PublicKeyErrorZ*)untag_ptr(arg);
10285         int64_t ret_conv = CResult_PublicKeyErrorZ_clone_ptr(arg_conv);
10286         return ret_conv;
10287 }
10288
10289 uint64_t  __attribute__((export_name("TS_CResult_PublicKeyErrorZ_clone"))) TS_CResult_PublicKeyErrorZ_clone(uint64_t orig) {
10290         LDKCResult_PublicKeyErrorZ* orig_conv = (LDKCResult_PublicKeyErrorZ*)untag_ptr(orig);
10291         LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
10292         *ret_conv = CResult_PublicKeyErrorZ_clone(orig_conv);
10293         return tag_ptr(ret_conv, true);
10294 }
10295
10296 uint64_t  __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_ok"))) TS_CResult_TxCreationKeysDecodeErrorZ_ok(uint64_t o) {
10297         LDKTxCreationKeys o_conv;
10298         o_conv.inner = untag_ptr(o);
10299         o_conv.is_owned = ptr_is_owned(o);
10300         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
10301         o_conv = TxCreationKeys_clone(&o_conv);
10302         LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
10303         *ret_conv = CResult_TxCreationKeysDecodeErrorZ_ok(o_conv);
10304         return tag_ptr(ret_conv, true);
10305 }
10306
10307 uint64_t  __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_err"))) TS_CResult_TxCreationKeysDecodeErrorZ_err(uint64_t e) {
10308         LDKDecodeError e_conv;
10309         e_conv.inner = untag_ptr(e);
10310         e_conv.is_owned = ptr_is_owned(e);
10311         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
10312         e_conv = DecodeError_clone(&e_conv);
10313         LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
10314         *ret_conv = CResult_TxCreationKeysDecodeErrorZ_err(e_conv);
10315         return tag_ptr(ret_conv, true);
10316 }
10317
10318 jboolean  __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_is_ok"))) TS_CResult_TxCreationKeysDecodeErrorZ_is_ok(uint64_t o) {
10319         LDKCResult_TxCreationKeysDecodeErrorZ* o_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)untag_ptr(o);
10320         jboolean ret_conv = CResult_TxCreationKeysDecodeErrorZ_is_ok(o_conv);
10321         return ret_conv;
10322 }
10323
10324 void  __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_free"))) TS_CResult_TxCreationKeysDecodeErrorZ_free(uint64_t _res) {
10325         if (!ptr_is_owned(_res)) return;
10326         void* _res_ptr = untag_ptr(_res);
10327         CHECK_ACCESS(_res_ptr);
10328         LDKCResult_TxCreationKeysDecodeErrorZ _res_conv = *(LDKCResult_TxCreationKeysDecodeErrorZ*)(_res_ptr);
10329         FREE(untag_ptr(_res));
10330         CResult_TxCreationKeysDecodeErrorZ_free(_res_conv);
10331 }
10332
10333 static inline uint64_t CResult_TxCreationKeysDecodeErrorZ_clone_ptr(LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR arg) {
10334         LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
10335         *ret_conv = CResult_TxCreationKeysDecodeErrorZ_clone(arg);
10336         return tag_ptr(ret_conv, true);
10337 }
10338 int64_t  __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_clone_ptr"))) TS_CResult_TxCreationKeysDecodeErrorZ_clone_ptr(uint64_t arg) {
10339         LDKCResult_TxCreationKeysDecodeErrorZ* arg_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)untag_ptr(arg);
10340         int64_t ret_conv = CResult_TxCreationKeysDecodeErrorZ_clone_ptr(arg_conv);
10341         return ret_conv;
10342 }
10343
10344 uint64_t  __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_clone"))) TS_CResult_TxCreationKeysDecodeErrorZ_clone(uint64_t orig) {
10345         LDKCResult_TxCreationKeysDecodeErrorZ* orig_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)untag_ptr(orig);
10346         LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
10347         *ret_conv = CResult_TxCreationKeysDecodeErrorZ_clone(orig_conv);
10348         return tag_ptr(ret_conv, true);
10349 }
10350
10351 uint64_t  __attribute__((export_name("TS_CResult_ChannelPublicKeysDecodeErrorZ_ok"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_ok(uint64_t o) {
10352         LDKChannelPublicKeys o_conv;
10353         o_conv.inner = untag_ptr(o);
10354         o_conv.is_owned = ptr_is_owned(o);
10355         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
10356         o_conv = ChannelPublicKeys_clone(&o_conv);
10357         LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
10358         *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_ok(o_conv);
10359         return tag_ptr(ret_conv, true);
10360 }
10361
10362 uint64_t  __attribute__((export_name("TS_CResult_ChannelPublicKeysDecodeErrorZ_err"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_err(uint64_t e) {
10363         LDKDecodeError e_conv;
10364         e_conv.inner = untag_ptr(e);
10365         e_conv.is_owned = ptr_is_owned(e);
10366         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
10367         e_conv = DecodeError_clone(&e_conv);
10368         LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
10369         *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_err(e_conv);
10370         return tag_ptr(ret_conv, true);
10371 }
10372
10373 jboolean  __attribute__((export_name("TS_CResult_ChannelPublicKeysDecodeErrorZ_is_ok"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_is_ok(uint64_t o) {
10374         LDKCResult_ChannelPublicKeysDecodeErrorZ* o_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)untag_ptr(o);
10375         jboolean ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_is_ok(o_conv);
10376         return ret_conv;
10377 }
10378
10379 void  __attribute__((export_name("TS_CResult_ChannelPublicKeysDecodeErrorZ_free"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_free(uint64_t _res) {
10380         if (!ptr_is_owned(_res)) return;
10381         void* _res_ptr = untag_ptr(_res);
10382         CHECK_ACCESS(_res_ptr);
10383         LDKCResult_ChannelPublicKeysDecodeErrorZ _res_conv = *(LDKCResult_ChannelPublicKeysDecodeErrorZ*)(_res_ptr);
10384         FREE(untag_ptr(_res));
10385         CResult_ChannelPublicKeysDecodeErrorZ_free(_res_conv);
10386 }
10387
10388 static inline uint64_t CResult_ChannelPublicKeysDecodeErrorZ_clone_ptr(LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR arg) {
10389         LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
10390         *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_clone(arg);
10391         return tag_ptr(ret_conv, true);
10392 }
10393 int64_t  __attribute__((export_name("TS_CResult_ChannelPublicKeysDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_clone_ptr(uint64_t arg) {
10394         LDKCResult_ChannelPublicKeysDecodeErrorZ* arg_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)untag_ptr(arg);
10395         int64_t ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_clone_ptr(arg_conv);
10396         return ret_conv;
10397 }
10398
10399 uint64_t  __attribute__((export_name("TS_CResult_ChannelPublicKeysDecodeErrorZ_clone"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_clone(uint64_t orig) {
10400         LDKCResult_ChannelPublicKeysDecodeErrorZ* orig_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)untag_ptr(orig);
10401         LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
10402         *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_clone(orig_conv);
10403         return tag_ptr(ret_conv, true);
10404 }
10405
10406 uint64_t  __attribute__((export_name("TS_CResult_TxCreationKeysErrorZ_ok"))) TS_CResult_TxCreationKeysErrorZ_ok(uint64_t o) {
10407         LDKTxCreationKeys o_conv;
10408         o_conv.inner = untag_ptr(o);
10409         o_conv.is_owned = ptr_is_owned(o);
10410         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
10411         o_conv = TxCreationKeys_clone(&o_conv);
10412         LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
10413         *ret_conv = CResult_TxCreationKeysErrorZ_ok(o_conv);
10414         return tag_ptr(ret_conv, true);
10415 }
10416
10417 uint64_t  __attribute__((export_name("TS_CResult_TxCreationKeysErrorZ_err"))) TS_CResult_TxCreationKeysErrorZ_err(uint32_t e) {
10418         LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_js(e);
10419         LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
10420         *ret_conv = CResult_TxCreationKeysErrorZ_err(e_conv);
10421         return tag_ptr(ret_conv, true);
10422 }
10423
10424 jboolean  __attribute__((export_name("TS_CResult_TxCreationKeysErrorZ_is_ok"))) TS_CResult_TxCreationKeysErrorZ_is_ok(uint64_t o) {
10425         LDKCResult_TxCreationKeysErrorZ* o_conv = (LDKCResult_TxCreationKeysErrorZ*)untag_ptr(o);
10426         jboolean ret_conv = CResult_TxCreationKeysErrorZ_is_ok(o_conv);
10427         return ret_conv;
10428 }
10429
10430 void  __attribute__((export_name("TS_CResult_TxCreationKeysErrorZ_free"))) TS_CResult_TxCreationKeysErrorZ_free(uint64_t _res) {
10431         if (!ptr_is_owned(_res)) return;
10432         void* _res_ptr = untag_ptr(_res);
10433         CHECK_ACCESS(_res_ptr);
10434         LDKCResult_TxCreationKeysErrorZ _res_conv = *(LDKCResult_TxCreationKeysErrorZ*)(_res_ptr);
10435         FREE(untag_ptr(_res));
10436         CResult_TxCreationKeysErrorZ_free(_res_conv);
10437 }
10438
10439 static inline uint64_t CResult_TxCreationKeysErrorZ_clone_ptr(LDKCResult_TxCreationKeysErrorZ *NONNULL_PTR arg) {
10440         LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
10441         *ret_conv = CResult_TxCreationKeysErrorZ_clone(arg);
10442         return tag_ptr(ret_conv, true);
10443 }
10444 int64_t  __attribute__((export_name("TS_CResult_TxCreationKeysErrorZ_clone_ptr"))) TS_CResult_TxCreationKeysErrorZ_clone_ptr(uint64_t arg) {
10445         LDKCResult_TxCreationKeysErrorZ* arg_conv = (LDKCResult_TxCreationKeysErrorZ*)untag_ptr(arg);
10446         int64_t ret_conv = CResult_TxCreationKeysErrorZ_clone_ptr(arg_conv);
10447         return ret_conv;
10448 }
10449
10450 uint64_t  __attribute__((export_name("TS_CResult_TxCreationKeysErrorZ_clone"))) TS_CResult_TxCreationKeysErrorZ_clone(uint64_t orig) {
10451         LDKCResult_TxCreationKeysErrorZ* orig_conv = (LDKCResult_TxCreationKeysErrorZ*)untag_ptr(orig);
10452         LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
10453         *ret_conv = CResult_TxCreationKeysErrorZ_clone(orig_conv);
10454         return tag_ptr(ret_conv, true);
10455 }
10456
10457 uint64_t  __attribute__((export_name("TS_COption_u32Z_some"))) TS_COption_u32Z_some(int32_t o) {
10458         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
10459         *ret_copy = COption_u32Z_some(o);
10460         uint64_t ret_ref = tag_ptr(ret_copy, true);
10461         return ret_ref;
10462 }
10463
10464 uint64_t  __attribute__((export_name("TS_COption_u32Z_none"))) TS_COption_u32Z_none() {
10465         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
10466         *ret_copy = COption_u32Z_none();
10467         uint64_t ret_ref = tag_ptr(ret_copy, true);
10468         return ret_ref;
10469 }
10470
10471 void  __attribute__((export_name("TS_COption_u32Z_free"))) TS_COption_u32Z_free(uint64_t _res) {
10472         if (!ptr_is_owned(_res)) return;
10473         void* _res_ptr = untag_ptr(_res);
10474         CHECK_ACCESS(_res_ptr);
10475         LDKCOption_u32Z _res_conv = *(LDKCOption_u32Z*)(_res_ptr);
10476         FREE(untag_ptr(_res));
10477         COption_u32Z_free(_res_conv);
10478 }
10479
10480 static inline uint64_t COption_u32Z_clone_ptr(LDKCOption_u32Z *NONNULL_PTR arg) {
10481         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
10482         *ret_copy = COption_u32Z_clone(arg);
10483         uint64_t ret_ref = tag_ptr(ret_copy, true);
10484         return ret_ref;
10485 }
10486 int64_t  __attribute__((export_name("TS_COption_u32Z_clone_ptr"))) TS_COption_u32Z_clone_ptr(uint64_t arg) {
10487         LDKCOption_u32Z* arg_conv = (LDKCOption_u32Z*)untag_ptr(arg);
10488         int64_t ret_conv = COption_u32Z_clone_ptr(arg_conv);
10489         return ret_conv;
10490 }
10491
10492 uint64_t  __attribute__((export_name("TS_COption_u32Z_clone"))) TS_COption_u32Z_clone(uint64_t orig) {
10493         LDKCOption_u32Z* orig_conv = (LDKCOption_u32Z*)untag_ptr(orig);
10494         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
10495         *ret_copy = COption_u32Z_clone(orig_conv);
10496         uint64_t ret_ref = tag_ptr(ret_copy, true);
10497         return ret_ref;
10498 }
10499
10500 uint64_t  __attribute__((export_name("TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_ok"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(uint64_t o) {
10501         LDKHTLCOutputInCommitment o_conv;
10502         o_conv.inner = untag_ptr(o);
10503         o_conv.is_owned = ptr_is_owned(o);
10504         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
10505         o_conv = HTLCOutputInCommitment_clone(&o_conv);
10506         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
10507         *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(o_conv);
10508         return tag_ptr(ret_conv, true);
10509 }
10510
10511 uint64_t  __attribute__((export_name("TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_err"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_err(uint64_t e) {
10512         LDKDecodeError e_conv;
10513         e_conv.inner = untag_ptr(e);
10514         e_conv.is_owned = ptr_is_owned(e);
10515         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
10516         e_conv = DecodeError_clone(&e_conv);
10517         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
10518         *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_err(e_conv);
10519         return tag_ptr(ret_conv, true);
10520 }
10521
10522 jboolean  __attribute__((export_name("TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_is_ok"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_is_ok(uint64_t o) {
10523         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* o_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)untag_ptr(o);
10524         jboolean ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_is_ok(o_conv);
10525         return ret_conv;
10526 }
10527
10528 void  __attribute__((export_name("TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_free"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_free(uint64_t _res) {
10529         if (!ptr_is_owned(_res)) return;
10530         void* _res_ptr = untag_ptr(_res);
10531         CHECK_ACCESS(_res_ptr);
10532         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ _res_conv = *(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(_res_ptr);
10533         FREE(untag_ptr(_res));
10534         CResult_HTLCOutputInCommitmentDecodeErrorZ_free(_res_conv);
10535 }
10536
10537 static inline uint64_t CResult_HTLCOutputInCommitmentDecodeErrorZ_clone_ptr(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR arg) {
10538         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
10539         *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(arg);
10540         return tag_ptr(ret_conv, true);
10541 }
10542 int64_t  __attribute__((export_name("TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_clone_ptr"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_clone_ptr(uint64_t arg) {
10543         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* arg_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)untag_ptr(arg);
10544         int64_t ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_clone_ptr(arg_conv);
10545         return ret_conv;
10546 }
10547
10548 uint64_t  __attribute__((export_name("TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_clone"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(uint64_t orig) {
10549         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* orig_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)untag_ptr(orig);
10550         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
10551         *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(orig_conv);
10552         return tag_ptr(ret_conv, true);
10553 }
10554
10555 uint32_t  __attribute__((export_name("TS_COption_NoneZ_some"))) TS_COption_NoneZ_some() {
10556         uint32_t ret_conv = LDKCOption_NoneZ_to_js(COption_NoneZ_some());
10557         return ret_conv;
10558 }
10559
10560 uint32_t  __attribute__((export_name("TS_COption_NoneZ_none"))) TS_COption_NoneZ_none() {
10561         uint32_t ret_conv = LDKCOption_NoneZ_to_js(COption_NoneZ_none());
10562         return ret_conv;
10563 }
10564
10565 void  __attribute__((export_name("TS_COption_NoneZ_free"))) TS_COption_NoneZ_free(uint32_t _res) {
10566         LDKCOption_NoneZ _res_conv = LDKCOption_NoneZ_from_js(_res);
10567         COption_NoneZ_free(_res_conv);
10568 }
10569
10570 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(uint64_t o) {
10571         LDKCounterpartyChannelTransactionParameters o_conv;
10572         o_conv.inner = untag_ptr(o);
10573         o_conv.is_owned = ptr_is_owned(o);
10574         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
10575         o_conv = CounterpartyChannelTransactionParameters_clone(&o_conv);
10576         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
10577         *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(o_conv);
10578         return tag_ptr(ret_conv, true);
10579 }
10580
10581 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(uint64_t e) {
10582         LDKDecodeError e_conv;
10583         e_conv.inner = untag_ptr(e);
10584         e_conv.is_owned = ptr_is_owned(e);
10585         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
10586         e_conv = DecodeError_clone(&e_conv);
10587         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
10588         *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(e_conv);
10589         return tag_ptr(ret_conv, true);
10590 }
10591
10592 jboolean  __attribute__((export_name("TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_is_ok"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_is_ok(uint64_t o) {
10593         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* o_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)untag_ptr(o);
10594         jboolean ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_is_ok(o_conv);
10595         return ret_conv;
10596 }
10597
10598 void  __attribute__((export_name("TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(uint64_t _res) {
10599         if (!ptr_is_owned(_res)) return;
10600         void* _res_ptr = untag_ptr(_res);
10601         CHECK_ACCESS(_res_ptr);
10602         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ _res_conv = *(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(_res_ptr);
10603         FREE(untag_ptr(_res));
10604         CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(_res_conv);
10605 }
10606
10607 static inline uint64_t CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone_ptr(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR arg) {
10608         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
10609         *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(arg);
10610         return tag_ptr(ret_conv, true);
10611 }
10612 int64_t  __attribute__((export_name("TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone_ptr"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone_ptr(uint64_t arg) {
10613         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* arg_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)untag_ptr(arg);
10614         int64_t ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone_ptr(arg_conv);
10615         return ret_conv;
10616 }
10617
10618 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(uint64_t orig) {
10619         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* orig_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)untag_ptr(orig);
10620         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
10621         *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(orig_conv);
10622         return tag_ptr(ret_conv, true);
10623 }
10624
10625 uint64_t  __attribute__((export_name("TS_CResult_ChannelTransactionParametersDecodeErrorZ_ok"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_ok(uint64_t o) {
10626         LDKChannelTransactionParameters o_conv;
10627         o_conv.inner = untag_ptr(o);
10628         o_conv.is_owned = ptr_is_owned(o);
10629         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
10630         o_conv = ChannelTransactionParameters_clone(&o_conv);
10631         LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
10632         *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_ok(o_conv);
10633         return tag_ptr(ret_conv, true);
10634 }
10635
10636 uint64_t  __attribute__((export_name("TS_CResult_ChannelTransactionParametersDecodeErrorZ_err"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_err(uint64_t e) {
10637         LDKDecodeError e_conv;
10638         e_conv.inner = untag_ptr(e);
10639         e_conv.is_owned = ptr_is_owned(e);
10640         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
10641         e_conv = DecodeError_clone(&e_conv);
10642         LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
10643         *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_err(e_conv);
10644         return tag_ptr(ret_conv, true);
10645 }
10646
10647 jboolean  __attribute__((export_name("TS_CResult_ChannelTransactionParametersDecodeErrorZ_is_ok"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_is_ok(uint64_t o) {
10648         LDKCResult_ChannelTransactionParametersDecodeErrorZ* o_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)untag_ptr(o);
10649         jboolean ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_is_ok(o_conv);
10650         return ret_conv;
10651 }
10652
10653 void  __attribute__((export_name("TS_CResult_ChannelTransactionParametersDecodeErrorZ_free"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_free(uint64_t _res) {
10654         if (!ptr_is_owned(_res)) return;
10655         void* _res_ptr = untag_ptr(_res);
10656         CHECK_ACCESS(_res_ptr);
10657         LDKCResult_ChannelTransactionParametersDecodeErrorZ _res_conv = *(LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(_res_ptr);
10658         FREE(untag_ptr(_res));
10659         CResult_ChannelTransactionParametersDecodeErrorZ_free(_res_conv);
10660 }
10661
10662 static inline uint64_t CResult_ChannelTransactionParametersDecodeErrorZ_clone_ptr(LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR arg) {
10663         LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
10664         *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_clone(arg);
10665         return tag_ptr(ret_conv, true);
10666 }
10667 int64_t  __attribute__((export_name("TS_CResult_ChannelTransactionParametersDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_clone_ptr(uint64_t arg) {
10668         LDKCResult_ChannelTransactionParametersDecodeErrorZ* arg_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)untag_ptr(arg);
10669         int64_t ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_clone_ptr(arg_conv);
10670         return ret_conv;
10671 }
10672
10673 uint64_t  __attribute__((export_name("TS_CResult_ChannelTransactionParametersDecodeErrorZ_clone"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_clone(uint64_t orig) {
10674         LDKCResult_ChannelTransactionParametersDecodeErrorZ* orig_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)untag_ptr(orig);
10675         LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
10676         *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_clone(orig_conv);
10677         return tag_ptr(ret_conv, true);
10678 }
10679
10680 void  __attribute__((export_name("TS_CVec_SignatureZ_free"))) TS_CVec_SignatureZ_free(ptrArray _res) {
10681         LDKCVec_SignatureZ _res_constr;
10682         _res_constr.datalen = _res->arr_len;
10683         if (_res_constr.datalen > 0)
10684                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
10685         else
10686                 _res_constr.data = NULL;
10687         int8_tArray* _res_vals = (void*) _res->elems;
10688         for (size_t m = 0; m < _res_constr.datalen; m++) {
10689                 int8_tArray _res_conv_12 = _res_vals[m];
10690                 LDKSignature _res_conv_12_ref;
10691                 CHECK(_res_conv_12->arr_len == 64);
10692                 memcpy(_res_conv_12_ref.compact_form, _res_conv_12->elems, 64); FREE(_res_conv_12);
10693                 _res_constr.data[m] = _res_conv_12_ref;
10694         }
10695         FREE(_res);
10696         CVec_SignatureZ_free(_res_constr);
10697 }
10698
10699 uint64_t  __attribute__((export_name("TS_CResult_HolderCommitmentTransactionDecodeErrorZ_ok"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_ok(uint64_t o) {
10700         LDKHolderCommitmentTransaction o_conv;
10701         o_conv.inner = untag_ptr(o);
10702         o_conv.is_owned = ptr_is_owned(o);
10703         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
10704         o_conv = HolderCommitmentTransaction_clone(&o_conv);
10705         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
10706         *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_ok(o_conv);
10707         return tag_ptr(ret_conv, true);
10708 }
10709
10710 uint64_t  __attribute__((export_name("TS_CResult_HolderCommitmentTransactionDecodeErrorZ_err"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_err(uint64_t e) {
10711         LDKDecodeError e_conv;
10712         e_conv.inner = untag_ptr(e);
10713         e_conv.is_owned = ptr_is_owned(e);
10714         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
10715         e_conv = DecodeError_clone(&e_conv);
10716         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
10717         *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_err(e_conv);
10718         return tag_ptr(ret_conv, true);
10719 }
10720
10721 jboolean  __attribute__((export_name("TS_CResult_HolderCommitmentTransactionDecodeErrorZ_is_ok"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_is_ok(uint64_t o) {
10722         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* o_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)untag_ptr(o);
10723         jboolean ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_is_ok(o_conv);
10724         return ret_conv;
10725 }
10726
10727 void  __attribute__((export_name("TS_CResult_HolderCommitmentTransactionDecodeErrorZ_free"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_free(uint64_t _res) {
10728         if (!ptr_is_owned(_res)) return;
10729         void* _res_ptr = untag_ptr(_res);
10730         CHECK_ACCESS(_res_ptr);
10731         LDKCResult_HolderCommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(_res_ptr);
10732         FREE(untag_ptr(_res));
10733         CResult_HolderCommitmentTransactionDecodeErrorZ_free(_res_conv);
10734 }
10735
10736 static inline uint64_t CResult_HolderCommitmentTransactionDecodeErrorZ_clone_ptr(LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR arg) {
10737         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
10738         *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_clone(arg);
10739         return tag_ptr(ret_conv, true);
10740 }
10741 int64_t  __attribute__((export_name("TS_CResult_HolderCommitmentTransactionDecodeErrorZ_clone_ptr"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_clone_ptr(uint64_t arg) {
10742         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* arg_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)untag_ptr(arg);
10743         int64_t ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_clone_ptr(arg_conv);
10744         return ret_conv;
10745 }
10746
10747 uint64_t  __attribute__((export_name("TS_CResult_HolderCommitmentTransactionDecodeErrorZ_clone"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_clone(uint64_t orig) {
10748         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)untag_ptr(orig);
10749         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
10750         *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_clone(orig_conv);
10751         return tag_ptr(ret_conv, true);
10752 }
10753
10754 uint64_t  __attribute__((export_name("TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_ok"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(uint64_t o) {
10755         LDKBuiltCommitmentTransaction o_conv;
10756         o_conv.inner = untag_ptr(o);
10757         o_conv.is_owned = ptr_is_owned(o);
10758         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
10759         o_conv = BuiltCommitmentTransaction_clone(&o_conv);
10760         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
10761         *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(o_conv);
10762         return tag_ptr(ret_conv, true);
10763 }
10764
10765 uint64_t  __attribute__((export_name("TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_err"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_err(uint64_t e) {
10766         LDKDecodeError e_conv;
10767         e_conv.inner = untag_ptr(e);
10768         e_conv.is_owned = ptr_is_owned(e);
10769         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
10770         e_conv = DecodeError_clone(&e_conv);
10771         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
10772         *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_err(e_conv);
10773         return tag_ptr(ret_conv, true);
10774 }
10775
10776 jboolean  __attribute__((export_name("TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_is_ok"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_is_ok(uint64_t o) {
10777         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* o_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)untag_ptr(o);
10778         jboolean ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_is_ok(o_conv);
10779         return ret_conv;
10780 }
10781
10782 void  __attribute__((export_name("TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_free"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_free(uint64_t _res) {
10783         if (!ptr_is_owned(_res)) return;
10784         void* _res_ptr = untag_ptr(_res);
10785         CHECK_ACCESS(_res_ptr);
10786         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(_res_ptr);
10787         FREE(untag_ptr(_res));
10788         CResult_BuiltCommitmentTransactionDecodeErrorZ_free(_res_conv);
10789 }
10790
10791 static inline uint64_t CResult_BuiltCommitmentTransactionDecodeErrorZ_clone_ptr(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR arg) {
10792         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
10793         *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(arg);
10794         return tag_ptr(ret_conv, true);
10795 }
10796 int64_t  __attribute__((export_name("TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_clone_ptr"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_clone_ptr(uint64_t arg) {
10797         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* arg_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)untag_ptr(arg);
10798         int64_t ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_clone_ptr(arg_conv);
10799         return ret_conv;
10800 }
10801
10802 uint64_t  __attribute__((export_name("TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_clone"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(uint64_t orig) {
10803         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)untag_ptr(orig);
10804         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
10805         *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(orig_conv);
10806         return tag_ptr(ret_conv, true);
10807 }
10808
10809 uint64_t  __attribute__((export_name("TS_CResult_TrustedClosingTransactionNoneZ_ok"))) TS_CResult_TrustedClosingTransactionNoneZ_ok(uint64_t o) {
10810         LDKTrustedClosingTransaction o_conv;
10811         o_conv.inner = untag_ptr(o);
10812         o_conv.is_owned = ptr_is_owned(o);
10813         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
10814         // WARNING: we need a move here but no clone is available for LDKTrustedClosingTransaction
10815         
10816         LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
10817         *ret_conv = CResult_TrustedClosingTransactionNoneZ_ok(o_conv);
10818         return tag_ptr(ret_conv, true);
10819 }
10820
10821 uint64_t  __attribute__((export_name("TS_CResult_TrustedClosingTransactionNoneZ_err"))) TS_CResult_TrustedClosingTransactionNoneZ_err() {
10822         LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
10823         *ret_conv = CResult_TrustedClosingTransactionNoneZ_err();
10824         return tag_ptr(ret_conv, true);
10825 }
10826
10827 jboolean  __attribute__((export_name("TS_CResult_TrustedClosingTransactionNoneZ_is_ok"))) TS_CResult_TrustedClosingTransactionNoneZ_is_ok(uint64_t o) {
10828         LDKCResult_TrustedClosingTransactionNoneZ* o_conv = (LDKCResult_TrustedClosingTransactionNoneZ*)untag_ptr(o);
10829         jboolean ret_conv = CResult_TrustedClosingTransactionNoneZ_is_ok(o_conv);
10830         return ret_conv;
10831 }
10832
10833 void  __attribute__((export_name("TS_CResult_TrustedClosingTransactionNoneZ_free"))) TS_CResult_TrustedClosingTransactionNoneZ_free(uint64_t _res) {
10834         if (!ptr_is_owned(_res)) return;
10835         void* _res_ptr = untag_ptr(_res);
10836         CHECK_ACCESS(_res_ptr);
10837         LDKCResult_TrustedClosingTransactionNoneZ _res_conv = *(LDKCResult_TrustedClosingTransactionNoneZ*)(_res_ptr);
10838         FREE(untag_ptr(_res));
10839         CResult_TrustedClosingTransactionNoneZ_free(_res_conv);
10840 }
10841
10842 uint64_t  __attribute__((export_name("TS_CResult_CommitmentTransactionDecodeErrorZ_ok"))) TS_CResult_CommitmentTransactionDecodeErrorZ_ok(uint64_t o) {
10843         LDKCommitmentTransaction o_conv;
10844         o_conv.inner = untag_ptr(o);
10845         o_conv.is_owned = ptr_is_owned(o);
10846         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
10847         o_conv = CommitmentTransaction_clone(&o_conv);
10848         LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
10849         *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_ok(o_conv);
10850         return tag_ptr(ret_conv, true);
10851 }
10852
10853 uint64_t  __attribute__((export_name("TS_CResult_CommitmentTransactionDecodeErrorZ_err"))) TS_CResult_CommitmentTransactionDecodeErrorZ_err(uint64_t e) {
10854         LDKDecodeError e_conv;
10855         e_conv.inner = untag_ptr(e);
10856         e_conv.is_owned = ptr_is_owned(e);
10857         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
10858         e_conv = DecodeError_clone(&e_conv);
10859         LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
10860         *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_err(e_conv);
10861         return tag_ptr(ret_conv, true);
10862 }
10863
10864 jboolean  __attribute__((export_name("TS_CResult_CommitmentTransactionDecodeErrorZ_is_ok"))) TS_CResult_CommitmentTransactionDecodeErrorZ_is_ok(uint64_t o) {
10865         LDKCResult_CommitmentTransactionDecodeErrorZ* o_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)untag_ptr(o);
10866         jboolean ret_conv = CResult_CommitmentTransactionDecodeErrorZ_is_ok(o_conv);
10867         return ret_conv;
10868 }
10869
10870 void  __attribute__((export_name("TS_CResult_CommitmentTransactionDecodeErrorZ_free"))) TS_CResult_CommitmentTransactionDecodeErrorZ_free(uint64_t _res) {
10871         if (!ptr_is_owned(_res)) return;
10872         void* _res_ptr = untag_ptr(_res);
10873         CHECK_ACCESS(_res_ptr);
10874         LDKCResult_CommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_CommitmentTransactionDecodeErrorZ*)(_res_ptr);
10875         FREE(untag_ptr(_res));
10876         CResult_CommitmentTransactionDecodeErrorZ_free(_res_conv);
10877 }
10878
10879 static inline uint64_t CResult_CommitmentTransactionDecodeErrorZ_clone_ptr(LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR arg) {
10880         LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
10881         *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_clone(arg);
10882         return tag_ptr(ret_conv, true);
10883 }
10884 int64_t  __attribute__((export_name("TS_CResult_CommitmentTransactionDecodeErrorZ_clone_ptr"))) TS_CResult_CommitmentTransactionDecodeErrorZ_clone_ptr(uint64_t arg) {
10885         LDKCResult_CommitmentTransactionDecodeErrorZ* arg_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)untag_ptr(arg);
10886         int64_t ret_conv = CResult_CommitmentTransactionDecodeErrorZ_clone_ptr(arg_conv);
10887         return ret_conv;
10888 }
10889
10890 uint64_t  __attribute__((export_name("TS_CResult_CommitmentTransactionDecodeErrorZ_clone"))) TS_CResult_CommitmentTransactionDecodeErrorZ_clone(uint64_t orig) {
10891         LDKCResult_CommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)untag_ptr(orig);
10892         LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
10893         *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_clone(orig_conv);
10894         return tag_ptr(ret_conv, true);
10895 }
10896
10897 uint64_t  __attribute__((export_name("TS_CResult_TrustedCommitmentTransactionNoneZ_ok"))) TS_CResult_TrustedCommitmentTransactionNoneZ_ok(uint64_t o) {
10898         LDKTrustedCommitmentTransaction o_conv;
10899         o_conv.inner = untag_ptr(o);
10900         o_conv.is_owned = ptr_is_owned(o);
10901         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
10902         // WARNING: we need a move here but no clone is available for LDKTrustedCommitmentTransaction
10903         
10904         LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
10905         *ret_conv = CResult_TrustedCommitmentTransactionNoneZ_ok(o_conv);
10906         return tag_ptr(ret_conv, true);
10907 }
10908
10909 uint64_t  __attribute__((export_name("TS_CResult_TrustedCommitmentTransactionNoneZ_err"))) TS_CResult_TrustedCommitmentTransactionNoneZ_err() {
10910         LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
10911         *ret_conv = CResult_TrustedCommitmentTransactionNoneZ_err();
10912         return tag_ptr(ret_conv, true);
10913 }
10914
10915 jboolean  __attribute__((export_name("TS_CResult_TrustedCommitmentTransactionNoneZ_is_ok"))) TS_CResult_TrustedCommitmentTransactionNoneZ_is_ok(uint64_t o) {
10916         LDKCResult_TrustedCommitmentTransactionNoneZ* o_conv = (LDKCResult_TrustedCommitmentTransactionNoneZ*)untag_ptr(o);
10917         jboolean ret_conv = CResult_TrustedCommitmentTransactionNoneZ_is_ok(o_conv);
10918         return ret_conv;
10919 }
10920
10921 void  __attribute__((export_name("TS_CResult_TrustedCommitmentTransactionNoneZ_free"))) TS_CResult_TrustedCommitmentTransactionNoneZ_free(uint64_t _res) {
10922         if (!ptr_is_owned(_res)) return;
10923         void* _res_ptr = untag_ptr(_res);
10924         CHECK_ACCESS(_res_ptr);
10925         LDKCResult_TrustedCommitmentTransactionNoneZ _res_conv = *(LDKCResult_TrustedCommitmentTransactionNoneZ*)(_res_ptr);
10926         FREE(untag_ptr(_res));
10927         CResult_TrustedCommitmentTransactionNoneZ_free(_res_conv);
10928 }
10929
10930 uint64_t  __attribute__((export_name("TS_CResult_CVec_SignatureZNoneZ_ok"))) TS_CResult_CVec_SignatureZNoneZ_ok(ptrArray o) {
10931         LDKCVec_SignatureZ o_constr;
10932         o_constr.datalen = o->arr_len;
10933         if (o_constr.datalen > 0)
10934                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
10935         else
10936                 o_constr.data = NULL;
10937         int8_tArray* o_vals = (void*) o->elems;
10938         for (size_t m = 0; m < o_constr.datalen; m++) {
10939                 int8_tArray o_conv_12 = o_vals[m];
10940                 LDKSignature o_conv_12_ref;
10941                 CHECK(o_conv_12->arr_len == 64);
10942                 memcpy(o_conv_12_ref.compact_form, o_conv_12->elems, 64); FREE(o_conv_12);
10943                 o_constr.data[m] = o_conv_12_ref;
10944         }
10945         FREE(o);
10946         LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
10947         *ret_conv = CResult_CVec_SignatureZNoneZ_ok(o_constr);
10948         return tag_ptr(ret_conv, true);
10949 }
10950
10951 uint64_t  __attribute__((export_name("TS_CResult_CVec_SignatureZNoneZ_err"))) TS_CResult_CVec_SignatureZNoneZ_err() {
10952         LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
10953         *ret_conv = CResult_CVec_SignatureZNoneZ_err();
10954         return tag_ptr(ret_conv, true);
10955 }
10956
10957 jboolean  __attribute__((export_name("TS_CResult_CVec_SignatureZNoneZ_is_ok"))) TS_CResult_CVec_SignatureZNoneZ_is_ok(uint64_t o) {
10958         LDKCResult_CVec_SignatureZNoneZ* o_conv = (LDKCResult_CVec_SignatureZNoneZ*)untag_ptr(o);
10959         jboolean ret_conv = CResult_CVec_SignatureZNoneZ_is_ok(o_conv);
10960         return ret_conv;
10961 }
10962
10963 void  __attribute__((export_name("TS_CResult_CVec_SignatureZNoneZ_free"))) TS_CResult_CVec_SignatureZNoneZ_free(uint64_t _res) {
10964         if (!ptr_is_owned(_res)) return;
10965         void* _res_ptr = untag_ptr(_res);
10966         CHECK_ACCESS(_res_ptr);
10967         LDKCResult_CVec_SignatureZNoneZ _res_conv = *(LDKCResult_CVec_SignatureZNoneZ*)(_res_ptr);
10968         FREE(untag_ptr(_res));
10969         CResult_CVec_SignatureZNoneZ_free(_res_conv);
10970 }
10971
10972 static inline uint64_t CResult_CVec_SignatureZNoneZ_clone_ptr(LDKCResult_CVec_SignatureZNoneZ *NONNULL_PTR arg) {
10973         LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
10974         *ret_conv = CResult_CVec_SignatureZNoneZ_clone(arg);
10975         return tag_ptr(ret_conv, true);
10976 }
10977 int64_t  __attribute__((export_name("TS_CResult_CVec_SignatureZNoneZ_clone_ptr"))) TS_CResult_CVec_SignatureZNoneZ_clone_ptr(uint64_t arg) {
10978         LDKCResult_CVec_SignatureZNoneZ* arg_conv = (LDKCResult_CVec_SignatureZNoneZ*)untag_ptr(arg);
10979         int64_t ret_conv = CResult_CVec_SignatureZNoneZ_clone_ptr(arg_conv);
10980         return ret_conv;
10981 }
10982
10983 uint64_t  __attribute__((export_name("TS_CResult_CVec_SignatureZNoneZ_clone"))) TS_CResult_CVec_SignatureZNoneZ_clone(uint64_t orig) {
10984         LDKCResult_CVec_SignatureZNoneZ* orig_conv = (LDKCResult_CVec_SignatureZNoneZ*)untag_ptr(orig);
10985         LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
10986         *ret_conv = CResult_CVec_SignatureZNoneZ_clone(orig_conv);
10987         return tag_ptr(ret_conv, true);
10988 }
10989
10990 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptDecodeErrorZ_ok"))) TS_CResult_ShutdownScriptDecodeErrorZ_ok(uint64_t o) {
10991         LDKShutdownScript o_conv;
10992         o_conv.inner = untag_ptr(o);
10993         o_conv.is_owned = ptr_is_owned(o);
10994         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
10995         o_conv = ShutdownScript_clone(&o_conv);
10996         LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
10997         *ret_conv = CResult_ShutdownScriptDecodeErrorZ_ok(o_conv);
10998         return tag_ptr(ret_conv, true);
10999 }
11000
11001 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptDecodeErrorZ_err"))) TS_CResult_ShutdownScriptDecodeErrorZ_err(uint64_t e) {
11002         LDKDecodeError e_conv;
11003         e_conv.inner = untag_ptr(e);
11004         e_conv.is_owned = ptr_is_owned(e);
11005         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
11006         e_conv = DecodeError_clone(&e_conv);
11007         LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
11008         *ret_conv = CResult_ShutdownScriptDecodeErrorZ_err(e_conv);
11009         return tag_ptr(ret_conv, true);
11010 }
11011
11012 jboolean  __attribute__((export_name("TS_CResult_ShutdownScriptDecodeErrorZ_is_ok"))) TS_CResult_ShutdownScriptDecodeErrorZ_is_ok(uint64_t o) {
11013         LDKCResult_ShutdownScriptDecodeErrorZ* o_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)untag_ptr(o);
11014         jboolean ret_conv = CResult_ShutdownScriptDecodeErrorZ_is_ok(o_conv);
11015         return ret_conv;
11016 }
11017
11018 void  __attribute__((export_name("TS_CResult_ShutdownScriptDecodeErrorZ_free"))) TS_CResult_ShutdownScriptDecodeErrorZ_free(uint64_t _res) {
11019         if (!ptr_is_owned(_res)) return;
11020         void* _res_ptr = untag_ptr(_res);
11021         CHECK_ACCESS(_res_ptr);
11022         LDKCResult_ShutdownScriptDecodeErrorZ _res_conv = *(LDKCResult_ShutdownScriptDecodeErrorZ*)(_res_ptr);
11023         FREE(untag_ptr(_res));
11024         CResult_ShutdownScriptDecodeErrorZ_free(_res_conv);
11025 }
11026
11027 static inline uint64_t CResult_ShutdownScriptDecodeErrorZ_clone_ptr(LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR arg) {
11028         LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
11029         *ret_conv = CResult_ShutdownScriptDecodeErrorZ_clone(arg);
11030         return tag_ptr(ret_conv, true);
11031 }
11032 int64_t  __attribute__((export_name("TS_CResult_ShutdownScriptDecodeErrorZ_clone_ptr"))) TS_CResult_ShutdownScriptDecodeErrorZ_clone_ptr(uint64_t arg) {
11033         LDKCResult_ShutdownScriptDecodeErrorZ* arg_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)untag_ptr(arg);
11034         int64_t ret_conv = CResult_ShutdownScriptDecodeErrorZ_clone_ptr(arg_conv);
11035         return ret_conv;
11036 }
11037
11038 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptDecodeErrorZ_clone"))) TS_CResult_ShutdownScriptDecodeErrorZ_clone(uint64_t orig) {
11039         LDKCResult_ShutdownScriptDecodeErrorZ* orig_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)untag_ptr(orig);
11040         LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
11041         *ret_conv = CResult_ShutdownScriptDecodeErrorZ_clone(orig_conv);
11042         return tag_ptr(ret_conv, true);
11043 }
11044
11045 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptInvalidShutdownScriptZ_ok"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_ok(uint64_t o) {
11046         LDKShutdownScript o_conv;
11047         o_conv.inner = untag_ptr(o);
11048         o_conv.is_owned = ptr_is_owned(o);
11049         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
11050         o_conv = ShutdownScript_clone(&o_conv);
11051         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
11052         *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_ok(o_conv);
11053         return tag_ptr(ret_conv, true);
11054 }
11055
11056 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptInvalidShutdownScriptZ_err"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_err(uint64_t e) {
11057         LDKInvalidShutdownScript e_conv;
11058         e_conv.inner = untag_ptr(e);
11059         e_conv.is_owned = ptr_is_owned(e);
11060         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
11061         e_conv = InvalidShutdownScript_clone(&e_conv);
11062         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
11063         *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_err(e_conv);
11064         return tag_ptr(ret_conv, true);
11065 }
11066
11067 jboolean  __attribute__((export_name("TS_CResult_ShutdownScriptInvalidShutdownScriptZ_is_ok"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_is_ok(uint64_t o) {
11068         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* o_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)untag_ptr(o);
11069         jboolean ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_is_ok(o_conv);
11070         return ret_conv;
11071 }
11072
11073 void  __attribute__((export_name("TS_CResult_ShutdownScriptInvalidShutdownScriptZ_free"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_free(uint64_t _res) {
11074         if (!ptr_is_owned(_res)) return;
11075         void* _res_ptr = untag_ptr(_res);
11076         CHECK_ACCESS(_res_ptr);
11077         LDKCResult_ShutdownScriptInvalidShutdownScriptZ _res_conv = *(LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)(_res_ptr);
11078         FREE(untag_ptr(_res));
11079         CResult_ShutdownScriptInvalidShutdownScriptZ_free(_res_conv);
11080 }
11081
11082 static inline uint64_t CResult_ShutdownScriptInvalidShutdownScriptZ_clone_ptr(LDKCResult_ShutdownScriptInvalidShutdownScriptZ *NONNULL_PTR arg) {
11083         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
11084         *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_clone(arg);
11085         return tag_ptr(ret_conv, true);
11086 }
11087 int64_t  __attribute__((export_name("TS_CResult_ShutdownScriptInvalidShutdownScriptZ_clone_ptr"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_clone_ptr(uint64_t arg) {
11088         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* arg_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)untag_ptr(arg);
11089         int64_t ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_clone_ptr(arg_conv);
11090         return ret_conv;
11091 }
11092
11093 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptInvalidShutdownScriptZ_clone"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_clone(uint64_t orig) {
11094         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* orig_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)untag_ptr(orig);
11095         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
11096         *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_clone(orig_conv);
11097         return tag_ptr(ret_conv, true);
11098 }
11099
11100 uint64_t  __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_ok"))) TS_CResult_RouteHopDecodeErrorZ_ok(uint64_t o) {
11101         LDKRouteHop o_conv;
11102         o_conv.inner = untag_ptr(o);
11103         o_conv.is_owned = ptr_is_owned(o);
11104         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
11105         o_conv = RouteHop_clone(&o_conv);
11106         LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
11107         *ret_conv = CResult_RouteHopDecodeErrorZ_ok(o_conv);
11108         return tag_ptr(ret_conv, true);
11109 }
11110
11111 uint64_t  __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_err"))) TS_CResult_RouteHopDecodeErrorZ_err(uint64_t e) {
11112         LDKDecodeError e_conv;
11113         e_conv.inner = untag_ptr(e);
11114         e_conv.is_owned = ptr_is_owned(e);
11115         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
11116         e_conv = DecodeError_clone(&e_conv);
11117         LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
11118         *ret_conv = CResult_RouteHopDecodeErrorZ_err(e_conv);
11119         return tag_ptr(ret_conv, true);
11120 }
11121
11122 jboolean  __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_is_ok"))) TS_CResult_RouteHopDecodeErrorZ_is_ok(uint64_t o) {
11123         LDKCResult_RouteHopDecodeErrorZ* o_conv = (LDKCResult_RouteHopDecodeErrorZ*)untag_ptr(o);
11124         jboolean ret_conv = CResult_RouteHopDecodeErrorZ_is_ok(o_conv);
11125         return ret_conv;
11126 }
11127
11128 void  __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_free"))) TS_CResult_RouteHopDecodeErrorZ_free(uint64_t _res) {
11129         if (!ptr_is_owned(_res)) return;
11130         void* _res_ptr = untag_ptr(_res);
11131         CHECK_ACCESS(_res_ptr);
11132         LDKCResult_RouteHopDecodeErrorZ _res_conv = *(LDKCResult_RouteHopDecodeErrorZ*)(_res_ptr);
11133         FREE(untag_ptr(_res));
11134         CResult_RouteHopDecodeErrorZ_free(_res_conv);
11135 }
11136
11137 static inline uint64_t CResult_RouteHopDecodeErrorZ_clone_ptr(LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR arg) {
11138         LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
11139         *ret_conv = CResult_RouteHopDecodeErrorZ_clone(arg);
11140         return tag_ptr(ret_conv, true);
11141 }
11142 int64_t  __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_clone_ptr"))) TS_CResult_RouteHopDecodeErrorZ_clone_ptr(uint64_t arg) {
11143         LDKCResult_RouteHopDecodeErrorZ* arg_conv = (LDKCResult_RouteHopDecodeErrorZ*)untag_ptr(arg);
11144         int64_t ret_conv = CResult_RouteHopDecodeErrorZ_clone_ptr(arg_conv);
11145         return ret_conv;
11146 }
11147
11148 uint64_t  __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_clone"))) TS_CResult_RouteHopDecodeErrorZ_clone(uint64_t orig) {
11149         LDKCResult_RouteHopDecodeErrorZ* orig_conv = (LDKCResult_RouteHopDecodeErrorZ*)untag_ptr(orig);
11150         LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
11151         *ret_conv = CResult_RouteHopDecodeErrorZ_clone(orig_conv);
11152         return tag_ptr(ret_conv, true);
11153 }
11154
11155 void  __attribute__((export_name("TS_CVec_RouteHopZ_free"))) TS_CVec_RouteHopZ_free(uint64_tArray _res) {
11156         LDKCVec_RouteHopZ _res_constr;
11157         _res_constr.datalen = _res->arr_len;
11158         if (_res_constr.datalen > 0)
11159                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
11160         else
11161                 _res_constr.data = NULL;
11162         uint64_t* _res_vals = _res->elems;
11163         for (size_t k = 0; k < _res_constr.datalen; k++) {
11164                 uint64_t _res_conv_10 = _res_vals[k];
11165                 LDKRouteHop _res_conv_10_conv;
11166                 _res_conv_10_conv.inner = untag_ptr(_res_conv_10);
11167                 _res_conv_10_conv.is_owned = ptr_is_owned(_res_conv_10);
11168                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_10_conv);
11169                 _res_constr.data[k] = _res_conv_10_conv;
11170         }
11171         FREE(_res);
11172         CVec_RouteHopZ_free(_res_constr);
11173 }
11174
11175 void  __attribute__((export_name("TS_CVec_CVec_RouteHopZZ_free"))) TS_CVec_CVec_RouteHopZZ_free(ptrArray _res) {
11176         LDKCVec_CVec_RouteHopZZ _res_constr;
11177         _res_constr.datalen = _res->arr_len;
11178         if (_res_constr.datalen > 0)
11179                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
11180         else
11181                 _res_constr.data = NULL;
11182         uint64_tArray* _res_vals = (void*) _res->elems;
11183         for (size_t m = 0; m < _res_constr.datalen; m++) {
11184                 uint64_tArray _res_conv_12 = _res_vals[m];
11185                 LDKCVec_RouteHopZ _res_conv_12_constr;
11186                 _res_conv_12_constr.datalen = _res_conv_12->arr_len;
11187                 if (_res_conv_12_constr.datalen > 0)
11188                         _res_conv_12_constr.data = MALLOC(_res_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
11189                 else
11190                         _res_conv_12_constr.data = NULL;
11191                 uint64_t* _res_conv_12_vals = _res_conv_12->elems;
11192                 for (size_t k = 0; k < _res_conv_12_constr.datalen; k++) {
11193                         uint64_t _res_conv_12_conv_10 = _res_conv_12_vals[k];
11194                         LDKRouteHop _res_conv_12_conv_10_conv;
11195                         _res_conv_12_conv_10_conv.inner = untag_ptr(_res_conv_12_conv_10);
11196                         _res_conv_12_conv_10_conv.is_owned = ptr_is_owned(_res_conv_12_conv_10);
11197                         CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_12_conv_10_conv);
11198                         _res_conv_12_constr.data[k] = _res_conv_12_conv_10_conv;
11199                 }
11200                 FREE(_res_conv_12);
11201                 _res_constr.data[m] = _res_conv_12_constr;
11202         }
11203         FREE(_res);
11204         CVec_CVec_RouteHopZZ_free(_res_constr);
11205 }
11206
11207 uint64_t  __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_ok"))) TS_CResult_RouteDecodeErrorZ_ok(uint64_t o) {
11208         LDKRoute o_conv;
11209         o_conv.inner = untag_ptr(o);
11210         o_conv.is_owned = ptr_is_owned(o);
11211         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
11212         o_conv = Route_clone(&o_conv);
11213         LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
11214         *ret_conv = CResult_RouteDecodeErrorZ_ok(o_conv);
11215         return tag_ptr(ret_conv, true);
11216 }
11217
11218 uint64_t  __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_err"))) TS_CResult_RouteDecodeErrorZ_err(uint64_t e) {
11219         LDKDecodeError e_conv;
11220         e_conv.inner = untag_ptr(e);
11221         e_conv.is_owned = ptr_is_owned(e);
11222         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
11223         e_conv = DecodeError_clone(&e_conv);
11224         LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
11225         *ret_conv = CResult_RouteDecodeErrorZ_err(e_conv);
11226         return tag_ptr(ret_conv, true);
11227 }
11228
11229 jboolean  __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_is_ok"))) TS_CResult_RouteDecodeErrorZ_is_ok(uint64_t o) {
11230         LDKCResult_RouteDecodeErrorZ* o_conv = (LDKCResult_RouteDecodeErrorZ*)untag_ptr(o);
11231         jboolean ret_conv = CResult_RouteDecodeErrorZ_is_ok(o_conv);
11232         return ret_conv;
11233 }
11234
11235 void  __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_free"))) TS_CResult_RouteDecodeErrorZ_free(uint64_t _res) {
11236         if (!ptr_is_owned(_res)) return;
11237         void* _res_ptr = untag_ptr(_res);
11238         CHECK_ACCESS(_res_ptr);
11239         LDKCResult_RouteDecodeErrorZ _res_conv = *(LDKCResult_RouteDecodeErrorZ*)(_res_ptr);
11240         FREE(untag_ptr(_res));
11241         CResult_RouteDecodeErrorZ_free(_res_conv);
11242 }
11243
11244 static inline uint64_t CResult_RouteDecodeErrorZ_clone_ptr(LDKCResult_RouteDecodeErrorZ *NONNULL_PTR arg) {
11245         LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
11246         *ret_conv = CResult_RouteDecodeErrorZ_clone(arg);
11247         return tag_ptr(ret_conv, true);
11248 }
11249 int64_t  __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_clone_ptr"))) TS_CResult_RouteDecodeErrorZ_clone_ptr(uint64_t arg) {
11250         LDKCResult_RouteDecodeErrorZ* arg_conv = (LDKCResult_RouteDecodeErrorZ*)untag_ptr(arg);
11251         int64_t ret_conv = CResult_RouteDecodeErrorZ_clone_ptr(arg_conv);
11252         return ret_conv;
11253 }
11254
11255 uint64_t  __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_clone"))) TS_CResult_RouteDecodeErrorZ_clone(uint64_t orig) {
11256         LDKCResult_RouteDecodeErrorZ* orig_conv = (LDKCResult_RouteDecodeErrorZ*)untag_ptr(orig);
11257         LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
11258         *ret_conv = CResult_RouteDecodeErrorZ_clone(orig_conv);
11259         return tag_ptr(ret_conv, true);
11260 }
11261
11262 uint64_t  __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_ok"))) TS_CResult_RouteParametersDecodeErrorZ_ok(uint64_t o) {
11263         LDKRouteParameters o_conv;
11264         o_conv.inner = untag_ptr(o);
11265         o_conv.is_owned = ptr_is_owned(o);
11266         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
11267         o_conv = RouteParameters_clone(&o_conv);
11268         LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
11269         *ret_conv = CResult_RouteParametersDecodeErrorZ_ok(o_conv);
11270         return tag_ptr(ret_conv, true);
11271 }
11272
11273 uint64_t  __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_err"))) TS_CResult_RouteParametersDecodeErrorZ_err(uint64_t e) {
11274         LDKDecodeError e_conv;
11275         e_conv.inner = untag_ptr(e);
11276         e_conv.is_owned = ptr_is_owned(e);
11277         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
11278         e_conv = DecodeError_clone(&e_conv);
11279         LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
11280         *ret_conv = CResult_RouteParametersDecodeErrorZ_err(e_conv);
11281         return tag_ptr(ret_conv, true);
11282 }
11283
11284 jboolean  __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_is_ok"))) TS_CResult_RouteParametersDecodeErrorZ_is_ok(uint64_t o) {
11285         LDKCResult_RouteParametersDecodeErrorZ* o_conv = (LDKCResult_RouteParametersDecodeErrorZ*)untag_ptr(o);
11286         jboolean ret_conv = CResult_RouteParametersDecodeErrorZ_is_ok(o_conv);
11287         return ret_conv;
11288 }
11289
11290 void  __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_free"))) TS_CResult_RouteParametersDecodeErrorZ_free(uint64_t _res) {
11291         if (!ptr_is_owned(_res)) return;
11292         void* _res_ptr = untag_ptr(_res);
11293         CHECK_ACCESS(_res_ptr);
11294         LDKCResult_RouteParametersDecodeErrorZ _res_conv = *(LDKCResult_RouteParametersDecodeErrorZ*)(_res_ptr);
11295         FREE(untag_ptr(_res));
11296         CResult_RouteParametersDecodeErrorZ_free(_res_conv);
11297 }
11298
11299 static inline uint64_t CResult_RouteParametersDecodeErrorZ_clone_ptr(LDKCResult_RouteParametersDecodeErrorZ *NONNULL_PTR arg) {
11300         LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
11301         *ret_conv = CResult_RouteParametersDecodeErrorZ_clone(arg);
11302         return tag_ptr(ret_conv, true);
11303 }
11304 int64_t  __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_clone_ptr"))) TS_CResult_RouteParametersDecodeErrorZ_clone_ptr(uint64_t arg) {
11305         LDKCResult_RouteParametersDecodeErrorZ* arg_conv = (LDKCResult_RouteParametersDecodeErrorZ*)untag_ptr(arg);
11306         int64_t ret_conv = CResult_RouteParametersDecodeErrorZ_clone_ptr(arg_conv);
11307         return ret_conv;
11308 }
11309
11310 uint64_t  __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_clone"))) TS_CResult_RouteParametersDecodeErrorZ_clone(uint64_t orig) {
11311         LDKCResult_RouteParametersDecodeErrorZ* orig_conv = (LDKCResult_RouteParametersDecodeErrorZ*)untag_ptr(orig);
11312         LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
11313         *ret_conv = CResult_RouteParametersDecodeErrorZ_clone(orig_conv);
11314         return tag_ptr(ret_conv, true);
11315 }
11316
11317 void  __attribute__((export_name("TS_CVec_RouteHintZ_free"))) TS_CVec_RouteHintZ_free(uint64_tArray _res) {
11318         LDKCVec_RouteHintZ _res_constr;
11319         _res_constr.datalen = _res->arr_len;
11320         if (_res_constr.datalen > 0)
11321                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
11322         else
11323                 _res_constr.data = NULL;
11324         uint64_t* _res_vals = _res->elems;
11325         for (size_t l = 0; l < _res_constr.datalen; l++) {
11326                 uint64_t _res_conv_11 = _res_vals[l];
11327                 LDKRouteHint _res_conv_11_conv;
11328                 _res_conv_11_conv.inner = untag_ptr(_res_conv_11);
11329                 _res_conv_11_conv.is_owned = ptr_is_owned(_res_conv_11);
11330                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_11_conv);
11331                 _res_constr.data[l] = _res_conv_11_conv;
11332         }
11333         FREE(_res);
11334         CVec_RouteHintZ_free(_res_constr);
11335 }
11336
11337 uint64_t  __attribute__((export_name("TS_COption_u64Z_some"))) TS_COption_u64Z_some(int64_t o) {
11338         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
11339         *ret_copy = COption_u64Z_some(o);
11340         uint64_t ret_ref = tag_ptr(ret_copy, true);
11341         return ret_ref;
11342 }
11343
11344 uint64_t  __attribute__((export_name("TS_COption_u64Z_none"))) TS_COption_u64Z_none() {
11345         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
11346         *ret_copy = COption_u64Z_none();
11347         uint64_t ret_ref = tag_ptr(ret_copy, true);
11348         return ret_ref;
11349 }
11350
11351 void  __attribute__((export_name("TS_COption_u64Z_free"))) TS_COption_u64Z_free(uint64_t _res) {
11352         if (!ptr_is_owned(_res)) return;
11353         void* _res_ptr = untag_ptr(_res);
11354         CHECK_ACCESS(_res_ptr);
11355         LDKCOption_u64Z _res_conv = *(LDKCOption_u64Z*)(_res_ptr);
11356         FREE(untag_ptr(_res));
11357         COption_u64Z_free(_res_conv);
11358 }
11359
11360 static inline uint64_t COption_u64Z_clone_ptr(LDKCOption_u64Z *NONNULL_PTR arg) {
11361         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
11362         *ret_copy = COption_u64Z_clone(arg);
11363         uint64_t ret_ref = tag_ptr(ret_copy, true);
11364         return ret_ref;
11365 }
11366 int64_t  __attribute__((export_name("TS_COption_u64Z_clone_ptr"))) TS_COption_u64Z_clone_ptr(uint64_t arg) {
11367         LDKCOption_u64Z* arg_conv = (LDKCOption_u64Z*)untag_ptr(arg);
11368         int64_t ret_conv = COption_u64Z_clone_ptr(arg_conv);
11369         return ret_conv;
11370 }
11371
11372 uint64_t  __attribute__((export_name("TS_COption_u64Z_clone"))) TS_COption_u64Z_clone(uint64_t orig) {
11373         LDKCOption_u64Z* orig_conv = (LDKCOption_u64Z*)untag_ptr(orig);
11374         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
11375         *ret_copy = COption_u64Z_clone(orig_conv);
11376         uint64_t ret_ref = tag_ptr(ret_copy, true);
11377         return ret_ref;
11378 }
11379
11380 void  __attribute__((export_name("TS_CVec_u64Z_free"))) TS_CVec_u64Z_free(int64_tArray _res) {
11381         LDKCVec_u64Z _res_constr;
11382         _res_constr.datalen = _res->arr_len;
11383         if (_res_constr.datalen > 0)
11384                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
11385         else
11386                 _res_constr.data = NULL;
11387         int64_t* _res_vals = _res->elems;
11388         for (size_t i = 0; i < _res_constr.datalen; i++) {
11389                 int64_t _res_conv_8 = _res_vals[i];
11390                 _res_constr.data[i] = _res_conv_8;
11391         }
11392         FREE(_res);
11393         CVec_u64Z_free(_res_constr);
11394 }
11395
11396 uint64_t  __attribute__((export_name("TS_CResult_PaymentParametersDecodeErrorZ_ok"))) TS_CResult_PaymentParametersDecodeErrorZ_ok(uint64_t o) {
11397         LDKPaymentParameters o_conv;
11398         o_conv.inner = untag_ptr(o);
11399         o_conv.is_owned = ptr_is_owned(o);
11400         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
11401         o_conv = PaymentParameters_clone(&o_conv);
11402         LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
11403         *ret_conv = CResult_PaymentParametersDecodeErrorZ_ok(o_conv);
11404         return tag_ptr(ret_conv, true);
11405 }
11406
11407 uint64_t  __attribute__((export_name("TS_CResult_PaymentParametersDecodeErrorZ_err"))) TS_CResult_PaymentParametersDecodeErrorZ_err(uint64_t e) {
11408         LDKDecodeError e_conv;
11409         e_conv.inner = untag_ptr(e);
11410         e_conv.is_owned = ptr_is_owned(e);
11411         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
11412         e_conv = DecodeError_clone(&e_conv);
11413         LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
11414         *ret_conv = CResult_PaymentParametersDecodeErrorZ_err(e_conv);
11415         return tag_ptr(ret_conv, true);
11416 }
11417
11418 jboolean  __attribute__((export_name("TS_CResult_PaymentParametersDecodeErrorZ_is_ok"))) TS_CResult_PaymentParametersDecodeErrorZ_is_ok(uint64_t o) {
11419         LDKCResult_PaymentParametersDecodeErrorZ* o_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)untag_ptr(o);
11420         jboolean ret_conv = CResult_PaymentParametersDecodeErrorZ_is_ok(o_conv);
11421         return ret_conv;
11422 }
11423
11424 void  __attribute__((export_name("TS_CResult_PaymentParametersDecodeErrorZ_free"))) TS_CResult_PaymentParametersDecodeErrorZ_free(uint64_t _res) {
11425         if (!ptr_is_owned(_res)) return;
11426         void* _res_ptr = untag_ptr(_res);
11427         CHECK_ACCESS(_res_ptr);
11428         LDKCResult_PaymentParametersDecodeErrorZ _res_conv = *(LDKCResult_PaymentParametersDecodeErrorZ*)(_res_ptr);
11429         FREE(untag_ptr(_res));
11430         CResult_PaymentParametersDecodeErrorZ_free(_res_conv);
11431 }
11432
11433 static inline uint64_t CResult_PaymentParametersDecodeErrorZ_clone_ptr(LDKCResult_PaymentParametersDecodeErrorZ *NONNULL_PTR arg) {
11434         LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
11435         *ret_conv = CResult_PaymentParametersDecodeErrorZ_clone(arg);
11436         return tag_ptr(ret_conv, true);
11437 }
11438 int64_t  __attribute__((export_name("TS_CResult_PaymentParametersDecodeErrorZ_clone_ptr"))) TS_CResult_PaymentParametersDecodeErrorZ_clone_ptr(uint64_t arg) {
11439         LDKCResult_PaymentParametersDecodeErrorZ* arg_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)untag_ptr(arg);
11440         int64_t ret_conv = CResult_PaymentParametersDecodeErrorZ_clone_ptr(arg_conv);
11441         return ret_conv;
11442 }
11443
11444 uint64_t  __attribute__((export_name("TS_CResult_PaymentParametersDecodeErrorZ_clone"))) TS_CResult_PaymentParametersDecodeErrorZ_clone(uint64_t orig) {
11445         LDKCResult_PaymentParametersDecodeErrorZ* orig_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)untag_ptr(orig);
11446         LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
11447         *ret_conv = CResult_PaymentParametersDecodeErrorZ_clone(orig_conv);
11448         return tag_ptr(ret_conv, true);
11449 }
11450
11451 void  __attribute__((export_name("TS_CVec_RouteHintHopZ_free"))) TS_CVec_RouteHintHopZ_free(uint64_tArray _res) {
11452         LDKCVec_RouteHintHopZ _res_constr;
11453         _res_constr.datalen = _res->arr_len;
11454         if (_res_constr.datalen > 0)
11455                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHintHop), "LDKCVec_RouteHintHopZ Elements");
11456         else
11457                 _res_constr.data = NULL;
11458         uint64_t* _res_vals = _res->elems;
11459         for (size_t o = 0; o < _res_constr.datalen; o++) {
11460                 uint64_t _res_conv_14 = _res_vals[o];
11461                 LDKRouteHintHop _res_conv_14_conv;
11462                 _res_conv_14_conv.inner = untag_ptr(_res_conv_14);
11463                 _res_conv_14_conv.is_owned = ptr_is_owned(_res_conv_14);
11464                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_14_conv);
11465                 _res_constr.data[o] = _res_conv_14_conv;
11466         }
11467         FREE(_res);
11468         CVec_RouteHintHopZ_free(_res_constr);
11469 }
11470
11471 uint64_t  __attribute__((export_name("TS_CResult_RouteHintDecodeErrorZ_ok"))) TS_CResult_RouteHintDecodeErrorZ_ok(uint64_t o) {
11472         LDKRouteHint o_conv;
11473         o_conv.inner = untag_ptr(o);
11474         o_conv.is_owned = ptr_is_owned(o);
11475         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
11476         o_conv = RouteHint_clone(&o_conv);
11477         LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
11478         *ret_conv = CResult_RouteHintDecodeErrorZ_ok(o_conv);
11479         return tag_ptr(ret_conv, true);
11480 }
11481
11482 uint64_t  __attribute__((export_name("TS_CResult_RouteHintDecodeErrorZ_err"))) TS_CResult_RouteHintDecodeErrorZ_err(uint64_t e) {
11483         LDKDecodeError e_conv;
11484         e_conv.inner = untag_ptr(e);
11485         e_conv.is_owned = ptr_is_owned(e);
11486         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
11487         e_conv = DecodeError_clone(&e_conv);
11488         LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
11489         *ret_conv = CResult_RouteHintDecodeErrorZ_err(e_conv);
11490         return tag_ptr(ret_conv, true);
11491 }
11492
11493 jboolean  __attribute__((export_name("TS_CResult_RouteHintDecodeErrorZ_is_ok"))) TS_CResult_RouteHintDecodeErrorZ_is_ok(uint64_t o) {
11494         LDKCResult_RouteHintDecodeErrorZ* o_conv = (LDKCResult_RouteHintDecodeErrorZ*)untag_ptr(o);
11495         jboolean ret_conv = CResult_RouteHintDecodeErrorZ_is_ok(o_conv);
11496         return ret_conv;
11497 }
11498
11499 void  __attribute__((export_name("TS_CResult_RouteHintDecodeErrorZ_free"))) TS_CResult_RouteHintDecodeErrorZ_free(uint64_t _res) {
11500         if (!ptr_is_owned(_res)) return;
11501         void* _res_ptr = untag_ptr(_res);
11502         CHECK_ACCESS(_res_ptr);
11503         LDKCResult_RouteHintDecodeErrorZ _res_conv = *(LDKCResult_RouteHintDecodeErrorZ*)(_res_ptr);
11504         FREE(untag_ptr(_res));
11505         CResult_RouteHintDecodeErrorZ_free(_res_conv);
11506 }
11507
11508 static inline uint64_t CResult_RouteHintDecodeErrorZ_clone_ptr(LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR arg) {
11509         LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
11510         *ret_conv = CResult_RouteHintDecodeErrorZ_clone(arg);
11511         return tag_ptr(ret_conv, true);
11512 }
11513 int64_t  __attribute__((export_name("TS_CResult_RouteHintDecodeErrorZ_clone_ptr"))) TS_CResult_RouteHintDecodeErrorZ_clone_ptr(uint64_t arg) {
11514         LDKCResult_RouteHintDecodeErrorZ* arg_conv = (LDKCResult_RouteHintDecodeErrorZ*)untag_ptr(arg);
11515         int64_t ret_conv = CResult_RouteHintDecodeErrorZ_clone_ptr(arg_conv);
11516         return ret_conv;
11517 }
11518
11519 uint64_t  __attribute__((export_name("TS_CResult_RouteHintDecodeErrorZ_clone"))) TS_CResult_RouteHintDecodeErrorZ_clone(uint64_t orig) {
11520         LDKCResult_RouteHintDecodeErrorZ* orig_conv = (LDKCResult_RouteHintDecodeErrorZ*)untag_ptr(orig);
11521         LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
11522         *ret_conv = CResult_RouteHintDecodeErrorZ_clone(orig_conv);
11523         return tag_ptr(ret_conv, true);
11524 }
11525
11526 uint64_t  __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_ok"))) TS_CResult_RouteHintHopDecodeErrorZ_ok(uint64_t o) {
11527         LDKRouteHintHop o_conv;
11528         o_conv.inner = untag_ptr(o);
11529         o_conv.is_owned = ptr_is_owned(o);
11530         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
11531         o_conv = RouteHintHop_clone(&o_conv);
11532         LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
11533         *ret_conv = CResult_RouteHintHopDecodeErrorZ_ok(o_conv);
11534         return tag_ptr(ret_conv, true);
11535 }
11536
11537 uint64_t  __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_err"))) TS_CResult_RouteHintHopDecodeErrorZ_err(uint64_t e) {
11538         LDKDecodeError e_conv;
11539         e_conv.inner = untag_ptr(e);
11540         e_conv.is_owned = ptr_is_owned(e);
11541         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
11542         e_conv = DecodeError_clone(&e_conv);
11543         LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
11544         *ret_conv = CResult_RouteHintHopDecodeErrorZ_err(e_conv);
11545         return tag_ptr(ret_conv, true);
11546 }
11547
11548 jboolean  __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_is_ok"))) TS_CResult_RouteHintHopDecodeErrorZ_is_ok(uint64_t o) {
11549         LDKCResult_RouteHintHopDecodeErrorZ* o_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)untag_ptr(o);
11550         jboolean ret_conv = CResult_RouteHintHopDecodeErrorZ_is_ok(o_conv);
11551         return ret_conv;
11552 }
11553
11554 void  __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_free"))) TS_CResult_RouteHintHopDecodeErrorZ_free(uint64_t _res) {
11555         if (!ptr_is_owned(_res)) return;
11556         void* _res_ptr = untag_ptr(_res);
11557         CHECK_ACCESS(_res_ptr);
11558         LDKCResult_RouteHintHopDecodeErrorZ _res_conv = *(LDKCResult_RouteHintHopDecodeErrorZ*)(_res_ptr);
11559         FREE(untag_ptr(_res));
11560         CResult_RouteHintHopDecodeErrorZ_free(_res_conv);
11561 }
11562
11563 static inline uint64_t CResult_RouteHintHopDecodeErrorZ_clone_ptr(LDKCResult_RouteHintHopDecodeErrorZ *NONNULL_PTR arg) {
11564         LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
11565         *ret_conv = CResult_RouteHintHopDecodeErrorZ_clone(arg);
11566         return tag_ptr(ret_conv, true);
11567 }
11568 int64_t  __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_clone_ptr"))) TS_CResult_RouteHintHopDecodeErrorZ_clone_ptr(uint64_t arg) {
11569         LDKCResult_RouteHintHopDecodeErrorZ* arg_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)untag_ptr(arg);
11570         int64_t ret_conv = CResult_RouteHintHopDecodeErrorZ_clone_ptr(arg_conv);
11571         return ret_conv;
11572 }
11573
11574 uint64_t  __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_clone"))) TS_CResult_RouteHintHopDecodeErrorZ_clone(uint64_t orig) {
11575         LDKCResult_RouteHintHopDecodeErrorZ* orig_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)untag_ptr(orig);
11576         LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
11577         *ret_conv = CResult_RouteHintHopDecodeErrorZ_clone(orig_conv);
11578         return tag_ptr(ret_conv, true);
11579 }
11580
11581 void  __attribute__((export_name("TS_CVec_ChannelDetailsZ_free"))) TS_CVec_ChannelDetailsZ_free(uint64_tArray _res) {
11582         LDKCVec_ChannelDetailsZ _res_constr;
11583         _res_constr.datalen = _res->arr_len;
11584         if (_res_constr.datalen > 0)
11585                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
11586         else
11587                 _res_constr.data = NULL;
11588         uint64_t* _res_vals = _res->elems;
11589         for (size_t q = 0; q < _res_constr.datalen; q++) {
11590                 uint64_t _res_conv_16 = _res_vals[q];
11591                 LDKChannelDetails _res_conv_16_conv;
11592                 _res_conv_16_conv.inner = untag_ptr(_res_conv_16);
11593                 _res_conv_16_conv.is_owned = ptr_is_owned(_res_conv_16);
11594                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_16_conv);
11595                 _res_constr.data[q] = _res_conv_16_conv;
11596         }
11597         FREE(_res);
11598         CVec_ChannelDetailsZ_free(_res_constr);
11599 }
11600
11601 uint64_t  __attribute__((export_name("TS_CResult_RouteLightningErrorZ_ok"))) TS_CResult_RouteLightningErrorZ_ok(uint64_t o) {
11602         LDKRoute o_conv;
11603         o_conv.inner = untag_ptr(o);
11604         o_conv.is_owned = ptr_is_owned(o);
11605         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
11606         o_conv = Route_clone(&o_conv);
11607         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
11608         *ret_conv = CResult_RouteLightningErrorZ_ok(o_conv);
11609         return tag_ptr(ret_conv, true);
11610 }
11611
11612 uint64_t  __attribute__((export_name("TS_CResult_RouteLightningErrorZ_err"))) TS_CResult_RouteLightningErrorZ_err(uint64_t e) {
11613         LDKLightningError e_conv;
11614         e_conv.inner = untag_ptr(e);
11615         e_conv.is_owned = ptr_is_owned(e);
11616         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
11617         e_conv = LightningError_clone(&e_conv);
11618         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
11619         *ret_conv = CResult_RouteLightningErrorZ_err(e_conv);
11620         return tag_ptr(ret_conv, true);
11621 }
11622
11623 jboolean  __attribute__((export_name("TS_CResult_RouteLightningErrorZ_is_ok"))) TS_CResult_RouteLightningErrorZ_is_ok(uint64_t o) {
11624         LDKCResult_RouteLightningErrorZ* o_conv = (LDKCResult_RouteLightningErrorZ*)untag_ptr(o);
11625         jboolean ret_conv = CResult_RouteLightningErrorZ_is_ok(o_conv);
11626         return ret_conv;
11627 }
11628
11629 void  __attribute__((export_name("TS_CResult_RouteLightningErrorZ_free"))) TS_CResult_RouteLightningErrorZ_free(uint64_t _res) {
11630         if (!ptr_is_owned(_res)) return;
11631         void* _res_ptr = untag_ptr(_res);
11632         CHECK_ACCESS(_res_ptr);
11633         LDKCResult_RouteLightningErrorZ _res_conv = *(LDKCResult_RouteLightningErrorZ*)(_res_ptr);
11634         FREE(untag_ptr(_res));
11635         CResult_RouteLightningErrorZ_free(_res_conv);
11636 }
11637
11638 static inline uint64_t CResult_RouteLightningErrorZ_clone_ptr(LDKCResult_RouteLightningErrorZ *NONNULL_PTR arg) {
11639         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
11640         *ret_conv = CResult_RouteLightningErrorZ_clone(arg);
11641         return tag_ptr(ret_conv, true);
11642 }
11643 int64_t  __attribute__((export_name("TS_CResult_RouteLightningErrorZ_clone_ptr"))) TS_CResult_RouteLightningErrorZ_clone_ptr(uint64_t arg) {
11644         LDKCResult_RouteLightningErrorZ* arg_conv = (LDKCResult_RouteLightningErrorZ*)untag_ptr(arg);
11645         int64_t ret_conv = CResult_RouteLightningErrorZ_clone_ptr(arg_conv);
11646         return ret_conv;
11647 }
11648
11649 uint64_t  __attribute__((export_name("TS_CResult_RouteLightningErrorZ_clone"))) TS_CResult_RouteLightningErrorZ_clone(uint64_t orig) {
11650         LDKCResult_RouteLightningErrorZ* orig_conv = (LDKCResult_RouteLightningErrorZ*)untag_ptr(orig);
11651         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
11652         *ret_conv = CResult_RouteLightningErrorZ_clone(orig_conv);
11653         return tag_ptr(ret_conv, true);
11654 }
11655
11656 void  __attribute__((export_name("TS_CVec_PublicKeyZ_free"))) TS_CVec_PublicKeyZ_free(ptrArray _res) {
11657         LDKCVec_PublicKeyZ _res_constr;
11658         _res_constr.datalen = _res->arr_len;
11659         if (_res_constr.datalen > 0)
11660                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
11661         else
11662                 _res_constr.data = NULL;
11663         int8_tArray* _res_vals = (void*) _res->elems;
11664         for (size_t m = 0; m < _res_constr.datalen; m++) {
11665                 int8_tArray _res_conv_12 = _res_vals[m];
11666                 LDKPublicKey _res_conv_12_ref;
11667                 CHECK(_res_conv_12->arr_len == 33);
11668                 memcpy(_res_conv_12_ref.compressed_form, _res_conv_12->elems, 33); FREE(_res_conv_12);
11669                 _res_constr.data[m] = _res_conv_12_ref;
11670         }
11671         FREE(_res);
11672         CVec_PublicKeyZ_free(_res_constr);
11673 }
11674
11675 uint64_t  __attribute__((export_name("TS_CResult_PaymentPurposeDecodeErrorZ_ok"))) TS_CResult_PaymentPurposeDecodeErrorZ_ok(uint64_t o) {
11676         void* o_ptr = untag_ptr(o);
11677         CHECK_ACCESS(o_ptr);
11678         LDKPaymentPurpose o_conv = *(LDKPaymentPurpose*)(o_ptr);
11679         o_conv = PaymentPurpose_clone((LDKPaymentPurpose*)untag_ptr(o));
11680         LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
11681         *ret_conv = CResult_PaymentPurposeDecodeErrorZ_ok(o_conv);
11682         return tag_ptr(ret_conv, true);
11683 }
11684
11685 uint64_t  __attribute__((export_name("TS_CResult_PaymentPurposeDecodeErrorZ_err"))) TS_CResult_PaymentPurposeDecodeErrorZ_err(uint64_t e) {
11686         LDKDecodeError e_conv;
11687         e_conv.inner = untag_ptr(e);
11688         e_conv.is_owned = ptr_is_owned(e);
11689         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
11690         e_conv = DecodeError_clone(&e_conv);
11691         LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
11692         *ret_conv = CResult_PaymentPurposeDecodeErrorZ_err(e_conv);
11693         return tag_ptr(ret_conv, true);
11694 }
11695
11696 jboolean  __attribute__((export_name("TS_CResult_PaymentPurposeDecodeErrorZ_is_ok"))) TS_CResult_PaymentPurposeDecodeErrorZ_is_ok(uint64_t o) {
11697         LDKCResult_PaymentPurposeDecodeErrorZ* o_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)untag_ptr(o);
11698         jboolean ret_conv = CResult_PaymentPurposeDecodeErrorZ_is_ok(o_conv);
11699         return ret_conv;
11700 }
11701
11702 void  __attribute__((export_name("TS_CResult_PaymentPurposeDecodeErrorZ_free"))) TS_CResult_PaymentPurposeDecodeErrorZ_free(uint64_t _res) {
11703         if (!ptr_is_owned(_res)) return;
11704         void* _res_ptr = untag_ptr(_res);
11705         CHECK_ACCESS(_res_ptr);
11706         LDKCResult_PaymentPurposeDecodeErrorZ _res_conv = *(LDKCResult_PaymentPurposeDecodeErrorZ*)(_res_ptr);
11707         FREE(untag_ptr(_res));
11708         CResult_PaymentPurposeDecodeErrorZ_free(_res_conv);
11709 }
11710
11711 static inline uint64_t CResult_PaymentPurposeDecodeErrorZ_clone_ptr(LDKCResult_PaymentPurposeDecodeErrorZ *NONNULL_PTR arg) {
11712         LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
11713         *ret_conv = CResult_PaymentPurposeDecodeErrorZ_clone(arg);
11714         return tag_ptr(ret_conv, true);
11715 }
11716 int64_t  __attribute__((export_name("TS_CResult_PaymentPurposeDecodeErrorZ_clone_ptr"))) TS_CResult_PaymentPurposeDecodeErrorZ_clone_ptr(uint64_t arg) {
11717         LDKCResult_PaymentPurposeDecodeErrorZ* arg_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)untag_ptr(arg);
11718         int64_t ret_conv = CResult_PaymentPurposeDecodeErrorZ_clone_ptr(arg_conv);
11719         return ret_conv;
11720 }
11721
11722 uint64_t  __attribute__((export_name("TS_CResult_PaymentPurposeDecodeErrorZ_clone"))) TS_CResult_PaymentPurposeDecodeErrorZ_clone(uint64_t orig) {
11723         LDKCResult_PaymentPurposeDecodeErrorZ* orig_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)untag_ptr(orig);
11724         LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
11725         *ret_conv = CResult_PaymentPurposeDecodeErrorZ_clone(orig_conv);
11726         return tag_ptr(ret_conv, true);
11727 }
11728
11729 uint64_t  __attribute__((export_name("TS_COption_ClosureReasonZ_some"))) TS_COption_ClosureReasonZ_some(uint64_t o) {
11730         void* o_ptr = untag_ptr(o);
11731         CHECK_ACCESS(o_ptr);
11732         LDKClosureReason o_conv = *(LDKClosureReason*)(o_ptr);
11733         o_conv = ClosureReason_clone((LDKClosureReason*)untag_ptr(o));
11734         LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
11735         *ret_copy = COption_ClosureReasonZ_some(o_conv);
11736         uint64_t ret_ref = tag_ptr(ret_copy, true);
11737         return ret_ref;
11738 }
11739
11740 uint64_t  __attribute__((export_name("TS_COption_ClosureReasonZ_none"))) TS_COption_ClosureReasonZ_none() {
11741         LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
11742         *ret_copy = COption_ClosureReasonZ_none();
11743         uint64_t ret_ref = tag_ptr(ret_copy, true);
11744         return ret_ref;
11745 }
11746
11747 void  __attribute__((export_name("TS_COption_ClosureReasonZ_free"))) TS_COption_ClosureReasonZ_free(uint64_t _res) {
11748         if (!ptr_is_owned(_res)) return;
11749         void* _res_ptr = untag_ptr(_res);
11750         CHECK_ACCESS(_res_ptr);
11751         LDKCOption_ClosureReasonZ _res_conv = *(LDKCOption_ClosureReasonZ*)(_res_ptr);
11752         FREE(untag_ptr(_res));
11753         COption_ClosureReasonZ_free(_res_conv);
11754 }
11755
11756 static inline uint64_t COption_ClosureReasonZ_clone_ptr(LDKCOption_ClosureReasonZ *NONNULL_PTR arg) {
11757         LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
11758         *ret_copy = COption_ClosureReasonZ_clone(arg);
11759         uint64_t ret_ref = tag_ptr(ret_copy, true);
11760         return ret_ref;
11761 }
11762 int64_t  __attribute__((export_name("TS_COption_ClosureReasonZ_clone_ptr"))) TS_COption_ClosureReasonZ_clone_ptr(uint64_t arg) {
11763         LDKCOption_ClosureReasonZ* arg_conv = (LDKCOption_ClosureReasonZ*)untag_ptr(arg);
11764         int64_t ret_conv = COption_ClosureReasonZ_clone_ptr(arg_conv);
11765         return ret_conv;
11766 }
11767
11768 uint64_t  __attribute__((export_name("TS_COption_ClosureReasonZ_clone"))) TS_COption_ClosureReasonZ_clone(uint64_t orig) {
11769         LDKCOption_ClosureReasonZ* orig_conv = (LDKCOption_ClosureReasonZ*)untag_ptr(orig);
11770         LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
11771         *ret_copy = COption_ClosureReasonZ_clone(orig_conv);
11772         uint64_t ret_ref = tag_ptr(ret_copy, true);
11773         return ret_ref;
11774 }
11775
11776 uint64_t  __attribute__((export_name("TS_CResult_COption_ClosureReasonZDecodeErrorZ_ok"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_ok(uint64_t o) {
11777         void* o_ptr = untag_ptr(o);
11778         CHECK_ACCESS(o_ptr);
11779         LDKCOption_ClosureReasonZ o_conv = *(LDKCOption_ClosureReasonZ*)(o_ptr);
11780         o_conv = COption_ClosureReasonZ_clone((LDKCOption_ClosureReasonZ*)untag_ptr(o));
11781         LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
11782         *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_ok(o_conv);
11783         return tag_ptr(ret_conv, true);
11784 }
11785
11786 uint64_t  __attribute__((export_name("TS_CResult_COption_ClosureReasonZDecodeErrorZ_err"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_err(uint64_t e) {
11787         LDKDecodeError e_conv;
11788         e_conv.inner = untag_ptr(e);
11789         e_conv.is_owned = ptr_is_owned(e);
11790         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
11791         e_conv = DecodeError_clone(&e_conv);
11792         LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
11793         *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_err(e_conv);
11794         return tag_ptr(ret_conv, true);
11795 }
11796
11797 jboolean  __attribute__((export_name("TS_CResult_COption_ClosureReasonZDecodeErrorZ_is_ok"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_is_ok(uint64_t o) {
11798         LDKCResult_COption_ClosureReasonZDecodeErrorZ* o_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)untag_ptr(o);
11799         jboolean ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_is_ok(o_conv);
11800         return ret_conv;
11801 }
11802
11803 void  __attribute__((export_name("TS_CResult_COption_ClosureReasonZDecodeErrorZ_free"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_free(uint64_t _res) {
11804         if (!ptr_is_owned(_res)) return;
11805         void* _res_ptr = untag_ptr(_res);
11806         CHECK_ACCESS(_res_ptr);
11807         LDKCResult_COption_ClosureReasonZDecodeErrorZ _res_conv = *(LDKCResult_COption_ClosureReasonZDecodeErrorZ*)(_res_ptr);
11808         FREE(untag_ptr(_res));
11809         CResult_COption_ClosureReasonZDecodeErrorZ_free(_res_conv);
11810 }
11811
11812 static inline uint64_t CResult_COption_ClosureReasonZDecodeErrorZ_clone_ptr(LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR arg) {
11813         LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
11814         *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_clone(arg);
11815         return tag_ptr(ret_conv, true);
11816 }
11817 int64_t  __attribute__((export_name("TS_CResult_COption_ClosureReasonZDecodeErrorZ_clone_ptr"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_clone_ptr(uint64_t arg) {
11818         LDKCResult_COption_ClosureReasonZDecodeErrorZ* arg_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)untag_ptr(arg);
11819         int64_t ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_clone_ptr(arg_conv);
11820         return ret_conv;
11821 }
11822
11823 uint64_t  __attribute__((export_name("TS_CResult_COption_ClosureReasonZDecodeErrorZ_clone"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_clone(uint64_t orig) {
11824         LDKCResult_COption_ClosureReasonZDecodeErrorZ* orig_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)untag_ptr(orig);
11825         LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
11826         *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_clone(orig_conv);
11827         return tag_ptr(ret_conv, true);
11828 }
11829
11830 uint64_t  __attribute__((export_name("TS_COption_HTLCDestinationZ_some"))) TS_COption_HTLCDestinationZ_some(uint64_t o) {
11831         void* o_ptr = untag_ptr(o);
11832         CHECK_ACCESS(o_ptr);
11833         LDKHTLCDestination o_conv = *(LDKHTLCDestination*)(o_ptr);
11834         o_conv = HTLCDestination_clone((LDKHTLCDestination*)untag_ptr(o));
11835         LDKCOption_HTLCDestinationZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCDestinationZ), "LDKCOption_HTLCDestinationZ");
11836         *ret_copy = COption_HTLCDestinationZ_some(o_conv);
11837         uint64_t ret_ref = tag_ptr(ret_copy, true);
11838         return ret_ref;
11839 }
11840
11841 uint64_t  __attribute__((export_name("TS_COption_HTLCDestinationZ_none"))) TS_COption_HTLCDestinationZ_none() {
11842         LDKCOption_HTLCDestinationZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCDestinationZ), "LDKCOption_HTLCDestinationZ");
11843         *ret_copy = COption_HTLCDestinationZ_none();
11844         uint64_t ret_ref = tag_ptr(ret_copy, true);
11845         return ret_ref;
11846 }
11847
11848 void  __attribute__((export_name("TS_COption_HTLCDestinationZ_free"))) TS_COption_HTLCDestinationZ_free(uint64_t _res) {
11849         if (!ptr_is_owned(_res)) return;
11850         void* _res_ptr = untag_ptr(_res);
11851         CHECK_ACCESS(_res_ptr);
11852         LDKCOption_HTLCDestinationZ _res_conv = *(LDKCOption_HTLCDestinationZ*)(_res_ptr);
11853         FREE(untag_ptr(_res));
11854         COption_HTLCDestinationZ_free(_res_conv);
11855 }
11856
11857 static inline uint64_t COption_HTLCDestinationZ_clone_ptr(LDKCOption_HTLCDestinationZ *NONNULL_PTR arg) {
11858         LDKCOption_HTLCDestinationZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCDestinationZ), "LDKCOption_HTLCDestinationZ");
11859         *ret_copy = COption_HTLCDestinationZ_clone(arg);
11860         uint64_t ret_ref = tag_ptr(ret_copy, true);
11861         return ret_ref;
11862 }
11863 int64_t  __attribute__((export_name("TS_COption_HTLCDestinationZ_clone_ptr"))) TS_COption_HTLCDestinationZ_clone_ptr(uint64_t arg) {
11864         LDKCOption_HTLCDestinationZ* arg_conv = (LDKCOption_HTLCDestinationZ*)untag_ptr(arg);
11865         int64_t ret_conv = COption_HTLCDestinationZ_clone_ptr(arg_conv);
11866         return ret_conv;
11867 }
11868
11869 uint64_t  __attribute__((export_name("TS_COption_HTLCDestinationZ_clone"))) TS_COption_HTLCDestinationZ_clone(uint64_t orig) {
11870         LDKCOption_HTLCDestinationZ* orig_conv = (LDKCOption_HTLCDestinationZ*)untag_ptr(orig);
11871         LDKCOption_HTLCDestinationZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCDestinationZ), "LDKCOption_HTLCDestinationZ");
11872         *ret_copy = COption_HTLCDestinationZ_clone(orig_conv);
11873         uint64_t ret_ref = tag_ptr(ret_copy, true);
11874         return ret_ref;
11875 }
11876
11877 uint64_t  __attribute__((export_name("TS_CResult_COption_HTLCDestinationZDecodeErrorZ_ok"))) TS_CResult_COption_HTLCDestinationZDecodeErrorZ_ok(uint64_t o) {
11878         void* o_ptr = untag_ptr(o);
11879         CHECK_ACCESS(o_ptr);
11880         LDKCOption_HTLCDestinationZ o_conv = *(LDKCOption_HTLCDestinationZ*)(o_ptr);
11881         o_conv = COption_HTLCDestinationZ_clone((LDKCOption_HTLCDestinationZ*)untag_ptr(o));
11882         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ), "LDKCResult_COption_HTLCDestinationZDecodeErrorZ");
11883         *ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_ok(o_conv);
11884         return tag_ptr(ret_conv, true);
11885 }
11886
11887 uint64_t  __attribute__((export_name("TS_CResult_COption_HTLCDestinationZDecodeErrorZ_err"))) TS_CResult_COption_HTLCDestinationZDecodeErrorZ_err(uint64_t e) {
11888         LDKDecodeError e_conv;
11889         e_conv.inner = untag_ptr(e);
11890         e_conv.is_owned = ptr_is_owned(e);
11891         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
11892         e_conv = DecodeError_clone(&e_conv);
11893         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ), "LDKCResult_COption_HTLCDestinationZDecodeErrorZ");
11894         *ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_err(e_conv);
11895         return tag_ptr(ret_conv, true);
11896 }
11897
11898 jboolean  __attribute__((export_name("TS_CResult_COption_HTLCDestinationZDecodeErrorZ_is_ok"))) TS_CResult_COption_HTLCDestinationZDecodeErrorZ_is_ok(uint64_t o) {
11899         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* o_conv = (LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)untag_ptr(o);
11900         jboolean ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_is_ok(o_conv);
11901         return ret_conv;
11902 }
11903
11904 void  __attribute__((export_name("TS_CResult_COption_HTLCDestinationZDecodeErrorZ_free"))) TS_CResult_COption_HTLCDestinationZDecodeErrorZ_free(uint64_t _res) {
11905         if (!ptr_is_owned(_res)) return;
11906         void* _res_ptr = untag_ptr(_res);
11907         CHECK_ACCESS(_res_ptr);
11908         LDKCResult_COption_HTLCDestinationZDecodeErrorZ _res_conv = *(LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)(_res_ptr);
11909         FREE(untag_ptr(_res));
11910         CResult_COption_HTLCDestinationZDecodeErrorZ_free(_res_conv);
11911 }
11912
11913 static inline uint64_t CResult_COption_HTLCDestinationZDecodeErrorZ_clone_ptr(LDKCResult_COption_HTLCDestinationZDecodeErrorZ *NONNULL_PTR arg) {
11914         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ), "LDKCResult_COption_HTLCDestinationZDecodeErrorZ");
11915         *ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_clone(arg);
11916         return tag_ptr(ret_conv, true);
11917 }
11918 int64_t  __attribute__((export_name("TS_CResult_COption_HTLCDestinationZDecodeErrorZ_clone_ptr"))) TS_CResult_COption_HTLCDestinationZDecodeErrorZ_clone_ptr(uint64_t arg) {
11919         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* arg_conv = (LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)untag_ptr(arg);
11920         int64_t ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_clone_ptr(arg_conv);
11921         return ret_conv;
11922 }
11923
11924 uint64_t  __attribute__((export_name("TS_CResult_COption_HTLCDestinationZDecodeErrorZ_clone"))) TS_CResult_COption_HTLCDestinationZDecodeErrorZ_clone(uint64_t orig) {
11925         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* orig_conv = (LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)untag_ptr(orig);
11926         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ), "LDKCResult_COption_HTLCDestinationZDecodeErrorZ");
11927         *ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_clone(orig_conv);
11928         return tag_ptr(ret_conv, true);
11929 }
11930
11931 uint64_t  __attribute__((export_name("TS_COption_NetworkUpdateZ_some"))) TS_COption_NetworkUpdateZ_some(uint64_t o) {
11932         void* o_ptr = untag_ptr(o);
11933         CHECK_ACCESS(o_ptr);
11934         LDKNetworkUpdate o_conv = *(LDKNetworkUpdate*)(o_ptr);
11935         o_conv = NetworkUpdate_clone((LDKNetworkUpdate*)untag_ptr(o));
11936         LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
11937         *ret_copy = COption_NetworkUpdateZ_some(o_conv);
11938         uint64_t ret_ref = tag_ptr(ret_copy, true);
11939         return ret_ref;
11940 }
11941
11942 uint64_t  __attribute__((export_name("TS_COption_NetworkUpdateZ_none"))) TS_COption_NetworkUpdateZ_none() {
11943         LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
11944         *ret_copy = COption_NetworkUpdateZ_none();
11945         uint64_t ret_ref = tag_ptr(ret_copy, true);
11946         return ret_ref;
11947 }
11948
11949 void  __attribute__((export_name("TS_COption_NetworkUpdateZ_free"))) TS_COption_NetworkUpdateZ_free(uint64_t _res) {
11950         if (!ptr_is_owned(_res)) return;
11951         void* _res_ptr = untag_ptr(_res);
11952         CHECK_ACCESS(_res_ptr);
11953         LDKCOption_NetworkUpdateZ _res_conv = *(LDKCOption_NetworkUpdateZ*)(_res_ptr);
11954         FREE(untag_ptr(_res));
11955         COption_NetworkUpdateZ_free(_res_conv);
11956 }
11957
11958 static inline uint64_t COption_NetworkUpdateZ_clone_ptr(LDKCOption_NetworkUpdateZ *NONNULL_PTR arg) {
11959         LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
11960         *ret_copy = COption_NetworkUpdateZ_clone(arg);
11961         uint64_t ret_ref = tag_ptr(ret_copy, true);
11962         return ret_ref;
11963 }
11964 int64_t  __attribute__((export_name("TS_COption_NetworkUpdateZ_clone_ptr"))) TS_COption_NetworkUpdateZ_clone_ptr(uint64_t arg) {
11965         LDKCOption_NetworkUpdateZ* arg_conv = (LDKCOption_NetworkUpdateZ*)untag_ptr(arg);
11966         int64_t ret_conv = COption_NetworkUpdateZ_clone_ptr(arg_conv);
11967         return ret_conv;
11968 }
11969
11970 uint64_t  __attribute__((export_name("TS_COption_NetworkUpdateZ_clone"))) TS_COption_NetworkUpdateZ_clone(uint64_t orig) {
11971         LDKCOption_NetworkUpdateZ* orig_conv = (LDKCOption_NetworkUpdateZ*)untag_ptr(orig);
11972         LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
11973         *ret_copy = COption_NetworkUpdateZ_clone(orig_conv);
11974         uint64_t ret_ref = tag_ptr(ret_copy, true);
11975         return ret_ref;
11976 }
11977
11978 void  __attribute__((export_name("TS_CVec_SpendableOutputDescriptorZ_free"))) TS_CVec_SpendableOutputDescriptorZ_free(uint64_tArray _res) {
11979         LDKCVec_SpendableOutputDescriptorZ _res_constr;
11980         _res_constr.datalen = _res->arr_len;
11981         if (_res_constr.datalen > 0)
11982                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
11983         else
11984                 _res_constr.data = NULL;
11985         uint64_t* _res_vals = _res->elems;
11986         for (size_t b = 0; b < _res_constr.datalen; b++) {
11987                 uint64_t _res_conv_27 = _res_vals[b];
11988                 void* _res_conv_27_ptr = untag_ptr(_res_conv_27);
11989                 CHECK_ACCESS(_res_conv_27_ptr);
11990                 LDKSpendableOutputDescriptor _res_conv_27_conv = *(LDKSpendableOutputDescriptor*)(_res_conv_27_ptr);
11991                 FREE(untag_ptr(_res_conv_27));
11992                 _res_constr.data[b] = _res_conv_27_conv;
11993         }
11994         FREE(_res);
11995         CVec_SpendableOutputDescriptorZ_free(_res_constr);
11996 }
11997
11998 uint64_t  __attribute__((export_name("TS_COption_EventZ_some"))) TS_COption_EventZ_some(uint64_t o) {
11999         void* o_ptr = untag_ptr(o);
12000         CHECK_ACCESS(o_ptr);
12001         LDKEvent o_conv = *(LDKEvent*)(o_ptr);
12002         o_conv = Event_clone((LDKEvent*)untag_ptr(o));
12003         LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
12004         *ret_copy = COption_EventZ_some(o_conv);
12005         uint64_t ret_ref = tag_ptr(ret_copy, true);
12006         return ret_ref;
12007 }
12008
12009 uint64_t  __attribute__((export_name("TS_COption_EventZ_none"))) TS_COption_EventZ_none() {
12010         LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
12011         *ret_copy = COption_EventZ_none();
12012         uint64_t ret_ref = tag_ptr(ret_copy, true);
12013         return ret_ref;
12014 }
12015
12016 void  __attribute__((export_name("TS_COption_EventZ_free"))) TS_COption_EventZ_free(uint64_t _res) {
12017         if (!ptr_is_owned(_res)) return;
12018         void* _res_ptr = untag_ptr(_res);
12019         CHECK_ACCESS(_res_ptr);
12020         LDKCOption_EventZ _res_conv = *(LDKCOption_EventZ*)(_res_ptr);
12021         FREE(untag_ptr(_res));
12022         COption_EventZ_free(_res_conv);
12023 }
12024
12025 static inline uint64_t COption_EventZ_clone_ptr(LDKCOption_EventZ *NONNULL_PTR arg) {
12026         LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
12027         *ret_copy = COption_EventZ_clone(arg);
12028         uint64_t ret_ref = tag_ptr(ret_copy, true);
12029         return ret_ref;
12030 }
12031 int64_t  __attribute__((export_name("TS_COption_EventZ_clone_ptr"))) TS_COption_EventZ_clone_ptr(uint64_t arg) {
12032         LDKCOption_EventZ* arg_conv = (LDKCOption_EventZ*)untag_ptr(arg);
12033         int64_t ret_conv = COption_EventZ_clone_ptr(arg_conv);
12034         return ret_conv;
12035 }
12036
12037 uint64_t  __attribute__((export_name("TS_COption_EventZ_clone"))) TS_COption_EventZ_clone(uint64_t orig) {
12038         LDKCOption_EventZ* orig_conv = (LDKCOption_EventZ*)untag_ptr(orig);
12039         LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
12040         *ret_copy = COption_EventZ_clone(orig_conv);
12041         uint64_t ret_ref = tag_ptr(ret_copy, true);
12042         return ret_ref;
12043 }
12044
12045 uint64_t  __attribute__((export_name("TS_CResult_COption_EventZDecodeErrorZ_ok"))) TS_CResult_COption_EventZDecodeErrorZ_ok(uint64_t o) {
12046         void* o_ptr = untag_ptr(o);
12047         CHECK_ACCESS(o_ptr);
12048         LDKCOption_EventZ o_conv = *(LDKCOption_EventZ*)(o_ptr);
12049         o_conv = COption_EventZ_clone((LDKCOption_EventZ*)untag_ptr(o));
12050         LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
12051         *ret_conv = CResult_COption_EventZDecodeErrorZ_ok(o_conv);
12052         return tag_ptr(ret_conv, true);
12053 }
12054
12055 uint64_t  __attribute__((export_name("TS_CResult_COption_EventZDecodeErrorZ_err"))) TS_CResult_COption_EventZDecodeErrorZ_err(uint64_t e) {
12056         LDKDecodeError e_conv;
12057         e_conv.inner = untag_ptr(e);
12058         e_conv.is_owned = ptr_is_owned(e);
12059         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
12060         e_conv = DecodeError_clone(&e_conv);
12061         LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
12062         *ret_conv = CResult_COption_EventZDecodeErrorZ_err(e_conv);
12063         return tag_ptr(ret_conv, true);
12064 }
12065
12066 jboolean  __attribute__((export_name("TS_CResult_COption_EventZDecodeErrorZ_is_ok"))) TS_CResult_COption_EventZDecodeErrorZ_is_ok(uint64_t o) {
12067         LDKCResult_COption_EventZDecodeErrorZ* o_conv = (LDKCResult_COption_EventZDecodeErrorZ*)untag_ptr(o);
12068         jboolean ret_conv = CResult_COption_EventZDecodeErrorZ_is_ok(o_conv);
12069         return ret_conv;
12070 }
12071
12072 void  __attribute__((export_name("TS_CResult_COption_EventZDecodeErrorZ_free"))) TS_CResult_COption_EventZDecodeErrorZ_free(uint64_t _res) {
12073         if (!ptr_is_owned(_res)) return;
12074         void* _res_ptr = untag_ptr(_res);
12075         CHECK_ACCESS(_res_ptr);
12076         LDKCResult_COption_EventZDecodeErrorZ _res_conv = *(LDKCResult_COption_EventZDecodeErrorZ*)(_res_ptr);
12077         FREE(untag_ptr(_res));
12078         CResult_COption_EventZDecodeErrorZ_free(_res_conv);
12079 }
12080
12081 static inline uint64_t CResult_COption_EventZDecodeErrorZ_clone_ptr(LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR arg) {
12082         LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
12083         *ret_conv = CResult_COption_EventZDecodeErrorZ_clone(arg);
12084         return tag_ptr(ret_conv, true);
12085 }
12086 int64_t  __attribute__((export_name("TS_CResult_COption_EventZDecodeErrorZ_clone_ptr"))) TS_CResult_COption_EventZDecodeErrorZ_clone_ptr(uint64_t arg) {
12087         LDKCResult_COption_EventZDecodeErrorZ* arg_conv = (LDKCResult_COption_EventZDecodeErrorZ*)untag_ptr(arg);
12088         int64_t ret_conv = CResult_COption_EventZDecodeErrorZ_clone_ptr(arg_conv);
12089         return ret_conv;
12090 }
12091
12092 uint64_t  __attribute__((export_name("TS_CResult_COption_EventZDecodeErrorZ_clone"))) TS_CResult_COption_EventZDecodeErrorZ_clone(uint64_t orig) {
12093         LDKCResult_COption_EventZDecodeErrorZ* orig_conv = (LDKCResult_COption_EventZDecodeErrorZ*)untag_ptr(orig);
12094         LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
12095         *ret_conv = CResult_COption_EventZDecodeErrorZ_clone(orig_conv);
12096         return tag_ptr(ret_conv, true);
12097 }
12098
12099 void  __attribute__((export_name("TS_CVec_MessageSendEventZ_free"))) TS_CVec_MessageSendEventZ_free(uint64_tArray _res) {
12100         LDKCVec_MessageSendEventZ _res_constr;
12101         _res_constr.datalen = _res->arr_len;
12102         if (_res_constr.datalen > 0)
12103                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
12104         else
12105                 _res_constr.data = NULL;
12106         uint64_t* _res_vals = _res->elems;
12107         for (size_t s = 0; s < _res_constr.datalen; s++) {
12108                 uint64_t _res_conv_18 = _res_vals[s];
12109                 void* _res_conv_18_ptr = untag_ptr(_res_conv_18);
12110                 CHECK_ACCESS(_res_conv_18_ptr);
12111                 LDKMessageSendEvent _res_conv_18_conv = *(LDKMessageSendEvent*)(_res_conv_18_ptr);
12112                 FREE(untag_ptr(_res_conv_18));
12113                 _res_constr.data[s] = _res_conv_18_conv;
12114         }
12115         FREE(_res);
12116         CVec_MessageSendEventZ_free(_res_constr);
12117 }
12118
12119 uint64_t  __attribute__((export_name("TS_CResult_TxOutAccessErrorZ_ok"))) TS_CResult_TxOutAccessErrorZ_ok(uint64_t o) {
12120         void* o_ptr = untag_ptr(o);
12121         CHECK_ACCESS(o_ptr);
12122         LDKTxOut o_conv = *(LDKTxOut*)(o_ptr);
12123         o_conv = TxOut_clone((LDKTxOut*)untag_ptr(o));
12124         LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
12125         *ret_conv = CResult_TxOutAccessErrorZ_ok(o_conv);
12126         return tag_ptr(ret_conv, true);
12127 }
12128
12129 uint64_t  __attribute__((export_name("TS_CResult_TxOutAccessErrorZ_err"))) TS_CResult_TxOutAccessErrorZ_err(uint32_t e) {
12130         LDKAccessError e_conv = LDKAccessError_from_js(e);
12131         LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
12132         *ret_conv = CResult_TxOutAccessErrorZ_err(e_conv);
12133         return tag_ptr(ret_conv, true);
12134 }
12135
12136 jboolean  __attribute__((export_name("TS_CResult_TxOutAccessErrorZ_is_ok"))) TS_CResult_TxOutAccessErrorZ_is_ok(uint64_t o) {
12137         LDKCResult_TxOutAccessErrorZ* o_conv = (LDKCResult_TxOutAccessErrorZ*)untag_ptr(o);
12138         jboolean ret_conv = CResult_TxOutAccessErrorZ_is_ok(o_conv);
12139         return ret_conv;
12140 }
12141
12142 void  __attribute__((export_name("TS_CResult_TxOutAccessErrorZ_free"))) TS_CResult_TxOutAccessErrorZ_free(uint64_t _res) {
12143         if (!ptr_is_owned(_res)) return;
12144         void* _res_ptr = untag_ptr(_res);
12145         CHECK_ACCESS(_res_ptr);
12146         LDKCResult_TxOutAccessErrorZ _res_conv = *(LDKCResult_TxOutAccessErrorZ*)(_res_ptr);
12147         FREE(untag_ptr(_res));
12148         CResult_TxOutAccessErrorZ_free(_res_conv);
12149 }
12150
12151 static inline uint64_t CResult_TxOutAccessErrorZ_clone_ptr(LDKCResult_TxOutAccessErrorZ *NONNULL_PTR arg) {
12152         LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
12153         *ret_conv = CResult_TxOutAccessErrorZ_clone(arg);
12154         return tag_ptr(ret_conv, true);
12155 }
12156 int64_t  __attribute__((export_name("TS_CResult_TxOutAccessErrorZ_clone_ptr"))) TS_CResult_TxOutAccessErrorZ_clone_ptr(uint64_t arg) {
12157         LDKCResult_TxOutAccessErrorZ* arg_conv = (LDKCResult_TxOutAccessErrorZ*)untag_ptr(arg);
12158         int64_t ret_conv = CResult_TxOutAccessErrorZ_clone_ptr(arg_conv);
12159         return ret_conv;
12160 }
12161
12162 uint64_t  __attribute__((export_name("TS_CResult_TxOutAccessErrorZ_clone"))) TS_CResult_TxOutAccessErrorZ_clone(uint64_t orig) {
12163         LDKCResult_TxOutAccessErrorZ* orig_conv = (LDKCResult_TxOutAccessErrorZ*)untag_ptr(orig);
12164         LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
12165         *ret_conv = CResult_TxOutAccessErrorZ_clone(orig_conv);
12166         return tag_ptr(ret_conv, true);
12167 }
12168
12169 static inline uint64_t C2Tuple_usizeTransactionZ_clone_ptr(LDKC2Tuple_usizeTransactionZ *NONNULL_PTR arg) {
12170         LDKC2Tuple_usizeTransactionZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
12171         *ret_conv = C2Tuple_usizeTransactionZ_clone(arg);
12172         return tag_ptr(ret_conv, true);
12173 }
12174 int64_t  __attribute__((export_name("TS_C2Tuple_usizeTransactionZ_clone_ptr"))) TS_C2Tuple_usizeTransactionZ_clone_ptr(uint64_t arg) {
12175         LDKC2Tuple_usizeTransactionZ* arg_conv = (LDKC2Tuple_usizeTransactionZ*)untag_ptr(arg);
12176         int64_t ret_conv = C2Tuple_usizeTransactionZ_clone_ptr(arg_conv);
12177         return ret_conv;
12178 }
12179
12180 uint64_t  __attribute__((export_name("TS_C2Tuple_usizeTransactionZ_clone"))) TS_C2Tuple_usizeTransactionZ_clone(uint64_t orig) {
12181         LDKC2Tuple_usizeTransactionZ* orig_conv = (LDKC2Tuple_usizeTransactionZ*)untag_ptr(orig);
12182         LDKC2Tuple_usizeTransactionZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
12183         *ret_conv = C2Tuple_usizeTransactionZ_clone(orig_conv);
12184         return tag_ptr(ret_conv, true);
12185 }
12186
12187 uint64_t  __attribute__((export_name("TS_C2Tuple_usizeTransactionZ_new"))) TS_C2Tuple_usizeTransactionZ_new(uint32_t a, int8_tArray b) {
12188         LDKTransaction b_ref;
12189         b_ref.datalen = b->arr_len;
12190         b_ref.data = MALLOC(b_ref.datalen, "LDKTransaction Bytes");
12191         memcpy(b_ref.data, b->elems, b_ref.datalen); FREE(b);
12192         b_ref.data_is_owned = true;
12193         LDKC2Tuple_usizeTransactionZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
12194         *ret_conv = C2Tuple_usizeTransactionZ_new(a, b_ref);
12195         return tag_ptr(ret_conv, true);
12196 }
12197
12198 void  __attribute__((export_name("TS_C2Tuple_usizeTransactionZ_free"))) TS_C2Tuple_usizeTransactionZ_free(uint64_t _res) {
12199         if (!ptr_is_owned(_res)) return;
12200         void* _res_ptr = untag_ptr(_res);
12201         CHECK_ACCESS(_res_ptr);
12202         LDKC2Tuple_usizeTransactionZ _res_conv = *(LDKC2Tuple_usizeTransactionZ*)(_res_ptr);
12203         FREE(untag_ptr(_res));
12204         C2Tuple_usizeTransactionZ_free(_res_conv);
12205 }
12206
12207 void  __attribute__((export_name("TS_CVec_C2Tuple_usizeTransactionZZ_free"))) TS_CVec_C2Tuple_usizeTransactionZZ_free(uint64_tArray _res) {
12208         LDKCVec_C2Tuple_usizeTransactionZZ _res_constr;
12209         _res_constr.datalen = _res->arr_len;
12210         if (_res_constr.datalen > 0)
12211                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
12212         else
12213                 _res_constr.data = NULL;
12214         uint64_t* _res_vals = _res->elems;
12215         for (size_t c = 0; c < _res_constr.datalen; c++) {
12216                 uint64_t _res_conv_28 = _res_vals[c];
12217                 void* _res_conv_28_ptr = untag_ptr(_res_conv_28);
12218                 CHECK_ACCESS(_res_conv_28_ptr);
12219                 LDKC2Tuple_usizeTransactionZ _res_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(_res_conv_28_ptr);
12220                 FREE(untag_ptr(_res_conv_28));
12221                 _res_constr.data[c] = _res_conv_28_conv;
12222         }
12223         FREE(_res);
12224         CVec_C2Tuple_usizeTransactionZZ_free(_res_constr);
12225 }
12226
12227 void  __attribute__((export_name("TS_CVec_TxidZ_free"))) TS_CVec_TxidZ_free(ptrArray _res) {
12228         LDKCVec_TxidZ _res_constr;
12229         _res_constr.datalen = _res->arr_len;
12230         if (_res_constr.datalen > 0)
12231                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_TxidZ Elements");
12232         else
12233                 _res_constr.data = NULL;
12234         int8_tArray* _res_vals = (void*) _res->elems;
12235         for (size_t m = 0; m < _res_constr.datalen; m++) {
12236                 int8_tArray _res_conv_12 = _res_vals[m];
12237                 LDKThirtyTwoBytes _res_conv_12_ref;
12238                 CHECK(_res_conv_12->arr_len == 32);
12239                 memcpy(_res_conv_12_ref.data, _res_conv_12->elems, 32); FREE(_res_conv_12);
12240                 _res_constr.data[m] = _res_conv_12_ref;
12241         }
12242         FREE(_res);
12243         CVec_TxidZ_free(_res_constr);
12244 }
12245
12246 uint64_t  __attribute__((export_name("TS_CResult_NoneChannelMonitorUpdateErrZ_ok"))) TS_CResult_NoneChannelMonitorUpdateErrZ_ok() {
12247         LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
12248         *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_ok();
12249         return tag_ptr(ret_conv, true);
12250 }
12251
12252 uint64_t  __attribute__((export_name("TS_CResult_NoneChannelMonitorUpdateErrZ_err"))) TS_CResult_NoneChannelMonitorUpdateErrZ_err(uint32_t e) {
12253         LDKChannelMonitorUpdateErr e_conv = LDKChannelMonitorUpdateErr_from_js(e);
12254         LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
12255         *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_err(e_conv);
12256         return tag_ptr(ret_conv, true);
12257 }
12258
12259 jboolean  __attribute__((export_name("TS_CResult_NoneChannelMonitorUpdateErrZ_is_ok"))) TS_CResult_NoneChannelMonitorUpdateErrZ_is_ok(uint64_t o) {
12260         LDKCResult_NoneChannelMonitorUpdateErrZ* o_conv = (LDKCResult_NoneChannelMonitorUpdateErrZ*)untag_ptr(o);
12261         jboolean ret_conv = CResult_NoneChannelMonitorUpdateErrZ_is_ok(o_conv);
12262         return ret_conv;
12263 }
12264
12265 void  __attribute__((export_name("TS_CResult_NoneChannelMonitorUpdateErrZ_free"))) TS_CResult_NoneChannelMonitorUpdateErrZ_free(uint64_t _res) {
12266         if (!ptr_is_owned(_res)) return;
12267         void* _res_ptr = untag_ptr(_res);
12268         CHECK_ACCESS(_res_ptr);
12269         LDKCResult_NoneChannelMonitorUpdateErrZ _res_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(_res_ptr);
12270         FREE(untag_ptr(_res));
12271         CResult_NoneChannelMonitorUpdateErrZ_free(_res_conv);
12272 }
12273
12274 static inline uint64_t CResult_NoneChannelMonitorUpdateErrZ_clone_ptr(LDKCResult_NoneChannelMonitorUpdateErrZ *NONNULL_PTR arg) {
12275         LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
12276         *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone(arg);
12277         return tag_ptr(ret_conv, true);
12278 }
12279 int64_t  __attribute__((export_name("TS_CResult_NoneChannelMonitorUpdateErrZ_clone_ptr"))) TS_CResult_NoneChannelMonitorUpdateErrZ_clone_ptr(uint64_t arg) {
12280         LDKCResult_NoneChannelMonitorUpdateErrZ* arg_conv = (LDKCResult_NoneChannelMonitorUpdateErrZ*)untag_ptr(arg);
12281         int64_t ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone_ptr(arg_conv);
12282         return ret_conv;
12283 }
12284
12285 uint64_t  __attribute__((export_name("TS_CResult_NoneChannelMonitorUpdateErrZ_clone"))) TS_CResult_NoneChannelMonitorUpdateErrZ_clone(uint64_t orig) {
12286         LDKCResult_NoneChannelMonitorUpdateErrZ* orig_conv = (LDKCResult_NoneChannelMonitorUpdateErrZ*)untag_ptr(orig);
12287         LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
12288         *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone(orig_conv);
12289         return tag_ptr(ret_conv, true);
12290 }
12291
12292 void  __attribute__((export_name("TS_CVec_MonitorEventZ_free"))) TS_CVec_MonitorEventZ_free(uint64_tArray _res) {
12293         LDKCVec_MonitorEventZ _res_constr;
12294         _res_constr.datalen = _res->arr_len;
12295         if (_res_constr.datalen > 0)
12296                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
12297         else
12298                 _res_constr.data = NULL;
12299         uint64_t* _res_vals = _res->elems;
12300         for (size_t o = 0; o < _res_constr.datalen; o++) {
12301                 uint64_t _res_conv_14 = _res_vals[o];
12302                 void* _res_conv_14_ptr = untag_ptr(_res_conv_14);
12303                 CHECK_ACCESS(_res_conv_14_ptr);
12304                 LDKMonitorEvent _res_conv_14_conv = *(LDKMonitorEvent*)(_res_conv_14_ptr);
12305                 FREE(untag_ptr(_res_conv_14));
12306                 _res_constr.data[o] = _res_conv_14_conv;
12307         }
12308         FREE(_res);
12309         CVec_MonitorEventZ_free(_res_constr);
12310 }
12311
12312 static inline uint64_t C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone_ptr(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ *NONNULL_PTR arg) {
12313         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ), "LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ");
12314         *ret_conv = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone(arg);
12315         return tag_ptr(ret_conv, true);
12316 }
12317 int64_t  __attribute__((export_name("TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone_ptr"))) TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone_ptr(uint64_t arg) {
12318         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* arg_conv = (LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)untag_ptr(arg);
12319         int64_t ret_conv = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone_ptr(arg_conv);
12320         return ret_conv;
12321 }
12322
12323 uint64_t  __attribute__((export_name("TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone"))) TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone(uint64_t orig) {
12324         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* orig_conv = (LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)untag_ptr(orig);
12325         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ), "LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ");
12326         *ret_conv = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone(orig_conv);
12327         return tag_ptr(ret_conv, true);
12328 }
12329
12330 uint64_t  __attribute__((export_name("TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_new"))) TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_new(uint64_t a, uint64_tArray b, int8_tArray c) {
12331         LDKOutPoint a_conv;
12332         a_conv.inner = untag_ptr(a);
12333         a_conv.is_owned = ptr_is_owned(a);
12334         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
12335         a_conv = OutPoint_clone(&a_conv);
12336         LDKCVec_MonitorEventZ b_constr;
12337         b_constr.datalen = b->arr_len;
12338         if (b_constr.datalen > 0)
12339                 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
12340         else
12341                 b_constr.data = NULL;
12342         uint64_t* b_vals = b->elems;
12343         for (size_t o = 0; o < b_constr.datalen; o++) {
12344                 uint64_t b_conv_14 = b_vals[o];
12345                 void* b_conv_14_ptr = untag_ptr(b_conv_14);
12346                 CHECK_ACCESS(b_conv_14_ptr);
12347                 LDKMonitorEvent b_conv_14_conv = *(LDKMonitorEvent*)(b_conv_14_ptr);
12348                 b_conv_14_conv = MonitorEvent_clone((LDKMonitorEvent*)untag_ptr(b_conv_14));
12349                 b_constr.data[o] = b_conv_14_conv;
12350         }
12351         FREE(b);
12352         LDKPublicKey c_ref;
12353         CHECK(c->arr_len == 33);
12354         memcpy(c_ref.compressed_form, c->elems, 33); FREE(c);
12355         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ), "LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ");
12356         *ret_conv = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_new(a_conv, b_constr, c_ref);
12357         return tag_ptr(ret_conv, true);
12358 }
12359
12360 void  __attribute__((export_name("TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_free"))) TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_free(uint64_t _res) {
12361         if (!ptr_is_owned(_res)) return;
12362         void* _res_ptr = untag_ptr(_res);
12363         CHECK_ACCESS(_res_ptr);
12364         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ _res_conv = *(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)(_res_ptr);
12365         FREE(untag_ptr(_res));
12366         C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_free(_res_conv);
12367 }
12368
12369 void  __attribute__((export_name("TS_CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ_free"))) TS_CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ_free(uint64_tArray _res) {
12370         LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ _res_constr;
12371         _res_constr.datalen = _res->arr_len;
12372         if (_res_constr.datalen > 0)
12373                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ), "LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ Elements");
12374         else
12375                 _res_constr.data = NULL;
12376         uint64_t* _res_vals = _res->elems;
12377         for (size_t x = 0; x < _res_constr.datalen; x++) {
12378                 uint64_t _res_conv_49 = _res_vals[x];
12379                 void* _res_conv_49_ptr = untag_ptr(_res_conv_49);
12380                 CHECK_ACCESS(_res_conv_49_ptr);
12381                 LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ _res_conv_49_conv = *(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)(_res_conv_49_ptr);
12382                 FREE(untag_ptr(_res_conv_49));
12383                 _res_constr.data[x] = _res_conv_49_conv;
12384         }
12385         FREE(_res);
12386         CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ_free(_res_constr);
12387 }
12388
12389 uint64_t  __attribute__((export_name("TS_COption_C2Tuple_usizeTransactionZZ_some"))) TS_COption_C2Tuple_usizeTransactionZZ_some(uint64_t o) {
12390         void* o_ptr = untag_ptr(o);
12391         CHECK_ACCESS(o_ptr);
12392         LDKC2Tuple_usizeTransactionZ o_conv = *(LDKC2Tuple_usizeTransactionZ*)(o_ptr);
12393         o_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)untag_ptr(o));
12394         LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
12395         *ret_copy = COption_C2Tuple_usizeTransactionZZ_some(o_conv);
12396         uint64_t ret_ref = tag_ptr(ret_copy, true);
12397         return ret_ref;
12398 }
12399
12400 uint64_t  __attribute__((export_name("TS_COption_C2Tuple_usizeTransactionZZ_none"))) TS_COption_C2Tuple_usizeTransactionZZ_none() {
12401         LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
12402         *ret_copy = COption_C2Tuple_usizeTransactionZZ_none();
12403         uint64_t ret_ref = tag_ptr(ret_copy, true);
12404         return ret_ref;
12405 }
12406
12407 void  __attribute__((export_name("TS_COption_C2Tuple_usizeTransactionZZ_free"))) TS_COption_C2Tuple_usizeTransactionZZ_free(uint64_t _res) {
12408         if (!ptr_is_owned(_res)) return;
12409         void* _res_ptr = untag_ptr(_res);
12410         CHECK_ACCESS(_res_ptr);
12411         LDKCOption_C2Tuple_usizeTransactionZZ _res_conv = *(LDKCOption_C2Tuple_usizeTransactionZZ*)(_res_ptr);
12412         FREE(untag_ptr(_res));
12413         COption_C2Tuple_usizeTransactionZZ_free(_res_conv);
12414 }
12415
12416 static inline uint64_t COption_C2Tuple_usizeTransactionZZ_clone_ptr(LDKCOption_C2Tuple_usizeTransactionZZ *NONNULL_PTR arg) {
12417         LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
12418         *ret_copy = COption_C2Tuple_usizeTransactionZZ_clone(arg);
12419         uint64_t ret_ref = tag_ptr(ret_copy, true);
12420         return ret_ref;
12421 }
12422 int64_t  __attribute__((export_name("TS_COption_C2Tuple_usizeTransactionZZ_clone_ptr"))) TS_COption_C2Tuple_usizeTransactionZZ_clone_ptr(uint64_t arg) {
12423         LDKCOption_C2Tuple_usizeTransactionZZ* arg_conv = (LDKCOption_C2Tuple_usizeTransactionZZ*)untag_ptr(arg);
12424         int64_t ret_conv = COption_C2Tuple_usizeTransactionZZ_clone_ptr(arg_conv);
12425         return ret_conv;
12426 }
12427
12428 uint64_t  __attribute__((export_name("TS_COption_C2Tuple_usizeTransactionZZ_clone"))) TS_COption_C2Tuple_usizeTransactionZZ_clone(uint64_t orig) {
12429         LDKCOption_C2Tuple_usizeTransactionZZ* orig_conv = (LDKCOption_C2Tuple_usizeTransactionZZ*)untag_ptr(orig);
12430         LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
12431         *ret_copy = COption_C2Tuple_usizeTransactionZZ_clone(orig_conv);
12432         uint64_t ret_ref = tag_ptr(ret_copy, true);
12433         return ret_ref;
12434 }
12435
12436 uint64_t  __attribute__((export_name("TS_CResult_FixedPenaltyScorerDecodeErrorZ_ok"))) TS_CResult_FixedPenaltyScorerDecodeErrorZ_ok(uint64_t o) {
12437         LDKFixedPenaltyScorer o_conv;
12438         o_conv.inner = untag_ptr(o);
12439         o_conv.is_owned = ptr_is_owned(o);
12440         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12441         o_conv = FixedPenaltyScorer_clone(&o_conv);
12442         LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
12443         *ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_ok(o_conv);
12444         return tag_ptr(ret_conv, true);
12445 }
12446
12447 uint64_t  __attribute__((export_name("TS_CResult_FixedPenaltyScorerDecodeErrorZ_err"))) TS_CResult_FixedPenaltyScorerDecodeErrorZ_err(uint64_t e) {
12448         LDKDecodeError e_conv;
12449         e_conv.inner = untag_ptr(e);
12450         e_conv.is_owned = ptr_is_owned(e);
12451         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
12452         e_conv = DecodeError_clone(&e_conv);
12453         LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
12454         *ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_err(e_conv);
12455         return tag_ptr(ret_conv, true);
12456 }
12457
12458 jboolean  __attribute__((export_name("TS_CResult_FixedPenaltyScorerDecodeErrorZ_is_ok"))) TS_CResult_FixedPenaltyScorerDecodeErrorZ_is_ok(uint64_t o) {
12459         LDKCResult_FixedPenaltyScorerDecodeErrorZ* o_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)untag_ptr(o);
12460         jboolean ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_is_ok(o_conv);
12461         return ret_conv;
12462 }
12463
12464 void  __attribute__((export_name("TS_CResult_FixedPenaltyScorerDecodeErrorZ_free"))) TS_CResult_FixedPenaltyScorerDecodeErrorZ_free(uint64_t _res) {
12465         if (!ptr_is_owned(_res)) return;
12466         void* _res_ptr = untag_ptr(_res);
12467         CHECK_ACCESS(_res_ptr);
12468         LDKCResult_FixedPenaltyScorerDecodeErrorZ _res_conv = *(LDKCResult_FixedPenaltyScorerDecodeErrorZ*)(_res_ptr);
12469         FREE(untag_ptr(_res));
12470         CResult_FixedPenaltyScorerDecodeErrorZ_free(_res_conv);
12471 }
12472
12473 static inline uint64_t CResult_FixedPenaltyScorerDecodeErrorZ_clone_ptr(LDKCResult_FixedPenaltyScorerDecodeErrorZ *NONNULL_PTR arg) {
12474         LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
12475         *ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_clone(arg);
12476         return tag_ptr(ret_conv, true);
12477 }
12478 int64_t  __attribute__((export_name("TS_CResult_FixedPenaltyScorerDecodeErrorZ_clone_ptr"))) TS_CResult_FixedPenaltyScorerDecodeErrorZ_clone_ptr(uint64_t arg) {
12479         LDKCResult_FixedPenaltyScorerDecodeErrorZ* arg_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)untag_ptr(arg);
12480         int64_t ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_clone_ptr(arg_conv);
12481         return ret_conv;
12482 }
12483
12484 uint64_t  __attribute__((export_name("TS_CResult_FixedPenaltyScorerDecodeErrorZ_clone"))) TS_CResult_FixedPenaltyScorerDecodeErrorZ_clone(uint64_t orig) {
12485         LDKCResult_FixedPenaltyScorerDecodeErrorZ* orig_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)untag_ptr(orig);
12486         LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
12487         *ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_clone(orig_conv);
12488         return tag_ptr(ret_conv, true);
12489 }
12490
12491 static inline uint64_t C2Tuple_u64u64Z_clone_ptr(LDKC2Tuple_u64u64Z *NONNULL_PTR arg) {
12492         LDKC2Tuple_u64u64Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
12493         *ret_conv = C2Tuple_u64u64Z_clone(arg);
12494         return tag_ptr(ret_conv, true);
12495 }
12496 int64_t  __attribute__((export_name("TS_C2Tuple_u64u64Z_clone_ptr"))) TS_C2Tuple_u64u64Z_clone_ptr(uint64_t arg) {
12497         LDKC2Tuple_u64u64Z* arg_conv = (LDKC2Tuple_u64u64Z*)untag_ptr(arg);
12498         int64_t ret_conv = C2Tuple_u64u64Z_clone_ptr(arg_conv);
12499         return ret_conv;
12500 }
12501
12502 uint64_t  __attribute__((export_name("TS_C2Tuple_u64u64Z_clone"))) TS_C2Tuple_u64u64Z_clone(uint64_t orig) {
12503         LDKC2Tuple_u64u64Z* orig_conv = (LDKC2Tuple_u64u64Z*)untag_ptr(orig);
12504         LDKC2Tuple_u64u64Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
12505         *ret_conv = C2Tuple_u64u64Z_clone(orig_conv);
12506         return tag_ptr(ret_conv, true);
12507 }
12508
12509 uint64_t  __attribute__((export_name("TS_C2Tuple_u64u64Z_new"))) TS_C2Tuple_u64u64Z_new(int64_t a, int64_t b) {
12510         LDKC2Tuple_u64u64Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
12511         *ret_conv = C2Tuple_u64u64Z_new(a, b);
12512         return tag_ptr(ret_conv, true);
12513 }
12514
12515 void  __attribute__((export_name("TS_C2Tuple_u64u64Z_free"))) TS_C2Tuple_u64u64Z_free(uint64_t _res) {
12516         if (!ptr_is_owned(_res)) return;
12517         void* _res_ptr = untag_ptr(_res);
12518         CHECK_ACCESS(_res_ptr);
12519         LDKC2Tuple_u64u64Z _res_conv = *(LDKC2Tuple_u64u64Z*)(_res_ptr);
12520         FREE(untag_ptr(_res));
12521         C2Tuple_u64u64Z_free(_res_conv);
12522 }
12523
12524 uint64_t  __attribute__((export_name("TS_COption_C2Tuple_u64u64ZZ_some"))) TS_COption_C2Tuple_u64u64ZZ_some(uint64_t o) {
12525         void* o_ptr = untag_ptr(o);
12526         CHECK_ACCESS(o_ptr);
12527         LDKC2Tuple_u64u64Z o_conv = *(LDKC2Tuple_u64u64Z*)(o_ptr);
12528         o_conv = C2Tuple_u64u64Z_clone((LDKC2Tuple_u64u64Z*)untag_ptr(o));
12529         LDKCOption_C2Tuple_u64u64ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u64ZZ), "LDKCOption_C2Tuple_u64u64ZZ");
12530         *ret_copy = COption_C2Tuple_u64u64ZZ_some(o_conv);
12531         uint64_t ret_ref = tag_ptr(ret_copy, true);
12532         return ret_ref;
12533 }
12534
12535 uint64_t  __attribute__((export_name("TS_COption_C2Tuple_u64u64ZZ_none"))) TS_COption_C2Tuple_u64u64ZZ_none() {
12536         LDKCOption_C2Tuple_u64u64ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u64ZZ), "LDKCOption_C2Tuple_u64u64ZZ");
12537         *ret_copy = COption_C2Tuple_u64u64ZZ_none();
12538         uint64_t ret_ref = tag_ptr(ret_copy, true);
12539         return ret_ref;
12540 }
12541
12542 void  __attribute__((export_name("TS_COption_C2Tuple_u64u64ZZ_free"))) TS_COption_C2Tuple_u64u64ZZ_free(uint64_t _res) {
12543         if (!ptr_is_owned(_res)) return;
12544         void* _res_ptr = untag_ptr(_res);
12545         CHECK_ACCESS(_res_ptr);
12546         LDKCOption_C2Tuple_u64u64ZZ _res_conv = *(LDKCOption_C2Tuple_u64u64ZZ*)(_res_ptr);
12547         FREE(untag_ptr(_res));
12548         COption_C2Tuple_u64u64ZZ_free(_res_conv);
12549 }
12550
12551 static inline uint64_t COption_C2Tuple_u64u64ZZ_clone_ptr(LDKCOption_C2Tuple_u64u64ZZ *NONNULL_PTR arg) {
12552         LDKCOption_C2Tuple_u64u64ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u64ZZ), "LDKCOption_C2Tuple_u64u64ZZ");
12553         *ret_copy = COption_C2Tuple_u64u64ZZ_clone(arg);
12554         uint64_t ret_ref = tag_ptr(ret_copy, true);
12555         return ret_ref;
12556 }
12557 int64_t  __attribute__((export_name("TS_COption_C2Tuple_u64u64ZZ_clone_ptr"))) TS_COption_C2Tuple_u64u64ZZ_clone_ptr(uint64_t arg) {
12558         LDKCOption_C2Tuple_u64u64ZZ* arg_conv = (LDKCOption_C2Tuple_u64u64ZZ*)untag_ptr(arg);
12559         int64_t ret_conv = COption_C2Tuple_u64u64ZZ_clone_ptr(arg_conv);
12560         return ret_conv;
12561 }
12562
12563 uint64_t  __attribute__((export_name("TS_COption_C2Tuple_u64u64ZZ_clone"))) TS_COption_C2Tuple_u64u64ZZ_clone(uint64_t orig) {
12564         LDKCOption_C2Tuple_u64u64ZZ* orig_conv = (LDKCOption_C2Tuple_u64u64ZZ*)untag_ptr(orig);
12565         LDKCOption_C2Tuple_u64u64ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u64ZZ), "LDKCOption_C2Tuple_u64u64ZZ");
12566         *ret_copy = COption_C2Tuple_u64u64ZZ_clone(orig_conv);
12567         uint64_t ret_ref = tag_ptr(ret_copy, true);
12568         return ret_ref;
12569 }
12570
12571 void  __attribute__((export_name("TS_CVec_NodeIdZ_free"))) TS_CVec_NodeIdZ_free(uint64_tArray _res) {
12572         LDKCVec_NodeIdZ _res_constr;
12573         _res_constr.datalen = _res->arr_len;
12574         if (_res_constr.datalen > 0)
12575                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKNodeId), "LDKCVec_NodeIdZ Elements");
12576         else
12577                 _res_constr.data = NULL;
12578         uint64_t* _res_vals = _res->elems;
12579         for (size_t i = 0; i < _res_constr.datalen; i++) {
12580                 uint64_t _res_conv_8 = _res_vals[i];
12581                 LDKNodeId _res_conv_8_conv;
12582                 _res_conv_8_conv.inner = untag_ptr(_res_conv_8);
12583                 _res_conv_8_conv.is_owned = ptr_is_owned(_res_conv_8);
12584                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_8_conv);
12585                 _res_constr.data[i] = _res_conv_8_conv;
12586         }
12587         FREE(_res);
12588         CVec_NodeIdZ_free(_res_constr);
12589 }
12590
12591 uint64_t  __attribute__((export_name("TS_CResult_ProbabilisticScorerDecodeErrorZ_ok"))) TS_CResult_ProbabilisticScorerDecodeErrorZ_ok(uint64_t o) {
12592         LDKProbabilisticScorer o_conv;
12593         o_conv.inner = untag_ptr(o);
12594         o_conv.is_owned = ptr_is_owned(o);
12595         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12596         // WARNING: we need a move here but no clone is available for LDKProbabilisticScorer
12597         
12598         LDKCResult_ProbabilisticScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ProbabilisticScorerDecodeErrorZ), "LDKCResult_ProbabilisticScorerDecodeErrorZ");
12599         *ret_conv = CResult_ProbabilisticScorerDecodeErrorZ_ok(o_conv);
12600         return tag_ptr(ret_conv, true);
12601 }
12602
12603 uint64_t  __attribute__((export_name("TS_CResult_ProbabilisticScorerDecodeErrorZ_err"))) TS_CResult_ProbabilisticScorerDecodeErrorZ_err(uint64_t e) {
12604         LDKDecodeError e_conv;
12605         e_conv.inner = untag_ptr(e);
12606         e_conv.is_owned = ptr_is_owned(e);
12607         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
12608         e_conv = DecodeError_clone(&e_conv);
12609         LDKCResult_ProbabilisticScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ProbabilisticScorerDecodeErrorZ), "LDKCResult_ProbabilisticScorerDecodeErrorZ");
12610         *ret_conv = CResult_ProbabilisticScorerDecodeErrorZ_err(e_conv);
12611         return tag_ptr(ret_conv, true);
12612 }
12613
12614 jboolean  __attribute__((export_name("TS_CResult_ProbabilisticScorerDecodeErrorZ_is_ok"))) TS_CResult_ProbabilisticScorerDecodeErrorZ_is_ok(uint64_t o) {
12615         LDKCResult_ProbabilisticScorerDecodeErrorZ* o_conv = (LDKCResult_ProbabilisticScorerDecodeErrorZ*)untag_ptr(o);
12616         jboolean ret_conv = CResult_ProbabilisticScorerDecodeErrorZ_is_ok(o_conv);
12617         return ret_conv;
12618 }
12619
12620 void  __attribute__((export_name("TS_CResult_ProbabilisticScorerDecodeErrorZ_free"))) TS_CResult_ProbabilisticScorerDecodeErrorZ_free(uint64_t _res) {
12621         if (!ptr_is_owned(_res)) return;
12622         void* _res_ptr = untag_ptr(_res);
12623         CHECK_ACCESS(_res_ptr);
12624         LDKCResult_ProbabilisticScorerDecodeErrorZ _res_conv = *(LDKCResult_ProbabilisticScorerDecodeErrorZ*)(_res_ptr);
12625         FREE(untag_ptr(_res));
12626         CResult_ProbabilisticScorerDecodeErrorZ_free(_res_conv);
12627 }
12628
12629 uint64_t  __attribute__((export_name("TS_CResult_InitFeaturesDecodeErrorZ_ok"))) TS_CResult_InitFeaturesDecodeErrorZ_ok(uint64_t o) {
12630         LDKInitFeatures o_conv;
12631         o_conv.inner = untag_ptr(o);
12632         o_conv.is_owned = ptr_is_owned(o);
12633         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12634         o_conv = InitFeatures_clone(&o_conv);
12635         LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
12636         *ret_conv = CResult_InitFeaturesDecodeErrorZ_ok(o_conv);
12637         return tag_ptr(ret_conv, true);
12638 }
12639
12640 uint64_t  __attribute__((export_name("TS_CResult_InitFeaturesDecodeErrorZ_err"))) TS_CResult_InitFeaturesDecodeErrorZ_err(uint64_t e) {
12641         LDKDecodeError e_conv;
12642         e_conv.inner = untag_ptr(e);
12643         e_conv.is_owned = ptr_is_owned(e);
12644         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
12645         e_conv = DecodeError_clone(&e_conv);
12646         LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
12647         *ret_conv = CResult_InitFeaturesDecodeErrorZ_err(e_conv);
12648         return tag_ptr(ret_conv, true);
12649 }
12650
12651 jboolean  __attribute__((export_name("TS_CResult_InitFeaturesDecodeErrorZ_is_ok"))) TS_CResult_InitFeaturesDecodeErrorZ_is_ok(uint64_t o) {
12652         LDKCResult_InitFeaturesDecodeErrorZ* o_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)untag_ptr(o);
12653         jboolean ret_conv = CResult_InitFeaturesDecodeErrorZ_is_ok(o_conv);
12654         return ret_conv;
12655 }
12656
12657 void  __attribute__((export_name("TS_CResult_InitFeaturesDecodeErrorZ_free"))) TS_CResult_InitFeaturesDecodeErrorZ_free(uint64_t _res) {
12658         if (!ptr_is_owned(_res)) return;
12659         void* _res_ptr = untag_ptr(_res);
12660         CHECK_ACCESS(_res_ptr);
12661         LDKCResult_InitFeaturesDecodeErrorZ _res_conv = *(LDKCResult_InitFeaturesDecodeErrorZ*)(_res_ptr);
12662         FREE(untag_ptr(_res));
12663         CResult_InitFeaturesDecodeErrorZ_free(_res_conv);
12664 }
12665
12666 static inline uint64_t CResult_InitFeaturesDecodeErrorZ_clone_ptr(LDKCResult_InitFeaturesDecodeErrorZ *NONNULL_PTR arg) {
12667         LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
12668         *ret_conv = CResult_InitFeaturesDecodeErrorZ_clone(arg);
12669         return tag_ptr(ret_conv, true);
12670 }
12671 int64_t  __attribute__((export_name("TS_CResult_InitFeaturesDecodeErrorZ_clone_ptr"))) TS_CResult_InitFeaturesDecodeErrorZ_clone_ptr(uint64_t arg) {
12672         LDKCResult_InitFeaturesDecodeErrorZ* arg_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)untag_ptr(arg);
12673         int64_t ret_conv = CResult_InitFeaturesDecodeErrorZ_clone_ptr(arg_conv);
12674         return ret_conv;
12675 }
12676
12677 uint64_t  __attribute__((export_name("TS_CResult_InitFeaturesDecodeErrorZ_clone"))) TS_CResult_InitFeaturesDecodeErrorZ_clone(uint64_t orig) {
12678         LDKCResult_InitFeaturesDecodeErrorZ* orig_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)untag_ptr(orig);
12679         LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
12680         *ret_conv = CResult_InitFeaturesDecodeErrorZ_clone(orig_conv);
12681         return tag_ptr(ret_conv, true);
12682 }
12683
12684 uint64_t  __attribute__((export_name("TS_CResult_ChannelFeaturesDecodeErrorZ_ok"))) TS_CResult_ChannelFeaturesDecodeErrorZ_ok(uint64_t o) {
12685         LDKChannelFeatures o_conv;
12686         o_conv.inner = untag_ptr(o);
12687         o_conv.is_owned = ptr_is_owned(o);
12688         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12689         o_conv = ChannelFeatures_clone(&o_conv);
12690         LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
12691         *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_ok(o_conv);
12692         return tag_ptr(ret_conv, true);
12693 }
12694
12695 uint64_t  __attribute__((export_name("TS_CResult_ChannelFeaturesDecodeErrorZ_err"))) TS_CResult_ChannelFeaturesDecodeErrorZ_err(uint64_t e) {
12696         LDKDecodeError e_conv;
12697         e_conv.inner = untag_ptr(e);
12698         e_conv.is_owned = ptr_is_owned(e);
12699         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
12700         e_conv = DecodeError_clone(&e_conv);
12701         LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
12702         *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_err(e_conv);
12703         return tag_ptr(ret_conv, true);
12704 }
12705
12706 jboolean  __attribute__((export_name("TS_CResult_ChannelFeaturesDecodeErrorZ_is_ok"))) TS_CResult_ChannelFeaturesDecodeErrorZ_is_ok(uint64_t o) {
12707         LDKCResult_ChannelFeaturesDecodeErrorZ* o_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)untag_ptr(o);
12708         jboolean ret_conv = CResult_ChannelFeaturesDecodeErrorZ_is_ok(o_conv);
12709         return ret_conv;
12710 }
12711
12712 void  __attribute__((export_name("TS_CResult_ChannelFeaturesDecodeErrorZ_free"))) TS_CResult_ChannelFeaturesDecodeErrorZ_free(uint64_t _res) {
12713         if (!ptr_is_owned(_res)) return;
12714         void* _res_ptr = untag_ptr(_res);
12715         CHECK_ACCESS(_res_ptr);
12716         LDKCResult_ChannelFeaturesDecodeErrorZ _res_conv = *(LDKCResult_ChannelFeaturesDecodeErrorZ*)(_res_ptr);
12717         FREE(untag_ptr(_res));
12718         CResult_ChannelFeaturesDecodeErrorZ_free(_res_conv);
12719 }
12720
12721 static inline uint64_t CResult_ChannelFeaturesDecodeErrorZ_clone_ptr(LDKCResult_ChannelFeaturesDecodeErrorZ *NONNULL_PTR arg) {
12722         LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
12723         *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_clone(arg);
12724         return tag_ptr(ret_conv, true);
12725 }
12726 int64_t  __attribute__((export_name("TS_CResult_ChannelFeaturesDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelFeaturesDecodeErrorZ_clone_ptr(uint64_t arg) {
12727         LDKCResult_ChannelFeaturesDecodeErrorZ* arg_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)untag_ptr(arg);
12728         int64_t ret_conv = CResult_ChannelFeaturesDecodeErrorZ_clone_ptr(arg_conv);
12729         return ret_conv;
12730 }
12731
12732 uint64_t  __attribute__((export_name("TS_CResult_ChannelFeaturesDecodeErrorZ_clone"))) TS_CResult_ChannelFeaturesDecodeErrorZ_clone(uint64_t orig) {
12733         LDKCResult_ChannelFeaturesDecodeErrorZ* orig_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)untag_ptr(orig);
12734         LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
12735         *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_clone(orig_conv);
12736         return tag_ptr(ret_conv, true);
12737 }
12738
12739 uint64_t  __attribute__((export_name("TS_CResult_NodeFeaturesDecodeErrorZ_ok"))) TS_CResult_NodeFeaturesDecodeErrorZ_ok(uint64_t o) {
12740         LDKNodeFeatures o_conv;
12741         o_conv.inner = untag_ptr(o);
12742         o_conv.is_owned = ptr_is_owned(o);
12743         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12744         o_conv = NodeFeatures_clone(&o_conv);
12745         LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
12746         *ret_conv = CResult_NodeFeaturesDecodeErrorZ_ok(o_conv);
12747         return tag_ptr(ret_conv, true);
12748 }
12749
12750 uint64_t  __attribute__((export_name("TS_CResult_NodeFeaturesDecodeErrorZ_err"))) TS_CResult_NodeFeaturesDecodeErrorZ_err(uint64_t e) {
12751         LDKDecodeError e_conv;
12752         e_conv.inner = untag_ptr(e);
12753         e_conv.is_owned = ptr_is_owned(e);
12754         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
12755         e_conv = DecodeError_clone(&e_conv);
12756         LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
12757         *ret_conv = CResult_NodeFeaturesDecodeErrorZ_err(e_conv);
12758         return tag_ptr(ret_conv, true);
12759 }
12760
12761 jboolean  __attribute__((export_name("TS_CResult_NodeFeaturesDecodeErrorZ_is_ok"))) TS_CResult_NodeFeaturesDecodeErrorZ_is_ok(uint64_t o) {
12762         LDKCResult_NodeFeaturesDecodeErrorZ* o_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)untag_ptr(o);
12763         jboolean ret_conv = CResult_NodeFeaturesDecodeErrorZ_is_ok(o_conv);
12764         return ret_conv;
12765 }
12766
12767 void  __attribute__((export_name("TS_CResult_NodeFeaturesDecodeErrorZ_free"))) TS_CResult_NodeFeaturesDecodeErrorZ_free(uint64_t _res) {
12768         if (!ptr_is_owned(_res)) return;
12769         void* _res_ptr = untag_ptr(_res);
12770         CHECK_ACCESS(_res_ptr);
12771         LDKCResult_NodeFeaturesDecodeErrorZ _res_conv = *(LDKCResult_NodeFeaturesDecodeErrorZ*)(_res_ptr);
12772         FREE(untag_ptr(_res));
12773         CResult_NodeFeaturesDecodeErrorZ_free(_res_conv);
12774 }
12775
12776 static inline uint64_t CResult_NodeFeaturesDecodeErrorZ_clone_ptr(LDKCResult_NodeFeaturesDecodeErrorZ *NONNULL_PTR arg) {
12777         LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
12778         *ret_conv = CResult_NodeFeaturesDecodeErrorZ_clone(arg);
12779         return tag_ptr(ret_conv, true);
12780 }
12781 int64_t  __attribute__((export_name("TS_CResult_NodeFeaturesDecodeErrorZ_clone_ptr"))) TS_CResult_NodeFeaturesDecodeErrorZ_clone_ptr(uint64_t arg) {
12782         LDKCResult_NodeFeaturesDecodeErrorZ* arg_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)untag_ptr(arg);
12783         int64_t ret_conv = CResult_NodeFeaturesDecodeErrorZ_clone_ptr(arg_conv);
12784         return ret_conv;
12785 }
12786
12787 uint64_t  __attribute__((export_name("TS_CResult_NodeFeaturesDecodeErrorZ_clone"))) TS_CResult_NodeFeaturesDecodeErrorZ_clone(uint64_t orig) {
12788         LDKCResult_NodeFeaturesDecodeErrorZ* orig_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)untag_ptr(orig);
12789         LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
12790         *ret_conv = CResult_NodeFeaturesDecodeErrorZ_clone(orig_conv);
12791         return tag_ptr(ret_conv, true);
12792 }
12793
12794 uint64_t  __attribute__((export_name("TS_CResult_InvoiceFeaturesDecodeErrorZ_ok"))) TS_CResult_InvoiceFeaturesDecodeErrorZ_ok(uint64_t o) {
12795         LDKInvoiceFeatures o_conv;
12796         o_conv.inner = untag_ptr(o);
12797         o_conv.is_owned = ptr_is_owned(o);
12798         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12799         o_conv = InvoiceFeatures_clone(&o_conv);
12800         LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
12801         *ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_ok(o_conv);
12802         return tag_ptr(ret_conv, true);
12803 }
12804
12805 uint64_t  __attribute__((export_name("TS_CResult_InvoiceFeaturesDecodeErrorZ_err"))) TS_CResult_InvoiceFeaturesDecodeErrorZ_err(uint64_t e) {
12806         LDKDecodeError e_conv;
12807         e_conv.inner = untag_ptr(e);
12808         e_conv.is_owned = ptr_is_owned(e);
12809         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
12810         e_conv = DecodeError_clone(&e_conv);
12811         LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
12812         *ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_err(e_conv);
12813         return tag_ptr(ret_conv, true);
12814 }
12815
12816 jboolean  __attribute__((export_name("TS_CResult_InvoiceFeaturesDecodeErrorZ_is_ok"))) TS_CResult_InvoiceFeaturesDecodeErrorZ_is_ok(uint64_t o) {
12817         LDKCResult_InvoiceFeaturesDecodeErrorZ* o_conv = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)untag_ptr(o);
12818         jboolean ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_is_ok(o_conv);
12819         return ret_conv;
12820 }
12821
12822 void  __attribute__((export_name("TS_CResult_InvoiceFeaturesDecodeErrorZ_free"))) TS_CResult_InvoiceFeaturesDecodeErrorZ_free(uint64_t _res) {
12823         if (!ptr_is_owned(_res)) return;
12824         void* _res_ptr = untag_ptr(_res);
12825         CHECK_ACCESS(_res_ptr);
12826         LDKCResult_InvoiceFeaturesDecodeErrorZ _res_conv = *(LDKCResult_InvoiceFeaturesDecodeErrorZ*)(_res_ptr);
12827         FREE(untag_ptr(_res));
12828         CResult_InvoiceFeaturesDecodeErrorZ_free(_res_conv);
12829 }
12830
12831 static inline uint64_t CResult_InvoiceFeaturesDecodeErrorZ_clone_ptr(LDKCResult_InvoiceFeaturesDecodeErrorZ *NONNULL_PTR arg) {
12832         LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
12833         *ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_clone(arg);
12834         return tag_ptr(ret_conv, true);
12835 }
12836 int64_t  __attribute__((export_name("TS_CResult_InvoiceFeaturesDecodeErrorZ_clone_ptr"))) TS_CResult_InvoiceFeaturesDecodeErrorZ_clone_ptr(uint64_t arg) {
12837         LDKCResult_InvoiceFeaturesDecodeErrorZ* arg_conv = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)untag_ptr(arg);
12838         int64_t ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_clone_ptr(arg_conv);
12839         return ret_conv;
12840 }
12841
12842 uint64_t  __attribute__((export_name("TS_CResult_InvoiceFeaturesDecodeErrorZ_clone"))) TS_CResult_InvoiceFeaturesDecodeErrorZ_clone(uint64_t orig) {
12843         LDKCResult_InvoiceFeaturesDecodeErrorZ* orig_conv = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)untag_ptr(orig);
12844         LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
12845         *ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_clone(orig_conv);
12846         return tag_ptr(ret_conv, true);
12847 }
12848
12849 uint64_t  __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_ok"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_ok(uint64_t o) {
12850         LDKChannelTypeFeatures o_conv;
12851         o_conv.inner = untag_ptr(o);
12852         o_conv.is_owned = ptr_is_owned(o);
12853         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12854         o_conv = ChannelTypeFeatures_clone(&o_conv);
12855         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
12856         *ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_ok(o_conv);
12857         return tag_ptr(ret_conv, true);
12858 }
12859
12860 uint64_t  __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_err"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_err(uint64_t e) {
12861         LDKDecodeError e_conv;
12862         e_conv.inner = untag_ptr(e);
12863         e_conv.is_owned = ptr_is_owned(e);
12864         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
12865         e_conv = DecodeError_clone(&e_conv);
12866         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
12867         *ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_err(e_conv);
12868         return tag_ptr(ret_conv, true);
12869 }
12870
12871 jboolean  __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_is_ok"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_is_ok(uint64_t o) {
12872         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* o_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)untag_ptr(o);
12873         jboolean ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_is_ok(o_conv);
12874         return ret_conv;
12875 }
12876
12877 void  __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_free"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_free(uint64_t _res) {
12878         if (!ptr_is_owned(_res)) return;
12879         void* _res_ptr = untag_ptr(_res);
12880         CHECK_ACCESS(_res_ptr);
12881         LDKCResult_ChannelTypeFeaturesDecodeErrorZ _res_conv = *(LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)(_res_ptr);
12882         FREE(untag_ptr(_res));
12883         CResult_ChannelTypeFeaturesDecodeErrorZ_free(_res_conv);
12884 }
12885
12886 static inline uint64_t CResult_ChannelTypeFeaturesDecodeErrorZ_clone_ptr(LDKCResult_ChannelTypeFeaturesDecodeErrorZ *NONNULL_PTR arg) {
12887         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
12888         *ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_clone(arg);
12889         return tag_ptr(ret_conv, true);
12890 }
12891 int64_t  __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_clone_ptr(uint64_t arg) {
12892         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* arg_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)untag_ptr(arg);
12893         int64_t ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_clone_ptr(arg_conv);
12894         return ret_conv;
12895 }
12896
12897 uint64_t  __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_clone"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_clone(uint64_t orig) {
12898         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* orig_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)untag_ptr(orig);
12899         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
12900         *ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_clone(orig_conv);
12901         return tag_ptr(ret_conv, true);
12902 }
12903
12904 uint64_t  __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_ok"))) TS_CResult_NodeIdDecodeErrorZ_ok(uint64_t o) {
12905         LDKNodeId o_conv;
12906         o_conv.inner = untag_ptr(o);
12907         o_conv.is_owned = ptr_is_owned(o);
12908         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12909         o_conv = NodeId_clone(&o_conv);
12910         LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
12911         *ret_conv = CResult_NodeIdDecodeErrorZ_ok(o_conv);
12912         return tag_ptr(ret_conv, true);
12913 }
12914
12915 uint64_t  __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_err"))) TS_CResult_NodeIdDecodeErrorZ_err(uint64_t e) {
12916         LDKDecodeError e_conv;
12917         e_conv.inner = untag_ptr(e);
12918         e_conv.is_owned = ptr_is_owned(e);
12919         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
12920         e_conv = DecodeError_clone(&e_conv);
12921         LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
12922         *ret_conv = CResult_NodeIdDecodeErrorZ_err(e_conv);
12923         return tag_ptr(ret_conv, true);
12924 }
12925
12926 jboolean  __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_is_ok"))) TS_CResult_NodeIdDecodeErrorZ_is_ok(uint64_t o) {
12927         LDKCResult_NodeIdDecodeErrorZ* o_conv = (LDKCResult_NodeIdDecodeErrorZ*)untag_ptr(o);
12928         jboolean ret_conv = CResult_NodeIdDecodeErrorZ_is_ok(o_conv);
12929         return ret_conv;
12930 }
12931
12932 void  __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_free"))) TS_CResult_NodeIdDecodeErrorZ_free(uint64_t _res) {
12933         if (!ptr_is_owned(_res)) return;
12934         void* _res_ptr = untag_ptr(_res);
12935         CHECK_ACCESS(_res_ptr);
12936         LDKCResult_NodeIdDecodeErrorZ _res_conv = *(LDKCResult_NodeIdDecodeErrorZ*)(_res_ptr);
12937         FREE(untag_ptr(_res));
12938         CResult_NodeIdDecodeErrorZ_free(_res_conv);
12939 }
12940
12941 static inline uint64_t CResult_NodeIdDecodeErrorZ_clone_ptr(LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR arg) {
12942         LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
12943         *ret_conv = CResult_NodeIdDecodeErrorZ_clone(arg);
12944         return tag_ptr(ret_conv, true);
12945 }
12946 int64_t  __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_clone_ptr"))) TS_CResult_NodeIdDecodeErrorZ_clone_ptr(uint64_t arg) {
12947         LDKCResult_NodeIdDecodeErrorZ* arg_conv = (LDKCResult_NodeIdDecodeErrorZ*)untag_ptr(arg);
12948         int64_t ret_conv = CResult_NodeIdDecodeErrorZ_clone_ptr(arg_conv);
12949         return ret_conv;
12950 }
12951
12952 uint64_t  __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_clone"))) TS_CResult_NodeIdDecodeErrorZ_clone(uint64_t orig) {
12953         LDKCResult_NodeIdDecodeErrorZ* orig_conv = (LDKCResult_NodeIdDecodeErrorZ*)untag_ptr(orig);
12954         LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
12955         *ret_conv = CResult_NodeIdDecodeErrorZ_clone(orig_conv);
12956         return tag_ptr(ret_conv, true);
12957 }
12958
12959 uint64_t  __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_ok"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_ok(uint64_t o) {
12960         void* o_ptr = untag_ptr(o);
12961         CHECK_ACCESS(o_ptr);
12962         LDKCOption_NetworkUpdateZ o_conv = *(LDKCOption_NetworkUpdateZ*)(o_ptr);
12963         o_conv = COption_NetworkUpdateZ_clone((LDKCOption_NetworkUpdateZ*)untag_ptr(o));
12964         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
12965         *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_ok(o_conv);
12966         return tag_ptr(ret_conv, true);
12967 }
12968
12969 uint64_t  __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_err"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_err(uint64_t e) {
12970         LDKDecodeError e_conv;
12971         e_conv.inner = untag_ptr(e);
12972         e_conv.is_owned = ptr_is_owned(e);
12973         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
12974         e_conv = DecodeError_clone(&e_conv);
12975         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
12976         *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_err(e_conv);
12977         return tag_ptr(ret_conv, true);
12978 }
12979
12980 jboolean  __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_is_ok"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_is_ok(uint64_t o) {
12981         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* o_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)untag_ptr(o);
12982         jboolean ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_is_ok(o_conv);
12983         return ret_conv;
12984 }
12985
12986 void  __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_free"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_free(uint64_t _res) {
12987         if (!ptr_is_owned(_res)) return;
12988         void* _res_ptr = untag_ptr(_res);
12989         CHECK_ACCESS(_res_ptr);
12990         LDKCResult_COption_NetworkUpdateZDecodeErrorZ _res_conv = *(LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)(_res_ptr);
12991         FREE(untag_ptr(_res));
12992         CResult_COption_NetworkUpdateZDecodeErrorZ_free(_res_conv);
12993 }
12994
12995 static inline uint64_t CResult_COption_NetworkUpdateZDecodeErrorZ_clone_ptr(LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR arg) {
12996         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
12997         *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_clone(arg);
12998         return tag_ptr(ret_conv, true);
12999 }
13000 int64_t  __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_clone_ptr"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_clone_ptr(uint64_t arg) {
13001         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* arg_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)untag_ptr(arg);
13002         int64_t ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_clone_ptr(arg_conv);
13003         return ret_conv;
13004 }
13005
13006 uint64_t  __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_clone"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_clone(uint64_t orig) {
13007         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* orig_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)untag_ptr(orig);
13008         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
13009         *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_clone(orig_conv);
13010         return tag_ptr(ret_conv, true);
13011 }
13012
13013 uint64_t  __attribute__((export_name("TS_COption_AccessZ_some"))) TS_COption_AccessZ_some(uint64_t o) {
13014         void* o_ptr = untag_ptr(o);
13015         CHECK_ACCESS(o_ptr);
13016         LDKAccess o_conv = *(LDKAccess*)(o_ptr);
13017         if (o_conv.free == LDKAccess_JCalls_free) {
13018                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
13019                 LDKAccess_JCalls_cloned(&o_conv);
13020         }
13021         LDKCOption_AccessZ *ret_copy = MALLOC(sizeof(LDKCOption_AccessZ), "LDKCOption_AccessZ");
13022         *ret_copy = COption_AccessZ_some(o_conv);
13023         uint64_t ret_ref = tag_ptr(ret_copy, true);
13024         return ret_ref;
13025 }
13026
13027 uint64_t  __attribute__((export_name("TS_COption_AccessZ_none"))) TS_COption_AccessZ_none() {
13028         LDKCOption_AccessZ *ret_copy = MALLOC(sizeof(LDKCOption_AccessZ), "LDKCOption_AccessZ");
13029         *ret_copy = COption_AccessZ_none();
13030         uint64_t ret_ref = tag_ptr(ret_copy, true);
13031         return ret_ref;
13032 }
13033
13034 void  __attribute__((export_name("TS_COption_AccessZ_free"))) TS_COption_AccessZ_free(uint64_t _res) {
13035         if (!ptr_is_owned(_res)) return;
13036         void* _res_ptr = untag_ptr(_res);
13037         CHECK_ACCESS(_res_ptr);
13038         LDKCOption_AccessZ _res_conv = *(LDKCOption_AccessZ*)(_res_ptr);
13039         FREE(untag_ptr(_res));
13040         COption_AccessZ_free(_res_conv);
13041 }
13042
13043 uint64_t  __attribute__((export_name("TS_CResult_boolLightningErrorZ_ok"))) TS_CResult_boolLightningErrorZ_ok(jboolean o) {
13044         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
13045         *ret_conv = CResult_boolLightningErrorZ_ok(o);
13046         return tag_ptr(ret_conv, true);
13047 }
13048
13049 uint64_t  __attribute__((export_name("TS_CResult_boolLightningErrorZ_err"))) TS_CResult_boolLightningErrorZ_err(uint64_t e) {
13050         LDKLightningError e_conv;
13051         e_conv.inner = untag_ptr(e);
13052         e_conv.is_owned = ptr_is_owned(e);
13053         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
13054         e_conv = LightningError_clone(&e_conv);
13055         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
13056         *ret_conv = CResult_boolLightningErrorZ_err(e_conv);
13057         return tag_ptr(ret_conv, true);
13058 }
13059
13060 jboolean  __attribute__((export_name("TS_CResult_boolLightningErrorZ_is_ok"))) TS_CResult_boolLightningErrorZ_is_ok(uint64_t o) {
13061         LDKCResult_boolLightningErrorZ* o_conv = (LDKCResult_boolLightningErrorZ*)untag_ptr(o);
13062         jboolean ret_conv = CResult_boolLightningErrorZ_is_ok(o_conv);
13063         return ret_conv;
13064 }
13065
13066 void  __attribute__((export_name("TS_CResult_boolLightningErrorZ_free"))) TS_CResult_boolLightningErrorZ_free(uint64_t _res) {
13067         if (!ptr_is_owned(_res)) return;
13068         void* _res_ptr = untag_ptr(_res);
13069         CHECK_ACCESS(_res_ptr);
13070         LDKCResult_boolLightningErrorZ _res_conv = *(LDKCResult_boolLightningErrorZ*)(_res_ptr);
13071         FREE(untag_ptr(_res));
13072         CResult_boolLightningErrorZ_free(_res_conv);
13073 }
13074
13075 static inline uint64_t CResult_boolLightningErrorZ_clone_ptr(LDKCResult_boolLightningErrorZ *NONNULL_PTR arg) {
13076         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
13077         *ret_conv = CResult_boolLightningErrorZ_clone(arg);
13078         return tag_ptr(ret_conv, true);
13079 }
13080 int64_t  __attribute__((export_name("TS_CResult_boolLightningErrorZ_clone_ptr"))) TS_CResult_boolLightningErrorZ_clone_ptr(uint64_t arg) {
13081         LDKCResult_boolLightningErrorZ* arg_conv = (LDKCResult_boolLightningErrorZ*)untag_ptr(arg);
13082         int64_t ret_conv = CResult_boolLightningErrorZ_clone_ptr(arg_conv);
13083         return ret_conv;
13084 }
13085
13086 uint64_t  __attribute__((export_name("TS_CResult_boolLightningErrorZ_clone"))) TS_CResult_boolLightningErrorZ_clone(uint64_t orig) {
13087         LDKCResult_boolLightningErrorZ* orig_conv = (LDKCResult_boolLightningErrorZ*)untag_ptr(orig);
13088         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
13089         *ret_conv = CResult_boolLightningErrorZ_clone(orig_conv);
13090         return tag_ptr(ret_conv, true);
13091 }
13092
13093 static inline uint64_t C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone_ptr(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR arg) {
13094         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
13095         *ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(arg);
13096         return tag_ptr(ret_conv, true);
13097 }
13098 int64_t  __attribute__((export_name("TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone_ptr"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone_ptr(uint64_t arg) {
13099         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* arg_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(arg);
13100         int64_t ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone_ptr(arg_conv);
13101         return ret_conv;
13102 }
13103
13104 uint64_t  __attribute__((export_name("TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(uint64_t orig) {
13105         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* orig_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(orig);
13106         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
13107         *ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(orig_conv);
13108         return tag_ptr(ret_conv, true);
13109 }
13110
13111 uint64_t  __attribute__((export_name("TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(uint64_t a, uint64_t b, uint64_t c) {
13112         LDKChannelAnnouncement a_conv;
13113         a_conv.inner = untag_ptr(a);
13114         a_conv.is_owned = ptr_is_owned(a);
13115         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
13116         a_conv = ChannelAnnouncement_clone(&a_conv);
13117         LDKChannelUpdate b_conv;
13118         b_conv.inner = untag_ptr(b);
13119         b_conv.is_owned = ptr_is_owned(b);
13120         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
13121         b_conv = ChannelUpdate_clone(&b_conv);
13122         LDKChannelUpdate c_conv;
13123         c_conv.inner = untag_ptr(c);
13124         c_conv.is_owned = ptr_is_owned(c);
13125         CHECK_INNER_FIELD_ACCESS_OR_NULL(c_conv);
13126         c_conv = ChannelUpdate_clone(&c_conv);
13127         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
13128         *ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(a_conv, b_conv, c_conv);
13129         return tag_ptr(ret_conv, true);
13130 }
13131
13132 void  __attribute__((export_name("TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(uint64_t _res) {
13133         if (!ptr_is_owned(_res)) return;
13134         void* _res_ptr = untag_ptr(_res);
13135         CHECK_ACCESS(_res_ptr);
13136         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ _res_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(_res_ptr);
13137         FREE(untag_ptr(_res));
13138         C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(_res_conv);
13139 }
13140
13141 void  __attribute__((export_name("TS_CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free"))) TS_CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(uint64_tArray _res) {
13142         LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ _res_constr;
13143         _res_constr.datalen = _res->arr_len;
13144         if (_res_constr.datalen > 0)
13145                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ Elements");
13146         else
13147                 _res_constr.data = NULL;
13148         uint64_t* _res_vals = _res->elems;
13149         for (size_t h = 0; h < _res_constr.datalen; h++) {
13150                 uint64_t _res_conv_59 = _res_vals[h];
13151                 void* _res_conv_59_ptr = untag_ptr(_res_conv_59);
13152                 CHECK_ACCESS(_res_conv_59_ptr);
13153                 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ _res_conv_59_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(_res_conv_59_ptr);
13154                 FREE(untag_ptr(_res_conv_59));
13155                 _res_constr.data[h] = _res_conv_59_conv;
13156         }
13157         FREE(_res);
13158         CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(_res_constr);
13159 }
13160
13161 void  __attribute__((export_name("TS_CVec_NodeAnnouncementZ_free"))) TS_CVec_NodeAnnouncementZ_free(uint64_tArray _res) {
13162         LDKCVec_NodeAnnouncementZ _res_constr;
13163         _res_constr.datalen = _res->arr_len;
13164         if (_res_constr.datalen > 0)
13165                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKNodeAnnouncement), "LDKCVec_NodeAnnouncementZ Elements");
13166         else
13167                 _res_constr.data = NULL;
13168         uint64_t* _res_vals = _res->elems;
13169         for (size_t s = 0; s < _res_constr.datalen; s++) {
13170                 uint64_t _res_conv_18 = _res_vals[s];
13171                 LDKNodeAnnouncement _res_conv_18_conv;
13172                 _res_conv_18_conv.inner = untag_ptr(_res_conv_18);
13173                 _res_conv_18_conv.is_owned = ptr_is_owned(_res_conv_18);
13174                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_18_conv);
13175                 _res_constr.data[s] = _res_conv_18_conv;
13176         }
13177         FREE(_res);
13178         CVec_NodeAnnouncementZ_free(_res_constr);
13179 }
13180
13181 uint64_t  __attribute__((export_name("TS_CResult_NoneLightningErrorZ_ok"))) TS_CResult_NoneLightningErrorZ_ok() {
13182         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
13183         *ret_conv = CResult_NoneLightningErrorZ_ok();
13184         return tag_ptr(ret_conv, true);
13185 }
13186
13187 uint64_t  __attribute__((export_name("TS_CResult_NoneLightningErrorZ_err"))) TS_CResult_NoneLightningErrorZ_err(uint64_t e) {
13188         LDKLightningError e_conv;
13189         e_conv.inner = untag_ptr(e);
13190         e_conv.is_owned = ptr_is_owned(e);
13191         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
13192         e_conv = LightningError_clone(&e_conv);
13193         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
13194         *ret_conv = CResult_NoneLightningErrorZ_err(e_conv);
13195         return tag_ptr(ret_conv, true);
13196 }
13197
13198 jboolean  __attribute__((export_name("TS_CResult_NoneLightningErrorZ_is_ok"))) TS_CResult_NoneLightningErrorZ_is_ok(uint64_t o) {
13199         LDKCResult_NoneLightningErrorZ* o_conv = (LDKCResult_NoneLightningErrorZ*)untag_ptr(o);
13200         jboolean ret_conv = CResult_NoneLightningErrorZ_is_ok(o_conv);
13201         return ret_conv;
13202 }
13203
13204 void  __attribute__((export_name("TS_CResult_NoneLightningErrorZ_free"))) TS_CResult_NoneLightningErrorZ_free(uint64_t _res) {
13205         if (!ptr_is_owned(_res)) return;
13206         void* _res_ptr = untag_ptr(_res);
13207         CHECK_ACCESS(_res_ptr);
13208         LDKCResult_NoneLightningErrorZ _res_conv = *(LDKCResult_NoneLightningErrorZ*)(_res_ptr);
13209         FREE(untag_ptr(_res));
13210         CResult_NoneLightningErrorZ_free(_res_conv);
13211 }
13212
13213 static inline uint64_t CResult_NoneLightningErrorZ_clone_ptr(LDKCResult_NoneLightningErrorZ *NONNULL_PTR arg) {
13214         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
13215         *ret_conv = CResult_NoneLightningErrorZ_clone(arg);
13216         return tag_ptr(ret_conv, true);
13217 }
13218 int64_t  __attribute__((export_name("TS_CResult_NoneLightningErrorZ_clone_ptr"))) TS_CResult_NoneLightningErrorZ_clone_ptr(uint64_t arg) {
13219         LDKCResult_NoneLightningErrorZ* arg_conv = (LDKCResult_NoneLightningErrorZ*)untag_ptr(arg);
13220         int64_t ret_conv = CResult_NoneLightningErrorZ_clone_ptr(arg_conv);
13221         return ret_conv;
13222 }
13223
13224 uint64_t  __attribute__((export_name("TS_CResult_NoneLightningErrorZ_clone"))) TS_CResult_NoneLightningErrorZ_clone(uint64_t orig) {
13225         LDKCResult_NoneLightningErrorZ* orig_conv = (LDKCResult_NoneLightningErrorZ*)untag_ptr(orig);
13226         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
13227         *ret_conv = CResult_NoneLightningErrorZ_clone(orig_conv);
13228         return tag_ptr(ret_conv, true);
13229 }
13230
13231 uint64_t  __attribute__((export_name("TS_CResult_ChannelUpdateInfoDecodeErrorZ_ok"))) TS_CResult_ChannelUpdateInfoDecodeErrorZ_ok(uint64_t o) {
13232         LDKChannelUpdateInfo o_conv;
13233         o_conv.inner = untag_ptr(o);
13234         o_conv.is_owned = ptr_is_owned(o);
13235         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13236         o_conv = ChannelUpdateInfo_clone(&o_conv);
13237         LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
13238         *ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_ok(o_conv);
13239         return tag_ptr(ret_conv, true);
13240 }
13241
13242 uint64_t  __attribute__((export_name("TS_CResult_ChannelUpdateInfoDecodeErrorZ_err"))) TS_CResult_ChannelUpdateInfoDecodeErrorZ_err(uint64_t e) {
13243         LDKDecodeError e_conv;
13244         e_conv.inner = untag_ptr(e);
13245         e_conv.is_owned = ptr_is_owned(e);
13246         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
13247         e_conv = DecodeError_clone(&e_conv);
13248         LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
13249         *ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_err(e_conv);
13250         return tag_ptr(ret_conv, true);
13251 }
13252
13253 jboolean  __attribute__((export_name("TS_CResult_ChannelUpdateInfoDecodeErrorZ_is_ok"))) TS_CResult_ChannelUpdateInfoDecodeErrorZ_is_ok(uint64_t o) {
13254         LDKCResult_ChannelUpdateInfoDecodeErrorZ* o_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)untag_ptr(o);
13255         jboolean ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_is_ok(o_conv);
13256         return ret_conv;
13257 }
13258
13259 void  __attribute__((export_name("TS_CResult_ChannelUpdateInfoDecodeErrorZ_free"))) TS_CResult_ChannelUpdateInfoDecodeErrorZ_free(uint64_t _res) {
13260         if (!ptr_is_owned(_res)) return;
13261         void* _res_ptr = untag_ptr(_res);
13262         CHECK_ACCESS(_res_ptr);
13263         LDKCResult_ChannelUpdateInfoDecodeErrorZ _res_conv = *(LDKCResult_ChannelUpdateInfoDecodeErrorZ*)(_res_ptr);
13264         FREE(untag_ptr(_res));
13265         CResult_ChannelUpdateInfoDecodeErrorZ_free(_res_conv);
13266 }
13267
13268 static inline uint64_t CResult_ChannelUpdateInfoDecodeErrorZ_clone_ptr(LDKCResult_ChannelUpdateInfoDecodeErrorZ *NONNULL_PTR arg) {
13269         LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
13270         *ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_clone(arg);
13271         return tag_ptr(ret_conv, true);
13272 }
13273 int64_t  __attribute__((export_name("TS_CResult_ChannelUpdateInfoDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelUpdateInfoDecodeErrorZ_clone_ptr(uint64_t arg) {
13274         LDKCResult_ChannelUpdateInfoDecodeErrorZ* arg_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)untag_ptr(arg);
13275         int64_t ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_clone_ptr(arg_conv);
13276         return ret_conv;
13277 }
13278
13279 uint64_t  __attribute__((export_name("TS_CResult_ChannelUpdateInfoDecodeErrorZ_clone"))) TS_CResult_ChannelUpdateInfoDecodeErrorZ_clone(uint64_t orig) {
13280         LDKCResult_ChannelUpdateInfoDecodeErrorZ* orig_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)untag_ptr(orig);
13281         LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
13282         *ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_clone(orig_conv);
13283         return tag_ptr(ret_conv, true);
13284 }
13285
13286 uint64_t  __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_ok"))) TS_CResult_ChannelInfoDecodeErrorZ_ok(uint64_t o) {
13287         LDKChannelInfo o_conv;
13288         o_conv.inner = untag_ptr(o);
13289         o_conv.is_owned = ptr_is_owned(o);
13290         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13291         o_conv = ChannelInfo_clone(&o_conv);
13292         LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
13293         *ret_conv = CResult_ChannelInfoDecodeErrorZ_ok(o_conv);
13294         return tag_ptr(ret_conv, true);
13295 }
13296
13297 uint64_t  __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_err"))) TS_CResult_ChannelInfoDecodeErrorZ_err(uint64_t e) {
13298         LDKDecodeError e_conv;
13299         e_conv.inner = untag_ptr(e);
13300         e_conv.is_owned = ptr_is_owned(e);
13301         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
13302         e_conv = DecodeError_clone(&e_conv);
13303         LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
13304         *ret_conv = CResult_ChannelInfoDecodeErrorZ_err(e_conv);
13305         return tag_ptr(ret_conv, true);
13306 }
13307
13308 jboolean  __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_is_ok"))) TS_CResult_ChannelInfoDecodeErrorZ_is_ok(uint64_t o) {
13309         LDKCResult_ChannelInfoDecodeErrorZ* o_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)untag_ptr(o);
13310         jboolean ret_conv = CResult_ChannelInfoDecodeErrorZ_is_ok(o_conv);
13311         return ret_conv;
13312 }
13313
13314 void  __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_free"))) TS_CResult_ChannelInfoDecodeErrorZ_free(uint64_t _res) {
13315         if (!ptr_is_owned(_res)) return;
13316         void* _res_ptr = untag_ptr(_res);
13317         CHECK_ACCESS(_res_ptr);
13318         LDKCResult_ChannelInfoDecodeErrorZ _res_conv = *(LDKCResult_ChannelInfoDecodeErrorZ*)(_res_ptr);
13319         FREE(untag_ptr(_res));
13320         CResult_ChannelInfoDecodeErrorZ_free(_res_conv);
13321 }
13322
13323 static inline uint64_t CResult_ChannelInfoDecodeErrorZ_clone_ptr(LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR arg) {
13324         LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
13325         *ret_conv = CResult_ChannelInfoDecodeErrorZ_clone(arg);
13326         return tag_ptr(ret_conv, true);
13327 }
13328 int64_t  __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelInfoDecodeErrorZ_clone_ptr(uint64_t arg) {
13329         LDKCResult_ChannelInfoDecodeErrorZ* arg_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)untag_ptr(arg);
13330         int64_t ret_conv = CResult_ChannelInfoDecodeErrorZ_clone_ptr(arg_conv);
13331         return ret_conv;
13332 }
13333
13334 uint64_t  __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_clone"))) TS_CResult_ChannelInfoDecodeErrorZ_clone(uint64_t orig) {
13335         LDKCResult_ChannelInfoDecodeErrorZ* orig_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)untag_ptr(orig);
13336         LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
13337         *ret_conv = CResult_ChannelInfoDecodeErrorZ_clone(orig_conv);
13338         return tag_ptr(ret_conv, true);
13339 }
13340
13341 uint64_t  __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_ok"))) TS_CResult_RoutingFeesDecodeErrorZ_ok(uint64_t o) {
13342         LDKRoutingFees o_conv;
13343         o_conv.inner = untag_ptr(o);
13344         o_conv.is_owned = ptr_is_owned(o);
13345         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13346         o_conv = RoutingFees_clone(&o_conv);
13347         LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
13348         *ret_conv = CResult_RoutingFeesDecodeErrorZ_ok(o_conv);
13349         return tag_ptr(ret_conv, true);
13350 }
13351
13352 uint64_t  __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_err"))) TS_CResult_RoutingFeesDecodeErrorZ_err(uint64_t e) {
13353         LDKDecodeError e_conv;
13354         e_conv.inner = untag_ptr(e);
13355         e_conv.is_owned = ptr_is_owned(e);
13356         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
13357         e_conv = DecodeError_clone(&e_conv);
13358         LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
13359         *ret_conv = CResult_RoutingFeesDecodeErrorZ_err(e_conv);
13360         return tag_ptr(ret_conv, true);
13361 }
13362
13363 jboolean  __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_is_ok"))) TS_CResult_RoutingFeesDecodeErrorZ_is_ok(uint64_t o) {
13364         LDKCResult_RoutingFeesDecodeErrorZ* o_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)untag_ptr(o);
13365         jboolean ret_conv = CResult_RoutingFeesDecodeErrorZ_is_ok(o_conv);
13366         return ret_conv;
13367 }
13368
13369 void  __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_free"))) TS_CResult_RoutingFeesDecodeErrorZ_free(uint64_t _res) {
13370         if (!ptr_is_owned(_res)) return;
13371         void* _res_ptr = untag_ptr(_res);
13372         CHECK_ACCESS(_res_ptr);
13373         LDKCResult_RoutingFeesDecodeErrorZ _res_conv = *(LDKCResult_RoutingFeesDecodeErrorZ*)(_res_ptr);
13374         FREE(untag_ptr(_res));
13375         CResult_RoutingFeesDecodeErrorZ_free(_res_conv);
13376 }
13377
13378 static inline uint64_t CResult_RoutingFeesDecodeErrorZ_clone_ptr(LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR arg) {
13379         LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
13380         *ret_conv = CResult_RoutingFeesDecodeErrorZ_clone(arg);
13381         return tag_ptr(ret_conv, true);
13382 }
13383 int64_t  __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_clone_ptr"))) TS_CResult_RoutingFeesDecodeErrorZ_clone_ptr(uint64_t arg) {
13384         LDKCResult_RoutingFeesDecodeErrorZ* arg_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)untag_ptr(arg);
13385         int64_t ret_conv = CResult_RoutingFeesDecodeErrorZ_clone_ptr(arg_conv);
13386         return ret_conv;
13387 }
13388
13389 uint64_t  __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_clone"))) TS_CResult_RoutingFeesDecodeErrorZ_clone(uint64_t orig) {
13390         LDKCResult_RoutingFeesDecodeErrorZ* orig_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)untag_ptr(orig);
13391         LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
13392         *ret_conv = CResult_RoutingFeesDecodeErrorZ_clone(orig_conv);
13393         return tag_ptr(ret_conv, true);
13394 }
13395
13396 void  __attribute__((export_name("TS_CVec_NetAddressZ_free"))) TS_CVec_NetAddressZ_free(uint64_tArray _res) {
13397         LDKCVec_NetAddressZ _res_constr;
13398         _res_constr.datalen = _res->arr_len;
13399         if (_res_constr.datalen > 0)
13400                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
13401         else
13402                 _res_constr.data = NULL;
13403         uint64_t* _res_vals = _res->elems;
13404         for (size_t m = 0; m < _res_constr.datalen; m++) {
13405                 uint64_t _res_conv_12 = _res_vals[m];
13406                 void* _res_conv_12_ptr = untag_ptr(_res_conv_12);
13407                 CHECK_ACCESS(_res_conv_12_ptr);
13408                 LDKNetAddress _res_conv_12_conv = *(LDKNetAddress*)(_res_conv_12_ptr);
13409                 FREE(untag_ptr(_res_conv_12));
13410                 _res_constr.data[m] = _res_conv_12_conv;
13411         }
13412         FREE(_res);
13413         CVec_NetAddressZ_free(_res_constr);
13414 }
13415
13416 uint64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_ok"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_ok(uint64_t o) {
13417         LDKNodeAnnouncementInfo o_conv;
13418         o_conv.inner = untag_ptr(o);
13419         o_conv.is_owned = ptr_is_owned(o);
13420         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13421         o_conv = NodeAnnouncementInfo_clone(&o_conv);
13422         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
13423         *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_ok(o_conv);
13424         return tag_ptr(ret_conv, true);
13425 }
13426
13427 uint64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_err"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_err(uint64_t e) {
13428         LDKDecodeError e_conv;
13429         e_conv.inner = untag_ptr(e);
13430         e_conv.is_owned = ptr_is_owned(e);
13431         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
13432         e_conv = DecodeError_clone(&e_conv);
13433         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
13434         *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_err(e_conv);
13435         return tag_ptr(ret_conv, true);
13436 }
13437
13438 jboolean  __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_is_ok"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_is_ok(uint64_t o) {
13439         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* o_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)untag_ptr(o);
13440         jboolean ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_is_ok(o_conv);
13441         return ret_conv;
13442 }
13443
13444 void  __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_free"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_free(uint64_t _res) {
13445         if (!ptr_is_owned(_res)) return;
13446         void* _res_ptr = untag_ptr(_res);
13447         CHECK_ACCESS(_res_ptr);
13448         LDKCResult_NodeAnnouncementInfoDecodeErrorZ _res_conv = *(LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(_res_ptr);
13449         FREE(untag_ptr(_res));
13450         CResult_NodeAnnouncementInfoDecodeErrorZ_free(_res_conv);
13451 }
13452
13453 static inline uint64_t CResult_NodeAnnouncementInfoDecodeErrorZ_clone_ptr(LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR arg) {
13454         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
13455         *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_clone(arg);
13456         return tag_ptr(ret_conv, true);
13457 }
13458 int64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_clone_ptr"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_clone_ptr(uint64_t arg) {
13459         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* arg_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)untag_ptr(arg);
13460         int64_t ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_clone_ptr(arg_conv);
13461         return ret_conv;
13462 }
13463
13464 uint64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_clone"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_clone(uint64_t orig) {
13465         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* orig_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)untag_ptr(orig);
13466         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
13467         *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_clone(orig_conv);
13468         return tag_ptr(ret_conv, true);
13469 }
13470
13471 uint64_t  __attribute__((export_name("TS_CResult_NodeAliasDecodeErrorZ_ok"))) TS_CResult_NodeAliasDecodeErrorZ_ok(uint64_t o) {
13472         LDKNodeAlias o_conv;
13473         o_conv.inner = untag_ptr(o);
13474         o_conv.is_owned = ptr_is_owned(o);
13475         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13476         o_conv = NodeAlias_clone(&o_conv);
13477         LDKCResult_NodeAliasDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAliasDecodeErrorZ), "LDKCResult_NodeAliasDecodeErrorZ");
13478         *ret_conv = CResult_NodeAliasDecodeErrorZ_ok(o_conv);
13479         return tag_ptr(ret_conv, true);
13480 }
13481
13482 uint64_t  __attribute__((export_name("TS_CResult_NodeAliasDecodeErrorZ_err"))) TS_CResult_NodeAliasDecodeErrorZ_err(uint64_t e) {
13483         LDKDecodeError e_conv;
13484         e_conv.inner = untag_ptr(e);
13485         e_conv.is_owned = ptr_is_owned(e);
13486         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
13487         e_conv = DecodeError_clone(&e_conv);
13488         LDKCResult_NodeAliasDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAliasDecodeErrorZ), "LDKCResult_NodeAliasDecodeErrorZ");
13489         *ret_conv = CResult_NodeAliasDecodeErrorZ_err(e_conv);
13490         return tag_ptr(ret_conv, true);
13491 }
13492
13493 jboolean  __attribute__((export_name("TS_CResult_NodeAliasDecodeErrorZ_is_ok"))) TS_CResult_NodeAliasDecodeErrorZ_is_ok(uint64_t o) {
13494         LDKCResult_NodeAliasDecodeErrorZ* o_conv = (LDKCResult_NodeAliasDecodeErrorZ*)untag_ptr(o);
13495         jboolean ret_conv = CResult_NodeAliasDecodeErrorZ_is_ok(o_conv);
13496         return ret_conv;
13497 }
13498
13499 void  __attribute__((export_name("TS_CResult_NodeAliasDecodeErrorZ_free"))) TS_CResult_NodeAliasDecodeErrorZ_free(uint64_t _res) {
13500         if (!ptr_is_owned(_res)) return;
13501         void* _res_ptr = untag_ptr(_res);
13502         CHECK_ACCESS(_res_ptr);
13503         LDKCResult_NodeAliasDecodeErrorZ _res_conv = *(LDKCResult_NodeAliasDecodeErrorZ*)(_res_ptr);
13504         FREE(untag_ptr(_res));
13505         CResult_NodeAliasDecodeErrorZ_free(_res_conv);
13506 }
13507
13508 static inline uint64_t CResult_NodeAliasDecodeErrorZ_clone_ptr(LDKCResult_NodeAliasDecodeErrorZ *NONNULL_PTR arg) {
13509         LDKCResult_NodeAliasDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAliasDecodeErrorZ), "LDKCResult_NodeAliasDecodeErrorZ");
13510         *ret_conv = CResult_NodeAliasDecodeErrorZ_clone(arg);
13511         return tag_ptr(ret_conv, true);
13512 }
13513 int64_t  __attribute__((export_name("TS_CResult_NodeAliasDecodeErrorZ_clone_ptr"))) TS_CResult_NodeAliasDecodeErrorZ_clone_ptr(uint64_t arg) {
13514         LDKCResult_NodeAliasDecodeErrorZ* arg_conv = (LDKCResult_NodeAliasDecodeErrorZ*)untag_ptr(arg);
13515         int64_t ret_conv = CResult_NodeAliasDecodeErrorZ_clone_ptr(arg_conv);
13516         return ret_conv;
13517 }
13518
13519 uint64_t  __attribute__((export_name("TS_CResult_NodeAliasDecodeErrorZ_clone"))) TS_CResult_NodeAliasDecodeErrorZ_clone(uint64_t orig) {
13520         LDKCResult_NodeAliasDecodeErrorZ* orig_conv = (LDKCResult_NodeAliasDecodeErrorZ*)untag_ptr(orig);
13521         LDKCResult_NodeAliasDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAliasDecodeErrorZ), "LDKCResult_NodeAliasDecodeErrorZ");
13522         *ret_conv = CResult_NodeAliasDecodeErrorZ_clone(orig_conv);
13523         return tag_ptr(ret_conv, true);
13524 }
13525
13526 uint64_t  __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_ok"))) TS_CResult_NodeInfoDecodeErrorZ_ok(uint64_t o) {
13527         LDKNodeInfo o_conv;
13528         o_conv.inner = untag_ptr(o);
13529         o_conv.is_owned = ptr_is_owned(o);
13530         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13531         o_conv = NodeInfo_clone(&o_conv);
13532         LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
13533         *ret_conv = CResult_NodeInfoDecodeErrorZ_ok(o_conv);
13534         return tag_ptr(ret_conv, true);
13535 }
13536
13537 uint64_t  __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_err"))) TS_CResult_NodeInfoDecodeErrorZ_err(uint64_t e) {
13538         LDKDecodeError e_conv;
13539         e_conv.inner = untag_ptr(e);
13540         e_conv.is_owned = ptr_is_owned(e);
13541         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
13542         e_conv = DecodeError_clone(&e_conv);
13543         LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
13544         *ret_conv = CResult_NodeInfoDecodeErrorZ_err(e_conv);
13545         return tag_ptr(ret_conv, true);
13546 }
13547
13548 jboolean  __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_is_ok"))) TS_CResult_NodeInfoDecodeErrorZ_is_ok(uint64_t o) {
13549         LDKCResult_NodeInfoDecodeErrorZ* o_conv = (LDKCResult_NodeInfoDecodeErrorZ*)untag_ptr(o);
13550         jboolean ret_conv = CResult_NodeInfoDecodeErrorZ_is_ok(o_conv);
13551         return ret_conv;
13552 }
13553
13554 void  __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_free"))) TS_CResult_NodeInfoDecodeErrorZ_free(uint64_t _res) {
13555         if (!ptr_is_owned(_res)) return;
13556         void* _res_ptr = untag_ptr(_res);
13557         CHECK_ACCESS(_res_ptr);
13558         LDKCResult_NodeInfoDecodeErrorZ _res_conv = *(LDKCResult_NodeInfoDecodeErrorZ*)(_res_ptr);
13559         FREE(untag_ptr(_res));
13560         CResult_NodeInfoDecodeErrorZ_free(_res_conv);
13561 }
13562
13563 static inline uint64_t CResult_NodeInfoDecodeErrorZ_clone_ptr(LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR arg) {
13564         LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
13565         *ret_conv = CResult_NodeInfoDecodeErrorZ_clone(arg);
13566         return tag_ptr(ret_conv, true);
13567 }
13568 int64_t  __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_clone_ptr"))) TS_CResult_NodeInfoDecodeErrorZ_clone_ptr(uint64_t arg) {
13569         LDKCResult_NodeInfoDecodeErrorZ* arg_conv = (LDKCResult_NodeInfoDecodeErrorZ*)untag_ptr(arg);
13570         int64_t ret_conv = CResult_NodeInfoDecodeErrorZ_clone_ptr(arg_conv);
13571         return ret_conv;
13572 }
13573
13574 uint64_t  __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_clone"))) TS_CResult_NodeInfoDecodeErrorZ_clone(uint64_t orig) {
13575         LDKCResult_NodeInfoDecodeErrorZ* orig_conv = (LDKCResult_NodeInfoDecodeErrorZ*)untag_ptr(orig);
13576         LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
13577         *ret_conv = CResult_NodeInfoDecodeErrorZ_clone(orig_conv);
13578         return tag_ptr(ret_conv, true);
13579 }
13580
13581 uint64_t  __attribute__((export_name("TS_CResult_NetworkGraphDecodeErrorZ_ok"))) TS_CResult_NetworkGraphDecodeErrorZ_ok(uint64_t o) {
13582         LDKNetworkGraph o_conv;
13583         o_conv.inner = untag_ptr(o);
13584         o_conv.is_owned = ptr_is_owned(o);
13585         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13586         // WARNING: we need a move here but no clone is available for LDKNetworkGraph
13587         
13588         LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
13589         *ret_conv = CResult_NetworkGraphDecodeErrorZ_ok(o_conv);
13590         return tag_ptr(ret_conv, true);
13591 }
13592
13593 uint64_t  __attribute__((export_name("TS_CResult_NetworkGraphDecodeErrorZ_err"))) TS_CResult_NetworkGraphDecodeErrorZ_err(uint64_t e) {
13594         LDKDecodeError e_conv;
13595         e_conv.inner = untag_ptr(e);
13596         e_conv.is_owned = ptr_is_owned(e);
13597         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
13598         e_conv = DecodeError_clone(&e_conv);
13599         LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
13600         *ret_conv = CResult_NetworkGraphDecodeErrorZ_err(e_conv);
13601         return tag_ptr(ret_conv, true);
13602 }
13603
13604 jboolean  __attribute__((export_name("TS_CResult_NetworkGraphDecodeErrorZ_is_ok"))) TS_CResult_NetworkGraphDecodeErrorZ_is_ok(uint64_t o) {
13605         LDKCResult_NetworkGraphDecodeErrorZ* o_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)untag_ptr(o);
13606         jboolean ret_conv = CResult_NetworkGraphDecodeErrorZ_is_ok(o_conv);
13607         return ret_conv;
13608 }
13609
13610 void  __attribute__((export_name("TS_CResult_NetworkGraphDecodeErrorZ_free"))) TS_CResult_NetworkGraphDecodeErrorZ_free(uint64_t _res) {
13611         if (!ptr_is_owned(_res)) return;
13612         void* _res_ptr = untag_ptr(_res);
13613         CHECK_ACCESS(_res_ptr);
13614         LDKCResult_NetworkGraphDecodeErrorZ _res_conv = *(LDKCResult_NetworkGraphDecodeErrorZ*)(_res_ptr);
13615         FREE(untag_ptr(_res));
13616         CResult_NetworkGraphDecodeErrorZ_free(_res_conv);
13617 }
13618
13619 uint64_t  __attribute__((export_name("TS_COption_CVec_NetAddressZZ_some"))) TS_COption_CVec_NetAddressZZ_some(uint64_tArray o) {
13620         LDKCVec_NetAddressZ o_constr;
13621         o_constr.datalen = o->arr_len;
13622         if (o_constr.datalen > 0)
13623                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
13624         else
13625                 o_constr.data = NULL;
13626         uint64_t* o_vals = o->elems;
13627         for (size_t m = 0; m < o_constr.datalen; m++) {
13628                 uint64_t o_conv_12 = o_vals[m];
13629                 void* o_conv_12_ptr = untag_ptr(o_conv_12);
13630                 CHECK_ACCESS(o_conv_12_ptr);
13631                 LDKNetAddress o_conv_12_conv = *(LDKNetAddress*)(o_conv_12_ptr);
13632                 o_conv_12_conv = NetAddress_clone((LDKNetAddress*)untag_ptr(o_conv_12));
13633                 o_constr.data[m] = o_conv_12_conv;
13634         }
13635         FREE(o);
13636         LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
13637         *ret_copy = COption_CVec_NetAddressZZ_some(o_constr);
13638         uint64_t ret_ref = tag_ptr(ret_copy, true);
13639         return ret_ref;
13640 }
13641
13642 uint64_t  __attribute__((export_name("TS_COption_CVec_NetAddressZZ_none"))) TS_COption_CVec_NetAddressZZ_none() {
13643         LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
13644         *ret_copy = COption_CVec_NetAddressZZ_none();
13645         uint64_t ret_ref = tag_ptr(ret_copy, true);
13646         return ret_ref;
13647 }
13648
13649 void  __attribute__((export_name("TS_COption_CVec_NetAddressZZ_free"))) TS_COption_CVec_NetAddressZZ_free(uint64_t _res) {
13650         if (!ptr_is_owned(_res)) return;
13651         void* _res_ptr = untag_ptr(_res);
13652         CHECK_ACCESS(_res_ptr);
13653         LDKCOption_CVec_NetAddressZZ _res_conv = *(LDKCOption_CVec_NetAddressZZ*)(_res_ptr);
13654         FREE(untag_ptr(_res));
13655         COption_CVec_NetAddressZZ_free(_res_conv);
13656 }
13657
13658 static inline uint64_t COption_CVec_NetAddressZZ_clone_ptr(LDKCOption_CVec_NetAddressZZ *NONNULL_PTR arg) {
13659         LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
13660         *ret_copy = COption_CVec_NetAddressZZ_clone(arg);
13661         uint64_t ret_ref = tag_ptr(ret_copy, true);
13662         return ret_ref;
13663 }
13664 int64_t  __attribute__((export_name("TS_COption_CVec_NetAddressZZ_clone_ptr"))) TS_COption_CVec_NetAddressZZ_clone_ptr(uint64_t arg) {
13665         LDKCOption_CVec_NetAddressZZ* arg_conv = (LDKCOption_CVec_NetAddressZZ*)untag_ptr(arg);
13666         int64_t ret_conv = COption_CVec_NetAddressZZ_clone_ptr(arg_conv);
13667         return ret_conv;
13668 }
13669
13670 uint64_t  __attribute__((export_name("TS_COption_CVec_NetAddressZZ_clone"))) TS_COption_CVec_NetAddressZZ_clone(uint64_t orig) {
13671         LDKCOption_CVec_NetAddressZZ* orig_conv = (LDKCOption_CVec_NetAddressZZ*)untag_ptr(orig);
13672         LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
13673         *ret_copy = COption_CVec_NetAddressZZ_clone(orig_conv);
13674         uint64_t ret_ref = tag_ptr(ret_copy, true);
13675         return ret_ref;
13676 }
13677
13678 uint64_t  __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(uint64_t o) {
13679         LDKDelayedPaymentOutputDescriptor o_conv;
13680         o_conv.inner = untag_ptr(o);
13681         o_conv.is_owned = ptr_is_owned(o);
13682         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13683         o_conv = DelayedPaymentOutputDescriptor_clone(&o_conv);
13684         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
13685         *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(o_conv);
13686         return tag_ptr(ret_conv, true);
13687 }
13688
13689 uint64_t  __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(uint64_t e) {
13690         LDKDecodeError e_conv;
13691         e_conv.inner = untag_ptr(e);
13692         e_conv.is_owned = ptr_is_owned(e);
13693         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
13694         e_conv = DecodeError_clone(&e_conv);
13695         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
13696         *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(e_conv);
13697         return tag_ptr(ret_conv, true);
13698 }
13699
13700 jboolean  __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_is_ok"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_is_ok(uint64_t o) {
13701         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* o_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(o);
13702         jboolean ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_is_ok(o_conv);
13703         return ret_conv;
13704 }
13705
13706 void  __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(uint64_t _res) {
13707         if (!ptr_is_owned(_res)) return;
13708         void* _res_ptr = untag_ptr(_res);
13709         CHECK_ACCESS(_res_ptr);
13710         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(_res_ptr);
13711         FREE(untag_ptr(_res));
13712         CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(_res_conv);
13713 }
13714
13715 static inline uint64_t CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone_ptr(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR arg) {
13716         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
13717         *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(arg);
13718         return tag_ptr(ret_conv, true);
13719 }
13720 int64_t  __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone_ptr"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone_ptr(uint64_t arg) {
13721         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* arg_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(arg);
13722         int64_t ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone_ptr(arg_conv);
13723         return ret_conv;
13724 }
13725
13726 uint64_t  __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(uint64_t orig) {
13727         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(orig);
13728         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
13729         *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(orig_conv);
13730         return tag_ptr(ret_conv, true);
13731 }
13732
13733 uint64_t  __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok(uint64_t o) {
13734         LDKStaticPaymentOutputDescriptor o_conv;
13735         o_conv.inner = untag_ptr(o);
13736         o_conv.is_owned = ptr_is_owned(o);
13737         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13738         o_conv = StaticPaymentOutputDescriptor_clone(&o_conv);
13739         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
13740         *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok(o_conv);
13741         return tag_ptr(ret_conv, true);
13742 }
13743
13744 uint64_t  __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(uint64_t e) {
13745         LDKDecodeError e_conv;
13746         e_conv.inner = untag_ptr(e);
13747         e_conv.is_owned = ptr_is_owned(e);
13748         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
13749         e_conv = DecodeError_clone(&e_conv);
13750         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
13751         *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(e_conv);
13752         return tag_ptr(ret_conv, true);
13753 }
13754
13755 jboolean  __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_is_ok"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_is_ok(uint64_t o) {
13756         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* o_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(o);
13757         jboolean ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_is_ok(o_conv);
13758         return ret_conv;
13759 }
13760
13761 void  __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(uint64_t _res) {
13762         if (!ptr_is_owned(_res)) return;
13763         void* _res_ptr = untag_ptr(_res);
13764         CHECK_ACCESS(_res_ptr);
13765         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(_res_ptr);
13766         FREE(untag_ptr(_res));
13767         CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(_res_conv);
13768 }
13769
13770 static inline uint64_t CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone_ptr(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR arg) {
13771         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
13772         *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(arg);
13773         return tag_ptr(ret_conv, true);
13774 }
13775 int64_t  __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone_ptr"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone_ptr(uint64_t arg) {
13776         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* arg_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(arg);
13777         int64_t ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone_ptr(arg_conv);
13778         return ret_conv;
13779 }
13780
13781 uint64_t  __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(uint64_t orig) {
13782         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(orig);
13783         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
13784         *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(orig_conv);
13785         return tag_ptr(ret_conv, true);
13786 }
13787
13788 uint64_t  __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_ok"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_ok(uint64_t o) {
13789         void* o_ptr = untag_ptr(o);
13790         CHECK_ACCESS(o_ptr);
13791         LDKSpendableOutputDescriptor o_conv = *(LDKSpendableOutputDescriptor*)(o_ptr);
13792         o_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(o));
13793         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
13794         *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_ok(o_conv);
13795         return tag_ptr(ret_conv, true);
13796 }
13797
13798 uint64_t  __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_err"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_err(uint64_t e) {
13799         LDKDecodeError e_conv;
13800         e_conv.inner = untag_ptr(e);
13801         e_conv.is_owned = ptr_is_owned(e);
13802         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
13803         e_conv = DecodeError_clone(&e_conv);
13804         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
13805         *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_err(e_conv);
13806         return tag_ptr(ret_conv, true);
13807 }
13808
13809 jboolean  __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_is_ok"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_is_ok(uint64_t o) {
13810         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* o_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)untag_ptr(o);
13811         jboolean ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_is_ok(o_conv);
13812         return ret_conv;
13813 }
13814
13815 void  __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_free"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_free(uint64_t _res) {
13816         if (!ptr_is_owned(_res)) return;
13817         void* _res_ptr = untag_ptr(_res);
13818         CHECK_ACCESS(_res_ptr);
13819         LDKCResult_SpendableOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(_res_ptr);
13820         FREE(untag_ptr(_res));
13821         CResult_SpendableOutputDescriptorDecodeErrorZ_free(_res_conv);
13822 }
13823
13824 static inline uint64_t CResult_SpendableOutputDescriptorDecodeErrorZ_clone_ptr(LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR arg) {
13825         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
13826         *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_clone(arg);
13827         return tag_ptr(ret_conv, true);
13828 }
13829 int64_t  __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_clone_ptr"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_clone_ptr(uint64_t arg) {
13830         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* arg_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)untag_ptr(arg);
13831         int64_t ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_clone_ptr(arg_conv);
13832         return ret_conv;
13833 }
13834
13835 uint64_t  __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_clone"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_clone(uint64_t orig) {
13836         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)untag_ptr(orig);
13837         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
13838         *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_clone(orig_conv);
13839         return tag_ptr(ret_conv, true);
13840 }
13841
13842 void  __attribute__((export_name("TS_CVec_PaymentPreimageZ_free"))) TS_CVec_PaymentPreimageZ_free(ptrArray _res) {
13843         LDKCVec_PaymentPreimageZ _res_constr;
13844         _res_constr.datalen = _res->arr_len;
13845         if (_res_constr.datalen > 0)
13846                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_PaymentPreimageZ Elements");
13847         else
13848                 _res_constr.data = NULL;
13849         int8_tArray* _res_vals = (void*) _res->elems;
13850         for (size_t m = 0; m < _res_constr.datalen; m++) {
13851                 int8_tArray _res_conv_12 = _res_vals[m];
13852                 LDKThirtyTwoBytes _res_conv_12_ref;
13853                 CHECK(_res_conv_12->arr_len == 32);
13854                 memcpy(_res_conv_12_ref.data, _res_conv_12->elems, 32); FREE(_res_conv_12);
13855                 _res_constr.data[m] = _res_conv_12_ref;
13856         }
13857         FREE(_res);
13858         CVec_PaymentPreimageZ_free(_res_constr);
13859 }
13860
13861 static inline uint64_t C2Tuple_SignatureCVec_SignatureZZ_clone_ptr(LDKC2Tuple_SignatureCVec_SignatureZZ *NONNULL_PTR arg) {
13862         LDKC2Tuple_SignatureCVec_SignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
13863         *ret_conv = C2Tuple_SignatureCVec_SignatureZZ_clone(arg);
13864         return tag_ptr(ret_conv, true);
13865 }
13866 int64_t  __attribute__((export_name("TS_C2Tuple_SignatureCVec_SignatureZZ_clone_ptr"))) TS_C2Tuple_SignatureCVec_SignatureZZ_clone_ptr(uint64_t arg) {
13867         LDKC2Tuple_SignatureCVec_SignatureZZ* arg_conv = (LDKC2Tuple_SignatureCVec_SignatureZZ*)untag_ptr(arg);
13868         int64_t ret_conv = C2Tuple_SignatureCVec_SignatureZZ_clone_ptr(arg_conv);
13869         return ret_conv;
13870 }
13871
13872 uint64_t  __attribute__((export_name("TS_C2Tuple_SignatureCVec_SignatureZZ_clone"))) TS_C2Tuple_SignatureCVec_SignatureZZ_clone(uint64_t orig) {
13873         LDKC2Tuple_SignatureCVec_SignatureZZ* orig_conv = (LDKC2Tuple_SignatureCVec_SignatureZZ*)untag_ptr(orig);
13874         LDKC2Tuple_SignatureCVec_SignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
13875         *ret_conv = C2Tuple_SignatureCVec_SignatureZZ_clone(orig_conv);
13876         return tag_ptr(ret_conv, true);
13877 }
13878
13879 uint64_t  __attribute__((export_name("TS_C2Tuple_SignatureCVec_SignatureZZ_new"))) TS_C2Tuple_SignatureCVec_SignatureZZ_new(int8_tArray a, ptrArray b) {
13880         LDKSignature a_ref;
13881         CHECK(a->arr_len == 64);
13882         memcpy(a_ref.compact_form, a->elems, 64); FREE(a);
13883         LDKCVec_SignatureZ b_constr;
13884         b_constr.datalen = b->arr_len;
13885         if (b_constr.datalen > 0)
13886                 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
13887         else
13888                 b_constr.data = NULL;
13889         int8_tArray* b_vals = (void*) b->elems;
13890         for (size_t m = 0; m < b_constr.datalen; m++) {
13891                 int8_tArray b_conv_12 = b_vals[m];
13892                 LDKSignature b_conv_12_ref;
13893                 CHECK(b_conv_12->arr_len == 64);
13894                 memcpy(b_conv_12_ref.compact_form, b_conv_12->elems, 64); FREE(b_conv_12);
13895                 b_constr.data[m] = b_conv_12_ref;
13896         }
13897         FREE(b);
13898         LDKC2Tuple_SignatureCVec_SignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
13899         *ret_conv = C2Tuple_SignatureCVec_SignatureZZ_new(a_ref, b_constr);
13900         return tag_ptr(ret_conv, true);
13901 }
13902
13903 void  __attribute__((export_name("TS_C2Tuple_SignatureCVec_SignatureZZ_free"))) TS_C2Tuple_SignatureCVec_SignatureZZ_free(uint64_t _res) {
13904         if (!ptr_is_owned(_res)) return;
13905         void* _res_ptr = untag_ptr(_res);
13906         CHECK_ACCESS(_res_ptr);
13907         LDKC2Tuple_SignatureCVec_SignatureZZ _res_conv = *(LDKC2Tuple_SignatureCVec_SignatureZZ*)(_res_ptr);
13908         FREE(untag_ptr(_res));
13909         C2Tuple_SignatureCVec_SignatureZZ_free(_res_conv);
13910 }
13911
13912 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(uint64_t o) {
13913         void* o_ptr = untag_ptr(o);
13914         CHECK_ACCESS(o_ptr);
13915         LDKC2Tuple_SignatureCVec_SignatureZZ o_conv = *(LDKC2Tuple_SignatureCVec_SignatureZZ*)(o_ptr);
13916         o_conv = C2Tuple_SignatureCVec_SignatureZZ_clone((LDKC2Tuple_SignatureCVec_SignatureZZ*)untag_ptr(o));
13917         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
13918         *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(o_conv);
13919         return tag_ptr(ret_conv, true);
13920 }
13921
13922 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err() {
13923         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
13924         *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err();
13925         return tag_ptr(ret_conv, true);
13926 }
13927
13928 jboolean  __attribute__((export_name("TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_is_ok"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_is_ok(uint64_t o) {
13929         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* o_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)untag_ptr(o);
13930         jboolean ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_is_ok(o_conv);
13931         return ret_conv;
13932 }
13933
13934 void  __attribute__((export_name("TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(uint64_t _res) {
13935         if (!ptr_is_owned(_res)) return;
13936         void* _res_ptr = untag_ptr(_res);
13937         CHECK_ACCESS(_res_ptr);
13938         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ _res_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(_res_ptr);
13939         FREE(untag_ptr(_res));
13940         CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(_res_conv);
13941 }
13942
13943 static inline uint64_t CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone_ptr(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *NONNULL_PTR arg) {
13944         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
13945         *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(arg);
13946         return tag_ptr(ret_conv, true);
13947 }
13948 int64_t  __attribute__((export_name("TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone_ptr"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone_ptr(uint64_t arg) {
13949         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* arg_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)untag_ptr(arg);
13950         int64_t ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone_ptr(arg_conv);
13951         return ret_conv;
13952 }
13953
13954 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(uint64_t orig) {
13955         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* orig_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)untag_ptr(orig);
13956         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
13957         *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(orig_conv);
13958         return tag_ptr(ret_conv, true);
13959 }
13960
13961 uint64_t  __attribute__((export_name("TS_CResult_SignatureNoneZ_ok"))) TS_CResult_SignatureNoneZ_ok(int8_tArray o) {
13962         LDKSignature o_ref;
13963         CHECK(o->arr_len == 64);
13964         memcpy(o_ref.compact_form, o->elems, 64); FREE(o);
13965         LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
13966         *ret_conv = CResult_SignatureNoneZ_ok(o_ref);
13967         return tag_ptr(ret_conv, true);
13968 }
13969
13970 uint64_t  __attribute__((export_name("TS_CResult_SignatureNoneZ_err"))) TS_CResult_SignatureNoneZ_err() {
13971         LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
13972         *ret_conv = CResult_SignatureNoneZ_err();
13973         return tag_ptr(ret_conv, true);
13974 }
13975
13976 jboolean  __attribute__((export_name("TS_CResult_SignatureNoneZ_is_ok"))) TS_CResult_SignatureNoneZ_is_ok(uint64_t o) {
13977         LDKCResult_SignatureNoneZ* o_conv = (LDKCResult_SignatureNoneZ*)untag_ptr(o);
13978         jboolean ret_conv = CResult_SignatureNoneZ_is_ok(o_conv);
13979         return ret_conv;
13980 }
13981
13982 void  __attribute__((export_name("TS_CResult_SignatureNoneZ_free"))) TS_CResult_SignatureNoneZ_free(uint64_t _res) {
13983         if (!ptr_is_owned(_res)) return;
13984         void* _res_ptr = untag_ptr(_res);
13985         CHECK_ACCESS(_res_ptr);
13986         LDKCResult_SignatureNoneZ _res_conv = *(LDKCResult_SignatureNoneZ*)(_res_ptr);
13987         FREE(untag_ptr(_res));
13988         CResult_SignatureNoneZ_free(_res_conv);
13989 }
13990
13991 static inline uint64_t CResult_SignatureNoneZ_clone_ptr(LDKCResult_SignatureNoneZ *NONNULL_PTR arg) {
13992         LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
13993         *ret_conv = CResult_SignatureNoneZ_clone(arg);
13994         return tag_ptr(ret_conv, true);
13995 }
13996 int64_t  __attribute__((export_name("TS_CResult_SignatureNoneZ_clone_ptr"))) TS_CResult_SignatureNoneZ_clone_ptr(uint64_t arg) {
13997         LDKCResult_SignatureNoneZ* arg_conv = (LDKCResult_SignatureNoneZ*)untag_ptr(arg);
13998         int64_t ret_conv = CResult_SignatureNoneZ_clone_ptr(arg_conv);
13999         return ret_conv;
14000 }
14001
14002 uint64_t  __attribute__((export_name("TS_CResult_SignatureNoneZ_clone"))) TS_CResult_SignatureNoneZ_clone(uint64_t orig) {
14003         LDKCResult_SignatureNoneZ* orig_conv = (LDKCResult_SignatureNoneZ*)untag_ptr(orig);
14004         LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
14005         *ret_conv = CResult_SignatureNoneZ_clone(orig_conv);
14006         return tag_ptr(ret_conv, true);
14007 }
14008
14009 static inline uint64_t C2Tuple_SignatureSignatureZ_clone_ptr(LDKC2Tuple_SignatureSignatureZ *NONNULL_PTR arg) {
14010         LDKC2Tuple_SignatureSignatureZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureSignatureZ), "LDKC2Tuple_SignatureSignatureZ");
14011         *ret_conv = C2Tuple_SignatureSignatureZ_clone(arg);
14012         return tag_ptr(ret_conv, true);
14013 }
14014 int64_t  __attribute__((export_name("TS_C2Tuple_SignatureSignatureZ_clone_ptr"))) TS_C2Tuple_SignatureSignatureZ_clone_ptr(uint64_t arg) {
14015         LDKC2Tuple_SignatureSignatureZ* arg_conv = (LDKC2Tuple_SignatureSignatureZ*)untag_ptr(arg);
14016         int64_t ret_conv = C2Tuple_SignatureSignatureZ_clone_ptr(arg_conv);
14017         return ret_conv;
14018 }
14019
14020 uint64_t  __attribute__((export_name("TS_C2Tuple_SignatureSignatureZ_clone"))) TS_C2Tuple_SignatureSignatureZ_clone(uint64_t orig) {
14021         LDKC2Tuple_SignatureSignatureZ* orig_conv = (LDKC2Tuple_SignatureSignatureZ*)untag_ptr(orig);
14022         LDKC2Tuple_SignatureSignatureZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureSignatureZ), "LDKC2Tuple_SignatureSignatureZ");
14023         *ret_conv = C2Tuple_SignatureSignatureZ_clone(orig_conv);
14024         return tag_ptr(ret_conv, true);
14025 }
14026
14027 uint64_t  __attribute__((export_name("TS_C2Tuple_SignatureSignatureZ_new"))) TS_C2Tuple_SignatureSignatureZ_new(int8_tArray a, int8_tArray b) {
14028         LDKSignature a_ref;
14029         CHECK(a->arr_len == 64);
14030         memcpy(a_ref.compact_form, a->elems, 64); FREE(a);
14031         LDKSignature b_ref;
14032         CHECK(b->arr_len == 64);
14033         memcpy(b_ref.compact_form, b->elems, 64); FREE(b);
14034         LDKC2Tuple_SignatureSignatureZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureSignatureZ), "LDKC2Tuple_SignatureSignatureZ");
14035         *ret_conv = C2Tuple_SignatureSignatureZ_new(a_ref, b_ref);
14036         return tag_ptr(ret_conv, true);
14037 }
14038
14039 void  __attribute__((export_name("TS_C2Tuple_SignatureSignatureZ_free"))) TS_C2Tuple_SignatureSignatureZ_free(uint64_t _res) {
14040         if (!ptr_is_owned(_res)) return;
14041         void* _res_ptr = untag_ptr(_res);
14042         CHECK_ACCESS(_res_ptr);
14043         LDKC2Tuple_SignatureSignatureZ _res_conv = *(LDKC2Tuple_SignatureSignatureZ*)(_res_ptr);
14044         FREE(untag_ptr(_res));
14045         C2Tuple_SignatureSignatureZ_free(_res_conv);
14046 }
14047
14048 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_SignatureSignatureZNoneZ_ok"))) TS_CResult_C2Tuple_SignatureSignatureZNoneZ_ok(uint64_t o) {
14049         void* o_ptr = untag_ptr(o);
14050         CHECK_ACCESS(o_ptr);
14051         LDKC2Tuple_SignatureSignatureZ o_conv = *(LDKC2Tuple_SignatureSignatureZ*)(o_ptr);
14052         o_conv = C2Tuple_SignatureSignatureZ_clone((LDKC2Tuple_SignatureSignatureZ*)untag_ptr(o));
14053         LDKCResult_C2Tuple_SignatureSignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureSignatureZNoneZ), "LDKCResult_C2Tuple_SignatureSignatureZNoneZ");
14054         *ret_conv = CResult_C2Tuple_SignatureSignatureZNoneZ_ok(o_conv);
14055         return tag_ptr(ret_conv, true);
14056 }
14057
14058 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_SignatureSignatureZNoneZ_err"))) TS_CResult_C2Tuple_SignatureSignatureZNoneZ_err() {
14059         LDKCResult_C2Tuple_SignatureSignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureSignatureZNoneZ), "LDKCResult_C2Tuple_SignatureSignatureZNoneZ");
14060         *ret_conv = CResult_C2Tuple_SignatureSignatureZNoneZ_err();
14061         return tag_ptr(ret_conv, true);
14062 }
14063
14064 jboolean  __attribute__((export_name("TS_CResult_C2Tuple_SignatureSignatureZNoneZ_is_ok"))) TS_CResult_C2Tuple_SignatureSignatureZNoneZ_is_ok(uint64_t o) {
14065         LDKCResult_C2Tuple_SignatureSignatureZNoneZ* o_conv = (LDKCResult_C2Tuple_SignatureSignatureZNoneZ*)untag_ptr(o);
14066         jboolean ret_conv = CResult_C2Tuple_SignatureSignatureZNoneZ_is_ok(o_conv);
14067         return ret_conv;
14068 }
14069
14070 void  __attribute__((export_name("TS_CResult_C2Tuple_SignatureSignatureZNoneZ_free"))) TS_CResult_C2Tuple_SignatureSignatureZNoneZ_free(uint64_t _res) {
14071         if (!ptr_is_owned(_res)) return;
14072         void* _res_ptr = untag_ptr(_res);
14073         CHECK_ACCESS(_res_ptr);
14074         LDKCResult_C2Tuple_SignatureSignatureZNoneZ _res_conv = *(LDKCResult_C2Tuple_SignatureSignatureZNoneZ*)(_res_ptr);
14075         FREE(untag_ptr(_res));
14076         CResult_C2Tuple_SignatureSignatureZNoneZ_free(_res_conv);
14077 }
14078
14079 static inline uint64_t CResult_C2Tuple_SignatureSignatureZNoneZ_clone_ptr(LDKCResult_C2Tuple_SignatureSignatureZNoneZ *NONNULL_PTR arg) {
14080         LDKCResult_C2Tuple_SignatureSignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureSignatureZNoneZ), "LDKCResult_C2Tuple_SignatureSignatureZNoneZ");
14081         *ret_conv = CResult_C2Tuple_SignatureSignatureZNoneZ_clone(arg);
14082         return tag_ptr(ret_conv, true);
14083 }
14084 int64_t  __attribute__((export_name("TS_CResult_C2Tuple_SignatureSignatureZNoneZ_clone_ptr"))) TS_CResult_C2Tuple_SignatureSignatureZNoneZ_clone_ptr(uint64_t arg) {
14085         LDKCResult_C2Tuple_SignatureSignatureZNoneZ* arg_conv = (LDKCResult_C2Tuple_SignatureSignatureZNoneZ*)untag_ptr(arg);
14086         int64_t ret_conv = CResult_C2Tuple_SignatureSignatureZNoneZ_clone_ptr(arg_conv);
14087         return ret_conv;
14088 }
14089
14090 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_SignatureSignatureZNoneZ_clone"))) TS_CResult_C2Tuple_SignatureSignatureZNoneZ_clone(uint64_t orig) {
14091         LDKCResult_C2Tuple_SignatureSignatureZNoneZ* orig_conv = (LDKCResult_C2Tuple_SignatureSignatureZNoneZ*)untag_ptr(orig);
14092         LDKCResult_C2Tuple_SignatureSignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureSignatureZNoneZ), "LDKCResult_C2Tuple_SignatureSignatureZNoneZ");
14093         *ret_conv = CResult_C2Tuple_SignatureSignatureZNoneZ_clone(orig_conv);
14094         return tag_ptr(ret_conv, true);
14095 }
14096
14097 uint64_t  __attribute__((export_name("TS_CResult_SecretKeyNoneZ_ok"))) TS_CResult_SecretKeyNoneZ_ok(int8_tArray o) {
14098         LDKSecretKey o_ref;
14099         CHECK(o->arr_len == 32);
14100         memcpy(o_ref.bytes, o->elems, 32); FREE(o);
14101         LDKCResult_SecretKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyNoneZ), "LDKCResult_SecretKeyNoneZ");
14102         *ret_conv = CResult_SecretKeyNoneZ_ok(o_ref);
14103         return tag_ptr(ret_conv, true);
14104 }
14105
14106 uint64_t  __attribute__((export_name("TS_CResult_SecretKeyNoneZ_err"))) TS_CResult_SecretKeyNoneZ_err() {
14107         LDKCResult_SecretKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyNoneZ), "LDKCResult_SecretKeyNoneZ");
14108         *ret_conv = CResult_SecretKeyNoneZ_err();
14109         return tag_ptr(ret_conv, true);
14110 }
14111
14112 jboolean  __attribute__((export_name("TS_CResult_SecretKeyNoneZ_is_ok"))) TS_CResult_SecretKeyNoneZ_is_ok(uint64_t o) {
14113         LDKCResult_SecretKeyNoneZ* o_conv = (LDKCResult_SecretKeyNoneZ*)untag_ptr(o);
14114         jboolean ret_conv = CResult_SecretKeyNoneZ_is_ok(o_conv);
14115         return ret_conv;
14116 }
14117
14118 void  __attribute__((export_name("TS_CResult_SecretKeyNoneZ_free"))) TS_CResult_SecretKeyNoneZ_free(uint64_t _res) {
14119         if (!ptr_is_owned(_res)) return;
14120         void* _res_ptr = untag_ptr(_res);
14121         CHECK_ACCESS(_res_ptr);
14122         LDKCResult_SecretKeyNoneZ _res_conv = *(LDKCResult_SecretKeyNoneZ*)(_res_ptr);
14123         FREE(untag_ptr(_res));
14124         CResult_SecretKeyNoneZ_free(_res_conv);
14125 }
14126
14127 static inline uint64_t CResult_SecretKeyNoneZ_clone_ptr(LDKCResult_SecretKeyNoneZ *NONNULL_PTR arg) {
14128         LDKCResult_SecretKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyNoneZ), "LDKCResult_SecretKeyNoneZ");
14129         *ret_conv = CResult_SecretKeyNoneZ_clone(arg);
14130         return tag_ptr(ret_conv, true);
14131 }
14132 int64_t  __attribute__((export_name("TS_CResult_SecretKeyNoneZ_clone_ptr"))) TS_CResult_SecretKeyNoneZ_clone_ptr(uint64_t arg) {
14133         LDKCResult_SecretKeyNoneZ* arg_conv = (LDKCResult_SecretKeyNoneZ*)untag_ptr(arg);
14134         int64_t ret_conv = CResult_SecretKeyNoneZ_clone_ptr(arg_conv);
14135         return ret_conv;
14136 }
14137
14138 uint64_t  __attribute__((export_name("TS_CResult_SecretKeyNoneZ_clone"))) TS_CResult_SecretKeyNoneZ_clone(uint64_t orig) {
14139         LDKCResult_SecretKeyNoneZ* orig_conv = (LDKCResult_SecretKeyNoneZ*)untag_ptr(orig);
14140         LDKCResult_SecretKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyNoneZ), "LDKCResult_SecretKeyNoneZ");
14141         *ret_conv = CResult_SecretKeyNoneZ_clone(orig_conv);
14142         return tag_ptr(ret_conv, true);
14143 }
14144
14145 uint64_t  __attribute__((export_name("TS_CResult_SignDecodeErrorZ_ok"))) TS_CResult_SignDecodeErrorZ_ok(uint64_t o) {
14146         void* o_ptr = untag_ptr(o);
14147         CHECK_ACCESS(o_ptr);
14148         LDKSign o_conv = *(LDKSign*)(o_ptr);
14149         if (o_conv.free == LDKSign_JCalls_free) {
14150                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
14151                 LDKSign_JCalls_cloned(&o_conv);
14152         }
14153         LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
14154         *ret_conv = CResult_SignDecodeErrorZ_ok(o_conv);
14155         return tag_ptr(ret_conv, true);
14156 }
14157
14158 uint64_t  __attribute__((export_name("TS_CResult_SignDecodeErrorZ_err"))) TS_CResult_SignDecodeErrorZ_err(uint64_t e) {
14159         LDKDecodeError e_conv;
14160         e_conv.inner = untag_ptr(e);
14161         e_conv.is_owned = ptr_is_owned(e);
14162         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14163         e_conv = DecodeError_clone(&e_conv);
14164         LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
14165         *ret_conv = CResult_SignDecodeErrorZ_err(e_conv);
14166         return tag_ptr(ret_conv, true);
14167 }
14168
14169 jboolean  __attribute__((export_name("TS_CResult_SignDecodeErrorZ_is_ok"))) TS_CResult_SignDecodeErrorZ_is_ok(uint64_t o) {
14170         LDKCResult_SignDecodeErrorZ* o_conv = (LDKCResult_SignDecodeErrorZ*)untag_ptr(o);
14171         jboolean ret_conv = CResult_SignDecodeErrorZ_is_ok(o_conv);
14172         return ret_conv;
14173 }
14174
14175 void  __attribute__((export_name("TS_CResult_SignDecodeErrorZ_free"))) TS_CResult_SignDecodeErrorZ_free(uint64_t _res) {
14176         if (!ptr_is_owned(_res)) return;
14177         void* _res_ptr = untag_ptr(_res);
14178         CHECK_ACCESS(_res_ptr);
14179         LDKCResult_SignDecodeErrorZ _res_conv = *(LDKCResult_SignDecodeErrorZ*)(_res_ptr);
14180         FREE(untag_ptr(_res));
14181         CResult_SignDecodeErrorZ_free(_res_conv);
14182 }
14183
14184 static inline uint64_t CResult_SignDecodeErrorZ_clone_ptr(LDKCResult_SignDecodeErrorZ *NONNULL_PTR arg) {
14185         LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
14186         *ret_conv = CResult_SignDecodeErrorZ_clone(arg);
14187         return tag_ptr(ret_conv, true);
14188 }
14189 int64_t  __attribute__((export_name("TS_CResult_SignDecodeErrorZ_clone_ptr"))) TS_CResult_SignDecodeErrorZ_clone_ptr(uint64_t arg) {
14190         LDKCResult_SignDecodeErrorZ* arg_conv = (LDKCResult_SignDecodeErrorZ*)untag_ptr(arg);
14191         int64_t ret_conv = CResult_SignDecodeErrorZ_clone_ptr(arg_conv);
14192         return ret_conv;
14193 }
14194
14195 uint64_t  __attribute__((export_name("TS_CResult_SignDecodeErrorZ_clone"))) TS_CResult_SignDecodeErrorZ_clone(uint64_t orig) {
14196         LDKCResult_SignDecodeErrorZ* orig_conv = (LDKCResult_SignDecodeErrorZ*)untag_ptr(orig);
14197         LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
14198         *ret_conv = CResult_SignDecodeErrorZ_clone(orig_conv);
14199         return tag_ptr(ret_conv, true);
14200 }
14201
14202 void  __attribute__((export_name("TS_CVec_u5Z_free"))) TS_CVec_u5Z_free(ptrArray _res) {
14203         LDKCVec_u5Z _res_constr;
14204         _res_constr.datalen = _res->arr_len;
14205         if (_res_constr.datalen > 0)
14206                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKu5), "LDKCVec_u5Z Elements");
14207         else
14208                 _res_constr.data = NULL;
14209         int8_t* _res_vals = (void*) _res->elems;
14210         for (size_t h = 0; h < _res_constr.datalen; h++) {
14211                 int8_t _res_conv_7 = _res_vals[h];
14212                 
14213                 _res_constr.data[h] = (LDKu5){ ._0 = _res_conv_7 };
14214         }
14215         FREE(_res);
14216         CVec_u5Z_free(_res_constr);
14217 }
14218
14219 uint64_t  __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_ok"))) TS_CResult_RecoverableSignatureNoneZ_ok(int8_tArray o) {
14220         LDKRecoverableSignature o_ref;
14221         CHECK(o->arr_len == 68);
14222         memcpy(o_ref.serialized_form, o->elems, 68); FREE(o);
14223         LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
14224         *ret_conv = CResult_RecoverableSignatureNoneZ_ok(o_ref);
14225         return tag_ptr(ret_conv, true);
14226 }
14227
14228 uint64_t  __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_err"))) TS_CResult_RecoverableSignatureNoneZ_err() {
14229         LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
14230         *ret_conv = CResult_RecoverableSignatureNoneZ_err();
14231         return tag_ptr(ret_conv, true);
14232 }
14233
14234 jboolean  __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_is_ok"))) TS_CResult_RecoverableSignatureNoneZ_is_ok(uint64_t o) {
14235         LDKCResult_RecoverableSignatureNoneZ* o_conv = (LDKCResult_RecoverableSignatureNoneZ*)untag_ptr(o);
14236         jboolean ret_conv = CResult_RecoverableSignatureNoneZ_is_ok(o_conv);
14237         return ret_conv;
14238 }
14239
14240 void  __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_free"))) TS_CResult_RecoverableSignatureNoneZ_free(uint64_t _res) {
14241         if (!ptr_is_owned(_res)) return;
14242         void* _res_ptr = untag_ptr(_res);
14243         CHECK_ACCESS(_res_ptr);
14244         LDKCResult_RecoverableSignatureNoneZ _res_conv = *(LDKCResult_RecoverableSignatureNoneZ*)(_res_ptr);
14245         FREE(untag_ptr(_res));
14246         CResult_RecoverableSignatureNoneZ_free(_res_conv);
14247 }
14248
14249 static inline uint64_t CResult_RecoverableSignatureNoneZ_clone_ptr(LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR arg) {
14250         LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
14251         *ret_conv = CResult_RecoverableSignatureNoneZ_clone(arg);
14252         return tag_ptr(ret_conv, true);
14253 }
14254 int64_t  __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_clone_ptr"))) TS_CResult_RecoverableSignatureNoneZ_clone_ptr(uint64_t arg) {
14255         LDKCResult_RecoverableSignatureNoneZ* arg_conv = (LDKCResult_RecoverableSignatureNoneZ*)untag_ptr(arg);
14256         int64_t ret_conv = CResult_RecoverableSignatureNoneZ_clone_ptr(arg_conv);
14257         return ret_conv;
14258 }
14259
14260 uint64_t  __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_clone"))) TS_CResult_RecoverableSignatureNoneZ_clone(uint64_t orig) {
14261         LDKCResult_RecoverableSignatureNoneZ* orig_conv = (LDKCResult_RecoverableSignatureNoneZ*)untag_ptr(orig);
14262         LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
14263         *ret_conv = CResult_RecoverableSignatureNoneZ_clone(orig_conv);
14264         return tag_ptr(ret_conv, true);
14265 }
14266
14267 void  __attribute__((export_name("TS_CVec_u8Z_free"))) TS_CVec_u8Z_free(int8_tArray _res) {
14268         LDKCVec_u8Z _res_ref;
14269         _res_ref.datalen = _res->arr_len;
14270         _res_ref.data = MALLOC(_res_ref.datalen, "LDKCVec_u8Z Bytes");
14271         memcpy(_res_ref.data, _res->elems, _res_ref.datalen); FREE(_res);
14272         CVec_u8Z_free(_res_ref);
14273 }
14274
14275 void  __attribute__((export_name("TS_CVec_CVec_u8ZZ_free"))) TS_CVec_CVec_u8ZZ_free(ptrArray _res) {
14276         LDKCVec_CVec_u8ZZ _res_constr;
14277         _res_constr.datalen = _res->arr_len;
14278         if (_res_constr.datalen > 0)
14279                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCVec_u8Z), "LDKCVec_CVec_u8ZZ Elements");
14280         else
14281                 _res_constr.data = NULL;
14282         int8_tArray* _res_vals = (void*) _res->elems;
14283         for (size_t m = 0; m < _res_constr.datalen; m++) {
14284                 int8_tArray _res_conv_12 = _res_vals[m];
14285                 LDKCVec_u8Z _res_conv_12_ref;
14286                 _res_conv_12_ref.datalen = _res_conv_12->arr_len;
14287                 _res_conv_12_ref.data = MALLOC(_res_conv_12_ref.datalen, "LDKCVec_u8Z Bytes");
14288                 memcpy(_res_conv_12_ref.data, _res_conv_12->elems, _res_conv_12_ref.datalen); FREE(_res_conv_12);
14289                 _res_constr.data[m] = _res_conv_12_ref;
14290         }
14291         FREE(_res);
14292         CVec_CVec_u8ZZ_free(_res_constr);
14293 }
14294
14295 uint64_t  __attribute__((export_name("TS_CResult_CVec_CVec_u8ZZNoneZ_ok"))) TS_CResult_CVec_CVec_u8ZZNoneZ_ok(ptrArray o) {
14296         LDKCVec_CVec_u8ZZ o_constr;
14297         o_constr.datalen = o->arr_len;
14298         if (o_constr.datalen > 0)
14299                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKCVec_u8Z), "LDKCVec_CVec_u8ZZ Elements");
14300         else
14301                 o_constr.data = NULL;
14302         int8_tArray* o_vals = (void*) o->elems;
14303         for (size_t m = 0; m < o_constr.datalen; m++) {
14304                 int8_tArray o_conv_12 = o_vals[m];
14305                 LDKCVec_u8Z o_conv_12_ref;
14306                 o_conv_12_ref.datalen = o_conv_12->arr_len;
14307                 o_conv_12_ref.data = MALLOC(o_conv_12_ref.datalen, "LDKCVec_u8Z Bytes");
14308                 memcpy(o_conv_12_ref.data, o_conv_12->elems, o_conv_12_ref.datalen); FREE(o_conv_12);
14309                 o_constr.data[m] = o_conv_12_ref;
14310         }
14311         FREE(o);
14312         LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
14313         *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_ok(o_constr);
14314         return tag_ptr(ret_conv, true);
14315 }
14316
14317 uint64_t  __attribute__((export_name("TS_CResult_CVec_CVec_u8ZZNoneZ_err"))) TS_CResult_CVec_CVec_u8ZZNoneZ_err() {
14318         LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
14319         *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_err();
14320         return tag_ptr(ret_conv, true);
14321 }
14322
14323 jboolean  __attribute__((export_name("TS_CResult_CVec_CVec_u8ZZNoneZ_is_ok"))) TS_CResult_CVec_CVec_u8ZZNoneZ_is_ok(uint64_t o) {
14324         LDKCResult_CVec_CVec_u8ZZNoneZ* o_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)untag_ptr(o);
14325         jboolean ret_conv = CResult_CVec_CVec_u8ZZNoneZ_is_ok(o_conv);
14326         return ret_conv;
14327 }
14328
14329 void  __attribute__((export_name("TS_CResult_CVec_CVec_u8ZZNoneZ_free"))) TS_CResult_CVec_CVec_u8ZZNoneZ_free(uint64_t _res) {
14330         if (!ptr_is_owned(_res)) return;
14331         void* _res_ptr = untag_ptr(_res);
14332         CHECK_ACCESS(_res_ptr);
14333         LDKCResult_CVec_CVec_u8ZZNoneZ _res_conv = *(LDKCResult_CVec_CVec_u8ZZNoneZ*)(_res_ptr);
14334         FREE(untag_ptr(_res));
14335         CResult_CVec_CVec_u8ZZNoneZ_free(_res_conv);
14336 }
14337
14338 static inline uint64_t CResult_CVec_CVec_u8ZZNoneZ_clone_ptr(LDKCResult_CVec_CVec_u8ZZNoneZ *NONNULL_PTR arg) {
14339         LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
14340         *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_clone(arg);
14341         return tag_ptr(ret_conv, true);
14342 }
14343 int64_t  __attribute__((export_name("TS_CResult_CVec_CVec_u8ZZNoneZ_clone_ptr"))) TS_CResult_CVec_CVec_u8ZZNoneZ_clone_ptr(uint64_t arg) {
14344         LDKCResult_CVec_CVec_u8ZZNoneZ* arg_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)untag_ptr(arg);
14345         int64_t ret_conv = CResult_CVec_CVec_u8ZZNoneZ_clone_ptr(arg_conv);
14346         return ret_conv;
14347 }
14348
14349 uint64_t  __attribute__((export_name("TS_CResult_CVec_CVec_u8ZZNoneZ_clone"))) TS_CResult_CVec_CVec_u8ZZNoneZ_clone(uint64_t orig) {
14350         LDKCResult_CVec_CVec_u8ZZNoneZ* orig_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)untag_ptr(orig);
14351         LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
14352         *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_clone(orig_conv);
14353         return tag_ptr(ret_conv, true);
14354 }
14355
14356 uint64_t  __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_ok"))) TS_CResult_InMemorySignerDecodeErrorZ_ok(uint64_t o) {
14357         LDKInMemorySigner o_conv;
14358         o_conv.inner = untag_ptr(o);
14359         o_conv.is_owned = ptr_is_owned(o);
14360         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14361         o_conv = InMemorySigner_clone(&o_conv);
14362         LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
14363         *ret_conv = CResult_InMemorySignerDecodeErrorZ_ok(o_conv);
14364         return tag_ptr(ret_conv, true);
14365 }
14366
14367 uint64_t  __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_err"))) TS_CResult_InMemorySignerDecodeErrorZ_err(uint64_t e) {
14368         LDKDecodeError e_conv;
14369         e_conv.inner = untag_ptr(e);
14370         e_conv.is_owned = ptr_is_owned(e);
14371         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14372         e_conv = DecodeError_clone(&e_conv);
14373         LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
14374         *ret_conv = CResult_InMemorySignerDecodeErrorZ_err(e_conv);
14375         return tag_ptr(ret_conv, true);
14376 }
14377
14378 jboolean  __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_is_ok"))) TS_CResult_InMemorySignerDecodeErrorZ_is_ok(uint64_t o) {
14379         LDKCResult_InMemorySignerDecodeErrorZ* o_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)untag_ptr(o);
14380         jboolean ret_conv = CResult_InMemorySignerDecodeErrorZ_is_ok(o_conv);
14381         return ret_conv;
14382 }
14383
14384 void  __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_free"))) TS_CResult_InMemorySignerDecodeErrorZ_free(uint64_t _res) {
14385         if (!ptr_is_owned(_res)) return;
14386         void* _res_ptr = untag_ptr(_res);
14387         CHECK_ACCESS(_res_ptr);
14388         LDKCResult_InMemorySignerDecodeErrorZ _res_conv = *(LDKCResult_InMemorySignerDecodeErrorZ*)(_res_ptr);
14389         FREE(untag_ptr(_res));
14390         CResult_InMemorySignerDecodeErrorZ_free(_res_conv);
14391 }
14392
14393 static inline uint64_t CResult_InMemorySignerDecodeErrorZ_clone_ptr(LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR arg) {
14394         LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
14395         *ret_conv = CResult_InMemorySignerDecodeErrorZ_clone(arg);
14396         return tag_ptr(ret_conv, true);
14397 }
14398 int64_t  __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_clone_ptr"))) TS_CResult_InMemorySignerDecodeErrorZ_clone_ptr(uint64_t arg) {
14399         LDKCResult_InMemorySignerDecodeErrorZ* arg_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)untag_ptr(arg);
14400         int64_t ret_conv = CResult_InMemorySignerDecodeErrorZ_clone_ptr(arg_conv);
14401         return ret_conv;
14402 }
14403
14404 uint64_t  __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_clone"))) TS_CResult_InMemorySignerDecodeErrorZ_clone(uint64_t orig) {
14405         LDKCResult_InMemorySignerDecodeErrorZ* orig_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)untag_ptr(orig);
14406         LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
14407         *ret_conv = CResult_InMemorySignerDecodeErrorZ_clone(orig_conv);
14408         return tag_ptr(ret_conv, true);
14409 }
14410
14411 void  __attribute__((export_name("TS_CVec_TxOutZ_free"))) TS_CVec_TxOutZ_free(uint64_tArray _res) {
14412         LDKCVec_TxOutZ _res_constr;
14413         _res_constr.datalen = _res->arr_len;
14414         if (_res_constr.datalen > 0)
14415                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
14416         else
14417                 _res_constr.data = NULL;
14418         uint64_t* _res_vals = _res->elems;
14419         for (size_t h = 0; h < _res_constr.datalen; h++) {
14420                 uint64_t _res_conv_7 = _res_vals[h];
14421                 void* _res_conv_7_ptr = untag_ptr(_res_conv_7);
14422                 CHECK_ACCESS(_res_conv_7_ptr);
14423                 LDKTxOut _res_conv_7_conv = *(LDKTxOut*)(_res_conv_7_ptr);
14424                 FREE(untag_ptr(_res_conv_7));
14425                 _res_constr.data[h] = _res_conv_7_conv;
14426         }
14427         FREE(_res);
14428         CVec_TxOutZ_free(_res_constr);
14429 }
14430
14431 uint64_t  __attribute__((export_name("TS_CResult_TransactionNoneZ_ok"))) TS_CResult_TransactionNoneZ_ok(int8_tArray o) {
14432         LDKTransaction o_ref;
14433         o_ref.datalen = o->arr_len;
14434         o_ref.data = MALLOC(o_ref.datalen, "LDKTransaction Bytes");
14435         memcpy(o_ref.data, o->elems, o_ref.datalen); FREE(o);
14436         o_ref.data_is_owned = true;
14437         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
14438         *ret_conv = CResult_TransactionNoneZ_ok(o_ref);
14439         return tag_ptr(ret_conv, true);
14440 }
14441
14442 uint64_t  __attribute__((export_name("TS_CResult_TransactionNoneZ_err"))) TS_CResult_TransactionNoneZ_err() {
14443         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
14444         *ret_conv = CResult_TransactionNoneZ_err();
14445         return tag_ptr(ret_conv, true);
14446 }
14447
14448 jboolean  __attribute__((export_name("TS_CResult_TransactionNoneZ_is_ok"))) TS_CResult_TransactionNoneZ_is_ok(uint64_t o) {
14449         LDKCResult_TransactionNoneZ* o_conv = (LDKCResult_TransactionNoneZ*)untag_ptr(o);
14450         jboolean ret_conv = CResult_TransactionNoneZ_is_ok(o_conv);
14451         return ret_conv;
14452 }
14453
14454 void  __attribute__((export_name("TS_CResult_TransactionNoneZ_free"))) TS_CResult_TransactionNoneZ_free(uint64_t _res) {
14455         if (!ptr_is_owned(_res)) return;
14456         void* _res_ptr = untag_ptr(_res);
14457         CHECK_ACCESS(_res_ptr);
14458         LDKCResult_TransactionNoneZ _res_conv = *(LDKCResult_TransactionNoneZ*)(_res_ptr);
14459         FREE(untag_ptr(_res));
14460         CResult_TransactionNoneZ_free(_res_conv);
14461 }
14462
14463 static inline uint64_t CResult_TransactionNoneZ_clone_ptr(LDKCResult_TransactionNoneZ *NONNULL_PTR arg) {
14464         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
14465         *ret_conv = CResult_TransactionNoneZ_clone(arg);
14466         return tag_ptr(ret_conv, true);
14467 }
14468 int64_t  __attribute__((export_name("TS_CResult_TransactionNoneZ_clone_ptr"))) TS_CResult_TransactionNoneZ_clone_ptr(uint64_t arg) {
14469         LDKCResult_TransactionNoneZ* arg_conv = (LDKCResult_TransactionNoneZ*)untag_ptr(arg);
14470         int64_t ret_conv = CResult_TransactionNoneZ_clone_ptr(arg_conv);
14471         return ret_conv;
14472 }
14473
14474 uint64_t  __attribute__((export_name("TS_CResult_TransactionNoneZ_clone"))) TS_CResult_TransactionNoneZ_clone(uint64_t orig) {
14475         LDKCResult_TransactionNoneZ* orig_conv = (LDKCResult_TransactionNoneZ*)untag_ptr(orig);
14476         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
14477         *ret_conv = CResult_TransactionNoneZ_clone(orig_conv);
14478         return tag_ptr(ret_conv, true);
14479 }
14480
14481 uint64_t  __attribute__((export_name("TS_COption_u16Z_some"))) TS_COption_u16Z_some(int16_t o) {
14482         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
14483         *ret_copy = COption_u16Z_some(o);
14484         uint64_t ret_ref = tag_ptr(ret_copy, true);
14485         return ret_ref;
14486 }
14487
14488 uint64_t  __attribute__((export_name("TS_COption_u16Z_none"))) TS_COption_u16Z_none() {
14489         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
14490         *ret_copy = COption_u16Z_none();
14491         uint64_t ret_ref = tag_ptr(ret_copy, true);
14492         return ret_ref;
14493 }
14494
14495 void  __attribute__((export_name("TS_COption_u16Z_free"))) TS_COption_u16Z_free(uint64_t _res) {
14496         if (!ptr_is_owned(_res)) return;
14497         void* _res_ptr = untag_ptr(_res);
14498         CHECK_ACCESS(_res_ptr);
14499         LDKCOption_u16Z _res_conv = *(LDKCOption_u16Z*)(_res_ptr);
14500         FREE(untag_ptr(_res));
14501         COption_u16Z_free(_res_conv);
14502 }
14503
14504 static inline uint64_t COption_u16Z_clone_ptr(LDKCOption_u16Z *NONNULL_PTR arg) {
14505         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
14506         *ret_copy = COption_u16Z_clone(arg);
14507         uint64_t ret_ref = tag_ptr(ret_copy, true);
14508         return ret_ref;
14509 }
14510 int64_t  __attribute__((export_name("TS_COption_u16Z_clone_ptr"))) TS_COption_u16Z_clone_ptr(uint64_t arg) {
14511         LDKCOption_u16Z* arg_conv = (LDKCOption_u16Z*)untag_ptr(arg);
14512         int64_t ret_conv = COption_u16Z_clone_ptr(arg_conv);
14513         return ret_conv;
14514 }
14515
14516 uint64_t  __attribute__((export_name("TS_COption_u16Z_clone"))) TS_COption_u16Z_clone(uint64_t orig) {
14517         LDKCOption_u16Z* orig_conv = (LDKCOption_u16Z*)untag_ptr(orig);
14518         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
14519         *ret_copy = COption_u16Z_clone(orig_conv);
14520         uint64_t ret_ref = tag_ptr(ret_copy, true);
14521         return ret_ref;
14522 }
14523
14524 uint64_t  __attribute__((export_name("TS_CResult_NoneAPIErrorZ_ok"))) TS_CResult_NoneAPIErrorZ_ok() {
14525         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
14526         *ret_conv = CResult_NoneAPIErrorZ_ok();
14527         return tag_ptr(ret_conv, true);
14528 }
14529
14530 uint64_t  __attribute__((export_name("TS_CResult_NoneAPIErrorZ_err"))) TS_CResult_NoneAPIErrorZ_err(uint64_t e) {
14531         void* e_ptr = untag_ptr(e);
14532         CHECK_ACCESS(e_ptr);
14533         LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
14534         e_conv = APIError_clone((LDKAPIError*)untag_ptr(e));
14535         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
14536         *ret_conv = CResult_NoneAPIErrorZ_err(e_conv);
14537         return tag_ptr(ret_conv, true);
14538 }
14539
14540 jboolean  __attribute__((export_name("TS_CResult_NoneAPIErrorZ_is_ok"))) TS_CResult_NoneAPIErrorZ_is_ok(uint64_t o) {
14541         LDKCResult_NoneAPIErrorZ* o_conv = (LDKCResult_NoneAPIErrorZ*)untag_ptr(o);
14542         jboolean ret_conv = CResult_NoneAPIErrorZ_is_ok(o_conv);
14543         return ret_conv;
14544 }
14545
14546 void  __attribute__((export_name("TS_CResult_NoneAPIErrorZ_free"))) TS_CResult_NoneAPIErrorZ_free(uint64_t _res) {
14547         if (!ptr_is_owned(_res)) return;
14548         void* _res_ptr = untag_ptr(_res);
14549         CHECK_ACCESS(_res_ptr);
14550         LDKCResult_NoneAPIErrorZ _res_conv = *(LDKCResult_NoneAPIErrorZ*)(_res_ptr);
14551         FREE(untag_ptr(_res));
14552         CResult_NoneAPIErrorZ_free(_res_conv);
14553 }
14554
14555 static inline uint64_t CResult_NoneAPIErrorZ_clone_ptr(LDKCResult_NoneAPIErrorZ *NONNULL_PTR arg) {
14556         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
14557         *ret_conv = CResult_NoneAPIErrorZ_clone(arg);
14558         return tag_ptr(ret_conv, true);
14559 }
14560 int64_t  __attribute__((export_name("TS_CResult_NoneAPIErrorZ_clone_ptr"))) TS_CResult_NoneAPIErrorZ_clone_ptr(uint64_t arg) {
14561         LDKCResult_NoneAPIErrorZ* arg_conv = (LDKCResult_NoneAPIErrorZ*)untag_ptr(arg);
14562         int64_t ret_conv = CResult_NoneAPIErrorZ_clone_ptr(arg_conv);
14563         return ret_conv;
14564 }
14565
14566 uint64_t  __attribute__((export_name("TS_CResult_NoneAPIErrorZ_clone"))) TS_CResult_NoneAPIErrorZ_clone(uint64_t orig) {
14567         LDKCResult_NoneAPIErrorZ* orig_conv = (LDKCResult_NoneAPIErrorZ*)untag_ptr(orig);
14568         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
14569         *ret_conv = CResult_NoneAPIErrorZ_clone(orig_conv);
14570         return tag_ptr(ret_conv, true);
14571 }
14572
14573 void  __attribute__((export_name("TS_CVec_CResult_NoneAPIErrorZZ_free"))) TS_CVec_CResult_NoneAPIErrorZZ_free(uint64_tArray _res) {
14574         LDKCVec_CResult_NoneAPIErrorZZ _res_constr;
14575         _res_constr.datalen = _res->arr_len;
14576         if (_res_constr.datalen > 0)
14577                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
14578         else
14579                 _res_constr.data = NULL;
14580         uint64_t* _res_vals = _res->elems;
14581         for (size_t w = 0; w < _res_constr.datalen; w++) {
14582                 uint64_t _res_conv_22 = _res_vals[w];
14583                 void* _res_conv_22_ptr = untag_ptr(_res_conv_22);
14584                 CHECK_ACCESS(_res_conv_22_ptr);
14585                 LDKCResult_NoneAPIErrorZ _res_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(_res_conv_22_ptr);
14586                 FREE(untag_ptr(_res_conv_22));
14587                 _res_constr.data[w] = _res_conv_22_conv;
14588         }
14589         FREE(_res);
14590         CVec_CResult_NoneAPIErrorZZ_free(_res_constr);
14591 }
14592
14593 void  __attribute__((export_name("TS_CVec_APIErrorZ_free"))) TS_CVec_APIErrorZ_free(uint64_tArray _res) {
14594         LDKCVec_APIErrorZ _res_constr;
14595         _res_constr.datalen = _res->arr_len;
14596         if (_res_constr.datalen > 0)
14597                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKAPIError), "LDKCVec_APIErrorZ Elements");
14598         else
14599                 _res_constr.data = NULL;
14600         uint64_t* _res_vals = _res->elems;
14601         for (size_t k = 0; k < _res_constr.datalen; k++) {
14602                 uint64_t _res_conv_10 = _res_vals[k];
14603                 void* _res_conv_10_ptr = untag_ptr(_res_conv_10);
14604                 CHECK_ACCESS(_res_conv_10_ptr);
14605                 LDKAPIError _res_conv_10_conv = *(LDKAPIError*)(_res_conv_10_ptr);
14606                 FREE(untag_ptr(_res_conv_10));
14607                 _res_constr.data[k] = _res_conv_10_conv;
14608         }
14609         FREE(_res);
14610         CVec_APIErrorZ_free(_res_constr);
14611 }
14612
14613 uint64_t  __attribute__((export_name("TS_CResult__u832APIErrorZ_ok"))) TS_CResult__u832APIErrorZ_ok(int8_tArray o) {
14614         LDKThirtyTwoBytes o_ref;
14615         CHECK(o->arr_len == 32);
14616         memcpy(o_ref.data, o->elems, 32); FREE(o);
14617         LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
14618         *ret_conv = CResult__u832APIErrorZ_ok(o_ref);
14619         return tag_ptr(ret_conv, true);
14620 }
14621
14622 uint64_t  __attribute__((export_name("TS_CResult__u832APIErrorZ_err"))) TS_CResult__u832APIErrorZ_err(uint64_t e) {
14623         void* e_ptr = untag_ptr(e);
14624         CHECK_ACCESS(e_ptr);
14625         LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
14626         e_conv = APIError_clone((LDKAPIError*)untag_ptr(e));
14627         LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
14628         *ret_conv = CResult__u832APIErrorZ_err(e_conv);
14629         return tag_ptr(ret_conv, true);
14630 }
14631
14632 jboolean  __attribute__((export_name("TS_CResult__u832APIErrorZ_is_ok"))) TS_CResult__u832APIErrorZ_is_ok(uint64_t o) {
14633         LDKCResult__u832APIErrorZ* o_conv = (LDKCResult__u832APIErrorZ*)untag_ptr(o);
14634         jboolean ret_conv = CResult__u832APIErrorZ_is_ok(o_conv);
14635         return ret_conv;
14636 }
14637
14638 void  __attribute__((export_name("TS_CResult__u832APIErrorZ_free"))) TS_CResult__u832APIErrorZ_free(uint64_t _res) {
14639         if (!ptr_is_owned(_res)) return;
14640         void* _res_ptr = untag_ptr(_res);
14641         CHECK_ACCESS(_res_ptr);
14642         LDKCResult__u832APIErrorZ _res_conv = *(LDKCResult__u832APIErrorZ*)(_res_ptr);
14643         FREE(untag_ptr(_res));
14644         CResult__u832APIErrorZ_free(_res_conv);
14645 }
14646
14647 static inline uint64_t CResult__u832APIErrorZ_clone_ptr(LDKCResult__u832APIErrorZ *NONNULL_PTR arg) {
14648         LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
14649         *ret_conv = CResult__u832APIErrorZ_clone(arg);
14650         return tag_ptr(ret_conv, true);
14651 }
14652 int64_t  __attribute__((export_name("TS_CResult__u832APIErrorZ_clone_ptr"))) TS_CResult__u832APIErrorZ_clone_ptr(uint64_t arg) {
14653         LDKCResult__u832APIErrorZ* arg_conv = (LDKCResult__u832APIErrorZ*)untag_ptr(arg);
14654         int64_t ret_conv = CResult__u832APIErrorZ_clone_ptr(arg_conv);
14655         return ret_conv;
14656 }
14657
14658 uint64_t  __attribute__((export_name("TS_CResult__u832APIErrorZ_clone"))) TS_CResult__u832APIErrorZ_clone(uint64_t orig) {
14659         LDKCResult__u832APIErrorZ* orig_conv = (LDKCResult__u832APIErrorZ*)untag_ptr(orig);
14660         LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
14661         *ret_conv = CResult__u832APIErrorZ_clone(orig_conv);
14662         return tag_ptr(ret_conv, true);
14663 }
14664
14665 uint64_t  __attribute__((export_name("TS_CResult_PaymentIdPaymentSendFailureZ_ok"))) TS_CResult_PaymentIdPaymentSendFailureZ_ok(int8_tArray o) {
14666         LDKThirtyTwoBytes o_ref;
14667         CHECK(o->arr_len == 32);
14668         memcpy(o_ref.data, o->elems, 32); FREE(o);
14669         LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
14670         *ret_conv = CResult_PaymentIdPaymentSendFailureZ_ok(o_ref);
14671         return tag_ptr(ret_conv, true);
14672 }
14673
14674 uint64_t  __attribute__((export_name("TS_CResult_PaymentIdPaymentSendFailureZ_err"))) TS_CResult_PaymentIdPaymentSendFailureZ_err(uint64_t e) {
14675         void* e_ptr = untag_ptr(e);
14676         CHECK_ACCESS(e_ptr);
14677         LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(e_ptr);
14678         e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)untag_ptr(e));
14679         LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
14680         *ret_conv = CResult_PaymentIdPaymentSendFailureZ_err(e_conv);
14681         return tag_ptr(ret_conv, true);
14682 }
14683
14684 jboolean  __attribute__((export_name("TS_CResult_PaymentIdPaymentSendFailureZ_is_ok"))) TS_CResult_PaymentIdPaymentSendFailureZ_is_ok(uint64_t o) {
14685         LDKCResult_PaymentIdPaymentSendFailureZ* o_conv = (LDKCResult_PaymentIdPaymentSendFailureZ*)untag_ptr(o);
14686         jboolean ret_conv = CResult_PaymentIdPaymentSendFailureZ_is_ok(o_conv);
14687         return ret_conv;
14688 }
14689
14690 void  __attribute__((export_name("TS_CResult_PaymentIdPaymentSendFailureZ_free"))) TS_CResult_PaymentIdPaymentSendFailureZ_free(uint64_t _res) {
14691         if (!ptr_is_owned(_res)) return;
14692         void* _res_ptr = untag_ptr(_res);
14693         CHECK_ACCESS(_res_ptr);
14694         LDKCResult_PaymentIdPaymentSendFailureZ _res_conv = *(LDKCResult_PaymentIdPaymentSendFailureZ*)(_res_ptr);
14695         FREE(untag_ptr(_res));
14696         CResult_PaymentIdPaymentSendFailureZ_free(_res_conv);
14697 }
14698
14699 static inline uint64_t CResult_PaymentIdPaymentSendFailureZ_clone_ptr(LDKCResult_PaymentIdPaymentSendFailureZ *NONNULL_PTR arg) {
14700         LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
14701         *ret_conv = CResult_PaymentIdPaymentSendFailureZ_clone(arg);
14702         return tag_ptr(ret_conv, true);
14703 }
14704 int64_t  __attribute__((export_name("TS_CResult_PaymentIdPaymentSendFailureZ_clone_ptr"))) TS_CResult_PaymentIdPaymentSendFailureZ_clone_ptr(uint64_t arg) {
14705         LDKCResult_PaymentIdPaymentSendFailureZ* arg_conv = (LDKCResult_PaymentIdPaymentSendFailureZ*)untag_ptr(arg);
14706         int64_t ret_conv = CResult_PaymentIdPaymentSendFailureZ_clone_ptr(arg_conv);
14707         return ret_conv;
14708 }
14709
14710 uint64_t  __attribute__((export_name("TS_CResult_PaymentIdPaymentSendFailureZ_clone"))) TS_CResult_PaymentIdPaymentSendFailureZ_clone(uint64_t orig) {
14711         LDKCResult_PaymentIdPaymentSendFailureZ* orig_conv = (LDKCResult_PaymentIdPaymentSendFailureZ*)untag_ptr(orig);
14712         LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
14713         *ret_conv = CResult_PaymentIdPaymentSendFailureZ_clone(orig_conv);
14714         return tag_ptr(ret_conv, true);
14715 }
14716
14717 uint64_t  __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_ok"))) TS_CResult_NonePaymentSendFailureZ_ok() {
14718         LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
14719         *ret_conv = CResult_NonePaymentSendFailureZ_ok();
14720         return tag_ptr(ret_conv, true);
14721 }
14722
14723 uint64_t  __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_err"))) TS_CResult_NonePaymentSendFailureZ_err(uint64_t e) {
14724         void* e_ptr = untag_ptr(e);
14725         CHECK_ACCESS(e_ptr);
14726         LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(e_ptr);
14727         e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)untag_ptr(e));
14728         LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
14729         *ret_conv = CResult_NonePaymentSendFailureZ_err(e_conv);
14730         return tag_ptr(ret_conv, true);
14731 }
14732
14733 jboolean  __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_is_ok"))) TS_CResult_NonePaymentSendFailureZ_is_ok(uint64_t o) {
14734         LDKCResult_NonePaymentSendFailureZ* o_conv = (LDKCResult_NonePaymentSendFailureZ*)untag_ptr(o);
14735         jboolean ret_conv = CResult_NonePaymentSendFailureZ_is_ok(o_conv);
14736         return ret_conv;
14737 }
14738
14739 void  __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_free"))) TS_CResult_NonePaymentSendFailureZ_free(uint64_t _res) {
14740         if (!ptr_is_owned(_res)) return;
14741         void* _res_ptr = untag_ptr(_res);
14742         CHECK_ACCESS(_res_ptr);
14743         LDKCResult_NonePaymentSendFailureZ _res_conv = *(LDKCResult_NonePaymentSendFailureZ*)(_res_ptr);
14744         FREE(untag_ptr(_res));
14745         CResult_NonePaymentSendFailureZ_free(_res_conv);
14746 }
14747
14748 static inline uint64_t CResult_NonePaymentSendFailureZ_clone_ptr(LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR arg) {
14749         LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
14750         *ret_conv = CResult_NonePaymentSendFailureZ_clone(arg);
14751         return tag_ptr(ret_conv, true);
14752 }
14753 int64_t  __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_clone_ptr"))) TS_CResult_NonePaymentSendFailureZ_clone_ptr(uint64_t arg) {
14754         LDKCResult_NonePaymentSendFailureZ* arg_conv = (LDKCResult_NonePaymentSendFailureZ*)untag_ptr(arg);
14755         int64_t ret_conv = CResult_NonePaymentSendFailureZ_clone_ptr(arg_conv);
14756         return ret_conv;
14757 }
14758
14759 uint64_t  __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_clone"))) TS_CResult_NonePaymentSendFailureZ_clone(uint64_t orig) {
14760         LDKCResult_NonePaymentSendFailureZ* orig_conv = (LDKCResult_NonePaymentSendFailureZ*)untag_ptr(orig);
14761         LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
14762         *ret_conv = CResult_NonePaymentSendFailureZ_clone(orig_conv);
14763         return tag_ptr(ret_conv, true);
14764 }
14765
14766 static inline uint64_t C2Tuple_PaymentHashPaymentIdZ_clone_ptr(LDKC2Tuple_PaymentHashPaymentIdZ *NONNULL_PTR arg) {
14767         LDKC2Tuple_PaymentHashPaymentIdZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentIdZ), "LDKC2Tuple_PaymentHashPaymentIdZ");
14768         *ret_conv = C2Tuple_PaymentHashPaymentIdZ_clone(arg);
14769         return tag_ptr(ret_conv, true);
14770 }
14771 int64_t  __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentIdZ_clone_ptr"))) TS_C2Tuple_PaymentHashPaymentIdZ_clone_ptr(uint64_t arg) {
14772         LDKC2Tuple_PaymentHashPaymentIdZ* arg_conv = (LDKC2Tuple_PaymentHashPaymentIdZ*)untag_ptr(arg);
14773         int64_t ret_conv = C2Tuple_PaymentHashPaymentIdZ_clone_ptr(arg_conv);
14774         return ret_conv;
14775 }
14776
14777 uint64_t  __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentIdZ_clone"))) TS_C2Tuple_PaymentHashPaymentIdZ_clone(uint64_t orig) {
14778         LDKC2Tuple_PaymentHashPaymentIdZ* orig_conv = (LDKC2Tuple_PaymentHashPaymentIdZ*)untag_ptr(orig);
14779         LDKC2Tuple_PaymentHashPaymentIdZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentIdZ), "LDKC2Tuple_PaymentHashPaymentIdZ");
14780         *ret_conv = C2Tuple_PaymentHashPaymentIdZ_clone(orig_conv);
14781         return tag_ptr(ret_conv, true);
14782 }
14783
14784 uint64_t  __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentIdZ_new"))) TS_C2Tuple_PaymentHashPaymentIdZ_new(int8_tArray a, int8_tArray b) {
14785         LDKThirtyTwoBytes a_ref;
14786         CHECK(a->arr_len == 32);
14787         memcpy(a_ref.data, a->elems, 32); FREE(a);
14788         LDKThirtyTwoBytes b_ref;
14789         CHECK(b->arr_len == 32);
14790         memcpy(b_ref.data, b->elems, 32); FREE(b);
14791         LDKC2Tuple_PaymentHashPaymentIdZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentIdZ), "LDKC2Tuple_PaymentHashPaymentIdZ");
14792         *ret_conv = C2Tuple_PaymentHashPaymentIdZ_new(a_ref, b_ref);
14793         return tag_ptr(ret_conv, true);
14794 }
14795
14796 void  __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentIdZ_free"))) TS_C2Tuple_PaymentHashPaymentIdZ_free(uint64_t _res) {
14797         if (!ptr_is_owned(_res)) return;
14798         void* _res_ptr = untag_ptr(_res);
14799         CHECK_ACCESS(_res_ptr);
14800         LDKC2Tuple_PaymentHashPaymentIdZ _res_conv = *(LDKC2Tuple_PaymentHashPaymentIdZ*)(_res_ptr);
14801         FREE(untag_ptr(_res));
14802         C2Tuple_PaymentHashPaymentIdZ_free(_res_conv);
14803 }
14804
14805 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_ok"))) TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_ok(uint64_t o) {
14806         void* o_ptr = untag_ptr(o);
14807         CHECK_ACCESS(o_ptr);
14808         LDKC2Tuple_PaymentHashPaymentIdZ o_conv = *(LDKC2Tuple_PaymentHashPaymentIdZ*)(o_ptr);
14809         o_conv = C2Tuple_PaymentHashPaymentIdZ_clone((LDKC2Tuple_PaymentHashPaymentIdZ*)untag_ptr(o));
14810         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
14811         *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_ok(o_conv);
14812         return tag_ptr(ret_conv, true);
14813 }
14814
14815 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_err"))) TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_err(uint64_t e) {
14816         void* e_ptr = untag_ptr(e);
14817         CHECK_ACCESS(e_ptr);
14818         LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(e_ptr);
14819         e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)untag_ptr(e));
14820         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
14821         *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_err(e_conv);
14822         return tag_ptr(ret_conv, true);
14823 }
14824
14825 jboolean  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_is_ok"))) TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_is_ok(uint64_t o) {
14826         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* o_conv = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)untag_ptr(o);
14827         jboolean ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_is_ok(o_conv);
14828         return ret_conv;
14829 }
14830
14831 void  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_free"))) TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_free(uint64_t _res) {
14832         if (!ptr_is_owned(_res)) return;
14833         void* _res_ptr = untag_ptr(_res);
14834         CHECK_ACCESS(_res_ptr);
14835         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ _res_conv = *(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)(_res_ptr);
14836         FREE(untag_ptr(_res));
14837         CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_free(_res_conv);
14838 }
14839
14840 static inline uint64_t CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone_ptr(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ *NONNULL_PTR arg) {
14841         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
14842         *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone(arg);
14843         return tag_ptr(ret_conv, true);
14844 }
14845 int64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone_ptr"))) TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone_ptr(uint64_t arg) {
14846         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* arg_conv = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)untag_ptr(arg);
14847         int64_t ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone_ptr(arg_conv);
14848         return ret_conv;
14849 }
14850
14851 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone"))) TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone(uint64_t orig) {
14852         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* orig_conv = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)untag_ptr(orig);
14853         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
14854         *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone(orig_conv);
14855         return tag_ptr(ret_conv, true);
14856 }
14857
14858 void  __attribute__((export_name("TS_CVec_ThirtyTwoBytesZ_free"))) TS_CVec_ThirtyTwoBytesZ_free(ptrArray _res) {
14859         LDKCVec_ThirtyTwoBytesZ _res_constr;
14860         _res_constr.datalen = _res->arr_len;
14861         if (_res_constr.datalen > 0)
14862                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_ThirtyTwoBytesZ Elements");
14863         else
14864                 _res_constr.data = NULL;
14865         int8_tArray* _res_vals = (void*) _res->elems;
14866         for (size_t m = 0; m < _res_constr.datalen; m++) {
14867                 int8_tArray _res_conv_12 = _res_vals[m];
14868                 LDKThirtyTwoBytes _res_conv_12_ref;
14869                 CHECK(_res_conv_12->arr_len == 32);
14870                 memcpy(_res_conv_12_ref.data, _res_conv_12->elems, 32); FREE(_res_conv_12);
14871                 _res_constr.data[m] = _res_conv_12_ref;
14872         }
14873         FREE(_res);
14874         CVec_ThirtyTwoBytesZ_free(_res_constr);
14875 }
14876
14877 static inline uint64_t C2Tuple_PaymentHashPaymentSecretZ_clone_ptr(LDKC2Tuple_PaymentHashPaymentSecretZ *NONNULL_PTR arg) {
14878         LDKC2Tuple_PaymentHashPaymentSecretZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
14879         *ret_conv = C2Tuple_PaymentHashPaymentSecretZ_clone(arg);
14880         return tag_ptr(ret_conv, true);
14881 }
14882 int64_t  __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentSecretZ_clone_ptr"))) TS_C2Tuple_PaymentHashPaymentSecretZ_clone_ptr(uint64_t arg) {
14883         LDKC2Tuple_PaymentHashPaymentSecretZ* arg_conv = (LDKC2Tuple_PaymentHashPaymentSecretZ*)untag_ptr(arg);
14884         int64_t ret_conv = C2Tuple_PaymentHashPaymentSecretZ_clone_ptr(arg_conv);
14885         return ret_conv;
14886 }
14887
14888 uint64_t  __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentSecretZ_clone"))) TS_C2Tuple_PaymentHashPaymentSecretZ_clone(uint64_t orig) {
14889         LDKC2Tuple_PaymentHashPaymentSecretZ* orig_conv = (LDKC2Tuple_PaymentHashPaymentSecretZ*)untag_ptr(orig);
14890         LDKC2Tuple_PaymentHashPaymentSecretZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
14891         *ret_conv = C2Tuple_PaymentHashPaymentSecretZ_clone(orig_conv);
14892         return tag_ptr(ret_conv, true);
14893 }
14894
14895 uint64_t  __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentSecretZ_new"))) TS_C2Tuple_PaymentHashPaymentSecretZ_new(int8_tArray a, int8_tArray b) {
14896         LDKThirtyTwoBytes a_ref;
14897         CHECK(a->arr_len == 32);
14898         memcpy(a_ref.data, a->elems, 32); FREE(a);
14899         LDKThirtyTwoBytes b_ref;
14900         CHECK(b->arr_len == 32);
14901         memcpy(b_ref.data, b->elems, 32); FREE(b);
14902         LDKC2Tuple_PaymentHashPaymentSecretZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
14903         *ret_conv = C2Tuple_PaymentHashPaymentSecretZ_new(a_ref, b_ref);
14904         return tag_ptr(ret_conv, true);
14905 }
14906
14907 void  __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentSecretZ_free"))) TS_C2Tuple_PaymentHashPaymentSecretZ_free(uint64_t _res) {
14908         if (!ptr_is_owned(_res)) return;
14909         void* _res_ptr = untag_ptr(_res);
14910         CHECK_ACCESS(_res_ptr);
14911         LDKC2Tuple_PaymentHashPaymentSecretZ _res_conv = *(LDKC2Tuple_PaymentHashPaymentSecretZ*)(_res_ptr);
14912         FREE(untag_ptr(_res));
14913         C2Tuple_PaymentHashPaymentSecretZ_free(_res_conv);
14914 }
14915
14916 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_ok"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_ok(uint64_t o) {
14917         void* o_ptr = untag_ptr(o);
14918         CHECK_ACCESS(o_ptr);
14919         LDKC2Tuple_PaymentHashPaymentSecretZ o_conv = *(LDKC2Tuple_PaymentHashPaymentSecretZ*)(o_ptr);
14920         o_conv = C2Tuple_PaymentHashPaymentSecretZ_clone((LDKC2Tuple_PaymentHashPaymentSecretZ*)untag_ptr(o));
14921         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
14922         *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_ok(o_conv);
14923         return tag_ptr(ret_conv, true);
14924 }
14925
14926 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_err"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_err() {
14927         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
14928         *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_err();
14929         return tag_ptr(ret_conv, true);
14930 }
14931
14932 jboolean  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_is_ok"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_is_ok(uint64_t o) {
14933         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* o_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)untag_ptr(o);
14934         jboolean ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_is_ok(o_conv);
14935         return ret_conv;
14936 }
14937
14938 void  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_free"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_free(uint64_t _res) {
14939         if (!ptr_is_owned(_res)) return;
14940         void* _res_ptr = untag_ptr(_res);
14941         CHECK_ACCESS(_res_ptr);
14942         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ _res_conv = *(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)(_res_ptr);
14943         FREE(untag_ptr(_res));
14944         CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_free(_res_conv);
14945 }
14946
14947 static inline uint64_t CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone_ptr(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ *NONNULL_PTR arg) {
14948         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
14949         *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone(arg);
14950         return tag_ptr(ret_conv, true);
14951 }
14952 int64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone_ptr"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone_ptr(uint64_t arg) {
14953         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* arg_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)untag_ptr(arg);
14954         int64_t ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone_ptr(arg_conv);
14955         return ret_conv;
14956 }
14957
14958 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone(uint64_t orig) {
14959         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* orig_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)untag_ptr(orig);
14960         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
14961         *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone(orig_conv);
14962         return tag_ptr(ret_conv, true);
14963 }
14964
14965 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_ok"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_ok(uint64_t o) {
14966         void* o_ptr = untag_ptr(o);
14967         CHECK_ACCESS(o_ptr);
14968         LDKC2Tuple_PaymentHashPaymentSecretZ o_conv = *(LDKC2Tuple_PaymentHashPaymentSecretZ*)(o_ptr);
14969         o_conv = C2Tuple_PaymentHashPaymentSecretZ_clone((LDKC2Tuple_PaymentHashPaymentSecretZ*)untag_ptr(o));
14970         LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ");
14971         *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_ok(o_conv);
14972         return tag_ptr(ret_conv, true);
14973 }
14974
14975 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_err"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_err(uint64_t e) {
14976         void* e_ptr = untag_ptr(e);
14977         CHECK_ACCESS(e_ptr);
14978         LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
14979         e_conv = APIError_clone((LDKAPIError*)untag_ptr(e));
14980         LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ");
14981         *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_err(e_conv);
14982         return tag_ptr(ret_conv, true);
14983 }
14984
14985 jboolean  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_is_ok"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_is_ok(uint64_t o) {
14986         LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* o_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)untag_ptr(o);
14987         jboolean ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_is_ok(o_conv);
14988         return ret_conv;
14989 }
14990
14991 void  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_free"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_free(uint64_t _res) {
14992         if (!ptr_is_owned(_res)) return;
14993         void* _res_ptr = untag_ptr(_res);
14994         CHECK_ACCESS(_res_ptr);
14995         LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ _res_conv = *(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)(_res_ptr);
14996         FREE(untag_ptr(_res));
14997         CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_free(_res_conv);
14998 }
14999
15000 static inline uint64_t CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone_ptr(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ *NONNULL_PTR arg) {
15001         LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ");
15002         *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone(arg);
15003         return tag_ptr(ret_conv, true);
15004 }
15005 int64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone_ptr"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone_ptr(uint64_t arg) {
15006         LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* arg_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)untag_ptr(arg);
15007         int64_t ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone_ptr(arg_conv);
15008         return ret_conv;
15009 }
15010
15011 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone(uint64_t orig) {
15012         LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* orig_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)untag_ptr(orig);
15013         LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ");
15014         *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone(orig_conv);
15015         return tag_ptr(ret_conv, true);
15016 }
15017
15018 uint64_t  __attribute__((export_name("TS_CResult_PaymentSecretNoneZ_ok"))) TS_CResult_PaymentSecretNoneZ_ok(int8_tArray o) {
15019         LDKThirtyTwoBytes o_ref;
15020         CHECK(o->arr_len == 32);
15021         memcpy(o_ref.data, o->elems, 32); FREE(o);
15022         LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
15023         *ret_conv = CResult_PaymentSecretNoneZ_ok(o_ref);
15024         return tag_ptr(ret_conv, true);
15025 }
15026
15027 uint64_t  __attribute__((export_name("TS_CResult_PaymentSecretNoneZ_err"))) TS_CResult_PaymentSecretNoneZ_err() {
15028         LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
15029         *ret_conv = CResult_PaymentSecretNoneZ_err();
15030         return tag_ptr(ret_conv, true);
15031 }
15032
15033 jboolean  __attribute__((export_name("TS_CResult_PaymentSecretNoneZ_is_ok"))) TS_CResult_PaymentSecretNoneZ_is_ok(uint64_t o) {
15034         LDKCResult_PaymentSecretNoneZ* o_conv = (LDKCResult_PaymentSecretNoneZ*)untag_ptr(o);
15035         jboolean ret_conv = CResult_PaymentSecretNoneZ_is_ok(o_conv);
15036         return ret_conv;
15037 }
15038
15039 void  __attribute__((export_name("TS_CResult_PaymentSecretNoneZ_free"))) TS_CResult_PaymentSecretNoneZ_free(uint64_t _res) {
15040         if (!ptr_is_owned(_res)) return;
15041         void* _res_ptr = untag_ptr(_res);
15042         CHECK_ACCESS(_res_ptr);
15043         LDKCResult_PaymentSecretNoneZ _res_conv = *(LDKCResult_PaymentSecretNoneZ*)(_res_ptr);
15044         FREE(untag_ptr(_res));
15045         CResult_PaymentSecretNoneZ_free(_res_conv);
15046 }
15047
15048 static inline uint64_t CResult_PaymentSecretNoneZ_clone_ptr(LDKCResult_PaymentSecretNoneZ *NONNULL_PTR arg) {
15049         LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
15050         *ret_conv = CResult_PaymentSecretNoneZ_clone(arg);
15051         return tag_ptr(ret_conv, true);
15052 }
15053 int64_t  __attribute__((export_name("TS_CResult_PaymentSecretNoneZ_clone_ptr"))) TS_CResult_PaymentSecretNoneZ_clone_ptr(uint64_t arg) {
15054         LDKCResult_PaymentSecretNoneZ* arg_conv = (LDKCResult_PaymentSecretNoneZ*)untag_ptr(arg);
15055         int64_t ret_conv = CResult_PaymentSecretNoneZ_clone_ptr(arg_conv);
15056         return ret_conv;
15057 }
15058
15059 uint64_t  __attribute__((export_name("TS_CResult_PaymentSecretNoneZ_clone"))) TS_CResult_PaymentSecretNoneZ_clone(uint64_t orig) {
15060         LDKCResult_PaymentSecretNoneZ* orig_conv = (LDKCResult_PaymentSecretNoneZ*)untag_ptr(orig);
15061         LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
15062         *ret_conv = CResult_PaymentSecretNoneZ_clone(orig_conv);
15063         return tag_ptr(ret_conv, true);
15064 }
15065
15066 uint64_t  __attribute__((export_name("TS_CResult_PaymentSecretAPIErrorZ_ok"))) TS_CResult_PaymentSecretAPIErrorZ_ok(int8_tArray o) {
15067         LDKThirtyTwoBytes o_ref;
15068         CHECK(o->arr_len == 32);
15069         memcpy(o_ref.data, o->elems, 32); FREE(o);
15070         LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
15071         *ret_conv = CResult_PaymentSecretAPIErrorZ_ok(o_ref);
15072         return tag_ptr(ret_conv, true);
15073 }
15074
15075 uint64_t  __attribute__((export_name("TS_CResult_PaymentSecretAPIErrorZ_err"))) TS_CResult_PaymentSecretAPIErrorZ_err(uint64_t e) {
15076         void* e_ptr = untag_ptr(e);
15077         CHECK_ACCESS(e_ptr);
15078         LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
15079         e_conv = APIError_clone((LDKAPIError*)untag_ptr(e));
15080         LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
15081         *ret_conv = CResult_PaymentSecretAPIErrorZ_err(e_conv);
15082         return tag_ptr(ret_conv, true);
15083 }
15084
15085 jboolean  __attribute__((export_name("TS_CResult_PaymentSecretAPIErrorZ_is_ok"))) TS_CResult_PaymentSecretAPIErrorZ_is_ok(uint64_t o) {
15086         LDKCResult_PaymentSecretAPIErrorZ* o_conv = (LDKCResult_PaymentSecretAPIErrorZ*)untag_ptr(o);
15087         jboolean ret_conv = CResult_PaymentSecretAPIErrorZ_is_ok(o_conv);
15088         return ret_conv;
15089 }
15090
15091 void  __attribute__((export_name("TS_CResult_PaymentSecretAPIErrorZ_free"))) TS_CResult_PaymentSecretAPIErrorZ_free(uint64_t _res) {
15092         if (!ptr_is_owned(_res)) return;
15093         void* _res_ptr = untag_ptr(_res);
15094         CHECK_ACCESS(_res_ptr);
15095         LDKCResult_PaymentSecretAPIErrorZ _res_conv = *(LDKCResult_PaymentSecretAPIErrorZ*)(_res_ptr);
15096         FREE(untag_ptr(_res));
15097         CResult_PaymentSecretAPIErrorZ_free(_res_conv);
15098 }
15099
15100 static inline uint64_t CResult_PaymentSecretAPIErrorZ_clone_ptr(LDKCResult_PaymentSecretAPIErrorZ *NONNULL_PTR arg) {
15101         LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
15102         *ret_conv = CResult_PaymentSecretAPIErrorZ_clone(arg);
15103         return tag_ptr(ret_conv, true);
15104 }
15105 int64_t  __attribute__((export_name("TS_CResult_PaymentSecretAPIErrorZ_clone_ptr"))) TS_CResult_PaymentSecretAPIErrorZ_clone_ptr(uint64_t arg) {
15106         LDKCResult_PaymentSecretAPIErrorZ* arg_conv = (LDKCResult_PaymentSecretAPIErrorZ*)untag_ptr(arg);
15107         int64_t ret_conv = CResult_PaymentSecretAPIErrorZ_clone_ptr(arg_conv);
15108         return ret_conv;
15109 }
15110
15111 uint64_t  __attribute__((export_name("TS_CResult_PaymentSecretAPIErrorZ_clone"))) TS_CResult_PaymentSecretAPIErrorZ_clone(uint64_t orig) {
15112         LDKCResult_PaymentSecretAPIErrorZ* orig_conv = (LDKCResult_PaymentSecretAPIErrorZ*)untag_ptr(orig);
15113         LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
15114         *ret_conv = CResult_PaymentSecretAPIErrorZ_clone(orig_conv);
15115         return tag_ptr(ret_conv, true);
15116 }
15117
15118 uint64_t  __attribute__((export_name("TS_CResult_PaymentPreimageAPIErrorZ_ok"))) TS_CResult_PaymentPreimageAPIErrorZ_ok(int8_tArray o) {
15119         LDKThirtyTwoBytes o_ref;
15120         CHECK(o->arr_len == 32);
15121         memcpy(o_ref.data, o->elems, 32); FREE(o);
15122         LDKCResult_PaymentPreimageAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPreimageAPIErrorZ), "LDKCResult_PaymentPreimageAPIErrorZ");
15123         *ret_conv = CResult_PaymentPreimageAPIErrorZ_ok(o_ref);
15124         return tag_ptr(ret_conv, true);
15125 }
15126
15127 uint64_t  __attribute__((export_name("TS_CResult_PaymentPreimageAPIErrorZ_err"))) TS_CResult_PaymentPreimageAPIErrorZ_err(uint64_t e) {
15128         void* e_ptr = untag_ptr(e);
15129         CHECK_ACCESS(e_ptr);
15130         LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
15131         e_conv = APIError_clone((LDKAPIError*)untag_ptr(e));
15132         LDKCResult_PaymentPreimageAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPreimageAPIErrorZ), "LDKCResult_PaymentPreimageAPIErrorZ");
15133         *ret_conv = CResult_PaymentPreimageAPIErrorZ_err(e_conv);
15134         return tag_ptr(ret_conv, true);
15135 }
15136
15137 jboolean  __attribute__((export_name("TS_CResult_PaymentPreimageAPIErrorZ_is_ok"))) TS_CResult_PaymentPreimageAPIErrorZ_is_ok(uint64_t o) {
15138         LDKCResult_PaymentPreimageAPIErrorZ* o_conv = (LDKCResult_PaymentPreimageAPIErrorZ*)untag_ptr(o);
15139         jboolean ret_conv = CResult_PaymentPreimageAPIErrorZ_is_ok(o_conv);
15140         return ret_conv;
15141 }
15142
15143 void  __attribute__((export_name("TS_CResult_PaymentPreimageAPIErrorZ_free"))) TS_CResult_PaymentPreimageAPIErrorZ_free(uint64_t _res) {
15144         if (!ptr_is_owned(_res)) return;
15145         void* _res_ptr = untag_ptr(_res);
15146         CHECK_ACCESS(_res_ptr);
15147         LDKCResult_PaymentPreimageAPIErrorZ _res_conv = *(LDKCResult_PaymentPreimageAPIErrorZ*)(_res_ptr);
15148         FREE(untag_ptr(_res));
15149         CResult_PaymentPreimageAPIErrorZ_free(_res_conv);
15150 }
15151
15152 static inline uint64_t CResult_PaymentPreimageAPIErrorZ_clone_ptr(LDKCResult_PaymentPreimageAPIErrorZ *NONNULL_PTR arg) {
15153         LDKCResult_PaymentPreimageAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPreimageAPIErrorZ), "LDKCResult_PaymentPreimageAPIErrorZ");
15154         *ret_conv = CResult_PaymentPreimageAPIErrorZ_clone(arg);
15155         return tag_ptr(ret_conv, true);
15156 }
15157 int64_t  __attribute__((export_name("TS_CResult_PaymentPreimageAPIErrorZ_clone_ptr"))) TS_CResult_PaymentPreimageAPIErrorZ_clone_ptr(uint64_t arg) {
15158         LDKCResult_PaymentPreimageAPIErrorZ* arg_conv = (LDKCResult_PaymentPreimageAPIErrorZ*)untag_ptr(arg);
15159         int64_t ret_conv = CResult_PaymentPreimageAPIErrorZ_clone_ptr(arg_conv);
15160         return ret_conv;
15161 }
15162
15163 uint64_t  __attribute__((export_name("TS_CResult_PaymentPreimageAPIErrorZ_clone"))) TS_CResult_PaymentPreimageAPIErrorZ_clone(uint64_t orig) {
15164         LDKCResult_PaymentPreimageAPIErrorZ* orig_conv = (LDKCResult_PaymentPreimageAPIErrorZ*)untag_ptr(orig);
15165         LDKCResult_PaymentPreimageAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPreimageAPIErrorZ), "LDKCResult_PaymentPreimageAPIErrorZ");
15166         *ret_conv = CResult_PaymentPreimageAPIErrorZ_clone(orig_conv);
15167         return tag_ptr(ret_conv, true);
15168 }
15169
15170 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_ok"))) TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_ok(uint64_t o) {
15171         LDKCounterpartyForwardingInfo o_conv;
15172         o_conv.inner = untag_ptr(o);
15173         o_conv.is_owned = ptr_is_owned(o);
15174         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15175         o_conv = CounterpartyForwardingInfo_clone(&o_conv);
15176         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
15177         *ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_ok(o_conv);
15178         return tag_ptr(ret_conv, true);
15179 }
15180
15181 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_err"))) TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_err(uint64_t e) {
15182         LDKDecodeError e_conv;
15183         e_conv.inner = untag_ptr(e);
15184         e_conv.is_owned = ptr_is_owned(e);
15185         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15186         e_conv = DecodeError_clone(&e_conv);
15187         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
15188         *ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_err(e_conv);
15189         return tag_ptr(ret_conv, true);
15190 }
15191
15192 jboolean  __attribute__((export_name("TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_is_ok"))) TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_is_ok(uint64_t o) {
15193         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* o_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)untag_ptr(o);
15194         jboolean ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_is_ok(o_conv);
15195         return ret_conv;
15196 }
15197
15198 void  __attribute__((export_name("TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_free"))) TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_free(uint64_t _res) {
15199         if (!ptr_is_owned(_res)) return;
15200         void* _res_ptr = untag_ptr(_res);
15201         CHECK_ACCESS(_res_ptr);
15202         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ _res_conv = *(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)(_res_ptr);
15203         FREE(untag_ptr(_res));
15204         CResult_CounterpartyForwardingInfoDecodeErrorZ_free(_res_conv);
15205 }
15206
15207 static inline uint64_t CResult_CounterpartyForwardingInfoDecodeErrorZ_clone_ptr(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ *NONNULL_PTR arg) {
15208         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
15209         *ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_clone(arg);
15210         return tag_ptr(ret_conv, true);
15211 }
15212 int64_t  __attribute__((export_name("TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_clone_ptr"))) TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_clone_ptr(uint64_t arg) {
15213         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* arg_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)untag_ptr(arg);
15214         int64_t ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_clone_ptr(arg_conv);
15215         return ret_conv;
15216 }
15217
15218 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_clone"))) TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_clone(uint64_t orig) {
15219         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* orig_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)untag_ptr(orig);
15220         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
15221         *ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_clone(orig_conv);
15222         return tag_ptr(ret_conv, true);
15223 }
15224
15225 uint64_t  __attribute__((export_name("TS_CResult_ChannelCounterpartyDecodeErrorZ_ok"))) TS_CResult_ChannelCounterpartyDecodeErrorZ_ok(uint64_t o) {
15226         LDKChannelCounterparty o_conv;
15227         o_conv.inner = untag_ptr(o);
15228         o_conv.is_owned = ptr_is_owned(o);
15229         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15230         o_conv = ChannelCounterparty_clone(&o_conv);
15231         LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
15232         *ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_ok(o_conv);
15233         return tag_ptr(ret_conv, true);
15234 }
15235
15236 uint64_t  __attribute__((export_name("TS_CResult_ChannelCounterpartyDecodeErrorZ_err"))) TS_CResult_ChannelCounterpartyDecodeErrorZ_err(uint64_t e) {
15237         LDKDecodeError e_conv;
15238         e_conv.inner = untag_ptr(e);
15239         e_conv.is_owned = ptr_is_owned(e);
15240         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15241         e_conv = DecodeError_clone(&e_conv);
15242         LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
15243         *ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_err(e_conv);
15244         return tag_ptr(ret_conv, true);
15245 }
15246
15247 jboolean  __attribute__((export_name("TS_CResult_ChannelCounterpartyDecodeErrorZ_is_ok"))) TS_CResult_ChannelCounterpartyDecodeErrorZ_is_ok(uint64_t o) {
15248         LDKCResult_ChannelCounterpartyDecodeErrorZ* o_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)untag_ptr(o);
15249         jboolean ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_is_ok(o_conv);
15250         return ret_conv;
15251 }
15252
15253 void  __attribute__((export_name("TS_CResult_ChannelCounterpartyDecodeErrorZ_free"))) TS_CResult_ChannelCounterpartyDecodeErrorZ_free(uint64_t _res) {
15254         if (!ptr_is_owned(_res)) return;
15255         void* _res_ptr = untag_ptr(_res);
15256         CHECK_ACCESS(_res_ptr);
15257         LDKCResult_ChannelCounterpartyDecodeErrorZ _res_conv = *(LDKCResult_ChannelCounterpartyDecodeErrorZ*)(_res_ptr);
15258         FREE(untag_ptr(_res));
15259         CResult_ChannelCounterpartyDecodeErrorZ_free(_res_conv);
15260 }
15261
15262 static inline uint64_t CResult_ChannelCounterpartyDecodeErrorZ_clone_ptr(LDKCResult_ChannelCounterpartyDecodeErrorZ *NONNULL_PTR arg) {
15263         LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
15264         *ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_clone(arg);
15265         return tag_ptr(ret_conv, true);
15266 }
15267 int64_t  __attribute__((export_name("TS_CResult_ChannelCounterpartyDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelCounterpartyDecodeErrorZ_clone_ptr(uint64_t arg) {
15268         LDKCResult_ChannelCounterpartyDecodeErrorZ* arg_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)untag_ptr(arg);
15269         int64_t ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_clone_ptr(arg_conv);
15270         return ret_conv;
15271 }
15272
15273 uint64_t  __attribute__((export_name("TS_CResult_ChannelCounterpartyDecodeErrorZ_clone"))) TS_CResult_ChannelCounterpartyDecodeErrorZ_clone(uint64_t orig) {
15274         LDKCResult_ChannelCounterpartyDecodeErrorZ* orig_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)untag_ptr(orig);
15275         LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
15276         *ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_clone(orig_conv);
15277         return tag_ptr(ret_conv, true);
15278 }
15279
15280 uint64_t  __attribute__((export_name("TS_CResult_ChannelDetailsDecodeErrorZ_ok"))) TS_CResult_ChannelDetailsDecodeErrorZ_ok(uint64_t o) {
15281         LDKChannelDetails o_conv;
15282         o_conv.inner = untag_ptr(o);
15283         o_conv.is_owned = ptr_is_owned(o);
15284         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15285         o_conv = ChannelDetails_clone(&o_conv);
15286         LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
15287         *ret_conv = CResult_ChannelDetailsDecodeErrorZ_ok(o_conv);
15288         return tag_ptr(ret_conv, true);
15289 }
15290
15291 uint64_t  __attribute__((export_name("TS_CResult_ChannelDetailsDecodeErrorZ_err"))) TS_CResult_ChannelDetailsDecodeErrorZ_err(uint64_t e) {
15292         LDKDecodeError e_conv;
15293         e_conv.inner = untag_ptr(e);
15294         e_conv.is_owned = ptr_is_owned(e);
15295         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15296         e_conv = DecodeError_clone(&e_conv);
15297         LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
15298         *ret_conv = CResult_ChannelDetailsDecodeErrorZ_err(e_conv);
15299         return tag_ptr(ret_conv, true);
15300 }
15301
15302 jboolean  __attribute__((export_name("TS_CResult_ChannelDetailsDecodeErrorZ_is_ok"))) TS_CResult_ChannelDetailsDecodeErrorZ_is_ok(uint64_t o) {
15303         LDKCResult_ChannelDetailsDecodeErrorZ* o_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)untag_ptr(o);
15304         jboolean ret_conv = CResult_ChannelDetailsDecodeErrorZ_is_ok(o_conv);
15305         return ret_conv;
15306 }
15307
15308 void  __attribute__((export_name("TS_CResult_ChannelDetailsDecodeErrorZ_free"))) TS_CResult_ChannelDetailsDecodeErrorZ_free(uint64_t _res) {
15309         if (!ptr_is_owned(_res)) return;
15310         void* _res_ptr = untag_ptr(_res);
15311         CHECK_ACCESS(_res_ptr);
15312         LDKCResult_ChannelDetailsDecodeErrorZ _res_conv = *(LDKCResult_ChannelDetailsDecodeErrorZ*)(_res_ptr);
15313         FREE(untag_ptr(_res));
15314         CResult_ChannelDetailsDecodeErrorZ_free(_res_conv);
15315 }
15316
15317 static inline uint64_t CResult_ChannelDetailsDecodeErrorZ_clone_ptr(LDKCResult_ChannelDetailsDecodeErrorZ *NONNULL_PTR arg) {
15318         LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
15319         *ret_conv = CResult_ChannelDetailsDecodeErrorZ_clone(arg);
15320         return tag_ptr(ret_conv, true);
15321 }
15322 int64_t  __attribute__((export_name("TS_CResult_ChannelDetailsDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelDetailsDecodeErrorZ_clone_ptr(uint64_t arg) {
15323         LDKCResult_ChannelDetailsDecodeErrorZ* arg_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)untag_ptr(arg);
15324         int64_t ret_conv = CResult_ChannelDetailsDecodeErrorZ_clone_ptr(arg_conv);
15325         return ret_conv;
15326 }
15327
15328 uint64_t  __attribute__((export_name("TS_CResult_ChannelDetailsDecodeErrorZ_clone"))) TS_CResult_ChannelDetailsDecodeErrorZ_clone(uint64_t orig) {
15329         LDKCResult_ChannelDetailsDecodeErrorZ* orig_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)untag_ptr(orig);
15330         LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
15331         *ret_conv = CResult_ChannelDetailsDecodeErrorZ_clone(orig_conv);
15332         return tag_ptr(ret_conv, true);
15333 }
15334
15335 uint64_t  __attribute__((export_name("TS_CResult_PhantomRouteHintsDecodeErrorZ_ok"))) TS_CResult_PhantomRouteHintsDecodeErrorZ_ok(uint64_t o) {
15336         LDKPhantomRouteHints o_conv;
15337         o_conv.inner = untag_ptr(o);
15338         o_conv.is_owned = ptr_is_owned(o);
15339         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15340         o_conv = PhantomRouteHints_clone(&o_conv);
15341         LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
15342         *ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_ok(o_conv);
15343         return tag_ptr(ret_conv, true);
15344 }
15345
15346 uint64_t  __attribute__((export_name("TS_CResult_PhantomRouteHintsDecodeErrorZ_err"))) TS_CResult_PhantomRouteHintsDecodeErrorZ_err(uint64_t e) {
15347         LDKDecodeError e_conv;
15348         e_conv.inner = untag_ptr(e);
15349         e_conv.is_owned = ptr_is_owned(e);
15350         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15351         e_conv = DecodeError_clone(&e_conv);
15352         LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
15353         *ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_err(e_conv);
15354         return tag_ptr(ret_conv, true);
15355 }
15356
15357 jboolean  __attribute__((export_name("TS_CResult_PhantomRouteHintsDecodeErrorZ_is_ok"))) TS_CResult_PhantomRouteHintsDecodeErrorZ_is_ok(uint64_t o) {
15358         LDKCResult_PhantomRouteHintsDecodeErrorZ* o_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)untag_ptr(o);
15359         jboolean ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_is_ok(o_conv);
15360         return ret_conv;
15361 }
15362
15363 void  __attribute__((export_name("TS_CResult_PhantomRouteHintsDecodeErrorZ_free"))) TS_CResult_PhantomRouteHintsDecodeErrorZ_free(uint64_t _res) {
15364         if (!ptr_is_owned(_res)) return;
15365         void* _res_ptr = untag_ptr(_res);
15366         CHECK_ACCESS(_res_ptr);
15367         LDKCResult_PhantomRouteHintsDecodeErrorZ _res_conv = *(LDKCResult_PhantomRouteHintsDecodeErrorZ*)(_res_ptr);
15368         FREE(untag_ptr(_res));
15369         CResult_PhantomRouteHintsDecodeErrorZ_free(_res_conv);
15370 }
15371
15372 static inline uint64_t CResult_PhantomRouteHintsDecodeErrorZ_clone_ptr(LDKCResult_PhantomRouteHintsDecodeErrorZ *NONNULL_PTR arg) {
15373         LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
15374         *ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_clone(arg);
15375         return tag_ptr(ret_conv, true);
15376 }
15377 int64_t  __attribute__((export_name("TS_CResult_PhantomRouteHintsDecodeErrorZ_clone_ptr"))) TS_CResult_PhantomRouteHintsDecodeErrorZ_clone_ptr(uint64_t arg) {
15378         LDKCResult_PhantomRouteHintsDecodeErrorZ* arg_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)untag_ptr(arg);
15379         int64_t ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_clone_ptr(arg_conv);
15380         return ret_conv;
15381 }
15382
15383 uint64_t  __attribute__((export_name("TS_CResult_PhantomRouteHintsDecodeErrorZ_clone"))) TS_CResult_PhantomRouteHintsDecodeErrorZ_clone(uint64_t orig) {
15384         LDKCResult_PhantomRouteHintsDecodeErrorZ* orig_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)untag_ptr(orig);
15385         LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
15386         *ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_clone(orig_conv);
15387         return tag_ptr(ret_conv, true);
15388 }
15389
15390 void  __attribute__((export_name("TS_CVec_ChannelMonitorZ_free"))) TS_CVec_ChannelMonitorZ_free(uint64_tArray _res) {
15391         LDKCVec_ChannelMonitorZ _res_constr;
15392         _res_constr.datalen = _res->arr_len;
15393         if (_res_constr.datalen > 0)
15394                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
15395         else
15396                 _res_constr.data = NULL;
15397         uint64_t* _res_vals = _res->elems;
15398         for (size_t q = 0; q < _res_constr.datalen; q++) {
15399                 uint64_t _res_conv_16 = _res_vals[q];
15400                 LDKChannelMonitor _res_conv_16_conv;
15401                 _res_conv_16_conv.inner = untag_ptr(_res_conv_16);
15402                 _res_conv_16_conv.is_owned = ptr_is_owned(_res_conv_16);
15403                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_16_conv);
15404                 _res_constr.data[q] = _res_conv_16_conv;
15405         }
15406         FREE(_res);
15407         CVec_ChannelMonitorZ_free(_res_constr);
15408 }
15409
15410 uint64_t  __attribute__((export_name("TS_C2Tuple_BlockHashChannelManagerZ_new"))) TS_C2Tuple_BlockHashChannelManagerZ_new(int8_tArray a, uint64_t b) {
15411         LDKThirtyTwoBytes a_ref;
15412         CHECK(a->arr_len == 32);
15413         memcpy(a_ref.data, a->elems, 32); FREE(a);
15414         LDKChannelManager b_conv;
15415         b_conv.inner = untag_ptr(b);
15416         b_conv.is_owned = ptr_is_owned(b);
15417         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
15418         // WARNING: we need a move here but no clone is available for LDKChannelManager
15419         
15420         LDKC2Tuple_BlockHashChannelManagerZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelManagerZ), "LDKC2Tuple_BlockHashChannelManagerZ");
15421         *ret_conv = C2Tuple_BlockHashChannelManagerZ_new(a_ref, b_conv);
15422         return tag_ptr(ret_conv, true);
15423 }
15424
15425 void  __attribute__((export_name("TS_C2Tuple_BlockHashChannelManagerZ_free"))) TS_C2Tuple_BlockHashChannelManagerZ_free(uint64_t _res) {
15426         if (!ptr_is_owned(_res)) return;
15427         void* _res_ptr = untag_ptr(_res);
15428         CHECK_ACCESS(_res_ptr);
15429         LDKC2Tuple_BlockHashChannelManagerZ _res_conv = *(LDKC2Tuple_BlockHashChannelManagerZ*)(_res_ptr);
15430         FREE(untag_ptr(_res));
15431         C2Tuple_BlockHashChannelManagerZ_free(_res_conv);
15432 }
15433
15434 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok"))) TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(uint64_t o) {
15435         void* o_ptr = untag_ptr(o);
15436         CHECK_ACCESS(o_ptr);
15437         LDKC2Tuple_BlockHashChannelManagerZ o_conv = *(LDKC2Tuple_BlockHashChannelManagerZ*)(o_ptr);
15438         // WARNING: we may need a move here but no clone is available for LDKC2Tuple_BlockHashChannelManagerZ
15439         LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
15440         *ret_conv = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(o_conv);
15441         return tag_ptr(ret_conv, true);
15442 }
15443
15444 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err"))) TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(uint64_t e) {
15445         LDKDecodeError e_conv;
15446         e_conv.inner = untag_ptr(e);
15447         e_conv.is_owned = ptr_is_owned(e);
15448         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15449         e_conv = DecodeError_clone(&e_conv);
15450         LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
15451         *ret_conv = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(e_conv);
15452         return tag_ptr(ret_conv, true);
15453 }
15454
15455 jboolean  __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_is_ok"))) TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_is_ok(uint64_t o) {
15456         LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* o_conv = (LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)untag_ptr(o);
15457         jboolean ret_conv = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_is_ok(o_conv);
15458         return ret_conv;
15459 }
15460
15461 void  __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free"))) TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(uint64_t _res) {
15462         if (!ptr_is_owned(_res)) return;
15463         void* _res_ptr = untag_ptr(_res);
15464         CHECK_ACCESS(_res_ptr);
15465         LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ _res_conv = *(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)(_res_ptr);
15466         FREE(untag_ptr(_res));
15467         CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(_res_conv);
15468 }
15469
15470 uint64_t  __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_ok"))) TS_CResult_ChannelConfigDecodeErrorZ_ok(uint64_t o) {
15471         LDKChannelConfig o_conv;
15472         o_conv.inner = untag_ptr(o);
15473         o_conv.is_owned = ptr_is_owned(o);
15474         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15475         o_conv = ChannelConfig_clone(&o_conv);
15476         LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
15477         *ret_conv = CResult_ChannelConfigDecodeErrorZ_ok(o_conv);
15478         return tag_ptr(ret_conv, true);
15479 }
15480
15481 uint64_t  __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_err"))) TS_CResult_ChannelConfigDecodeErrorZ_err(uint64_t e) {
15482         LDKDecodeError e_conv;
15483         e_conv.inner = untag_ptr(e);
15484         e_conv.is_owned = ptr_is_owned(e);
15485         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15486         e_conv = DecodeError_clone(&e_conv);
15487         LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
15488         *ret_conv = CResult_ChannelConfigDecodeErrorZ_err(e_conv);
15489         return tag_ptr(ret_conv, true);
15490 }
15491
15492 jboolean  __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_is_ok"))) TS_CResult_ChannelConfigDecodeErrorZ_is_ok(uint64_t o) {
15493         LDKCResult_ChannelConfigDecodeErrorZ* o_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)untag_ptr(o);
15494         jboolean ret_conv = CResult_ChannelConfigDecodeErrorZ_is_ok(o_conv);
15495         return ret_conv;
15496 }
15497
15498 void  __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_free"))) TS_CResult_ChannelConfigDecodeErrorZ_free(uint64_t _res) {
15499         if (!ptr_is_owned(_res)) return;
15500         void* _res_ptr = untag_ptr(_res);
15501         CHECK_ACCESS(_res_ptr);
15502         LDKCResult_ChannelConfigDecodeErrorZ _res_conv = *(LDKCResult_ChannelConfigDecodeErrorZ*)(_res_ptr);
15503         FREE(untag_ptr(_res));
15504         CResult_ChannelConfigDecodeErrorZ_free(_res_conv);
15505 }
15506
15507 static inline uint64_t CResult_ChannelConfigDecodeErrorZ_clone_ptr(LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR arg) {
15508         LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
15509         *ret_conv = CResult_ChannelConfigDecodeErrorZ_clone(arg);
15510         return tag_ptr(ret_conv, true);
15511 }
15512 int64_t  __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelConfigDecodeErrorZ_clone_ptr(uint64_t arg) {
15513         LDKCResult_ChannelConfigDecodeErrorZ* arg_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)untag_ptr(arg);
15514         int64_t ret_conv = CResult_ChannelConfigDecodeErrorZ_clone_ptr(arg_conv);
15515         return ret_conv;
15516 }
15517
15518 uint64_t  __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_clone"))) TS_CResult_ChannelConfigDecodeErrorZ_clone(uint64_t orig) {
15519         LDKCResult_ChannelConfigDecodeErrorZ* orig_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)untag_ptr(orig);
15520         LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
15521         *ret_conv = CResult_ChannelConfigDecodeErrorZ_clone(orig_conv);
15522         return tag_ptr(ret_conv, true);
15523 }
15524
15525 uint64_t  __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_ok"))) TS_CResult_OutPointDecodeErrorZ_ok(uint64_t o) {
15526         LDKOutPoint o_conv;
15527         o_conv.inner = untag_ptr(o);
15528         o_conv.is_owned = ptr_is_owned(o);
15529         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15530         o_conv = OutPoint_clone(&o_conv);
15531         LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
15532         *ret_conv = CResult_OutPointDecodeErrorZ_ok(o_conv);
15533         return tag_ptr(ret_conv, true);
15534 }
15535
15536 uint64_t  __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_err"))) TS_CResult_OutPointDecodeErrorZ_err(uint64_t e) {
15537         LDKDecodeError e_conv;
15538         e_conv.inner = untag_ptr(e);
15539         e_conv.is_owned = ptr_is_owned(e);
15540         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15541         e_conv = DecodeError_clone(&e_conv);
15542         LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
15543         *ret_conv = CResult_OutPointDecodeErrorZ_err(e_conv);
15544         return tag_ptr(ret_conv, true);
15545 }
15546
15547 jboolean  __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_is_ok"))) TS_CResult_OutPointDecodeErrorZ_is_ok(uint64_t o) {
15548         LDKCResult_OutPointDecodeErrorZ* o_conv = (LDKCResult_OutPointDecodeErrorZ*)untag_ptr(o);
15549         jboolean ret_conv = CResult_OutPointDecodeErrorZ_is_ok(o_conv);
15550         return ret_conv;
15551 }
15552
15553 void  __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_free"))) TS_CResult_OutPointDecodeErrorZ_free(uint64_t _res) {
15554         if (!ptr_is_owned(_res)) return;
15555         void* _res_ptr = untag_ptr(_res);
15556         CHECK_ACCESS(_res_ptr);
15557         LDKCResult_OutPointDecodeErrorZ _res_conv = *(LDKCResult_OutPointDecodeErrorZ*)(_res_ptr);
15558         FREE(untag_ptr(_res));
15559         CResult_OutPointDecodeErrorZ_free(_res_conv);
15560 }
15561
15562 static inline uint64_t CResult_OutPointDecodeErrorZ_clone_ptr(LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR arg) {
15563         LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
15564         *ret_conv = CResult_OutPointDecodeErrorZ_clone(arg);
15565         return tag_ptr(ret_conv, true);
15566 }
15567 int64_t  __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_clone_ptr"))) TS_CResult_OutPointDecodeErrorZ_clone_ptr(uint64_t arg) {
15568         LDKCResult_OutPointDecodeErrorZ* arg_conv = (LDKCResult_OutPointDecodeErrorZ*)untag_ptr(arg);
15569         int64_t ret_conv = CResult_OutPointDecodeErrorZ_clone_ptr(arg_conv);
15570         return ret_conv;
15571 }
15572
15573 uint64_t  __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_clone"))) TS_CResult_OutPointDecodeErrorZ_clone(uint64_t orig) {
15574         LDKCResult_OutPointDecodeErrorZ* orig_conv = (LDKCResult_OutPointDecodeErrorZ*)untag_ptr(orig);
15575         LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
15576         *ret_conv = CResult_OutPointDecodeErrorZ_clone(orig_conv);
15577         return tag_ptr(ret_conv, true);
15578 }
15579
15580 uint64_t  __attribute__((export_name("TS_COption_TypeZ_some"))) TS_COption_TypeZ_some(uint64_t o) {
15581         void* o_ptr = untag_ptr(o);
15582         CHECK_ACCESS(o_ptr);
15583         LDKType o_conv = *(LDKType*)(o_ptr);
15584         if (o_conv.free == LDKType_JCalls_free) {
15585                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
15586                 LDKType_JCalls_cloned(&o_conv);
15587         }
15588         LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
15589         *ret_copy = COption_TypeZ_some(o_conv);
15590         uint64_t ret_ref = tag_ptr(ret_copy, true);
15591         return ret_ref;
15592 }
15593
15594 uint64_t  __attribute__((export_name("TS_COption_TypeZ_none"))) TS_COption_TypeZ_none() {
15595         LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
15596         *ret_copy = COption_TypeZ_none();
15597         uint64_t ret_ref = tag_ptr(ret_copy, true);
15598         return ret_ref;
15599 }
15600
15601 void  __attribute__((export_name("TS_COption_TypeZ_free"))) TS_COption_TypeZ_free(uint64_t _res) {
15602         if (!ptr_is_owned(_res)) return;
15603         void* _res_ptr = untag_ptr(_res);
15604         CHECK_ACCESS(_res_ptr);
15605         LDKCOption_TypeZ _res_conv = *(LDKCOption_TypeZ*)(_res_ptr);
15606         FREE(untag_ptr(_res));
15607         COption_TypeZ_free(_res_conv);
15608 }
15609
15610 static inline uint64_t COption_TypeZ_clone_ptr(LDKCOption_TypeZ *NONNULL_PTR arg) {
15611         LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
15612         *ret_copy = COption_TypeZ_clone(arg);
15613         uint64_t ret_ref = tag_ptr(ret_copy, true);
15614         return ret_ref;
15615 }
15616 int64_t  __attribute__((export_name("TS_COption_TypeZ_clone_ptr"))) TS_COption_TypeZ_clone_ptr(uint64_t arg) {
15617         LDKCOption_TypeZ* arg_conv = (LDKCOption_TypeZ*)untag_ptr(arg);
15618         int64_t ret_conv = COption_TypeZ_clone_ptr(arg_conv);
15619         return ret_conv;
15620 }
15621
15622 uint64_t  __attribute__((export_name("TS_COption_TypeZ_clone"))) TS_COption_TypeZ_clone(uint64_t orig) {
15623         LDKCOption_TypeZ* orig_conv = (LDKCOption_TypeZ*)untag_ptr(orig);
15624         LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
15625         *ret_copy = COption_TypeZ_clone(orig_conv);
15626         uint64_t ret_ref = tag_ptr(ret_copy, true);
15627         return ret_ref;
15628 }
15629
15630 uint64_t  __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_ok"))) TS_CResult_COption_TypeZDecodeErrorZ_ok(uint64_t o) {
15631         void* o_ptr = untag_ptr(o);
15632         CHECK_ACCESS(o_ptr);
15633         LDKCOption_TypeZ o_conv = *(LDKCOption_TypeZ*)(o_ptr);
15634         o_conv = COption_TypeZ_clone((LDKCOption_TypeZ*)untag_ptr(o));
15635         LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
15636         *ret_conv = CResult_COption_TypeZDecodeErrorZ_ok(o_conv);
15637         return tag_ptr(ret_conv, true);
15638 }
15639
15640 uint64_t  __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_err"))) TS_CResult_COption_TypeZDecodeErrorZ_err(uint64_t e) {
15641         LDKDecodeError e_conv;
15642         e_conv.inner = untag_ptr(e);
15643         e_conv.is_owned = ptr_is_owned(e);
15644         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15645         e_conv = DecodeError_clone(&e_conv);
15646         LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
15647         *ret_conv = CResult_COption_TypeZDecodeErrorZ_err(e_conv);
15648         return tag_ptr(ret_conv, true);
15649 }
15650
15651 jboolean  __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_is_ok"))) TS_CResult_COption_TypeZDecodeErrorZ_is_ok(uint64_t o) {
15652         LDKCResult_COption_TypeZDecodeErrorZ* o_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)untag_ptr(o);
15653         jboolean ret_conv = CResult_COption_TypeZDecodeErrorZ_is_ok(o_conv);
15654         return ret_conv;
15655 }
15656
15657 void  __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_free"))) TS_CResult_COption_TypeZDecodeErrorZ_free(uint64_t _res) {
15658         if (!ptr_is_owned(_res)) return;
15659         void* _res_ptr = untag_ptr(_res);
15660         CHECK_ACCESS(_res_ptr);
15661         LDKCResult_COption_TypeZDecodeErrorZ _res_conv = *(LDKCResult_COption_TypeZDecodeErrorZ*)(_res_ptr);
15662         FREE(untag_ptr(_res));
15663         CResult_COption_TypeZDecodeErrorZ_free(_res_conv);
15664 }
15665
15666 static inline uint64_t CResult_COption_TypeZDecodeErrorZ_clone_ptr(LDKCResult_COption_TypeZDecodeErrorZ *NONNULL_PTR arg) {
15667         LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
15668         *ret_conv = CResult_COption_TypeZDecodeErrorZ_clone(arg);
15669         return tag_ptr(ret_conv, true);
15670 }
15671 int64_t  __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_clone_ptr"))) TS_CResult_COption_TypeZDecodeErrorZ_clone_ptr(uint64_t arg) {
15672         LDKCResult_COption_TypeZDecodeErrorZ* arg_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)untag_ptr(arg);
15673         int64_t ret_conv = CResult_COption_TypeZDecodeErrorZ_clone_ptr(arg_conv);
15674         return ret_conv;
15675 }
15676
15677 uint64_t  __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_clone"))) TS_CResult_COption_TypeZDecodeErrorZ_clone(uint64_t orig) {
15678         LDKCResult_COption_TypeZDecodeErrorZ* orig_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)untag_ptr(orig);
15679         LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
15680         *ret_conv = CResult_COption_TypeZDecodeErrorZ_clone(orig_conv);
15681         return tag_ptr(ret_conv, true);
15682 }
15683
15684 uint64_t  __attribute__((export_name("TS_CResult_PaymentIdPaymentErrorZ_ok"))) TS_CResult_PaymentIdPaymentErrorZ_ok(int8_tArray o) {
15685         LDKThirtyTwoBytes o_ref;
15686         CHECK(o->arr_len == 32);
15687         memcpy(o_ref.data, o->elems, 32); FREE(o);
15688         LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
15689         *ret_conv = CResult_PaymentIdPaymentErrorZ_ok(o_ref);
15690         return tag_ptr(ret_conv, true);
15691 }
15692
15693 uint64_t  __attribute__((export_name("TS_CResult_PaymentIdPaymentErrorZ_err"))) TS_CResult_PaymentIdPaymentErrorZ_err(uint64_t e) {
15694         void* e_ptr = untag_ptr(e);
15695         CHECK_ACCESS(e_ptr);
15696         LDKPaymentError e_conv = *(LDKPaymentError*)(e_ptr);
15697         e_conv = PaymentError_clone((LDKPaymentError*)untag_ptr(e));
15698         LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
15699         *ret_conv = CResult_PaymentIdPaymentErrorZ_err(e_conv);
15700         return tag_ptr(ret_conv, true);
15701 }
15702
15703 jboolean  __attribute__((export_name("TS_CResult_PaymentIdPaymentErrorZ_is_ok"))) TS_CResult_PaymentIdPaymentErrorZ_is_ok(uint64_t o) {
15704         LDKCResult_PaymentIdPaymentErrorZ* o_conv = (LDKCResult_PaymentIdPaymentErrorZ*)untag_ptr(o);
15705         jboolean ret_conv = CResult_PaymentIdPaymentErrorZ_is_ok(o_conv);
15706         return ret_conv;
15707 }
15708
15709 void  __attribute__((export_name("TS_CResult_PaymentIdPaymentErrorZ_free"))) TS_CResult_PaymentIdPaymentErrorZ_free(uint64_t _res) {
15710         if (!ptr_is_owned(_res)) return;
15711         void* _res_ptr = untag_ptr(_res);
15712         CHECK_ACCESS(_res_ptr);
15713         LDKCResult_PaymentIdPaymentErrorZ _res_conv = *(LDKCResult_PaymentIdPaymentErrorZ*)(_res_ptr);
15714         FREE(untag_ptr(_res));
15715         CResult_PaymentIdPaymentErrorZ_free(_res_conv);
15716 }
15717
15718 static inline uint64_t CResult_PaymentIdPaymentErrorZ_clone_ptr(LDKCResult_PaymentIdPaymentErrorZ *NONNULL_PTR arg) {
15719         LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
15720         *ret_conv = CResult_PaymentIdPaymentErrorZ_clone(arg);
15721         return tag_ptr(ret_conv, true);
15722 }
15723 int64_t  __attribute__((export_name("TS_CResult_PaymentIdPaymentErrorZ_clone_ptr"))) TS_CResult_PaymentIdPaymentErrorZ_clone_ptr(uint64_t arg) {
15724         LDKCResult_PaymentIdPaymentErrorZ* arg_conv = (LDKCResult_PaymentIdPaymentErrorZ*)untag_ptr(arg);
15725         int64_t ret_conv = CResult_PaymentIdPaymentErrorZ_clone_ptr(arg_conv);
15726         return ret_conv;
15727 }
15728
15729 uint64_t  __attribute__((export_name("TS_CResult_PaymentIdPaymentErrorZ_clone"))) TS_CResult_PaymentIdPaymentErrorZ_clone(uint64_t orig) {
15730         LDKCResult_PaymentIdPaymentErrorZ* orig_conv = (LDKCResult_PaymentIdPaymentErrorZ*)untag_ptr(orig);
15731         LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
15732         *ret_conv = CResult_PaymentIdPaymentErrorZ_clone(orig_conv);
15733         return tag_ptr(ret_conv, true);
15734 }
15735
15736 uint64_t  __attribute__((export_name("TS_CResult_SiPrefixParseErrorZ_ok"))) TS_CResult_SiPrefixParseErrorZ_ok(uint32_t o) {
15737         LDKSiPrefix o_conv = LDKSiPrefix_from_js(o);
15738         LDKCResult_SiPrefixParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixParseErrorZ), "LDKCResult_SiPrefixParseErrorZ");
15739         *ret_conv = CResult_SiPrefixParseErrorZ_ok(o_conv);
15740         return tag_ptr(ret_conv, true);
15741 }
15742
15743 uint64_t  __attribute__((export_name("TS_CResult_SiPrefixParseErrorZ_err"))) TS_CResult_SiPrefixParseErrorZ_err(uint64_t e) {
15744         void* e_ptr = untag_ptr(e);
15745         CHECK_ACCESS(e_ptr);
15746         LDKParseError e_conv = *(LDKParseError*)(e_ptr);
15747         e_conv = ParseError_clone((LDKParseError*)untag_ptr(e));
15748         LDKCResult_SiPrefixParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixParseErrorZ), "LDKCResult_SiPrefixParseErrorZ");
15749         *ret_conv = CResult_SiPrefixParseErrorZ_err(e_conv);
15750         return tag_ptr(ret_conv, true);
15751 }
15752
15753 jboolean  __attribute__((export_name("TS_CResult_SiPrefixParseErrorZ_is_ok"))) TS_CResult_SiPrefixParseErrorZ_is_ok(uint64_t o) {
15754         LDKCResult_SiPrefixParseErrorZ* o_conv = (LDKCResult_SiPrefixParseErrorZ*)untag_ptr(o);
15755         jboolean ret_conv = CResult_SiPrefixParseErrorZ_is_ok(o_conv);
15756         return ret_conv;
15757 }
15758
15759 void  __attribute__((export_name("TS_CResult_SiPrefixParseErrorZ_free"))) TS_CResult_SiPrefixParseErrorZ_free(uint64_t _res) {
15760         if (!ptr_is_owned(_res)) return;
15761         void* _res_ptr = untag_ptr(_res);
15762         CHECK_ACCESS(_res_ptr);
15763         LDKCResult_SiPrefixParseErrorZ _res_conv = *(LDKCResult_SiPrefixParseErrorZ*)(_res_ptr);
15764         FREE(untag_ptr(_res));
15765         CResult_SiPrefixParseErrorZ_free(_res_conv);
15766 }
15767
15768 static inline uint64_t CResult_SiPrefixParseErrorZ_clone_ptr(LDKCResult_SiPrefixParseErrorZ *NONNULL_PTR arg) {
15769         LDKCResult_SiPrefixParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixParseErrorZ), "LDKCResult_SiPrefixParseErrorZ");
15770         *ret_conv = CResult_SiPrefixParseErrorZ_clone(arg);
15771         return tag_ptr(ret_conv, true);
15772 }
15773 int64_t  __attribute__((export_name("TS_CResult_SiPrefixParseErrorZ_clone_ptr"))) TS_CResult_SiPrefixParseErrorZ_clone_ptr(uint64_t arg) {
15774         LDKCResult_SiPrefixParseErrorZ* arg_conv = (LDKCResult_SiPrefixParseErrorZ*)untag_ptr(arg);
15775         int64_t ret_conv = CResult_SiPrefixParseErrorZ_clone_ptr(arg_conv);
15776         return ret_conv;
15777 }
15778
15779 uint64_t  __attribute__((export_name("TS_CResult_SiPrefixParseErrorZ_clone"))) TS_CResult_SiPrefixParseErrorZ_clone(uint64_t orig) {
15780         LDKCResult_SiPrefixParseErrorZ* orig_conv = (LDKCResult_SiPrefixParseErrorZ*)untag_ptr(orig);
15781         LDKCResult_SiPrefixParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixParseErrorZ), "LDKCResult_SiPrefixParseErrorZ");
15782         *ret_conv = CResult_SiPrefixParseErrorZ_clone(orig_conv);
15783         return tag_ptr(ret_conv, true);
15784 }
15785
15786 uint64_t  __attribute__((export_name("TS_CResult_InvoiceParseOrSemanticErrorZ_ok"))) TS_CResult_InvoiceParseOrSemanticErrorZ_ok(uint64_t o) {
15787         LDKInvoice o_conv;
15788         o_conv.inner = untag_ptr(o);
15789         o_conv.is_owned = ptr_is_owned(o);
15790         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15791         o_conv = Invoice_clone(&o_conv);
15792         LDKCResult_InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceParseOrSemanticErrorZ), "LDKCResult_InvoiceParseOrSemanticErrorZ");
15793         *ret_conv = CResult_InvoiceParseOrSemanticErrorZ_ok(o_conv);
15794         return tag_ptr(ret_conv, true);
15795 }
15796
15797 uint64_t  __attribute__((export_name("TS_CResult_InvoiceParseOrSemanticErrorZ_err"))) TS_CResult_InvoiceParseOrSemanticErrorZ_err(uint64_t e) {
15798         void* e_ptr = untag_ptr(e);
15799         CHECK_ACCESS(e_ptr);
15800         LDKParseOrSemanticError e_conv = *(LDKParseOrSemanticError*)(e_ptr);
15801         e_conv = ParseOrSemanticError_clone((LDKParseOrSemanticError*)untag_ptr(e));
15802         LDKCResult_InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceParseOrSemanticErrorZ), "LDKCResult_InvoiceParseOrSemanticErrorZ");
15803         *ret_conv = CResult_InvoiceParseOrSemanticErrorZ_err(e_conv);
15804         return tag_ptr(ret_conv, true);
15805 }
15806
15807 jboolean  __attribute__((export_name("TS_CResult_InvoiceParseOrSemanticErrorZ_is_ok"))) TS_CResult_InvoiceParseOrSemanticErrorZ_is_ok(uint64_t o) {
15808         LDKCResult_InvoiceParseOrSemanticErrorZ* o_conv = (LDKCResult_InvoiceParseOrSemanticErrorZ*)untag_ptr(o);
15809         jboolean ret_conv = CResult_InvoiceParseOrSemanticErrorZ_is_ok(o_conv);
15810         return ret_conv;
15811 }
15812
15813 void  __attribute__((export_name("TS_CResult_InvoiceParseOrSemanticErrorZ_free"))) TS_CResult_InvoiceParseOrSemanticErrorZ_free(uint64_t _res) {
15814         if (!ptr_is_owned(_res)) return;
15815         void* _res_ptr = untag_ptr(_res);
15816         CHECK_ACCESS(_res_ptr);
15817         LDKCResult_InvoiceParseOrSemanticErrorZ _res_conv = *(LDKCResult_InvoiceParseOrSemanticErrorZ*)(_res_ptr);
15818         FREE(untag_ptr(_res));
15819         CResult_InvoiceParseOrSemanticErrorZ_free(_res_conv);
15820 }
15821
15822 static inline uint64_t CResult_InvoiceParseOrSemanticErrorZ_clone_ptr(LDKCResult_InvoiceParseOrSemanticErrorZ *NONNULL_PTR arg) {
15823         LDKCResult_InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceParseOrSemanticErrorZ), "LDKCResult_InvoiceParseOrSemanticErrorZ");
15824         *ret_conv = CResult_InvoiceParseOrSemanticErrorZ_clone(arg);
15825         return tag_ptr(ret_conv, true);
15826 }
15827 int64_t  __attribute__((export_name("TS_CResult_InvoiceParseOrSemanticErrorZ_clone_ptr"))) TS_CResult_InvoiceParseOrSemanticErrorZ_clone_ptr(uint64_t arg) {
15828         LDKCResult_InvoiceParseOrSemanticErrorZ* arg_conv = (LDKCResult_InvoiceParseOrSemanticErrorZ*)untag_ptr(arg);
15829         int64_t ret_conv = CResult_InvoiceParseOrSemanticErrorZ_clone_ptr(arg_conv);
15830         return ret_conv;
15831 }
15832
15833 uint64_t  __attribute__((export_name("TS_CResult_InvoiceParseOrSemanticErrorZ_clone"))) TS_CResult_InvoiceParseOrSemanticErrorZ_clone(uint64_t orig) {
15834         LDKCResult_InvoiceParseOrSemanticErrorZ* orig_conv = (LDKCResult_InvoiceParseOrSemanticErrorZ*)untag_ptr(orig);
15835         LDKCResult_InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceParseOrSemanticErrorZ), "LDKCResult_InvoiceParseOrSemanticErrorZ");
15836         *ret_conv = CResult_InvoiceParseOrSemanticErrorZ_clone(orig_conv);
15837         return tag_ptr(ret_conv, true);
15838 }
15839
15840 uint64_t  __attribute__((export_name("TS_CResult_SignedRawInvoiceParseErrorZ_ok"))) TS_CResult_SignedRawInvoiceParseErrorZ_ok(uint64_t o) {
15841         LDKSignedRawInvoice o_conv;
15842         o_conv.inner = untag_ptr(o);
15843         o_conv.is_owned = ptr_is_owned(o);
15844         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15845         o_conv = SignedRawInvoice_clone(&o_conv);
15846         LDKCResult_SignedRawInvoiceParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceParseErrorZ), "LDKCResult_SignedRawInvoiceParseErrorZ");
15847         *ret_conv = CResult_SignedRawInvoiceParseErrorZ_ok(o_conv);
15848         return tag_ptr(ret_conv, true);
15849 }
15850
15851 uint64_t  __attribute__((export_name("TS_CResult_SignedRawInvoiceParseErrorZ_err"))) TS_CResult_SignedRawInvoiceParseErrorZ_err(uint64_t e) {
15852         void* e_ptr = untag_ptr(e);
15853         CHECK_ACCESS(e_ptr);
15854         LDKParseError e_conv = *(LDKParseError*)(e_ptr);
15855         e_conv = ParseError_clone((LDKParseError*)untag_ptr(e));
15856         LDKCResult_SignedRawInvoiceParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceParseErrorZ), "LDKCResult_SignedRawInvoiceParseErrorZ");
15857         *ret_conv = CResult_SignedRawInvoiceParseErrorZ_err(e_conv);
15858         return tag_ptr(ret_conv, true);
15859 }
15860
15861 jboolean  __attribute__((export_name("TS_CResult_SignedRawInvoiceParseErrorZ_is_ok"))) TS_CResult_SignedRawInvoiceParseErrorZ_is_ok(uint64_t o) {
15862         LDKCResult_SignedRawInvoiceParseErrorZ* o_conv = (LDKCResult_SignedRawInvoiceParseErrorZ*)untag_ptr(o);
15863         jboolean ret_conv = CResult_SignedRawInvoiceParseErrorZ_is_ok(o_conv);
15864         return ret_conv;
15865 }
15866
15867 void  __attribute__((export_name("TS_CResult_SignedRawInvoiceParseErrorZ_free"))) TS_CResult_SignedRawInvoiceParseErrorZ_free(uint64_t _res) {
15868         if (!ptr_is_owned(_res)) return;
15869         void* _res_ptr = untag_ptr(_res);
15870         CHECK_ACCESS(_res_ptr);
15871         LDKCResult_SignedRawInvoiceParseErrorZ _res_conv = *(LDKCResult_SignedRawInvoiceParseErrorZ*)(_res_ptr);
15872         FREE(untag_ptr(_res));
15873         CResult_SignedRawInvoiceParseErrorZ_free(_res_conv);
15874 }
15875
15876 static inline uint64_t CResult_SignedRawInvoiceParseErrorZ_clone_ptr(LDKCResult_SignedRawInvoiceParseErrorZ *NONNULL_PTR arg) {
15877         LDKCResult_SignedRawInvoiceParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceParseErrorZ), "LDKCResult_SignedRawInvoiceParseErrorZ");
15878         *ret_conv = CResult_SignedRawInvoiceParseErrorZ_clone(arg);
15879         return tag_ptr(ret_conv, true);
15880 }
15881 int64_t  __attribute__((export_name("TS_CResult_SignedRawInvoiceParseErrorZ_clone_ptr"))) TS_CResult_SignedRawInvoiceParseErrorZ_clone_ptr(uint64_t arg) {
15882         LDKCResult_SignedRawInvoiceParseErrorZ* arg_conv = (LDKCResult_SignedRawInvoiceParseErrorZ*)untag_ptr(arg);
15883         int64_t ret_conv = CResult_SignedRawInvoiceParseErrorZ_clone_ptr(arg_conv);
15884         return ret_conv;
15885 }
15886
15887 uint64_t  __attribute__((export_name("TS_CResult_SignedRawInvoiceParseErrorZ_clone"))) TS_CResult_SignedRawInvoiceParseErrorZ_clone(uint64_t orig) {
15888         LDKCResult_SignedRawInvoiceParseErrorZ* orig_conv = (LDKCResult_SignedRawInvoiceParseErrorZ*)untag_ptr(orig);
15889         LDKCResult_SignedRawInvoiceParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceParseErrorZ), "LDKCResult_SignedRawInvoiceParseErrorZ");
15890         *ret_conv = CResult_SignedRawInvoiceParseErrorZ_clone(orig_conv);
15891         return tag_ptr(ret_conv, true);
15892 }
15893
15894 static inline uint64_t C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone_ptr(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *NONNULL_PTR arg) {
15895         LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
15896         *ret_conv = C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone(arg);
15897         return tag_ptr(ret_conv, true);
15898 }
15899 int64_t  __attribute__((export_name("TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone_ptr"))) TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone_ptr(uint64_t arg) {
15900         LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* arg_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)untag_ptr(arg);
15901         int64_t ret_conv = C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone_ptr(arg_conv);
15902         return ret_conv;
15903 }
15904
15905 uint64_t  __attribute__((export_name("TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone"))) TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone(uint64_t orig) {
15906         LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* orig_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)untag_ptr(orig);
15907         LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
15908         *ret_conv = C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone(orig_conv);
15909         return tag_ptr(ret_conv, true);
15910 }
15911
15912 uint64_t  __attribute__((export_name("TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_new"))) TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_new(uint64_t a, int8_tArray b, uint64_t c) {
15913         LDKRawInvoice a_conv;
15914         a_conv.inner = untag_ptr(a);
15915         a_conv.is_owned = ptr_is_owned(a);
15916         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
15917         a_conv = RawInvoice_clone(&a_conv);
15918         LDKThirtyTwoBytes b_ref;
15919         CHECK(b->arr_len == 32);
15920         memcpy(b_ref.data, b->elems, 32); FREE(b);
15921         LDKInvoiceSignature c_conv;
15922         c_conv.inner = untag_ptr(c);
15923         c_conv.is_owned = ptr_is_owned(c);
15924         CHECK_INNER_FIELD_ACCESS_OR_NULL(c_conv);
15925         c_conv = InvoiceSignature_clone(&c_conv);
15926         LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
15927         *ret_conv = C3Tuple_RawInvoice_u832InvoiceSignatureZ_new(a_conv, b_ref, c_conv);
15928         return tag_ptr(ret_conv, true);
15929 }
15930
15931 void  __attribute__((export_name("TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_free"))) TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_free(uint64_t _res) {
15932         if (!ptr_is_owned(_res)) return;
15933         void* _res_ptr = untag_ptr(_res);
15934         CHECK_ACCESS(_res_ptr);
15935         LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ _res_conv = *(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(_res_ptr);
15936         FREE(untag_ptr(_res));
15937         C3Tuple_RawInvoice_u832InvoiceSignatureZ_free(_res_conv);
15938 }
15939
15940 uint64_t  __attribute__((export_name("TS_CResult_PayeePubKeyErrorZ_ok"))) TS_CResult_PayeePubKeyErrorZ_ok(uint64_t o) {
15941         LDKPayeePubKey o_conv;
15942         o_conv.inner = untag_ptr(o);
15943         o_conv.is_owned = ptr_is_owned(o);
15944         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15945         o_conv = PayeePubKey_clone(&o_conv);
15946         LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
15947         *ret_conv = CResult_PayeePubKeyErrorZ_ok(o_conv);
15948         return tag_ptr(ret_conv, true);
15949 }
15950
15951 uint64_t  __attribute__((export_name("TS_CResult_PayeePubKeyErrorZ_err"))) TS_CResult_PayeePubKeyErrorZ_err(uint32_t e) {
15952         LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_js(e);
15953         LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
15954         *ret_conv = CResult_PayeePubKeyErrorZ_err(e_conv);
15955         return tag_ptr(ret_conv, true);
15956 }
15957
15958 jboolean  __attribute__((export_name("TS_CResult_PayeePubKeyErrorZ_is_ok"))) TS_CResult_PayeePubKeyErrorZ_is_ok(uint64_t o) {
15959         LDKCResult_PayeePubKeyErrorZ* o_conv = (LDKCResult_PayeePubKeyErrorZ*)untag_ptr(o);
15960         jboolean ret_conv = CResult_PayeePubKeyErrorZ_is_ok(o_conv);
15961         return ret_conv;
15962 }
15963
15964 void  __attribute__((export_name("TS_CResult_PayeePubKeyErrorZ_free"))) TS_CResult_PayeePubKeyErrorZ_free(uint64_t _res) {
15965         if (!ptr_is_owned(_res)) return;
15966         void* _res_ptr = untag_ptr(_res);
15967         CHECK_ACCESS(_res_ptr);
15968         LDKCResult_PayeePubKeyErrorZ _res_conv = *(LDKCResult_PayeePubKeyErrorZ*)(_res_ptr);
15969         FREE(untag_ptr(_res));
15970         CResult_PayeePubKeyErrorZ_free(_res_conv);
15971 }
15972
15973 static inline uint64_t CResult_PayeePubKeyErrorZ_clone_ptr(LDKCResult_PayeePubKeyErrorZ *NONNULL_PTR arg) {
15974         LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
15975         *ret_conv = CResult_PayeePubKeyErrorZ_clone(arg);
15976         return tag_ptr(ret_conv, true);
15977 }
15978 int64_t  __attribute__((export_name("TS_CResult_PayeePubKeyErrorZ_clone_ptr"))) TS_CResult_PayeePubKeyErrorZ_clone_ptr(uint64_t arg) {
15979         LDKCResult_PayeePubKeyErrorZ* arg_conv = (LDKCResult_PayeePubKeyErrorZ*)untag_ptr(arg);
15980         int64_t ret_conv = CResult_PayeePubKeyErrorZ_clone_ptr(arg_conv);
15981         return ret_conv;
15982 }
15983
15984 uint64_t  __attribute__((export_name("TS_CResult_PayeePubKeyErrorZ_clone"))) TS_CResult_PayeePubKeyErrorZ_clone(uint64_t orig) {
15985         LDKCResult_PayeePubKeyErrorZ* orig_conv = (LDKCResult_PayeePubKeyErrorZ*)untag_ptr(orig);
15986         LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
15987         *ret_conv = CResult_PayeePubKeyErrorZ_clone(orig_conv);
15988         return tag_ptr(ret_conv, true);
15989 }
15990
15991 void  __attribute__((export_name("TS_CVec_PrivateRouteZ_free"))) TS_CVec_PrivateRouteZ_free(uint64_tArray _res) {
15992         LDKCVec_PrivateRouteZ _res_constr;
15993         _res_constr.datalen = _res->arr_len;
15994         if (_res_constr.datalen > 0)
15995                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPrivateRoute), "LDKCVec_PrivateRouteZ Elements");
15996         else
15997                 _res_constr.data = NULL;
15998         uint64_t* _res_vals = _res->elems;
15999         for (size_t o = 0; o < _res_constr.datalen; o++) {
16000                 uint64_t _res_conv_14 = _res_vals[o];
16001                 LDKPrivateRoute _res_conv_14_conv;
16002                 _res_conv_14_conv.inner = untag_ptr(_res_conv_14);
16003                 _res_conv_14_conv.is_owned = ptr_is_owned(_res_conv_14);
16004                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_14_conv);
16005                 _res_constr.data[o] = _res_conv_14_conv;
16006         }
16007         FREE(_res);
16008         CVec_PrivateRouteZ_free(_res_constr);
16009 }
16010
16011 uint64_t  __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_ok"))) TS_CResult_PositiveTimestampCreationErrorZ_ok(uint64_t o) {
16012         LDKPositiveTimestamp o_conv;
16013         o_conv.inner = untag_ptr(o);
16014         o_conv.is_owned = ptr_is_owned(o);
16015         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16016         o_conv = PositiveTimestamp_clone(&o_conv);
16017         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
16018         *ret_conv = CResult_PositiveTimestampCreationErrorZ_ok(o_conv);
16019         return tag_ptr(ret_conv, true);
16020 }
16021
16022 uint64_t  __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_err"))) TS_CResult_PositiveTimestampCreationErrorZ_err(uint32_t e) {
16023         LDKCreationError e_conv = LDKCreationError_from_js(e);
16024         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
16025         *ret_conv = CResult_PositiveTimestampCreationErrorZ_err(e_conv);
16026         return tag_ptr(ret_conv, true);
16027 }
16028
16029 jboolean  __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_is_ok"))) TS_CResult_PositiveTimestampCreationErrorZ_is_ok(uint64_t o) {
16030         LDKCResult_PositiveTimestampCreationErrorZ* o_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)untag_ptr(o);
16031         jboolean ret_conv = CResult_PositiveTimestampCreationErrorZ_is_ok(o_conv);
16032         return ret_conv;
16033 }
16034
16035 void  __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_free"))) TS_CResult_PositiveTimestampCreationErrorZ_free(uint64_t _res) {
16036         if (!ptr_is_owned(_res)) return;
16037         void* _res_ptr = untag_ptr(_res);
16038         CHECK_ACCESS(_res_ptr);
16039         LDKCResult_PositiveTimestampCreationErrorZ _res_conv = *(LDKCResult_PositiveTimestampCreationErrorZ*)(_res_ptr);
16040         FREE(untag_ptr(_res));
16041         CResult_PositiveTimestampCreationErrorZ_free(_res_conv);
16042 }
16043
16044 static inline uint64_t CResult_PositiveTimestampCreationErrorZ_clone_ptr(LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR arg) {
16045         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
16046         *ret_conv = CResult_PositiveTimestampCreationErrorZ_clone(arg);
16047         return tag_ptr(ret_conv, true);
16048 }
16049 int64_t  __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_clone_ptr"))) TS_CResult_PositiveTimestampCreationErrorZ_clone_ptr(uint64_t arg) {
16050         LDKCResult_PositiveTimestampCreationErrorZ* arg_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)untag_ptr(arg);
16051         int64_t ret_conv = CResult_PositiveTimestampCreationErrorZ_clone_ptr(arg_conv);
16052         return ret_conv;
16053 }
16054
16055 uint64_t  __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_clone"))) TS_CResult_PositiveTimestampCreationErrorZ_clone(uint64_t orig) {
16056         LDKCResult_PositiveTimestampCreationErrorZ* orig_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)untag_ptr(orig);
16057         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
16058         *ret_conv = CResult_PositiveTimestampCreationErrorZ_clone(orig_conv);
16059         return tag_ptr(ret_conv, true);
16060 }
16061
16062 uint64_t  __attribute__((export_name("TS_CResult_NoneSemanticErrorZ_ok"))) TS_CResult_NoneSemanticErrorZ_ok() {
16063         LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
16064         *ret_conv = CResult_NoneSemanticErrorZ_ok();
16065         return tag_ptr(ret_conv, true);
16066 }
16067
16068 uint64_t  __attribute__((export_name("TS_CResult_NoneSemanticErrorZ_err"))) TS_CResult_NoneSemanticErrorZ_err(uint32_t e) {
16069         LDKSemanticError e_conv = LDKSemanticError_from_js(e);
16070         LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
16071         *ret_conv = CResult_NoneSemanticErrorZ_err(e_conv);
16072         return tag_ptr(ret_conv, true);
16073 }
16074
16075 jboolean  __attribute__((export_name("TS_CResult_NoneSemanticErrorZ_is_ok"))) TS_CResult_NoneSemanticErrorZ_is_ok(uint64_t o) {
16076         LDKCResult_NoneSemanticErrorZ* o_conv = (LDKCResult_NoneSemanticErrorZ*)untag_ptr(o);
16077         jboolean ret_conv = CResult_NoneSemanticErrorZ_is_ok(o_conv);
16078         return ret_conv;
16079 }
16080
16081 void  __attribute__((export_name("TS_CResult_NoneSemanticErrorZ_free"))) TS_CResult_NoneSemanticErrorZ_free(uint64_t _res) {
16082         if (!ptr_is_owned(_res)) return;
16083         void* _res_ptr = untag_ptr(_res);
16084         CHECK_ACCESS(_res_ptr);
16085         LDKCResult_NoneSemanticErrorZ _res_conv = *(LDKCResult_NoneSemanticErrorZ*)(_res_ptr);
16086         FREE(untag_ptr(_res));
16087         CResult_NoneSemanticErrorZ_free(_res_conv);
16088 }
16089
16090 static inline uint64_t CResult_NoneSemanticErrorZ_clone_ptr(LDKCResult_NoneSemanticErrorZ *NONNULL_PTR arg) {
16091         LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
16092         *ret_conv = CResult_NoneSemanticErrorZ_clone(arg);
16093         return tag_ptr(ret_conv, true);
16094 }
16095 int64_t  __attribute__((export_name("TS_CResult_NoneSemanticErrorZ_clone_ptr"))) TS_CResult_NoneSemanticErrorZ_clone_ptr(uint64_t arg) {
16096         LDKCResult_NoneSemanticErrorZ* arg_conv = (LDKCResult_NoneSemanticErrorZ*)untag_ptr(arg);
16097         int64_t ret_conv = CResult_NoneSemanticErrorZ_clone_ptr(arg_conv);
16098         return ret_conv;
16099 }
16100
16101 uint64_t  __attribute__((export_name("TS_CResult_NoneSemanticErrorZ_clone"))) TS_CResult_NoneSemanticErrorZ_clone(uint64_t orig) {
16102         LDKCResult_NoneSemanticErrorZ* orig_conv = (LDKCResult_NoneSemanticErrorZ*)untag_ptr(orig);
16103         LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
16104         *ret_conv = CResult_NoneSemanticErrorZ_clone(orig_conv);
16105         return tag_ptr(ret_conv, true);
16106 }
16107
16108 uint64_t  __attribute__((export_name("TS_CResult_InvoiceSemanticErrorZ_ok"))) TS_CResult_InvoiceSemanticErrorZ_ok(uint64_t o) {
16109         LDKInvoice o_conv;
16110         o_conv.inner = untag_ptr(o);
16111         o_conv.is_owned = ptr_is_owned(o);
16112         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16113         o_conv = Invoice_clone(&o_conv);
16114         LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
16115         *ret_conv = CResult_InvoiceSemanticErrorZ_ok(o_conv);
16116         return tag_ptr(ret_conv, true);
16117 }
16118
16119 uint64_t  __attribute__((export_name("TS_CResult_InvoiceSemanticErrorZ_err"))) TS_CResult_InvoiceSemanticErrorZ_err(uint32_t e) {
16120         LDKSemanticError e_conv = LDKSemanticError_from_js(e);
16121         LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
16122         *ret_conv = CResult_InvoiceSemanticErrorZ_err(e_conv);
16123         return tag_ptr(ret_conv, true);
16124 }
16125
16126 jboolean  __attribute__((export_name("TS_CResult_InvoiceSemanticErrorZ_is_ok"))) TS_CResult_InvoiceSemanticErrorZ_is_ok(uint64_t o) {
16127         LDKCResult_InvoiceSemanticErrorZ* o_conv = (LDKCResult_InvoiceSemanticErrorZ*)untag_ptr(o);
16128         jboolean ret_conv = CResult_InvoiceSemanticErrorZ_is_ok(o_conv);
16129         return ret_conv;
16130 }
16131
16132 void  __attribute__((export_name("TS_CResult_InvoiceSemanticErrorZ_free"))) TS_CResult_InvoiceSemanticErrorZ_free(uint64_t _res) {
16133         if (!ptr_is_owned(_res)) return;
16134         void* _res_ptr = untag_ptr(_res);
16135         CHECK_ACCESS(_res_ptr);
16136         LDKCResult_InvoiceSemanticErrorZ _res_conv = *(LDKCResult_InvoiceSemanticErrorZ*)(_res_ptr);
16137         FREE(untag_ptr(_res));
16138         CResult_InvoiceSemanticErrorZ_free(_res_conv);
16139 }
16140
16141 static inline uint64_t CResult_InvoiceSemanticErrorZ_clone_ptr(LDKCResult_InvoiceSemanticErrorZ *NONNULL_PTR arg) {
16142         LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
16143         *ret_conv = CResult_InvoiceSemanticErrorZ_clone(arg);
16144         return tag_ptr(ret_conv, true);
16145 }
16146 int64_t  __attribute__((export_name("TS_CResult_InvoiceSemanticErrorZ_clone_ptr"))) TS_CResult_InvoiceSemanticErrorZ_clone_ptr(uint64_t arg) {
16147         LDKCResult_InvoiceSemanticErrorZ* arg_conv = (LDKCResult_InvoiceSemanticErrorZ*)untag_ptr(arg);
16148         int64_t ret_conv = CResult_InvoiceSemanticErrorZ_clone_ptr(arg_conv);
16149         return ret_conv;
16150 }
16151
16152 uint64_t  __attribute__((export_name("TS_CResult_InvoiceSemanticErrorZ_clone"))) TS_CResult_InvoiceSemanticErrorZ_clone(uint64_t orig) {
16153         LDKCResult_InvoiceSemanticErrorZ* orig_conv = (LDKCResult_InvoiceSemanticErrorZ*)untag_ptr(orig);
16154         LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
16155         *ret_conv = CResult_InvoiceSemanticErrorZ_clone(orig_conv);
16156         return tag_ptr(ret_conv, true);
16157 }
16158
16159 uint64_t  __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_ok"))) TS_CResult_DescriptionCreationErrorZ_ok(uint64_t o) {
16160         LDKDescription o_conv;
16161         o_conv.inner = untag_ptr(o);
16162         o_conv.is_owned = ptr_is_owned(o);
16163         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16164         o_conv = Description_clone(&o_conv);
16165         LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
16166         *ret_conv = CResult_DescriptionCreationErrorZ_ok(o_conv);
16167         return tag_ptr(ret_conv, true);
16168 }
16169
16170 uint64_t  __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_err"))) TS_CResult_DescriptionCreationErrorZ_err(uint32_t e) {
16171         LDKCreationError e_conv = LDKCreationError_from_js(e);
16172         LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
16173         *ret_conv = CResult_DescriptionCreationErrorZ_err(e_conv);
16174         return tag_ptr(ret_conv, true);
16175 }
16176
16177 jboolean  __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_is_ok"))) TS_CResult_DescriptionCreationErrorZ_is_ok(uint64_t o) {
16178         LDKCResult_DescriptionCreationErrorZ* o_conv = (LDKCResult_DescriptionCreationErrorZ*)untag_ptr(o);
16179         jboolean ret_conv = CResult_DescriptionCreationErrorZ_is_ok(o_conv);
16180         return ret_conv;
16181 }
16182
16183 void  __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_free"))) TS_CResult_DescriptionCreationErrorZ_free(uint64_t _res) {
16184         if (!ptr_is_owned(_res)) return;
16185         void* _res_ptr = untag_ptr(_res);
16186         CHECK_ACCESS(_res_ptr);
16187         LDKCResult_DescriptionCreationErrorZ _res_conv = *(LDKCResult_DescriptionCreationErrorZ*)(_res_ptr);
16188         FREE(untag_ptr(_res));
16189         CResult_DescriptionCreationErrorZ_free(_res_conv);
16190 }
16191
16192 static inline uint64_t CResult_DescriptionCreationErrorZ_clone_ptr(LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR arg) {
16193         LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
16194         *ret_conv = CResult_DescriptionCreationErrorZ_clone(arg);
16195         return tag_ptr(ret_conv, true);
16196 }
16197 int64_t  __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_clone_ptr"))) TS_CResult_DescriptionCreationErrorZ_clone_ptr(uint64_t arg) {
16198         LDKCResult_DescriptionCreationErrorZ* arg_conv = (LDKCResult_DescriptionCreationErrorZ*)untag_ptr(arg);
16199         int64_t ret_conv = CResult_DescriptionCreationErrorZ_clone_ptr(arg_conv);
16200         return ret_conv;
16201 }
16202
16203 uint64_t  __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_clone"))) TS_CResult_DescriptionCreationErrorZ_clone(uint64_t orig) {
16204         LDKCResult_DescriptionCreationErrorZ* orig_conv = (LDKCResult_DescriptionCreationErrorZ*)untag_ptr(orig);
16205         LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
16206         *ret_conv = CResult_DescriptionCreationErrorZ_clone(orig_conv);
16207         return tag_ptr(ret_conv, true);
16208 }
16209
16210 uint64_t  __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_ok"))) TS_CResult_PrivateRouteCreationErrorZ_ok(uint64_t o) {
16211         LDKPrivateRoute o_conv;
16212         o_conv.inner = untag_ptr(o);
16213         o_conv.is_owned = ptr_is_owned(o);
16214         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16215         o_conv = PrivateRoute_clone(&o_conv);
16216         LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
16217         *ret_conv = CResult_PrivateRouteCreationErrorZ_ok(o_conv);
16218         return tag_ptr(ret_conv, true);
16219 }
16220
16221 uint64_t  __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_err"))) TS_CResult_PrivateRouteCreationErrorZ_err(uint32_t e) {
16222         LDKCreationError e_conv = LDKCreationError_from_js(e);
16223         LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
16224         *ret_conv = CResult_PrivateRouteCreationErrorZ_err(e_conv);
16225         return tag_ptr(ret_conv, true);
16226 }
16227
16228 jboolean  __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_is_ok"))) TS_CResult_PrivateRouteCreationErrorZ_is_ok(uint64_t o) {
16229         LDKCResult_PrivateRouteCreationErrorZ* o_conv = (LDKCResult_PrivateRouteCreationErrorZ*)untag_ptr(o);
16230         jboolean ret_conv = CResult_PrivateRouteCreationErrorZ_is_ok(o_conv);
16231         return ret_conv;
16232 }
16233
16234 void  __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_free"))) TS_CResult_PrivateRouteCreationErrorZ_free(uint64_t _res) {
16235         if (!ptr_is_owned(_res)) return;
16236         void* _res_ptr = untag_ptr(_res);
16237         CHECK_ACCESS(_res_ptr);
16238         LDKCResult_PrivateRouteCreationErrorZ _res_conv = *(LDKCResult_PrivateRouteCreationErrorZ*)(_res_ptr);
16239         FREE(untag_ptr(_res));
16240         CResult_PrivateRouteCreationErrorZ_free(_res_conv);
16241 }
16242
16243 static inline uint64_t CResult_PrivateRouteCreationErrorZ_clone_ptr(LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR arg) {
16244         LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
16245         *ret_conv = CResult_PrivateRouteCreationErrorZ_clone(arg);
16246         return tag_ptr(ret_conv, true);
16247 }
16248 int64_t  __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_clone_ptr"))) TS_CResult_PrivateRouteCreationErrorZ_clone_ptr(uint64_t arg) {
16249         LDKCResult_PrivateRouteCreationErrorZ* arg_conv = (LDKCResult_PrivateRouteCreationErrorZ*)untag_ptr(arg);
16250         int64_t ret_conv = CResult_PrivateRouteCreationErrorZ_clone_ptr(arg_conv);
16251         return ret_conv;
16252 }
16253
16254 uint64_t  __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_clone"))) TS_CResult_PrivateRouteCreationErrorZ_clone(uint64_t orig) {
16255         LDKCResult_PrivateRouteCreationErrorZ* orig_conv = (LDKCResult_PrivateRouteCreationErrorZ*)untag_ptr(orig);
16256         LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
16257         *ret_conv = CResult_PrivateRouteCreationErrorZ_clone(orig_conv);
16258         return tag_ptr(ret_conv, true);
16259 }
16260
16261 uint64_t  __attribute__((export_name("TS_CResult_StringErrorZ_ok"))) TS_CResult_StringErrorZ_ok(jstring o) {
16262         LDKStr o_conv = str_ref_to_owned_c(o);
16263         LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
16264         *ret_conv = CResult_StringErrorZ_ok(o_conv);
16265         return tag_ptr(ret_conv, true);
16266 }
16267
16268 uint64_t  __attribute__((export_name("TS_CResult_StringErrorZ_err"))) TS_CResult_StringErrorZ_err(uint32_t e) {
16269         LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_js(e);
16270         LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
16271         *ret_conv = CResult_StringErrorZ_err(e_conv);
16272         return tag_ptr(ret_conv, true);
16273 }
16274
16275 jboolean  __attribute__((export_name("TS_CResult_StringErrorZ_is_ok"))) TS_CResult_StringErrorZ_is_ok(uint64_t o) {
16276         LDKCResult_StringErrorZ* o_conv = (LDKCResult_StringErrorZ*)untag_ptr(o);
16277         jboolean ret_conv = CResult_StringErrorZ_is_ok(o_conv);
16278         return ret_conv;
16279 }
16280
16281 void  __attribute__((export_name("TS_CResult_StringErrorZ_free"))) TS_CResult_StringErrorZ_free(uint64_t _res) {
16282         if (!ptr_is_owned(_res)) return;
16283         void* _res_ptr = untag_ptr(_res);
16284         CHECK_ACCESS(_res_ptr);
16285         LDKCResult_StringErrorZ _res_conv = *(LDKCResult_StringErrorZ*)(_res_ptr);
16286         FREE(untag_ptr(_res));
16287         CResult_StringErrorZ_free(_res_conv);
16288 }
16289
16290 static inline uint64_t CResult_StringErrorZ_clone_ptr(LDKCResult_StringErrorZ *NONNULL_PTR arg) {
16291         LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
16292         *ret_conv = CResult_StringErrorZ_clone(arg);
16293         return tag_ptr(ret_conv, true);
16294 }
16295 int64_t  __attribute__((export_name("TS_CResult_StringErrorZ_clone_ptr"))) TS_CResult_StringErrorZ_clone_ptr(uint64_t arg) {
16296         LDKCResult_StringErrorZ* arg_conv = (LDKCResult_StringErrorZ*)untag_ptr(arg);
16297         int64_t ret_conv = CResult_StringErrorZ_clone_ptr(arg_conv);
16298         return ret_conv;
16299 }
16300
16301 uint64_t  __attribute__((export_name("TS_CResult_StringErrorZ_clone"))) TS_CResult_StringErrorZ_clone(uint64_t orig) {
16302         LDKCResult_StringErrorZ* orig_conv = (LDKCResult_StringErrorZ*)untag_ptr(orig);
16303         LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
16304         *ret_conv = CResult_StringErrorZ_clone(orig_conv);
16305         return tag_ptr(ret_conv, true);
16306 }
16307
16308 uint64_t  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_ok"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_ok(uint64_t o) {
16309         LDKChannelMonitorUpdate o_conv;
16310         o_conv.inner = untag_ptr(o);
16311         o_conv.is_owned = ptr_is_owned(o);
16312         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16313         o_conv = ChannelMonitorUpdate_clone(&o_conv);
16314         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
16315         *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_ok(o_conv);
16316         return tag_ptr(ret_conv, true);
16317 }
16318
16319 uint64_t  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_err"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_err(uint64_t e) {
16320         LDKDecodeError e_conv;
16321         e_conv.inner = untag_ptr(e);
16322         e_conv.is_owned = ptr_is_owned(e);
16323         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
16324         e_conv = DecodeError_clone(&e_conv);
16325         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
16326         *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_err(e_conv);
16327         return tag_ptr(ret_conv, true);
16328 }
16329
16330 jboolean  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_is_ok"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_is_ok(uint64_t o) {
16331         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* o_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)untag_ptr(o);
16332         jboolean ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_is_ok(o_conv);
16333         return ret_conv;
16334 }
16335
16336 void  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_free"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_free(uint64_t _res) {
16337         if (!ptr_is_owned(_res)) return;
16338         void* _res_ptr = untag_ptr(_res);
16339         CHECK_ACCESS(_res_ptr);
16340         LDKCResult_ChannelMonitorUpdateDecodeErrorZ _res_conv = *(LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(_res_ptr);
16341         FREE(untag_ptr(_res));
16342         CResult_ChannelMonitorUpdateDecodeErrorZ_free(_res_conv);
16343 }
16344
16345 static inline uint64_t CResult_ChannelMonitorUpdateDecodeErrorZ_clone_ptr(LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR arg) {
16346         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
16347         *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_clone(arg);
16348         return tag_ptr(ret_conv, true);
16349 }
16350 int64_t  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_clone_ptr(uint64_t arg) {
16351         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* arg_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)untag_ptr(arg);
16352         int64_t ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_clone_ptr(arg_conv);
16353         return ret_conv;
16354 }
16355
16356 uint64_t  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_clone"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_clone(uint64_t orig) {
16357         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* orig_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)untag_ptr(orig);
16358         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
16359         *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_clone(orig_conv);
16360         return tag_ptr(ret_conv, true);
16361 }
16362
16363 uint64_t  __attribute__((export_name("TS_COption_MonitorEventZ_some"))) TS_COption_MonitorEventZ_some(uint64_t o) {
16364         void* o_ptr = untag_ptr(o);
16365         CHECK_ACCESS(o_ptr);
16366         LDKMonitorEvent o_conv = *(LDKMonitorEvent*)(o_ptr);
16367         o_conv = MonitorEvent_clone((LDKMonitorEvent*)untag_ptr(o));
16368         LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
16369         *ret_copy = COption_MonitorEventZ_some(o_conv);
16370         uint64_t ret_ref = tag_ptr(ret_copy, true);
16371         return ret_ref;
16372 }
16373
16374 uint64_t  __attribute__((export_name("TS_COption_MonitorEventZ_none"))) TS_COption_MonitorEventZ_none() {
16375         LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
16376         *ret_copy = COption_MonitorEventZ_none();
16377         uint64_t ret_ref = tag_ptr(ret_copy, true);
16378         return ret_ref;
16379 }
16380
16381 void  __attribute__((export_name("TS_COption_MonitorEventZ_free"))) TS_COption_MonitorEventZ_free(uint64_t _res) {
16382         if (!ptr_is_owned(_res)) return;
16383         void* _res_ptr = untag_ptr(_res);
16384         CHECK_ACCESS(_res_ptr);
16385         LDKCOption_MonitorEventZ _res_conv = *(LDKCOption_MonitorEventZ*)(_res_ptr);
16386         FREE(untag_ptr(_res));
16387         COption_MonitorEventZ_free(_res_conv);
16388 }
16389
16390 static inline uint64_t COption_MonitorEventZ_clone_ptr(LDKCOption_MonitorEventZ *NONNULL_PTR arg) {
16391         LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
16392         *ret_copy = COption_MonitorEventZ_clone(arg);
16393         uint64_t ret_ref = tag_ptr(ret_copy, true);
16394         return ret_ref;
16395 }
16396 int64_t  __attribute__((export_name("TS_COption_MonitorEventZ_clone_ptr"))) TS_COption_MonitorEventZ_clone_ptr(uint64_t arg) {
16397         LDKCOption_MonitorEventZ* arg_conv = (LDKCOption_MonitorEventZ*)untag_ptr(arg);
16398         int64_t ret_conv = COption_MonitorEventZ_clone_ptr(arg_conv);
16399         return ret_conv;
16400 }
16401
16402 uint64_t  __attribute__((export_name("TS_COption_MonitorEventZ_clone"))) TS_COption_MonitorEventZ_clone(uint64_t orig) {
16403         LDKCOption_MonitorEventZ* orig_conv = (LDKCOption_MonitorEventZ*)untag_ptr(orig);
16404         LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
16405         *ret_copy = COption_MonitorEventZ_clone(orig_conv);
16406         uint64_t ret_ref = tag_ptr(ret_copy, true);
16407         return ret_ref;
16408 }
16409
16410 uint64_t  __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_ok"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_ok(uint64_t o) {
16411         void* o_ptr = untag_ptr(o);
16412         CHECK_ACCESS(o_ptr);
16413         LDKCOption_MonitorEventZ o_conv = *(LDKCOption_MonitorEventZ*)(o_ptr);
16414         o_conv = COption_MonitorEventZ_clone((LDKCOption_MonitorEventZ*)untag_ptr(o));
16415         LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
16416         *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_ok(o_conv);
16417         return tag_ptr(ret_conv, true);
16418 }
16419
16420 uint64_t  __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_err"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_err(uint64_t e) {
16421         LDKDecodeError e_conv;
16422         e_conv.inner = untag_ptr(e);
16423         e_conv.is_owned = ptr_is_owned(e);
16424         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
16425         e_conv = DecodeError_clone(&e_conv);
16426         LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
16427         *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_err(e_conv);
16428         return tag_ptr(ret_conv, true);
16429 }
16430
16431 jboolean  __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_is_ok"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_is_ok(uint64_t o) {
16432         LDKCResult_COption_MonitorEventZDecodeErrorZ* o_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)untag_ptr(o);
16433         jboolean ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_is_ok(o_conv);
16434         return ret_conv;
16435 }
16436
16437 void  __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_free"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_free(uint64_t _res) {
16438         if (!ptr_is_owned(_res)) return;
16439         void* _res_ptr = untag_ptr(_res);
16440         CHECK_ACCESS(_res_ptr);
16441         LDKCResult_COption_MonitorEventZDecodeErrorZ _res_conv = *(LDKCResult_COption_MonitorEventZDecodeErrorZ*)(_res_ptr);
16442         FREE(untag_ptr(_res));
16443         CResult_COption_MonitorEventZDecodeErrorZ_free(_res_conv);
16444 }
16445
16446 static inline uint64_t CResult_COption_MonitorEventZDecodeErrorZ_clone_ptr(LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR arg) {
16447         LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
16448         *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_clone(arg);
16449         return tag_ptr(ret_conv, true);
16450 }
16451 int64_t  __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_clone_ptr"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_clone_ptr(uint64_t arg) {
16452         LDKCResult_COption_MonitorEventZDecodeErrorZ* arg_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)untag_ptr(arg);
16453         int64_t ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_clone_ptr(arg_conv);
16454         return ret_conv;
16455 }
16456
16457 uint64_t  __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_clone"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_clone(uint64_t orig) {
16458         LDKCResult_COption_MonitorEventZDecodeErrorZ* orig_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)untag_ptr(orig);
16459         LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
16460         *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_clone(orig_conv);
16461         return tag_ptr(ret_conv, true);
16462 }
16463
16464 uint64_t  __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_ok"))) TS_CResult_HTLCUpdateDecodeErrorZ_ok(uint64_t o) {
16465         LDKHTLCUpdate o_conv;
16466         o_conv.inner = untag_ptr(o);
16467         o_conv.is_owned = ptr_is_owned(o);
16468         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16469         o_conv = HTLCUpdate_clone(&o_conv);
16470         LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
16471         *ret_conv = CResult_HTLCUpdateDecodeErrorZ_ok(o_conv);
16472         return tag_ptr(ret_conv, true);
16473 }
16474
16475 uint64_t  __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_err"))) TS_CResult_HTLCUpdateDecodeErrorZ_err(uint64_t e) {
16476         LDKDecodeError e_conv;
16477         e_conv.inner = untag_ptr(e);
16478         e_conv.is_owned = ptr_is_owned(e);
16479         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
16480         e_conv = DecodeError_clone(&e_conv);
16481         LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
16482         *ret_conv = CResult_HTLCUpdateDecodeErrorZ_err(e_conv);
16483         return tag_ptr(ret_conv, true);
16484 }
16485
16486 jboolean  __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_is_ok"))) TS_CResult_HTLCUpdateDecodeErrorZ_is_ok(uint64_t o) {
16487         LDKCResult_HTLCUpdateDecodeErrorZ* o_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)untag_ptr(o);
16488         jboolean ret_conv = CResult_HTLCUpdateDecodeErrorZ_is_ok(o_conv);
16489         return ret_conv;
16490 }
16491
16492 void  __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_free"))) TS_CResult_HTLCUpdateDecodeErrorZ_free(uint64_t _res) {
16493         if (!ptr_is_owned(_res)) return;
16494         void* _res_ptr = untag_ptr(_res);
16495         CHECK_ACCESS(_res_ptr);
16496         LDKCResult_HTLCUpdateDecodeErrorZ _res_conv = *(LDKCResult_HTLCUpdateDecodeErrorZ*)(_res_ptr);
16497         FREE(untag_ptr(_res));
16498         CResult_HTLCUpdateDecodeErrorZ_free(_res_conv);
16499 }
16500
16501 static inline uint64_t CResult_HTLCUpdateDecodeErrorZ_clone_ptr(LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR arg) {
16502         LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
16503         *ret_conv = CResult_HTLCUpdateDecodeErrorZ_clone(arg);
16504         return tag_ptr(ret_conv, true);
16505 }
16506 int64_t  __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_clone_ptr"))) TS_CResult_HTLCUpdateDecodeErrorZ_clone_ptr(uint64_t arg) {
16507         LDKCResult_HTLCUpdateDecodeErrorZ* arg_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)untag_ptr(arg);
16508         int64_t ret_conv = CResult_HTLCUpdateDecodeErrorZ_clone_ptr(arg_conv);
16509         return ret_conv;
16510 }
16511
16512 uint64_t  __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_clone"))) TS_CResult_HTLCUpdateDecodeErrorZ_clone(uint64_t orig) {
16513         LDKCResult_HTLCUpdateDecodeErrorZ* orig_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)untag_ptr(orig);
16514         LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
16515         *ret_conv = CResult_HTLCUpdateDecodeErrorZ_clone(orig_conv);
16516         return tag_ptr(ret_conv, true);
16517 }
16518
16519 static inline uint64_t C2Tuple_OutPointScriptZ_clone_ptr(LDKC2Tuple_OutPointScriptZ *NONNULL_PTR arg) {
16520         LDKC2Tuple_OutPointScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
16521         *ret_conv = C2Tuple_OutPointScriptZ_clone(arg);
16522         return tag_ptr(ret_conv, true);
16523 }
16524 int64_t  __attribute__((export_name("TS_C2Tuple_OutPointScriptZ_clone_ptr"))) TS_C2Tuple_OutPointScriptZ_clone_ptr(uint64_t arg) {
16525         LDKC2Tuple_OutPointScriptZ* arg_conv = (LDKC2Tuple_OutPointScriptZ*)untag_ptr(arg);
16526         int64_t ret_conv = C2Tuple_OutPointScriptZ_clone_ptr(arg_conv);
16527         return ret_conv;
16528 }
16529
16530 uint64_t  __attribute__((export_name("TS_C2Tuple_OutPointScriptZ_clone"))) TS_C2Tuple_OutPointScriptZ_clone(uint64_t orig) {
16531         LDKC2Tuple_OutPointScriptZ* orig_conv = (LDKC2Tuple_OutPointScriptZ*)untag_ptr(orig);
16532         LDKC2Tuple_OutPointScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
16533         *ret_conv = C2Tuple_OutPointScriptZ_clone(orig_conv);
16534         return tag_ptr(ret_conv, true);
16535 }
16536
16537 uint64_t  __attribute__((export_name("TS_C2Tuple_OutPointScriptZ_new"))) TS_C2Tuple_OutPointScriptZ_new(uint64_t a, int8_tArray b) {
16538         LDKOutPoint a_conv;
16539         a_conv.inner = untag_ptr(a);
16540         a_conv.is_owned = ptr_is_owned(a);
16541         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
16542         a_conv = OutPoint_clone(&a_conv);
16543         LDKCVec_u8Z b_ref;
16544         b_ref.datalen = b->arr_len;
16545         b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
16546         memcpy(b_ref.data, b->elems, b_ref.datalen); FREE(b);
16547         LDKC2Tuple_OutPointScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
16548         *ret_conv = C2Tuple_OutPointScriptZ_new(a_conv, b_ref);
16549         return tag_ptr(ret_conv, true);
16550 }
16551
16552 void  __attribute__((export_name("TS_C2Tuple_OutPointScriptZ_free"))) TS_C2Tuple_OutPointScriptZ_free(uint64_t _res) {
16553         if (!ptr_is_owned(_res)) return;
16554         void* _res_ptr = untag_ptr(_res);
16555         CHECK_ACCESS(_res_ptr);
16556         LDKC2Tuple_OutPointScriptZ _res_conv = *(LDKC2Tuple_OutPointScriptZ*)(_res_ptr);
16557         FREE(untag_ptr(_res));
16558         C2Tuple_OutPointScriptZ_free(_res_conv);
16559 }
16560
16561 static inline uint64_t C2Tuple_u32ScriptZ_clone_ptr(LDKC2Tuple_u32ScriptZ *NONNULL_PTR arg) {
16562         LDKC2Tuple_u32ScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
16563         *ret_conv = C2Tuple_u32ScriptZ_clone(arg);
16564         return tag_ptr(ret_conv, true);
16565 }
16566 int64_t  __attribute__((export_name("TS_C2Tuple_u32ScriptZ_clone_ptr"))) TS_C2Tuple_u32ScriptZ_clone_ptr(uint64_t arg) {
16567         LDKC2Tuple_u32ScriptZ* arg_conv = (LDKC2Tuple_u32ScriptZ*)untag_ptr(arg);
16568         int64_t ret_conv = C2Tuple_u32ScriptZ_clone_ptr(arg_conv);
16569         return ret_conv;
16570 }
16571
16572 uint64_t  __attribute__((export_name("TS_C2Tuple_u32ScriptZ_clone"))) TS_C2Tuple_u32ScriptZ_clone(uint64_t orig) {
16573         LDKC2Tuple_u32ScriptZ* orig_conv = (LDKC2Tuple_u32ScriptZ*)untag_ptr(orig);
16574         LDKC2Tuple_u32ScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
16575         *ret_conv = C2Tuple_u32ScriptZ_clone(orig_conv);
16576         return tag_ptr(ret_conv, true);
16577 }
16578
16579 uint64_t  __attribute__((export_name("TS_C2Tuple_u32ScriptZ_new"))) TS_C2Tuple_u32ScriptZ_new(int32_t a, int8_tArray b) {
16580         LDKCVec_u8Z b_ref;
16581         b_ref.datalen = b->arr_len;
16582         b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
16583         memcpy(b_ref.data, b->elems, b_ref.datalen); FREE(b);
16584         LDKC2Tuple_u32ScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
16585         *ret_conv = C2Tuple_u32ScriptZ_new(a, b_ref);
16586         return tag_ptr(ret_conv, true);
16587 }
16588
16589 void  __attribute__((export_name("TS_C2Tuple_u32ScriptZ_free"))) TS_C2Tuple_u32ScriptZ_free(uint64_t _res) {
16590         if (!ptr_is_owned(_res)) return;
16591         void* _res_ptr = untag_ptr(_res);
16592         CHECK_ACCESS(_res_ptr);
16593         LDKC2Tuple_u32ScriptZ _res_conv = *(LDKC2Tuple_u32ScriptZ*)(_res_ptr);
16594         FREE(untag_ptr(_res));
16595         C2Tuple_u32ScriptZ_free(_res_conv);
16596 }
16597
16598 void  __attribute__((export_name("TS_CVec_C2Tuple_u32ScriptZZ_free"))) TS_CVec_C2Tuple_u32ScriptZZ_free(uint64_tArray _res) {
16599         LDKCVec_C2Tuple_u32ScriptZZ _res_constr;
16600         _res_constr.datalen = _res->arr_len;
16601         if (_res_constr.datalen > 0)
16602                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_u32ScriptZ), "LDKCVec_C2Tuple_u32ScriptZZ Elements");
16603         else
16604                 _res_constr.data = NULL;
16605         uint64_t* _res_vals = _res->elems;
16606         for (size_t v = 0; v < _res_constr.datalen; v++) {
16607                 uint64_t _res_conv_21 = _res_vals[v];
16608                 void* _res_conv_21_ptr = untag_ptr(_res_conv_21);
16609                 CHECK_ACCESS(_res_conv_21_ptr);
16610                 LDKC2Tuple_u32ScriptZ _res_conv_21_conv = *(LDKC2Tuple_u32ScriptZ*)(_res_conv_21_ptr);
16611                 FREE(untag_ptr(_res_conv_21));
16612                 _res_constr.data[v] = _res_conv_21_conv;
16613         }
16614         FREE(_res);
16615         CVec_C2Tuple_u32ScriptZZ_free(_res_constr);
16616 }
16617
16618 static inline uint64_t C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone_ptr(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *NONNULL_PTR arg) {
16619         LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
16620         *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(arg);
16621         return tag_ptr(ret_conv, true);
16622 }
16623 int64_t  __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone_ptr"))) TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone_ptr(uint64_t arg) {
16624         LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* arg_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)untag_ptr(arg);
16625         int64_t ret_conv = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone_ptr(arg_conv);
16626         return ret_conv;
16627 }
16628
16629 uint64_t  __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone"))) TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(uint64_t orig) {
16630         LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* orig_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)untag_ptr(orig);
16631         LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
16632         *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(orig_conv);
16633         return tag_ptr(ret_conv, true);
16634 }
16635
16636 uint64_t  __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_new"))) TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_new(int8_tArray a, uint64_tArray b) {
16637         LDKThirtyTwoBytes a_ref;
16638         CHECK(a->arr_len == 32);
16639         memcpy(a_ref.data, a->elems, 32); FREE(a);
16640         LDKCVec_C2Tuple_u32ScriptZZ b_constr;
16641         b_constr.datalen = b->arr_len;
16642         if (b_constr.datalen > 0)
16643                 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32ScriptZ), "LDKCVec_C2Tuple_u32ScriptZZ Elements");
16644         else
16645                 b_constr.data = NULL;
16646         uint64_t* b_vals = b->elems;
16647         for (size_t v = 0; v < b_constr.datalen; v++) {
16648                 uint64_t b_conv_21 = b_vals[v];
16649                 void* b_conv_21_ptr = untag_ptr(b_conv_21);
16650                 CHECK_ACCESS(b_conv_21_ptr);
16651                 LDKC2Tuple_u32ScriptZ b_conv_21_conv = *(LDKC2Tuple_u32ScriptZ*)(b_conv_21_ptr);
16652                 b_conv_21_conv = C2Tuple_u32ScriptZ_clone((LDKC2Tuple_u32ScriptZ*)untag_ptr(b_conv_21));
16653                 b_constr.data[v] = b_conv_21_conv;
16654         }
16655         FREE(b);
16656         LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
16657         *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_new(a_ref, b_constr);
16658         return tag_ptr(ret_conv, true);
16659 }
16660
16661 void  __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free"))) TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free(uint64_t _res) {
16662         if (!ptr_is_owned(_res)) return;
16663         void* _res_ptr = untag_ptr(_res);
16664         CHECK_ACCESS(_res_ptr);
16665         LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ _res_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(_res_ptr);
16666         FREE(untag_ptr(_res));
16667         C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free(_res_conv);
16668 }
16669
16670 void  __attribute__((export_name("TS_CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free"))) TS_CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(uint64_tArray _res) {
16671         LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ _res_constr;
16672         _res_constr.datalen = _res->arr_len;
16673         if (_res_constr.datalen > 0)
16674                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ Elements");
16675         else
16676                 _res_constr.data = NULL;
16677         uint64_t* _res_vals = _res->elems;
16678         for (size_t o = 0; o < _res_constr.datalen; o++) {
16679                 uint64_t _res_conv_40 = _res_vals[o];
16680                 void* _res_conv_40_ptr = untag_ptr(_res_conv_40);
16681                 CHECK_ACCESS(_res_conv_40_ptr);
16682                 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ _res_conv_40_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(_res_conv_40_ptr);
16683                 FREE(untag_ptr(_res_conv_40));
16684                 _res_constr.data[o] = _res_conv_40_conv;
16685         }
16686         FREE(_res);
16687         CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(_res_constr);
16688 }
16689
16690 void  __attribute__((export_name("TS_CVec_EventZ_free"))) TS_CVec_EventZ_free(uint64_tArray _res) {
16691         LDKCVec_EventZ _res_constr;
16692         _res_constr.datalen = _res->arr_len;
16693         if (_res_constr.datalen > 0)
16694                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKEvent), "LDKCVec_EventZ Elements");
16695         else
16696                 _res_constr.data = NULL;
16697         uint64_t* _res_vals = _res->elems;
16698         for (size_t h = 0; h < _res_constr.datalen; h++) {
16699                 uint64_t _res_conv_7 = _res_vals[h];
16700                 void* _res_conv_7_ptr = untag_ptr(_res_conv_7);
16701                 CHECK_ACCESS(_res_conv_7_ptr);
16702                 LDKEvent _res_conv_7_conv = *(LDKEvent*)(_res_conv_7_ptr);
16703                 FREE(untag_ptr(_res_conv_7));
16704                 _res_constr.data[h] = _res_conv_7_conv;
16705         }
16706         FREE(_res);
16707         CVec_EventZ_free(_res_constr);
16708 }
16709
16710 void  __attribute__((export_name("TS_CVec_TransactionZ_free"))) TS_CVec_TransactionZ_free(ptrArray _res) {
16711         LDKCVec_TransactionZ _res_constr;
16712         _res_constr.datalen = _res->arr_len;
16713         if (_res_constr.datalen > 0)
16714                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKTransaction), "LDKCVec_TransactionZ Elements");
16715         else
16716                 _res_constr.data = NULL;
16717         int8_tArray* _res_vals = (void*) _res->elems;
16718         for (size_t m = 0; m < _res_constr.datalen; m++) {
16719                 int8_tArray _res_conv_12 = _res_vals[m];
16720                 LDKTransaction _res_conv_12_ref;
16721                 _res_conv_12_ref.datalen = _res_conv_12->arr_len;
16722                 _res_conv_12_ref.data = MALLOC(_res_conv_12_ref.datalen, "LDKTransaction Bytes");
16723                 memcpy(_res_conv_12_ref.data, _res_conv_12->elems, _res_conv_12_ref.datalen); FREE(_res_conv_12);
16724                 _res_conv_12_ref.data_is_owned = true;
16725                 _res_constr.data[m] = _res_conv_12_ref;
16726         }
16727         FREE(_res);
16728         CVec_TransactionZ_free(_res_constr);
16729 }
16730
16731 static inline uint64_t C2Tuple_u32TxOutZ_clone_ptr(LDKC2Tuple_u32TxOutZ *NONNULL_PTR arg) {
16732         LDKC2Tuple_u32TxOutZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
16733         *ret_conv = C2Tuple_u32TxOutZ_clone(arg);
16734         return tag_ptr(ret_conv, true);
16735 }
16736 int64_t  __attribute__((export_name("TS_C2Tuple_u32TxOutZ_clone_ptr"))) TS_C2Tuple_u32TxOutZ_clone_ptr(uint64_t arg) {
16737         LDKC2Tuple_u32TxOutZ* arg_conv = (LDKC2Tuple_u32TxOutZ*)untag_ptr(arg);
16738         int64_t ret_conv = C2Tuple_u32TxOutZ_clone_ptr(arg_conv);
16739         return ret_conv;
16740 }
16741
16742 uint64_t  __attribute__((export_name("TS_C2Tuple_u32TxOutZ_clone"))) TS_C2Tuple_u32TxOutZ_clone(uint64_t orig) {
16743         LDKC2Tuple_u32TxOutZ* orig_conv = (LDKC2Tuple_u32TxOutZ*)untag_ptr(orig);
16744         LDKC2Tuple_u32TxOutZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
16745         *ret_conv = C2Tuple_u32TxOutZ_clone(orig_conv);
16746         return tag_ptr(ret_conv, true);
16747 }
16748
16749 uint64_t  __attribute__((export_name("TS_C2Tuple_u32TxOutZ_new"))) TS_C2Tuple_u32TxOutZ_new(int32_t a, uint64_t b) {
16750         void* b_ptr = untag_ptr(b);
16751         CHECK_ACCESS(b_ptr);
16752         LDKTxOut b_conv = *(LDKTxOut*)(b_ptr);
16753         b_conv = TxOut_clone((LDKTxOut*)untag_ptr(b));
16754         LDKC2Tuple_u32TxOutZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
16755         *ret_conv = C2Tuple_u32TxOutZ_new(a, b_conv);
16756         return tag_ptr(ret_conv, true);
16757 }
16758
16759 void  __attribute__((export_name("TS_C2Tuple_u32TxOutZ_free"))) TS_C2Tuple_u32TxOutZ_free(uint64_t _res) {
16760         if (!ptr_is_owned(_res)) return;
16761         void* _res_ptr = untag_ptr(_res);
16762         CHECK_ACCESS(_res_ptr);
16763         LDKC2Tuple_u32TxOutZ _res_conv = *(LDKC2Tuple_u32TxOutZ*)(_res_ptr);
16764         FREE(untag_ptr(_res));
16765         C2Tuple_u32TxOutZ_free(_res_conv);
16766 }
16767
16768 void  __attribute__((export_name("TS_CVec_C2Tuple_u32TxOutZZ_free"))) TS_CVec_C2Tuple_u32TxOutZZ_free(uint64_tArray _res) {
16769         LDKCVec_C2Tuple_u32TxOutZZ _res_constr;
16770         _res_constr.datalen = _res->arr_len;
16771         if (_res_constr.datalen > 0)
16772                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
16773         else
16774                 _res_constr.data = NULL;
16775         uint64_t* _res_vals = _res->elems;
16776         for (size_t u = 0; u < _res_constr.datalen; u++) {
16777                 uint64_t _res_conv_20 = _res_vals[u];
16778                 void* _res_conv_20_ptr = untag_ptr(_res_conv_20);
16779                 CHECK_ACCESS(_res_conv_20_ptr);
16780                 LDKC2Tuple_u32TxOutZ _res_conv_20_conv = *(LDKC2Tuple_u32TxOutZ*)(_res_conv_20_ptr);
16781                 FREE(untag_ptr(_res_conv_20));
16782                 _res_constr.data[u] = _res_conv_20_conv;
16783         }
16784         FREE(_res);
16785         CVec_C2Tuple_u32TxOutZZ_free(_res_constr);
16786 }
16787
16788 static inline uint64_t C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone_ptr(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR arg) {
16789         LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
16790         *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(arg);
16791         return tag_ptr(ret_conv, true);
16792 }
16793 int64_t  __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone_ptr"))) TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone_ptr(uint64_t arg) {
16794         LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* arg_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)untag_ptr(arg);
16795         int64_t ret_conv = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone_ptr(arg_conv);
16796         return ret_conv;
16797 }
16798
16799 uint64_t  __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone"))) TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(uint64_t orig) {
16800         LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* orig_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)untag_ptr(orig);
16801         LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
16802         *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(orig_conv);
16803         return tag_ptr(ret_conv, true);
16804 }
16805
16806 uint64_t  __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new"))) TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new(int8_tArray a, uint64_tArray b) {
16807         LDKThirtyTwoBytes a_ref;
16808         CHECK(a->arr_len == 32);
16809         memcpy(a_ref.data, a->elems, 32); FREE(a);
16810         LDKCVec_C2Tuple_u32TxOutZZ b_constr;
16811         b_constr.datalen = b->arr_len;
16812         if (b_constr.datalen > 0)
16813                 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
16814         else
16815                 b_constr.data = NULL;
16816         uint64_t* b_vals = b->elems;
16817         for (size_t u = 0; u < b_constr.datalen; u++) {
16818                 uint64_t b_conv_20 = b_vals[u];
16819                 void* b_conv_20_ptr = untag_ptr(b_conv_20);
16820                 CHECK_ACCESS(b_conv_20_ptr);
16821                 LDKC2Tuple_u32TxOutZ b_conv_20_conv = *(LDKC2Tuple_u32TxOutZ*)(b_conv_20_ptr);
16822                 b_conv_20_conv = C2Tuple_u32TxOutZ_clone((LDKC2Tuple_u32TxOutZ*)untag_ptr(b_conv_20));
16823                 b_constr.data[u] = b_conv_20_conv;
16824         }
16825         FREE(b);
16826         LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
16827         *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new(a_ref, b_constr);
16828         return tag_ptr(ret_conv, true);
16829 }
16830
16831 void  __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free"))) TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(uint64_t _res) {
16832         if (!ptr_is_owned(_res)) return;
16833         void* _res_ptr = untag_ptr(_res);
16834         CHECK_ACCESS(_res_ptr);
16835         LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ _res_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(_res_ptr);
16836         FREE(untag_ptr(_res));
16837         C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(_res_conv);
16838 }
16839
16840 void  __attribute__((export_name("TS_CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_free"))) TS_CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_free(uint64_tArray _res) {
16841         LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ _res_constr;
16842         _res_constr.datalen = _res->arr_len;
16843         if (_res_constr.datalen > 0)
16844                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ Elements");
16845         else
16846                 _res_constr.data = NULL;
16847         uint64_t* _res_vals = _res->elems;
16848         for (size_t n = 0; n < _res_constr.datalen; n++) {
16849                 uint64_t _res_conv_39 = _res_vals[n];
16850                 void* _res_conv_39_ptr = untag_ptr(_res_conv_39);
16851                 CHECK_ACCESS(_res_conv_39_ptr);
16852                 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ _res_conv_39_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(_res_conv_39_ptr);
16853                 FREE(untag_ptr(_res_conv_39));
16854                 _res_constr.data[n] = _res_conv_39_conv;
16855         }
16856         FREE(_res);
16857         CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_free(_res_constr);
16858 }
16859
16860 void  __attribute__((export_name("TS_CVec_BalanceZ_free"))) TS_CVec_BalanceZ_free(uint64_tArray _res) {
16861         LDKCVec_BalanceZ _res_constr;
16862         _res_constr.datalen = _res->arr_len;
16863         if (_res_constr.datalen > 0)
16864                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKBalance), "LDKCVec_BalanceZ Elements");
16865         else
16866                 _res_constr.data = NULL;
16867         uint64_t* _res_vals = _res->elems;
16868         for (size_t j = 0; j < _res_constr.datalen; j++) {
16869                 uint64_t _res_conv_9 = _res_vals[j];
16870                 void* _res_conv_9_ptr = untag_ptr(_res_conv_9);
16871                 CHECK_ACCESS(_res_conv_9_ptr);
16872                 LDKBalance _res_conv_9_conv = *(LDKBalance*)(_res_conv_9_ptr);
16873                 FREE(untag_ptr(_res_conv_9));
16874                 _res_constr.data[j] = _res_conv_9_conv;
16875         }
16876         FREE(_res);
16877         CVec_BalanceZ_free(_res_constr);
16878 }
16879
16880 static inline uint64_t C2Tuple_BlockHashChannelMonitorZ_clone_ptr(LDKC2Tuple_BlockHashChannelMonitorZ *NONNULL_PTR arg) {
16881         LDKC2Tuple_BlockHashChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
16882         *ret_conv = C2Tuple_BlockHashChannelMonitorZ_clone(arg);
16883         return tag_ptr(ret_conv, true);
16884 }
16885 int64_t  __attribute__((export_name("TS_C2Tuple_BlockHashChannelMonitorZ_clone_ptr"))) TS_C2Tuple_BlockHashChannelMonitorZ_clone_ptr(uint64_t arg) {
16886         LDKC2Tuple_BlockHashChannelMonitorZ* arg_conv = (LDKC2Tuple_BlockHashChannelMonitorZ*)untag_ptr(arg);
16887         int64_t ret_conv = C2Tuple_BlockHashChannelMonitorZ_clone_ptr(arg_conv);
16888         return ret_conv;
16889 }
16890
16891 uint64_t  __attribute__((export_name("TS_C2Tuple_BlockHashChannelMonitorZ_clone"))) TS_C2Tuple_BlockHashChannelMonitorZ_clone(uint64_t orig) {
16892         LDKC2Tuple_BlockHashChannelMonitorZ* orig_conv = (LDKC2Tuple_BlockHashChannelMonitorZ*)untag_ptr(orig);
16893         LDKC2Tuple_BlockHashChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
16894         *ret_conv = C2Tuple_BlockHashChannelMonitorZ_clone(orig_conv);
16895         return tag_ptr(ret_conv, true);
16896 }
16897
16898 uint64_t  __attribute__((export_name("TS_C2Tuple_BlockHashChannelMonitorZ_new"))) TS_C2Tuple_BlockHashChannelMonitorZ_new(int8_tArray a, uint64_t b) {
16899         LDKThirtyTwoBytes a_ref;
16900         CHECK(a->arr_len == 32);
16901         memcpy(a_ref.data, a->elems, 32); FREE(a);
16902         LDKChannelMonitor b_conv;
16903         b_conv.inner = untag_ptr(b);
16904         b_conv.is_owned = ptr_is_owned(b);
16905         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
16906         b_conv = ChannelMonitor_clone(&b_conv);
16907         LDKC2Tuple_BlockHashChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
16908         *ret_conv = C2Tuple_BlockHashChannelMonitorZ_new(a_ref, b_conv);
16909         return tag_ptr(ret_conv, true);
16910 }
16911
16912 void  __attribute__((export_name("TS_C2Tuple_BlockHashChannelMonitorZ_free"))) TS_C2Tuple_BlockHashChannelMonitorZ_free(uint64_t _res) {
16913         if (!ptr_is_owned(_res)) return;
16914         void* _res_ptr = untag_ptr(_res);
16915         CHECK_ACCESS(_res_ptr);
16916         LDKC2Tuple_BlockHashChannelMonitorZ _res_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(_res_ptr);
16917         FREE(untag_ptr(_res));
16918         C2Tuple_BlockHashChannelMonitorZ_free(_res_conv);
16919 }
16920
16921 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(uint64_t o) {
16922         void* o_ptr = untag_ptr(o);
16923         CHECK_ACCESS(o_ptr);
16924         LDKC2Tuple_BlockHashChannelMonitorZ o_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(o_ptr);
16925         o_conv = C2Tuple_BlockHashChannelMonitorZ_clone((LDKC2Tuple_BlockHashChannelMonitorZ*)untag_ptr(o));
16926         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
16927         *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(o_conv);
16928         return tag_ptr(ret_conv, true);
16929 }
16930
16931 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(uint64_t e) {
16932         LDKDecodeError e_conv;
16933         e_conv.inner = untag_ptr(e);
16934         e_conv.is_owned = ptr_is_owned(e);
16935         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
16936         e_conv = DecodeError_clone(&e_conv);
16937         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
16938         *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(e_conv);
16939         return tag_ptr(ret_conv, true);
16940 }
16941
16942 jboolean  __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_is_ok"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_is_ok(uint64_t o) {
16943         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* o_conv = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)untag_ptr(o);
16944         jboolean ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_is_ok(o_conv);
16945         return ret_conv;
16946 }
16947
16948 void  __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(uint64_t _res) {
16949         if (!ptr_is_owned(_res)) return;
16950         void* _res_ptr = untag_ptr(_res);
16951         CHECK_ACCESS(_res_ptr);
16952         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ _res_conv = *(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(_res_ptr);
16953         FREE(untag_ptr(_res));
16954         CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(_res_conv);
16955 }
16956
16957 static inline uint64_t CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone_ptr(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *NONNULL_PTR arg) {
16958         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
16959         *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone(arg);
16960         return tag_ptr(ret_conv, true);
16961 }
16962 int64_t  __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone_ptr"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone_ptr(uint64_t arg) {
16963         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* arg_conv = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)untag_ptr(arg);
16964         int64_t ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone_ptr(arg_conv);
16965         return ret_conv;
16966 }
16967
16968 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone(uint64_t orig) {
16969         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* orig_conv = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)untag_ptr(orig);
16970         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
16971         *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone(orig_conv);
16972         return tag_ptr(ret_conv, true);
16973 }
16974
16975 static inline uint64_t C2Tuple_PublicKeyTypeZ_clone_ptr(LDKC2Tuple_PublicKeyTypeZ *NONNULL_PTR arg) {
16976         LDKC2Tuple_PublicKeyTypeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
16977         *ret_conv = C2Tuple_PublicKeyTypeZ_clone(arg);
16978         return tag_ptr(ret_conv, true);
16979 }
16980 int64_t  __attribute__((export_name("TS_C2Tuple_PublicKeyTypeZ_clone_ptr"))) TS_C2Tuple_PublicKeyTypeZ_clone_ptr(uint64_t arg) {
16981         LDKC2Tuple_PublicKeyTypeZ* arg_conv = (LDKC2Tuple_PublicKeyTypeZ*)untag_ptr(arg);
16982         int64_t ret_conv = C2Tuple_PublicKeyTypeZ_clone_ptr(arg_conv);
16983         return ret_conv;
16984 }
16985
16986 uint64_t  __attribute__((export_name("TS_C2Tuple_PublicKeyTypeZ_clone"))) TS_C2Tuple_PublicKeyTypeZ_clone(uint64_t orig) {
16987         LDKC2Tuple_PublicKeyTypeZ* orig_conv = (LDKC2Tuple_PublicKeyTypeZ*)untag_ptr(orig);
16988         LDKC2Tuple_PublicKeyTypeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
16989         *ret_conv = C2Tuple_PublicKeyTypeZ_clone(orig_conv);
16990         return tag_ptr(ret_conv, true);
16991 }
16992
16993 uint64_t  __attribute__((export_name("TS_C2Tuple_PublicKeyTypeZ_new"))) TS_C2Tuple_PublicKeyTypeZ_new(int8_tArray a, uint64_t b) {
16994         LDKPublicKey a_ref;
16995         CHECK(a->arr_len == 33);
16996         memcpy(a_ref.compressed_form, a->elems, 33); FREE(a);
16997         void* b_ptr = untag_ptr(b);
16998         CHECK_ACCESS(b_ptr);
16999         LDKType b_conv = *(LDKType*)(b_ptr);
17000         if (b_conv.free == LDKType_JCalls_free) {
17001                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
17002                 LDKType_JCalls_cloned(&b_conv);
17003         }
17004         LDKC2Tuple_PublicKeyTypeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
17005         *ret_conv = C2Tuple_PublicKeyTypeZ_new(a_ref, b_conv);
17006         return tag_ptr(ret_conv, true);
17007 }
17008
17009 void  __attribute__((export_name("TS_C2Tuple_PublicKeyTypeZ_free"))) TS_C2Tuple_PublicKeyTypeZ_free(uint64_t _res) {
17010         if (!ptr_is_owned(_res)) return;
17011         void* _res_ptr = untag_ptr(_res);
17012         CHECK_ACCESS(_res_ptr);
17013         LDKC2Tuple_PublicKeyTypeZ _res_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(_res_ptr);
17014         FREE(untag_ptr(_res));
17015         C2Tuple_PublicKeyTypeZ_free(_res_conv);
17016 }
17017
17018 void  __attribute__((export_name("TS_CVec_C2Tuple_PublicKeyTypeZZ_free"))) TS_CVec_C2Tuple_PublicKeyTypeZZ_free(uint64_tArray _res) {
17019         LDKCVec_C2Tuple_PublicKeyTypeZZ _res_constr;
17020         _res_constr.datalen = _res->arr_len;
17021         if (_res_constr.datalen > 0)
17022                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKCVec_C2Tuple_PublicKeyTypeZZ Elements");
17023         else
17024                 _res_constr.data = NULL;
17025         uint64_t* _res_vals = _res->elems;
17026         for (size_t z = 0; z < _res_constr.datalen; z++) {
17027                 uint64_t _res_conv_25 = _res_vals[z];
17028                 void* _res_conv_25_ptr = untag_ptr(_res_conv_25);
17029                 CHECK_ACCESS(_res_conv_25_ptr);
17030                 LDKC2Tuple_PublicKeyTypeZ _res_conv_25_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(_res_conv_25_ptr);
17031                 FREE(untag_ptr(_res_conv_25));
17032                 _res_constr.data[z] = _res_conv_25_conv;
17033         }
17034         FREE(_res);
17035         CVec_C2Tuple_PublicKeyTypeZZ_free(_res_constr);
17036 }
17037
17038 uint64_t  __attribute__((export_name("TS_COption_NetAddressZ_some"))) TS_COption_NetAddressZ_some(uint64_t o) {
17039         void* o_ptr = untag_ptr(o);
17040         CHECK_ACCESS(o_ptr);
17041         LDKNetAddress o_conv = *(LDKNetAddress*)(o_ptr);
17042         o_conv = NetAddress_clone((LDKNetAddress*)untag_ptr(o));
17043         LDKCOption_NetAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_NetAddressZ), "LDKCOption_NetAddressZ");
17044         *ret_copy = COption_NetAddressZ_some(o_conv);
17045         uint64_t ret_ref = tag_ptr(ret_copy, true);
17046         return ret_ref;
17047 }
17048
17049 uint64_t  __attribute__((export_name("TS_COption_NetAddressZ_none"))) TS_COption_NetAddressZ_none() {
17050         LDKCOption_NetAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_NetAddressZ), "LDKCOption_NetAddressZ");
17051         *ret_copy = COption_NetAddressZ_none();
17052         uint64_t ret_ref = tag_ptr(ret_copy, true);
17053         return ret_ref;
17054 }
17055
17056 void  __attribute__((export_name("TS_COption_NetAddressZ_free"))) TS_COption_NetAddressZ_free(uint64_t _res) {
17057         if (!ptr_is_owned(_res)) return;
17058         void* _res_ptr = untag_ptr(_res);
17059         CHECK_ACCESS(_res_ptr);
17060         LDKCOption_NetAddressZ _res_conv = *(LDKCOption_NetAddressZ*)(_res_ptr);
17061         FREE(untag_ptr(_res));
17062         COption_NetAddressZ_free(_res_conv);
17063 }
17064
17065 static inline uint64_t COption_NetAddressZ_clone_ptr(LDKCOption_NetAddressZ *NONNULL_PTR arg) {
17066         LDKCOption_NetAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_NetAddressZ), "LDKCOption_NetAddressZ");
17067         *ret_copy = COption_NetAddressZ_clone(arg);
17068         uint64_t ret_ref = tag_ptr(ret_copy, true);
17069         return ret_ref;
17070 }
17071 int64_t  __attribute__((export_name("TS_COption_NetAddressZ_clone_ptr"))) TS_COption_NetAddressZ_clone_ptr(uint64_t arg) {
17072         LDKCOption_NetAddressZ* arg_conv = (LDKCOption_NetAddressZ*)untag_ptr(arg);
17073         int64_t ret_conv = COption_NetAddressZ_clone_ptr(arg_conv);
17074         return ret_conv;
17075 }
17076
17077 uint64_t  __attribute__((export_name("TS_COption_NetAddressZ_clone"))) TS_COption_NetAddressZ_clone(uint64_t orig) {
17078         LDKCOption_NetAddressZ* orig_conv = (LDKCOption_NetAddressZ*)untag_ptr(orig);
17079         LDKCOption_NetAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_NetAddressZ), "LDKCOption_NetAddressZ");
17080         *ret_copy = COption_NetAddressZ_clone(orig_conv);
17081         uint64_t ret_ref = tag_ptr(ret_copy, true);
17082         return ret_ref;
17083 }
17084
17085 uint64_t  __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_ok"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_ok(int8_tArray o) {
17086         LDKCVec_u8Z o_ref;
17087         o_ref.datalen = o->arr_len;
17088         o_ref.data = MALLOC(o_ref.datalen, "LDKCVec_u8Z Bytes");
17089         memcpy(o_ref.data, o->elems, o_ref.datalen); FREE(o);
17090         LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
17091         *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_ok(o_ref);
17092         return tag_ptr(ret_conv, true);
17093 }
17094
17095 uint64_t  __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_err"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_err(uint64_t e) {
17096         LDKPeerHandleError e_conv;
17097         e_conv.inner = untag_ptr(e);
17098         e_conv.is_owned = ptr_is_owned(e);
17099         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
17100         e_conv = PeerHandleError_clone(&e_conv);
17101         LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
17102         *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_err(e_conv);
17103         return tag_ptr(ret_conv, true);
17104 }
17105
17106 jboolean  __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_is_ok"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_is_ok(uint64_t o) {
17107         LDKCResult_CVec_u8ZPeerHandleErrorZ* o_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)untag_ptr(o);
17108         jboolean ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_is_ok(o_conv);
17109         return ret_conv;
17110 }
17111
17112 void  __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_free"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_free(uint64_t _res) {
17113         if (!ptr_is_owned(_res)) return;
17114         void* _res_ptr = untag_ptr(_res);
17115         CHECK_ACCESS(_res_ptr);
17116         LDKCResult_CVec_u8ZPeerHandleErrorZ _res_conv = *(LDKCResult_CVec_u8ZPeerHandleErrorZ*)(_res_ptr);
17117         FREE(untag_ptr(_res));
17118         CResult_CVec_u8ZPeerHandleErrorZ_free(_res_conv);
17119 }
17120
17121 static inline uint64_t CResult_CVec_u8ZPeerHandleErrorZ_clone_ptr(LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR arg) {
17122         LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
17123         *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_clone(arg);
17124         return tag_ptr(ret_conv, true);
17125 }
17126 int64_t  __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_clone_ptr"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_clone_ptr(uint64_t arg) {
17127         LDKCResult_CVec_u8ZPeerHandleErrorZ* arg_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)untag_ptr(arg);
17128         int64_t ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_clone_ptr(arg_conv);
17129         return ret_conv;
17130 }
17131
17132 uint64_t  __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_clone"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_clone(uint64_t orig) {
17133         LDKCResult_CVec_u8ZPeerHandleErrorZ* orig_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)untag_ptr(orig);
17134         LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
17135         *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_clone(orig_conv);
17136         return tag_ptr(ret_conv, true);
17137 }
17138
17139 uint64_t  __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_ok"))) TS_CResult_NonePeerHandleErrorZ_ok() {
17140         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
17141         *ret_conv = CResult_NonePeerHandleErrorZ_ok();
17142         return tag_ptr(ret_conv, true);
17143 }
17144
17145 uint64_t  __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_err"))) TS_CResult_NonePeerHandleErrorZ_err(uint64_t e) {
17146         LDKPeerHandleError e_conv;
17147         e_conv.inner = untag_ptr(e);
17148         e_conv.is_owned = ptr_is_owned(e);
17149         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
17150         e_conv = PeerHandleError_clone(&e_conv);
17151         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
17152         *ret_conv = CResult_NonePeerHandleErrorZ_err(e_conv);
17153         return tag_ptr(ret_conv, true);
17154 }
17155
17156 jboolean  __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_is_ok"))) TS_CResult_NonePeerHandleErrorZ_is_ok(uint64_t o) {
17157         LDKCResult_NonePeerHandleErrorZ* o_conv = (LDKCResult_NonePeerHandleErrorZ*)untag_ptr(o);
17158         jboolean ret_conv = CResult_NonePeerHandleErrorZ_is_ok(o_conv);
17159         return ret_conv;
17160 }
17161
17162 void  __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_free"))) TS_CResult_NonePeerHandleErrorZ_free(uint64_t _res) {
17163         if (!ptr_is_owned(_res)) return;
17164         void* _res_ptr = untag_ptr(_res);
17165         CHECK_ACCESS(_res_ptr);
17166         LDKCResult_NonePeerHandleErrorZ _res_conv = *(LDKCResult_NonePeerHandleErrorZ*)(_res_ptr);
17167         FREE(untag_ptr(_res));
17168         CResult_NonePeerHandleErrorZ_free(_res_conv);
17169 }
17170
17171 static inline uint64_t CResult_NonePeerHandleErrorZ_clone_ptr(LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR arg) {
17172         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
17173         *ret_conv = CResult_NonePeerHandleErrorZ_clone(arg);
17174         return tag_ptr(ret_conv, true);
17175 }
17176 int64_t  __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_clone_ptr"))) TS_CResult_NonePeerHandleErrorZ_clone_ptr(uint64_t arg) {
17177         LDKCResult_NonePeerHandleErrorZ* arg_conv = (LDKCResult_NonePeerHandleErrorZ*)untag_ptr(arg);
17178         int64_t ret_conv = CResult_NonePeerHandleErrorZ_clone_ptr(arg_conv);
17179         return ret_conv;
17180 }
17181
17182 uint64_t  __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_clone"))) TS_CResult_NonePeerHandleErrorZ_clone(uint64_t orig) {
17183         LDKCResult_NonePeerHandleErrorZ* orig_conv = (LDKCResult_NonePeerHandleErrorZ*)untag_ptr(orig);
17184         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
17185         *ret_conv = CResult_NonePeerHandleErrorZ_clone(orig_conv);
17186         return tag_ptr(ret_conv, true);
17187 }
17188
17189 uint64_t  __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_ok"))) TS_CResult_boolPeerHandleErrorZ_ok(jboolean o) {
17190         LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
17191         *ret_conv = CResult_boolPeerHandleErrorZ_ok(o);
17192         return tag_ptr(ret_conv, true);
17193 }
17194
17195 uint64_t  __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_err"))) TS_CResult_boolPeerHandleErrorZ_err(uint64_t e) {
17196         LDKPeerHandleError e_conv;
17197         e_conv.inner = untag_ptr(e);
17198         e_conv.is_owned = ptr_is_owned(e);
17199         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
17200         e_conv = PeerHandleError_clone(&e_conv);
17201         LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
17202         *ret_conv = CResult_boolPeerHandleErrorZ_err(e_conv);
17203         return tag_ptr(ret_conv, true);
17204 }
17205
17206 jboolean  __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_is_ok"))) TS_CResult_boolPeerHandleErrorZ_is_ok(uint64_t o) {
17207         LDKCResult_boolPeerHandleErrorZ* o_conv = (LDKCResult_boolPeerHandleErrorZ*)untag_ptr(o);
17208         jboolean ret_conv = CResult_boolPeerHandleErrorZ_is_ok(o_conv);
17209         return ret_conv;
17210 }
17211
17212 void  __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_free"))) TS_CResult_boolPeerHandleErrorZ_free(uint64_t _res) {
17213         if (!ptr_is_owned(_res)) return;
17214         void* _res_ptr = untag_ptr(_res);
17215         CHECK_ACCESS(_res_ptr);
17216         LDKCResult_boolPeerHandleErrorZ _res_conv = *(LDKCResult_boolPeerHandleErrorZ*)(_res_ptr);
17217         FREE(untag_ptr(_res));
17218         CResult_boolPeerHandleErrorZ_free(_res_conv);
17219 }
17220
17221 static inline uint64_t CResult_boolPeerHandleErrorZ_clone_ptr(LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR arg) {
17222         LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
17223         *ret_conv = CResult_boolPeerHandleErrorZ_clone(arg);
17224         return tag_ptr(ret_conv, true);
17225 }
17226 int64_t  __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_clone_ptr"))) TS_CResult_boolPeerHandleErrorZ_clone_ptr(uint64_t arg) {
17227         LDKCResult_boolPeerHandleErrorZ* arg_conv = (LDKCResult_boolPeerHandleErrorZ*)untag_ptr(arg);
17228         int64_t ret_conv = CResult_boolPeerHandleErrorZ_clone_ptr(arg_conv);
17229         return ret_conv;
17230 }
17231
17232 uint64_t  __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_clone"))) TS_CResult_boolPeerHandleErrorZ_clone(uint64_t orig) {
17233         LDKCResult_boolPeerHandleErrorZ* orig_conv = (LDKCResult_boolPeerHandleErrorZ*)untag_ptr(orig);
17234         LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
17235         *ret_conv = CResult_boolPeerHandleErrorZ_clone(orig_conv);
17236         return tag_ptr(ret_conv, true);
17237 }
17238
17239 uint64_t  __attribute__((export_name("TS_CResult_NoneErrorZ_ok"))) TS_CResult_NoneErrorZ_ok() {
17240         LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
17241         *ret_conv = CResult_NoneErrorZ_ok();
17242         return tag_ptr(ret_conv, true);
17243 }
17244
17245 uint64_t  __attribute__((export_name("TS_CResult_NoneErrorZ_err"))) TS_CResult_NoneErrorZ_err(uint32_t e) {
17246         LDKIOError e_conv = LDKIOError_from_js(e);
17247         LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
17248         *ret_conv = CResult_NoneErrorZ_err(e_conv);
17249         return tag_ptr(ret_conv, true);
17250 }
17251
17252 jboolean  __attribute__((export_name("TS_CResult_NoneErrorZ_is_ok"))) TS_CResult_NoneErrorZ_is_ok(uint64_t o) {
17253         LDKCResult_NoneErrorZ* o_conv = (LDKCResult_NoneErrorZ*)untag_ptr(o);
17254         jboolean ret_conv = CResult_NoneErrorZ_is_ok(o_conv);
17255         return ret_conv;
17256 }
17257
17258 void  __attribute__((export_name("TS_CResult_NoneErrorZ_free"))) TS_CResult_NoneErrorZ_free(uint64_t _res) {
17259         if (!ptr_is_owned(_res)) return;
17260         void* _res_ptr = untag_ptr(_res);
17261         CHECK_ACCESS(_res_ptr);
17262         LDKCResult_NoneErrorZ _res_conv = *(LDKCResult_NoneErrorZ*)(_res_ptr);
17263         FREE(untag_ptr(_res));
17264         CResult_NoneErrorZ_free(_res_conv);
17265 }
17266
17267 static inline uint64_t CResult_NoneErrorZ_clone_ptr(LDKCResult_NoneErrorZ *NONNULL_PTR arg) {
17268         LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
17269         *ret_conv = CResult_NoneErrorZ_clone(arg);
17270         return tag_ptr(ret_conv, true);
17271 }
17272 int64_t  __attribute__((export_name("TS_CResult_NoneErrorZ_clone_ptr"))) TS_CResult_NoneErrorZ_clone_ptr(uint64_t arg) {
17273         LDKCResult_NoneErrorZ* arg_conv = (LDKCResult_NoneErrorZ*)untag_ptr(arg);
17274         int64_t ret_conv = CResult_NoneErrorZ_clone_ptr(arg_conv);
17275         return ret_conv;
17276 }
17277
17278 uint64_t  __attribute__((export_name("TS_CResult_NoneErrorZ_clone"))) TS_CResult_NoneErrorZ_clone(uint64_t orig) {
17279         LDKCResult_NoneErrorZ* orig_conv = (LDKCResult_NoneErrorZ*)untag_ptr(orig);
17280         LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
17281         *ret_conv = CResult_NoneErrorZ_clone(orig_conv);
17282         return tag_ptr(ret_conv, true);
17283 }
17284
17285 uint64_t  __attribute__((export_name("TS_CResult_NetAddressDecodeErrorZ_ok"))) TS_CResult_NetAddressDecodeErrorZ_ok(uint64_t o) {
17286         void* o_ptr = untag_ptr(o);
17287         CHECK_ACCESS(o_ptr);
17288         LDKNetAddress o_conv = *(LDKNetAddress*)(o_ptr);
17289         o_conv = NetAddress_clone((LDKNetAddress*)untag_ptr(o));
17290         LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
17291         *ret_conv = CResult_NetAddressDecodeErrorZ_ok(o_conv);
17292         return tag_ptr(ret_conv, true);
17293 }
17294
17295 uint64_t  __attribute__((export_name("TS_CResult_NetAddressDecodeErrorZ_err"))) TS_CResult_NetAddressDecodeErrorZ_err(uint64_t e) {
17296         LDKDecodeError e_conv;
17297         e_conv.inner = untag_ptr(e);
17298         e_conv.is_owned = ptr_is_owned(e);
17299         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
17300         e_conv = DecodeError_clone(&e_conv);
17301         LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
17302         *ret_conv = CResult_NetAddressDecodeErrorZ_err(e_conv);
17303         return tag_ptr(ret_conv, true);
17304 }
17305
17306 jboolean  __attribute__((export_name("TS_CResult_NetAddressDecodeErrorZ_is_ok"))) TS_CResult_NetAddressDecodeErrorZ_is_ok(uint64_t o) {
17307         LDKCResult_NetAddressDecodeErrorZ* o_conv = (LDKCResult_NetAddressDecodeErrorZ*)untag_ptr(o);
17308         jboolean ret_conv = CResult_NetAddressDecodeErrorZ_is_ok(o_conv);
17309         return ret_conv;
17310 }
17311
17312 void  __attribute__((export_name("TS_CResult_NetAddressDecodeErrorZ_free"))) TS_CResult_NetAddressDecodeErrorZ_free(uint64_t _res) {
17313         if (!ptr_is_owned(_res)) return;
17314         void* _res_ptr = untag_ptr(_res);
17315         CHECK_ACCESS(_res_ptr);
17316         LDKCResult_NetAddressDecodeErrorZ _res_conv = *(LDKCResult_NetAddressDecodeErrorZ*)(_res_ptr);
17317         FREE(untag_ptr(_res));
17318         CResult_NetAddressDecodeErrorZ_free(_res_conv);
17319 }
17320
17321 static inline uint64_t CResult_NetAddressDecodeErrorZ_clone_ptr(LDKCResult_NetAddressDecodeErrorZ *NONNULL_PTR arg) {
17322         LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
17323         *ret_conv = CResult_NetAddressDecodeErrorZ_clone(arg);
17324         return tag_ptr(ret_conv, true);
17325 }
17326 int64_t  __attribute__((export_name("TS_CResult_NetAddressDecodeErrorZ_clone_ptr"))) TS_CResult_NetAddressDecodeErrorZ_clone_ptr(uint64_t arg) {
17327         LDKCResult_NetAddressDecodeErrorZ* arg_conv = (LDKCResult_NetAddressDecodeErrorZ*)untag_ptr(arg);
17328         int64_t ret_conv = CResult_NetAddressDecodeErrorZ_clone_ptr(arg_conv);
17329         return ret_conv;
17330 }
17331
17332 uint64_t  __attribute__((export_name("TS_CResult_NetAddressDecodeErrorZ_clone"))) TS_CResult_NetAddressDecodeErrorZ_clone(uint64_t orig) {
17333         LDKCResult_NetAddressDecodeErrorZ* orig_conv = (LDKCResult_NetAddressDecodeErrorZ*)untag_ptr(orig);
17334         LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
17335         *ret_conv = CResult_NetAddressDecodeErrorZ_clone(orig_conv);
17336         return tag_ptr(ret_conv, true);
17337 }
17338
17339 void  __attribute__((export_name("TS_CVec_UpdateAddHTLCZ_free"))) TS_CVec_UpdateAddHTLCZ_free(uint64_tArray _res) {
17340         LDKCVec_UpdateAddHTLCZ _res_constr;
17341         _res_constr.datalen = _res->arr_len;
17342         if (_res_constr.datalen > 0)
17343                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
17344         else
17345                 _res_constr.data = NULL;
17346         uint64_t* _res_vals = _res->elems;
17347         for (size_t p = 0; p < _res_constr.datalen; p++) {
17348                 uint64_t _res_conv_15 = _res_vals[p];
17349                 LDKUpdateAddHTLC _res_conv_15_conv;
17350                 _res_conv_15_conv.inner = untag_ptr(_res_conv_15);
17351                 _res_conv_15_conv.is_owned = ptr_is_owned(_res_conv_15);
17352                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_15_conv);
17353                 _res_constr.data[p] = _res_conv_15_conv;
17354         }
17355         FREE(_res);
17356         CVec_UpdateAddHTLCZ_free(_res_constr);
17357 }
17358
17359 void  __attribute__((export_name("TS_CVec_UpdateFulfillHTLCZ_free"))) TS_CVec_UpdateFulfillHTLCZ_free(uint64_tArray _res) {
17360         LDKCVec_UpdateFulfillHTLCZ _res_constr;
17361         _res_constr.datalen = _res->arr_len;
17362         if (_res_constr.datalen > 0)
17363                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
17364         else
17365                 _res_constr.data = NULL;
17366         uint64_t* _res_vals = _res->elems;
17367         for (size_t t = 0; t < _res_constr.datalen; t++) {
17368                 uint64_t _res_conv_19 = _res_vals[t];
17369                 LDKUpdateFulfillHTLC _res_conv_19_conv;
17370                 _res_conv_19_conv.inner = untag_ptr(_res_conv_19);
17371                 _res_conv_19_conv.is_owned = ptr_is_owned(_res_conv_19);
17372                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_19_conv);
17373                 _res_constr.data[t] = _res_conv_19_conv;
17374         }
17375         FREE(_res);
17376         CVec_UpdateFulfillHTLCZ_free(_res_constr);
17377 }
17378
17379 void  __attribute__((export_name("TS_CVec_UpdateFailHTLCZ_free"))) TS_CVec_UpdateFailHTLCZ_free(uint64_tArray _res) {
17380         LDKCVec_UpdateFailHTLCZ _res_constr;
17381         _res_constr.datalen = _res->arr_len;
17382         if (_res_constr.datalen > 0)
17383                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
17384         else
17385                 _res_constr.data = NULL;
17386         uint64_t* _res_vals = _res->elems;
17387         for (size_t q = 0; q < _res_constr.datalen; q++) {
17388                 uint64_t _res_conv_16 = _res_vals[q];
17389                 LDKUpdateFailHTLC _res_conv_16_conv;
17390                 _res_conv_16_conv.inner = untag_ptr(_res_conv_16);
17391                 _res_conv_16_conv.is_owned = ptr_is_owned(_res_conv_16);
17392                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_16_conv);
17393                 _res_constr.data[q] = _res_conv_16_conv;
17394         }
17395         FREE(_res);
17396         CVec_UpdateFailHTLCZ_free(_res_constr);
17397 }
17398
17399 void  __attribute__((export_name("TS_CVec_UpdateFailMalformedHTLCZ_free"))) TS_CVec_UpdateFailMalformedHTLCZ_free(uint64_tArray _res) {
17400         LDKCVec_UpdateFailMalformedHTLCZ _res_constr;
17401         _res_constr.datalen = _res->arr_len;
17402         if (_res_constr.datalen > 0)
17403                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
17404         else
17405                 _res_constr.data = NULL;
17406         uint64_t* _res_vals = _res->elems;
17407         for (size_t z = 0; z < _res_constr.datalen; z++) {
17408                 uint64_t _res_conv_25 = _res_vals[z];
17409                 LDKUpdateFailMalformedHTLC _res_conv_25_conv;
17410                 _res_conv_25_conv.inner = untag_ptr(_res_conv_25);
17411                 _res_conv_25_conv.is_owned = ptr_is_owned(_res_conv_25);
17412                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_25_conv);
17413                 _res_constr.data[z] = _res_conv_25_conv;
17414         }
17415         FREE(_res);
17416         CVec_UpdateFailMalformedHTLCZ_free(_res_constr);
17417 }
17418
17419 uint64_t  __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_ok"))) TS_CResult_AcceptChannelDecodeErrorZ_ok(uint64_t o) {
17420         LDKAcceptChannel o_conv;
17421         o_conv.inner = untag_ptr(o);
17422         o_conv.is_owned = ptr_is_owned(o);
17423         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17424         o_conv = AcceptChannel_clone(&o_conv);
17425         LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
17426         *ret_conv = CResult_AcceptChannelDecodeErrorZ_ok(o_conv);
17427         return tag_ptr(ret_conv, true);
17428 }
17429
17430 uint64_t  __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_err"))) TS_CResult_AcceptChannelDecodeErrorZ_err(uint64_t e) {
17431         LDKDecodeError e_conv;
17432         e_conv.inner = untag_ptr(e);
17433         e_conv.is_owned = ptr_is_owned(e);
17434         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
17435         e_conv = DecodeError_clone(&e_conv);
17436         LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
17437         *ret_conv = CResult_AcceptChannelDecodeErrorZ_err(e_conv);
17438         return tag_ptr(ret_conv, true);
17439 }
17440
17441 jboolean  __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_is_ok"))) TS_CResult_AcceptChannelDecodeErrorZ_is_ok(uint64_t o) {
17442         LDKCResult_AcceptChannelDecodeErrorZ* o_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)untag_ptr(o);
17443         jboolean ret_conv = CResult_AcceptChannelDecodeErrorZ_is_ok(o_conv);
17444         return ret_conv;
17445 }
17446
17447 void  __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_free"))) TS_CResult_AcceptChannelDecodeErrorZ_free(uint64_t _res) {
17448         if (!ptr_is_owned(_res)) return;
17449         void* _res_ptr = untag_ptr(_res);
17450         CHECK_ACCESS(_res_ptr);
17451         LDKCResult_AcceptChannelDecodeErrorZ _res_conv = *(LDKCResult_AcceptChannelDecodeErrorZ*)(_res_ptr);
17452         FREE(untag_ptr(_res));
17453         CResult_AcceptChannelDecodeErrorZ_free(_res_conv);
17454 }
17455
17456 static inline uint64_t CResult_AcceptChannelDecodeErrorZ_clone_ptr(LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR arg) {
17457         LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
17458         *ret_conv = CResult_AcceptChannelDecodeErrorZ_clone(arg);
17459         return tag_ptr(ret_conv, true);
17460 }
17461 int64_t  __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_clone_ptr"))) TS_CResult_AcceptChannelDecodeErrorZ_clone_ptr(uint64_t arg) {
17462         LDKCResult_AcceptChannelDecodeErrorZ* arg_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)untag_ptr(arg);
17463         int64_t ret_conv = CResult_AcceptChannelDecodeErrorZ_clone_ptr(arg_conv);
17464         return ret_conv;
17465 }
17466
17467 uint64_t  __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_clone"))) TS_CResult_AcceptChannelDecodeErrorZ_clone(uint64_t orig) {
17468         LDKCResult_AcceptChannelDecodeErrorZ* orig_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)untag_ptr(orig);
17469         LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
17470         *ret_conv = CResult_AcceptChannelDecodeErrorZ_clone(orig_conv);
17471         return tag_ptr(ret_conv, true);
17472 }
17473
17474 uint64_t  __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_ok"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_ok(uint64_t o) {
17475         LDKAnnouncementSignatures o_conv;
17476         o_conv.inner = untag_ptr(o);
17477         o_conv.is_owned = ptr_is_owned(o);
17478         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17479         o_conv = AnnouncementSignatures_clone(&o_conv);
17480         LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
17481         *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_ok(o_conv);
17482         return tag_ptr(ret_conv, true);
17483 }
17484
17485 uint64_t  __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_err"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_err(uint64_t e) {
17486         LDKDecodeError e_conv;
17487         e_conv.inner = untag_ptr(e);
17488         e_conv.is_owned = ptr_is_owned(e);
17489         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
17490         e_conv = DecodeError_clone(&e_conv);
17491         LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
17492         *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_err(e_conv);
17493         return tag_ptr(ret_conv, true);
17494 }
17495
17496 jboolean  __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_is_ok"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_is_ok(uint64_t o) {
17497         LDKCResult_AnnouncementSignaturesDecodeErrorZ* o_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)untag_ptr(o);
17498         jboolean ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_is_ok(o_conv);
17499         return ret_conv;
17500 }
17501
17502 void  __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_free"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_free(uint64_t _res) {
17503         if (!ptr_is_owned(_res)) return;
17504         void* _res_ptr = untag_ptr(_res);
17505         CHECK_ACCESS(_res_ptr);
17506         LDKCResult_AnnouncementSignaturesDecodeErrorZ _res_conv = *(LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(_res_ptr);
17507         FREE(untag_ptr(_res));
17508         CResult_AnnouncementSignaturesDecodeErrorZ_free(_res_conv);
17509 }
17510
17511 static inline uint64_t CResult_AnnouncementSignaturesDecodeErrorZ_clone_ptr(LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR arg) {
17512         LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
17513         *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_clone(arg);
17514         return tag_ptr(ret_conv, true);
17515 }
17516 int64_t  __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_clone_ptr"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_clone_ptr(uint64_t arg) {
17517         LDKCResult_AnnouncementSignaturesDecodeErrorZ* arg_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)untag_ptr(arg);
17518         int64_t ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_clone_ptr(arg_conv);
17519         return ret_conv;
17520 }
17521
17522 uint64_t  __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_clone"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_clone(uint64_t orig) {
17523         LDKCResult_AnnouncementSignaturesDecodeErrorZ* orig_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)untag_ptr(orig);
17524         LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
17525         *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_clone(orig_conv);
17526         return tag_ptr(ret_conv, true);
17527 }
17528
17529 uint64_t  __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_ok"))) TS_CResult_ChannelReestablishDecodeErrorZ_ok(uint64_t o) {
17530         LDKChannelReestablish o_conv;
17531         o_conv.inner = untag_ptr(o);
17532         o_conv.is_owned = ptr_is_owned(o);
17533         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17534         o_conv = ChannelReestablish_clone(&o_conv);
17535         LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
17536         *ret_conv = CResult_ChannelReestablishDecodeErrorZ_ok(o_conv);
17537         return tag_ptr(ret_conv, true);
17538 }
17539
17540 uint64_t  __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_err"))) TS_CResult_ChannelReestablishDecodeErrorZ_err(uint64_t e) {
17541         LDKDecodeError e_conv;
17542         e_conv.inner = untag_ptr(e);
17543         e_conv.is_owned = ptr_is_owned(e);
17544         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
17545         e_conv = DecodeError_clone(&e_conv);
17546         LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
17547         *ret_conv = CResult_ChannelReestablishDecodeErrorZ_err(e_conv);
17548         return tag_ptr(ret_conv, true);
17549 }
17550
17551 jboolean  __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_is_ok"))) TS_CResult_ChannelReestablishDecodeErrorZ_is_ok(uint64_t o) {
17552         LDKCResult_ChannelReestablishDecodeErrorZ* o_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)untag_ptr(o);
17553         jboolean ret_conv = CResult_ChannelReestablishDecodeErrorZ_is_ok(o_conv);
17554         return ret_conv;
17555 }
17556
17557 void  __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_free"))) TS_CResult_ChannelReestablishDecodeErrorZ_free(uint64_t _res) {
17558         if (!ptr_is_owned(_res)) return;
17559         void* _res_ptr = untag_ptr(_res);
17560         CHECK_ACCESS(_res_ptr);
17561         LDKCResult_ChannelReestablishDecodeErrorZ _res_conv = *(LDKCResult_ChannelReestablishDecodeErrorZ*)(_res_ptr);
17562         FREE(untag_ptr(_res));
17563         CResult_ChannelReestablishDecodeErrorZ_free(_res_conv);
17564 }
17565
17566 static inline uint64_t CResult_ChannelReestablishDecodeErrorZ_clone_ptr(LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR arg) {
17567         LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
17568         *ret_conv = CResult_ChannelReestablishDecodeErrorZ_clone(arg);
17569         return tag_ptr(ret_conv, true);
17570 }
17571 int64_t  __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelReestablishDecodeErrorZ_clone_ptr(uint64_t arg) {
17572         LDKCResult_ChannelReestablishDecodeErrorZ* arg_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)untag_ptr(arg);
17573         int64_t ret_conv = CResult_ChannelReestablishDecodeErrorZ_clone_ptr(arg_conv);
17574         return ret_conv;
17575 }
17576
17577 uint64_t  __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_clone"))) TS_CResult_ChannelReestablishDecodeErrorZ_clone(uint64_t orig) {
17578         LDKCResult_ChannelReestablishDecodeErrorZ* orig_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)untag_ptr(orig);
17579         LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
17580         *ret_conv = CResult_ChannelReestablishDecodeErrorZ_clone(orig_conv);
17581         return tag_ptr(ret_conv, true);
17582 }
17583
17584 uint64_t  __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_ok"))) TS_CResult_ClosingSignedDecodeErrorZ_ok(uint64_t o) {
17585         LDKClosingSigned o_conv;
17586         o_conv.inner = untag_ptr(o);
17587         o_conv.is_owned = ptr_is_owned(o);
17588         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17589         o_conv = ClosingSigned_clone(&o_conv);
17590         LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
17591         *ret_conv = CResult_ClosingSignedDecodeErrorZ_ok(o_conv);
17592         return tag_ptr(ret_conv, true);
17593 }
17594
17595 uint64_t  __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_err"))) TS_CResult_ClosingSignedDecodeErrorZ_err(uint64_t e) {
17596         LDKDecodeError e_conv;
17597         e_conv.inner = untag_ptr(e);
17598         e_conv.is_owned = ptr_is_owned(e);
17599         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
17600         e_conv = DecodeError_clone(&e_conv);
17601         LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
17602         *ret_conv = CResult_ClosingSignedDecodeErrorZ_err(e_conv);
17603         return tag_ptr(ret_conv, true);
17604 }
17605
17606 jboolean  __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_is_ok"))) TS_CResult_ClosingSignedDecodeErrorZ_is_ok(uint64_t o) {
17607         LDKCResult_ClosingSignedDecodeErrorZ* o_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)untag_ptr(o);
17608         jboolean ret_conv = CResult_ClosingSignedDecodeErrorZ_is_ok(o_conv);
17609         return ret_conv;
17610 }
17611
17612 void  __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_free"))) TS_CResult_ClosingSignedDecodeErrorZ_free(uint64_t _res) {
17613         if (!ptr_is_owned(_res)) return;
17614         void* _res_ptr = untag_ptr(_res);
17615         CHECK_ACCESS(_res_ptr);
17616         LDKCResult_ClosingSignedDecodeErrorZ _res_conv = *(LDKCResult_ClosingSignedDecodeErrorZ*)(_res_ptr);
17617         FREE(untag_ptr(_res));
17618         CResult_ClosingSignedDecodeErrorZ_free(_res_conv);
17619 }
17620
17621 static inline uint64_t CResult_ClosingSignedDecodeErrorZ_clone_ptr(LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR arg) {
17622         LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
17623         *ret_conv = CResult_ClosingSignedDecodeErrorZ_clone(arg);
17624         return tag_ptr(ret_conv, true);
17625 }
17626 int64_t  __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_clone_ptr"))) TS_CResult_ClosingSignedDecodeErrorZ_clone_ptr(uint64_t arg) {
17627         LDKCResult_ClosingSignedDecodeErrorZ* arg_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)untag_ptr(arg);
17628         int64_t ret_conv = CResult_ClosingSignedDecodeErrorZ_clone_ptr(arg_conv);
17629         return ret_conv;
17630 }
17631
17632 uint64_t  __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_clone"))) TS_CResult_ClosingSignedDecodeErrorZ_clone(uint64_t orig) {
17633         LDKCResult_ClosingSignedDecodeErrorZ* orig_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)untag_ptr(orig);
17634         LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
17635         *ret_conv = CResult_ClosingSignedDecodeErrorZ_clone(orig_conv);
17636         return tag_ptr(ret_conv, true);
17637 }
17638
17639 uint64_t  __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_ok"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(uint64_t o) {
17640         LDKClosingSignedFeeRange o_conv;
17641         o_conv.inner = untag_ptr(o);
17642         o_conv.is_owned = ptr_is_owned(o);
17643         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17644         o_conv = ClosingSignedFeeRange_clone(&o_conv);
17645         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
17646         *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(o_conv);
17647         return tag_ptr(ret_conv, true);
17648 }
17649
17650 uint64_t  __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_err"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_err(uint64_t e) {
17651         LDKDecodeError e_conv;
17652         e_conv.inner = untag_ptr(e);
17653         e_conv.is_owned = ptr_is_owned(e);
17654         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
17655         e_conv = DecodeError_clone(&e_conv);
17656         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
17657         *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_err(e_conv);
17658         return tag_ptr(ret_conv, true);
17659 }
17660
17661 jboolean  __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_is_ok"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_is_ok(uint64_t o) {
17662         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* o_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)untag_ptr(o);
17663         jboolean ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_is_ok(o_conv);
17664         return ret_conv;
17665 }
17666
17667 void  __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_free"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_free(uint64_t _res) {
17668         if (!ptr_is_owned(_res)) return;
17669         void* _res_ptr = untag_ptr(_res);
17670         CHECK_ACCESS(_res_ptr);
17671         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ _res_conv = *(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(_res_ptr);
17672         FREE(untag_ptr(_res));
17673         CResult_ClosingSignedFeeRangeDecodeErrorZ_free(_res_conv);
17674 }
17675
17676 static inline uint64_t CResult_ClosingSignedFeeRangeDecodeErrorZ_clone_ptr(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR arg) {
17677         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
17678         *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(arg);
17679         return tag_ptr(ret_conv, true);
17680 }
17681 int64_t  __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_clone_ptr"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_clone_ptr(uint64_t arg) {
17682         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* arg_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)untag_ptr(arg);
17683         int64_t ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_clone_ptr(arg_conv);
17684         return ret_conv;
17685 }
17686
17687 uint64_t  __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_clone"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(uint64_t orig) {
17688         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* orig_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)untag_ptr(orig);
17689         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
17690         *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(orig_conv);
17691         return tag_ptr(ret_conv, true);
17692 }
17693
17694 uint64_t  __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_ok"))) TS_CResult_CommitmentSignedDecodeErrorZ_ok(uint64_t o) {
17695         LDKCommitmentSigned o_conv;
17696         o_conv.inner = untag_ptr(o);
17697         o_conv.is_owned = ptr_is_owned(o);
17698         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17699         o_conv = CommitmentSigned_clone(&o_conv);
17700         LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
17701         *ret_conv = CResult_CommitmentSignedDecodeErrorZ_ok(o_conv);
17702         return tag_ptr(ret_conv, true);
17703 }
17704
17705 uint64_t  __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_err"))) TS_CResult_CommitmentSignedDecodeErrorZ_err(uint64_t e) {
17706         LDKDecodeError e_conv;
17707         e_conv.inner = untag_ptr(e);
17708         e_conv.is_owned = ptr_is_owned(e);
17709         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
17710         e_conv = DecodeError_clone(&e_conv);
17711         LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
17712         *ret_conv = CResult_CommitmentSignedDecodeErrorZ_err(e_conv);
17713         return tag_ptr(ret_conv, true);
17714 }
17715
17716 jboolean  __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_is_ok"))) TS_CResult_CommitmentSignedDecodeErrorZ_is_ok(uint64_t o) {
17717         LDKCResult_CommitmentSignedDecodeErrorZ* o_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)untag_ptr(o);
17718         jboolean ret_conv = CResult_CommitmentSignedDecodeErrorZ_is_ok(o_conv);
17719         return ret_conv;
17720 }
17721
17722 void  __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_free"))) TS_CResult_CommitmentSignedDecodeErrorZ_free(uint64_t _res) {
17723         if (!ptr_is_owned(_res)) return;
17724         void* _res_ptr = untag_ptr(_res);
17725         CHECK_ACCESS(_res_ptr);
17726         LDKCResult_CommitmentSignedDecodeErrorZ _res_conv = *(LDKCResult_CommitmentSignedDecodeErrorZ*)(_res_ptr);
17727         FREE(untag_ptr(_res));
17728         CResult_CommitmentSignedDecodeErrorZ_free(_res_conv);
17729 }
17730
17731 static inline uint64_t CResult_CommitmentSignedDecodeErrorZ_clone_ptr(LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR arg) {
17732         LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
17733         *ret_conv = CResult_CommitmentSignedDecodeErrorZ_clone(arg);
17734         return tag_ptr(ret_conv, true);
17735 }
17736 int64_t  __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_clone_ptr"))) TS_CResult_CommitmentSignedDecodeErrorZ_clone_ptr(uint64_t arg) {
17737         LDKCResult_CommitmentSignedDecodeErrorZ* arg_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)untag_ptr(arg);
17738         int64_t ret_conv = CResult_CommitmentSignedDecodeErrorZ_clone_ptr(arg_conv);
17739         return ret_conv;
17740 }
17741
17742 uint64_t  __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_clone"))) TS_CResult_CommitmentSignedDecodeErrorZ_clone(uint64_t orig) {
17743         LDKCResult_CommitmentSignedDecodeErrorZ* orig_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)untag_ptr(orig);
17744         LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
17745         *ret_conv = CResult_CommitmentSignedDecodeErrorZ_clone(orig_conv);
17746         return tag_ptr(ret_conv, true);
17747 }
17748
17749 uint64_t  __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_ok"))) TS_CResult_FundingCreatedDecodeErrorZ_ok(uint64_t o) {
17750         LDKFundingCreated o_conv;
17751         o_conv.inner = untag_ptr(o);
17752         o_conv.is_owned = ptr_is_owned(o);
17753         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17754         o_conv = FundingCreated_clone(&o_conv);
17755         LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
17756         *ret_conv = CResult_FundingCreatedDecodeErrorZ_ok(o_conv);
17757         return tag_ptr(ret_conv, true);
17758 }
17759
17760 uint64_t  __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_err"))) TS_CResult_FundingCreatedDecodeErrorZ_err(uint64_t e) {
17761         LDKDecodeError e_conv;
17762         e_conv.inner = untag_ptr(e);
17763         e_conv.is_owned = ptr_is_owned(e);
17764         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
17765         e_conv = DecodeError_clone(&e_conv);
17766         LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
17767         *ret_conv = CResult_FundingCreatedDecodeErrorZ_err(e_conv);
17768         return tag_ptr(ret_conv, true);
17769 }
17770
17771 jboolean  __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_is_ok"))) TS_CResult_FundingCreatedDecodeErrorZ_is_ok(uint64_t o) {
17772         LDKCResult_FundingCreatedDecodeErrorZ* o_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)untag_ptr(o);
17773         jboolean ret_conv = CResult_FundingCreatedDecodeErrorZ_is_ok(o_conv);
17774         return ret_conv;
17775 }
17776
17777 void  __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_free"))) TS_CResult_FundingCreatedDecodeErrorZ_free(uint64_t _res) {
17778         if (!ptr_is_owned(_res)) return;
17779         void* _res_ptr = untag_ptr(_res);
17780         CHECK_ACCESS(_res_ptr);
17781         LDKCResult_FundingCreatedDecodeErrorZ _res_conv = *(LDKCResult_FundingCreatedDecodeErrorZ*)(_res_ptr);
17782         FREE(untag_ptr(_res));
17783         CResult_FundingCreatedDecodeErrorZ_free(_res_conv);
17784 }
17785
17786 static inline uint64_t CResult_FundingCreatedDecodeErrorZ_clone_ptr(LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR arg) {
17787         LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
17788         *ret_conv = CResult_FundingCreatedDecodeErrorZ_clone(arg);
17789         return tag_ptr(ret_conv, true);
17790 }
17791 int64_t  __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_clone_ptr"))) TS_CResult_FundingCreatedDecodeErrorZ_clone_ptr(uint64_t arg) {
17792         LDKCResult_FundingCreatedDecodeErrorZ* arg_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)untag_ptr(arg);
17793         int64_t ret_conv = CResult_FundingCreatedDecodeErrorZ_clone_ptr(arg_conv);
17794         return ret_conv;
17795 }
17796
17797 uint64_t  __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_clone"))) TS_CResult_FundingCreatedDecodeErrorZ_clone(uint64_t orig) {
17798         LDKCResult_FundingCreatedDecodeErrorZ* orig_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)untag_ptr(orig);
17799         LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
17800         *ret_conv = CResult_FundingCreatedDecodeErrorZ_clone(orig_conv);
17801         return tag_ptr(ret_conv, true);
17802 }
17803
17804 uint64_t  __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_ok"))) TS_CResult_FundingSignedDecodeErrorZ_ok(uint64_t o) {
17805         LDKFundingSigned o_conv;
17806         o_conv.inner = untag_ptr(o);
17807         o_conv.is_owned = ptr_is_owned(o);
17808         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17809         o_conv = FundingSigned_clone(&o_conv);
17810         LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
17811         *ret_conv = CResult_FundingSignedDecodeErrorZ_ok(o_conv);
17812         return tag_ptr(ret_conv, true);
17813 }
17814
17815 uint64_t  __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_err"))) TS_CResult_FundingSignedDecodeErrorZ_err(uint64_t e) {
17816         LDKDecodeError e_conv;
17817         e_conv.inner = untag_ptr(e);
17818         e_conv.is_owned = ptr_is_owned(e);
17819         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
17820         e_conv = DecodeError_clone(&e_conv);
17821         LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
17822         *ret_conv = CResult_FundingSignedDecodeErrorZ_err(e_conv);
17823         return tag_ptr(ret_conv, true);
17824 }
17825
17826 jboolean  __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_is_ok"))) TS_CResult_FundingSignedDecodeErrorZ_is_ok(uint64_t o) {
17827         LDKCResult_FundingSignedDecodeErrorZ* o_conv = (LDKCResult_FundingSignedDecodeErrorZ*)untag_ptr(o);
17828         jboolean ret_conv = CResult_FundingSignedDecodeErrorZ_is_ok(o_conv);
17829         return ret_conv;
17830 }
17831
17832 void  __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_free"))) TS_CResult_FundingSignedDecodeErrorZ_free(uint64_t _res) {
17833         if (!ptr_is_owned(_res)) return;
17834         void* _res_ptr = untag_ptr(_res);
17835         CHECK_ACCESS(_res_ptr);
17836         LDKCResult_FundingSignedDecodeErrorZ _res_conv = *(LDKCResult_FundingSignedDecodeErrorZ*)(_res_ptr);
17837         FREE(untag_ptr(_res));
17838         CResult_FundingSignedDecodeErrorZ_free(_res_conv);
17839 }
17840
17841 static inline uint64_t CResult_FundingSignedDecodeErrorZ_clone_ptr(LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR arg) {
17842         LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
17843         *ret_conv = CResult_FundingSignedDecodeErrorZ_clone(arg);
17844         return tag_ptr(ret_conv, true);
17845 }
17846 int64_t  __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_clone_ptr"))) TS_CResult_FundingSignedDecodeErrorZ_clone_ptr(uint64_t arg) {
17847         LDKCResult_FundingSignedDecodeErrorZ* arg_conv = (LDKCResult_FundingSignedDecodeErrorZ*)untag_ptr(arg);
17848         int64_t ret_conv = CResult_FundingSignedDecodeErrorZ_clone_ptr(arg_conv);
17849         return ret_conv;
17850 }
17851
17852 uint64_t  __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_clone"))) TS_CResult_FundingSignedDecodeErrorZ_clone(uint64_t orig) {
17853         LDKCResult_FundingSignedDecodeErrorZ* orig_conv = (LDKCResult_FundingSignedDecodeErrorZ*)untag_ptr(orig);
17854         LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
17855         *ret_conv = CResult_FundingSignedDecodeErrorZ_clone(orig_conv);
17856         return tag_ptr(ret_conv, true);
17857 }
17858
17859 uint64_t  __attribute__((export_name("TS_CResult_ChannelReadyDecodeErrorZ_ok"))) TS_CResult_ChannelReadyDecodeErrorZ_ok(uint64_t o) {
17860         LDKChannelReady o_conv;
17861         o_conv.inner = untag_ptr(o);
17862         o_conv.is_owned = ptr_is_owned(o);
17863         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17864         o_conv = ChannelReady_clone(&o_conv);
17865         LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
17866         *ret_conv = CResult_ChannelReadyDecodeErrorZ_ok(o_conv);
17867         return tag_ptr(ret_conv, true);
17868 }
17869
17870 uint64_t  __attribute__((export_name("TS_CResult_ChannelReadyDecodeErrorZ_err"))) TS_CResult_ChannelReadyDecodeErrorZ_err(uint64_t e) {
17871         LDKDecodeError e_conv;
17872         e_conv.inner = untag_ptr(e);
17873         e_conv.is_owned = ptr_is_owned(e);
17874         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
17875         e_conv = DecodeError_clone(&e_conv);
17876         LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
17877         *ret_conv = CResult_ChannelReadyDecodeErrorZ_err(e_conv);
17878         return tag_ptr(ret_conv, true);
17879 }
17880
17881 jboolean  __attribute__((export_name("TS_CResult_ChannelReadyDecodeErrorZ_is_ok"))) TS_CResult_ChannelReadyDecodeErrorZ_is_ok(uint64_t o) {
17882         LDKCResult_ChannelReadyDecodeErrorZ* o_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)untag_ptr(o);
17883         jboolean ret_conv = CResult_ChannelReadyDecodeErrorZ_is_ok(o_conv);
17884         return ret_conv;
17885 }
17886
17887 void  __attribute__((export_name("TS_CResult_ChannelReadyDecodeErrorZ_free"))) TS_CResult_ChannelReadyDecodeErrorZ_free(uint64_t _res) {
17888         if (!ptr_is_owned(_res)) return;
17889         void* _res_ptr = untag_ptr(_res);
17890         CHECK_ACCESS(_res_ptr);
17891         LDKCResult_ChannelReadyDecodeErrorZ _res_conv = *(LDKCResult_ChannelReadyDecodeErrorZ*)(_res_ptr);
17892         FREE(untag_ptr(_res));
17893         CResult_ChannelReadyDecodeErrorZ_free(_res_conv);
17894 }
17895
17896 static inline uint64_t CResult_ChannelReadyDecodeErrorZ_clone_ptr(LDKCResult_ChannelReadyDecodeErrorZ *NONNULL_PTR arg) {
17897         LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
17898         *ret_conv = CResult_ChannelReadyDecodeErrorZ_clone(arg);
17899         return tag_ptr(ret_conv, true);
17900 }
17901 int64_t  __attribute__((export_name("TS_CResult_ChannelReadyDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelReadyDecodeErrorZ_clone_ptr(uint64_t arg) {
17902         LDKCResult_ChannelReadyDecodeErrorZ* arg_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)untag_ptr(arg);
17903         int64_t ret_conv = CResult_ChannelReadyDecodeErrorZ_clone_ptr(arg_conv);
17904         return ret_conv;
17905 }
17906
17907 uint64_t  __attribute__((export_name("TS_CResult_ChannelReadyDecodeErrorZ_clone"))) TS_CResult_ChannelReadyDecodeErrorZ_clone(uint64_t orig) {
17908         LDKCResult_ChannelReadyDecodeErrorZ* orig_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)untag_ptr(orig);
17909         LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
17910         *ret_conv = CResult_ChannelReadyDecodeErrorZ_clone(orig_conv);
17911         return tag_ptr(ret_conv, true);
17912 }
17913
17914 uint64_t  __attribute__((export_name("TS_CResult_InitDecodeErrorZ_ok"))) TS_CResult_InitDecodeErrorZ_ok(uint64_t o) {
17915         LDKInit o_conv;
17916         o_conv.inner = untag_ptr(o);
17917         o_conv.is_owned = ptr_is_owned(o);
17918         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17919         o_conv = Init_clone(&o_conv);
17920         LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
17921         *ret_conv = CResult_InitDecodeErrorZ_ok(o_conv);
17922         return tag_ptr(ret_conv, true);
17923 }
17924
17925 uint64_t  __attribute__((export_name("TS_CResult_InitDecodeErrorZ_err"))) TS_CResult_InitDecodeErrorZ_err(uint64_t e) {
17926         LDKDecodeError e_conv;
17927         e_conv.inner = untag_ptr(e);
17928         e_conv.is_owned = ptr_is_owned(e);
17929         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
17930         e_conv = DecodeError_clone(&e_conv);
17931         LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
17932         *ret_conv = CResult_InitDecodeErrorZ_err(e_conv);
17933         return tag_ptr(ret_conv, true);
17934 }
17935
17936 jboolean  __attribute__((export_name("TS_CResult_InitDecodeErrorZ_is_ok"))) TS_CResult_InitDecodeErrorZ_is_ok(uint64_t o) {
17937         LDKCResult_InitDecodeErrorZ* o_conv = (LDKCResult_InitDecodeErrorZ*)untag_ptr(o);
17938         jboolean ret_conv = CResult_InitDecodeErrorZ_is_ok(o_conv);
17939         return ret_conv;
17940 }
17941
17942 void  __attribute__((export_name("TS_CResult_InitDecodeErrorZ_free"))) TS_CResult_InitDecodeErrorZ_free(uint64_t _res) {
17943         if (!ptr_is_owned(_res)) return;
17944         void* _res_ptr = untag_ptr(_res);
17945         CHECK_ACCESS(_res_ptr);
17946         LDKCResult_InitDecodeErrorZ _res_conv = *(LDKCResult_InitDecodeErrorZ*)(_res_ptr);
17947         FREE(untag_ptr(_res));
17948         CResult_InitDecodeErrorZ_free(_res_conv);
17949 }
17950
17951 static inline uint64_t CResult_InitDecodeErrorZ_clone_ptr(LDKCResult_InitDecodeErrorZ *NONNULL_PTR arg) {
17952         LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
17953         *ret_conv = CResult_InitDecodeErrorZ_clone(arg);
17954         return tag_ptr(ret_conv, true);
17955 }
17956 int64_t  __attribute__((export_name("TS_CResult_InitDecodeErrorZ_clone_ptr"))) TS_CResult_InitDecodeErrorZ_clone_ptr(uint64_t arg) {
17957         LDKCResult_InitDecodeErrorZ* arg_conv = (LDKCResult_InitDecodeErrorZ*)untag_ptr(arg);
17958         int64_t ret_conv = CResult_InitDecodeErrorZ_clone_ptr(arg_conv);
17959         return ret_conv;
17960 }
17961
17962 uint64_t  __attribute__((export_name("TS_CResult_InitDecodeErrorZ_clone"))) TS_CResult_InitDecodeErrorZ_clone(uint64_t orig) {
17963         LDKCResult_InitDecodeErrorZ* orig_conv = (LDKCResult_InitDecodeErrorZ*)untag_ptr(orig);
17964         LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
17965         *ret_conv = CResult_InitDecodeErrorZ_clone(orig_conv);
17966         return tag_ptr(ret_conv, true);
17967 }
17968
17969 uint64_t  __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_ok"))) TS_CResult_OpenChannelDecodeErrorZ_ok(uint64_t o) {
17970         LDKOpenChannel o_conv;
17971         o_conv.inner = untag_ptr(o);
17972         o_conv.is_owned = ptr_is_owned(o);
17973         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17974         o_conv = OpenChannel_clone(&o_conv);
17975         LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
17976         *ret_conv = CResult_OpenChannelDecodeErrorZ_ok(o_conv);
17977         return tag_ptr(ret_conv, true);
17978 }
17979
17980 uint64_t  __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_err"))) TS_CResult_OpenChannelDecodeErrorZ_err(uint64_t e) {
17981         LDKDecodeError e_conv;
17982         e_conv.inner = untag_ptr(e);
17983         e_conv.is_owned = ptr_is_owned(e);
17984         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
17985         e_conv = DecodeError_clone(&e_conv);
17986         LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
17987         *ret_conv = CResult_OpenChannelDecodeErrorZ_err(e_conv);
17988         return tag_ptr(ret_conv, true);
17989 }
17990
17991 jboolean  __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_is_ok"))) TS_CResult_OpenChannelDecodeErrorZ_is_ok(uint64_t o) {
17992         LDKCResult_OpenChannelDecodeErrorZ* o_conv = (LDKCResult_OpenChannelDecodeErrorZ*)untag_ptr(o);
17993         jboolean ret_conv = CResult_OpenChannelDecodeErrorZ_is_ok(o_conv);
17994         return ret_conv;
17995 }
17996
17997 void  __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_free"))) TS_CResult_OpenChannelDecodeErrorZ_free(uint64_t _res) {
17998         if (!ptr_is_owned(_res)) return;
17999         void* _res_ptr = untag_ptr(_res);
18000         CHECK_ACCESS(_res_ptr);
18001         LDKCResult_OpenChannelDecodeErrorZ _res_conv = *(LDKCResult_OpenChannelDecodeErrorZ*)(_res_ptr);
18002         FREE(untag_ptr(_res));
18003         CResult_OpenChannelDecodeErrorZ_free(_res_conv);
18004 }
18005
18006 static inline uint64_t CResult_OpenChannelDecodeErrorZ_clone_ptr(LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR arg) {
18007         LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
18008         *ret_conv = CResult_OpenChannelDecodeErrorZ_clone(arg);
18009         return tag_ptr(ret_conv, true);
18010 }
18011 int64_t  __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_clone_ptr"))) TS_CResult_OpenChannelDecodeErrorZ_clone_ptr(uint64_t arg) {
18012         LDKCResult_OpenChannelDecodeErrorZ* arg_conv = (LDKCResult_OpenChannelDecodeErrorZ*)untag_ptr(arg);
18013         int64_t ret_conv = CResult_OpenChannelDecodeErrorZ_clone_ptr(arg_conv);
18014         return ret_conv;
18015 }
18016
18017 uint64_t  __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_clone"))) TS_CResult_OpenChannelDecodeErrorZ_clone(uint64_t orig) {
18018         LDKCResult_OpenChannelDecodeErrorZ* orig_conv = (LDKCResult_OpenChannelDecodeErrorZ*)untag_ptr(orig);
18019         LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
18020         *ret_conv = CResult_OpenChannelDecodeErrorZ_clone(orig_conv);
18021         return tag_ptr(ret_conv, true);
18022 }
18023
18024 uint64_t  __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_ok"))) TS_CResult_RevokeAndACKDecodeErrorZ_ok(uint64_t o) {
18025         LDKRevokeAndACK o_conv;
18026         o_conv.inner = untag_ptr(o);
18027         o_conv.is_owned = ptr_is_owned(o);
18028         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18029         o_conv = RevokeAndACK_clone(&o_conv);
18030         LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
18031         *ret_conv = CResult_RevokeAndACKDecodeErrorZ_ok(o_conv);
18032         return tag_ptr(ret_conv, true);
18033 }
18034
18035 uint64_t  __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_err"))) TS_CResult_RevokeAndACKDecodeErrorZ_err(uint64_t e) {
18036         LDKDecodeError e_conv;
18037         e_conv.inner = untag_ptr(e);
18038         e_conv.is_owned = ptr_is_owned(e);
18039         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18040         e_conv = DecodeError_clone(&e_conv);
18041         LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
18042         *ret_conv = CResult_RevokeAndACKDecodeErrorZ_err(e_conv);
18043         return tag_ptr(ret_conv, true);
18044 }
18045
18046 jboolean  __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_is_ok"))) TS_CResult_RevokeAndACKDecodeErrorZ_is_ok(uint64_t o) {
18047         LDKCResult_RevokeAndACKDecodeErrorZ* o_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)untag_ptr(o);
18048         jboolean ret_conv = CResult_RevokeAndACKDecodeErrorZ_is_ok(o_conv);
18049         return ret_conv;
18050 }
18051
18052 void  __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_free"))) TS_CResult_RevokeAndACKDecodeErrorZ_free(uint64_t _res) {
18053         if (!ptr_is_owned(_res)) return;
18054         void* _res_ptr = untag_ptr(_res);
18055         CHECK_ACCESS(_res_ptr);
18056         LDKCResult_RevokeAndACKDecodeErrorZ _res_conv = *(LDKCResult_RevokeAndACKDecodeErrorZ*)(_res_ptr);
18057         FREE(untag_ptr(_res));
18058         CResult_RevokeAndACKDecodeErrorZ_free(_res_conv);
18059 }
18060
18061 static inline uint64_t CResult_RevokeAndACKDecodeErrorZ_clone_ptr(LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR arg) {
18062         LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
18063         *ret_conv = CResult_RevokeAndACKDecodeErrorZ_clone(arg);
18064         return tag_ptr(ret_conv, true);
18065 }
18066 int64_t  __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_clone_ptr"))) TS_CResult_RevokeAndACKDecodeErrorZ_clone_ptr(uint64_t arg) {
18067         LDKCResult_RevokeAndACKDecodeErrorZ* arg_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)untag_ptr(arg);
18068         int64_t ret_conv = CResult_RevokeAndACKDecodeErrorZ_clone_ptr(arg_conv);
18069         return ret_conv;
18070 }
18071
18072 uint64_t  __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_clone"))) TS_CResult_RevokeAndACKDecodeErrorZ_clone(uint64_t orig) {
18073         LDKCResult_RevokeAndACKDecodeErrorZ* orig_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)untag_ptr(orig);
18074         LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
18075         *ret_conv = CResult_RevokeAndACKDecodeErrorZ_clone(orig_conv);
18076         return tag_ptr(ret_conv, true);
18077 }
18078
18079 uint64_t  __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_ok"))) TS_CResult_ShutdownDecodeErrorZ_ok(uint64_t o) {
18080         LDKShutdown o_conv;
18081         o_conv.inner = untag_ptr(o);
18082         o_conv.is_owned = ptr_is_owned(o);
18083         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18084         o_conv = Shutdown_clone(&o_conv);
18085         LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
18086         *ret_conv = CResult_ShutdownDecodeErrorZ_ok(o_conv);
18087         return tag_ptr(ret_conv, true);
18088 }
18089
18090 uint64_t  __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_err"))) TS_CResult_ShutdownDecodeErrorZ_err(uint64_t e) {
18091         LDKDecodeError e_conv;
18092         e_conv.inner = untag_ptr(e);
18093         e_conv.is_owned = ptr_is_owned(e);
18094         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18095         e_conv = DecodeError_clone(&e_conv);
18096         LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
18097         *ret_conv = CResult_ShutdownDecodeErrorZ_err(e_conv);
18098         return tag_ptr(ret_conv, true);
18099 }
18100
18101 jboolean  __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_is_ok"))) TS_CResult_ShutdownDecodeErrorZ_is_ok(uint64_t o) {
18102         LDKCResult_ShutdownDecodeErrorZ* o_conv = (LDKCResult_ShutdownDecodeErrorZ*)untag_ptr(o);
18103         jboolean ret_conv = CResult_ShutdownDecodeErrorZ_is_ok(o_conv);
18104         return ret_conv;
18105 }
18106
18107 void  __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_free"))) TS_CResult_ShutdownDecodeErrorZ_free(uint64_t _res) {
18108         if (!ptr_is_owned(_res)) return;
18109         void* _res_ptr = untag_ptr(_res);
18110         CHECK_ACCESS(_res_ptr);
18111         LDKCResult_ShutdownDecodeErrorZ _res_conv = *(LDKCResult_ShutdownDecodeErrorZ*)(_res_ptr);
18112         FREE(untag_ptr(_res));
18113         CResult_ShutdownDecodeErrorZ_free(_res_conv);
18114 }
18115
18116 static inline uint64_t CResult_ShutdownDecodeErrorZ_clone_ptr(LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR arg) {
18117         LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
18118         *ret_conv = CResult_ShutdownDecodeErrorZ_clone(arg);
18119         return tag_ptr(ret_conv, true);
18120 }
18121 int64_t  __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_clone_ptr"))) TS_CResult_ShutdownDecodeErrorZ_clone_ptr(uint64_t arg) {
18122         LDKCResult_ShutdownDecodeErrorZ* arg_conv = (LDKCResult_ShutdownDecodeErrorZ*)untag_ptr(arg);
18123         int64_t ret_conv = CResult_ShutdownDecodeErrorZ_clone_ptr(arg_conv);
18124         return ret_conv;
18125 }
18126
18127 uint64_t  __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_clone"))) TS_CResult_ShutdownDecodeErrorZ_clone(uint64_t orig) {
18128         LDKCResult_ShutdownDecodeErrorZ* orig_conv = (LDKCResult_ShutdownDecodeErrorZ*)untag_ptr(orig);
18129         LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
18130         *ret_conv = CResult_ShutdownDecodeErrorZ_clone(orig_conv);
18131         return tag_ptr(ret_conv, true);
18132 }
18133
18134 uint64_t  __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_ok"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_ok(uint64_t o) {
18135         LDKUpdateFailHTLC o_conv;
18136         o_conv.inner = untag_ptr(o);
18137         o_conv.is_owned = ptr_is_owned(o);
18138         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18139         o_conv = UpdateFailHTLC_clone(&o_conv);
18140         LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
18141         *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_ok(o_conv);
18142         return tag_ptr(ret_conv, true);
18143 }
18144
18145 uint64_t  __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_err"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_err(uint64_t e) {
18146         LDKDecodeError e_conv;
18147         e_conv.inner = untag_ptr(e);
18148         e_conv.is_owned = ptr_is_owned(e);
18149         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18150         e_conv = DecodeError_clone(&e_conv);
18151         LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
18152         *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_err(e_conv);
18153         return tag_ptr(ret_conv, true);
18154 }
18155
18156 jboolean  __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_is_ok"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_is_ok(uint64_t o) {
18157         LDKCResult_UpdateFailHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)untag_ptr(o);
18158         jboolean ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_is_ok(o_conv);
18159         return ret_conv;
18160 }
18161
18162 void  __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_free"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_free(uint64_t _res) {
18163         if (!ptr_is_owned(_res)) return;
18164         void* _res_ptr = untag_ptr(_res);
18165         CHECK_ACCESS(_res_ptr);
18166         LDKCResult_UpdateFailHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFailHTLCDecodeErrorZ*)(_res_ptr);
18167         FREE(untag_ptr(_res));
18168         CResult_UpdateFailHTLCDecodeErrorZ_free(_res_conv);
18169 }
18170
18171 static inline uint64_t CResult_UpdateFailHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR arg) {
18172         LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
18173         *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_clone(arg);
18174         return tag_ptr(ret_conv, true);
18175 }
18176 int64_t  __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_clone_ptr"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_clone_ptr(uint64_t arg) {
18177         LDKCResult_UpdateFailHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)untag_ptr(arg);
18178         int64_t ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_clone_ptr(arg_conv);
18179         return ret_conv;
18180 }
18181
18182 uint64_t  __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_clone"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_clone(uint64_t orig) {
18183         LDKCResult_UpdateFailHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)untag_ptr(orig);
18184         LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
18185         *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_clone(orig_conv);
18186         return tag_ptr(ret_conv, true);
18187 }
18188
18189 uint64_t  __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(uint64_t o) {
18190         LDKUpdateFailMalformedHTLC o_conv;
18191         o_conv.inner = untag_ptr(o);
18192         o_conv.is_owned = ptr_is_owned(o);
18193         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18194         o_conv = UpdateFailMalformedHTLC_clone(&o_conv);
18195         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
18196         *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(o_conv);
18197         return tag_ptr(ret_conv, true);
18198 }
18199
18200 uint64_t  __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_err"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(uint64_t e) {
18201         LDKDecodeError e_conv;
18202         e_conv.inner = untag_ptr(e);
18203         e_conv.is_owned = ptr_is_owned(e);
18204         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18205         e_conv = DecodeError_clone(&e_conv);
18206         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
18207         *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(e_conv);
18208         return tag_ptr(ret_conv, true);
18209 }
18210
18211 jboolean  __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_is_ok"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_is_ok(uint64_t o) {
18212         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)untag_ptr(o);
18213         jboolean ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_is_ok(o_conv);
18214         return ret_conv;
18215 }
18216
18217 void  __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_free"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(uint64_t _res) {
18218         if (!ptr_is_owned(_res)) return;
18219         void* _res_ptr = untag_ptr(_res);
18220         CHECK_ACCESS(_res_ptr);
18221         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(_res_ptr);
18222         FREE(untag_ptr(_res));
18223         CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(_res_conv);
18224 }
18225
18226 static inline uint64_t CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR arg) {
18227         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
18228         *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(arg);
18229         return tag_ptr(ret_conv, true);
18230 }
18231 int64_t  __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone_ptr"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone_ptr(uint64_t arg) {
18232         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)untag_ptr(arg);
18233         int64_t ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone_ptr(arg_conv);
18234         return ret_conv;
18235 }
18236
18237 uint64_t  __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(uint64_t orig) {
18238         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)untag_ptr(orig);
18239         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
18240         *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(orig_conv);
18241         return tag_ptr(ret_conv, true);
18242 }
18243
18244 uint64_t  __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_ok"))) TS_CResult_UpdateFeeDecodeErrorZ_ok(uint64_t o) {
18245         LDKUpdateFee o_conv;
18246         o_conv.inner = untag_ptr(o);
18247         o_conv.is_owned = ptr_is_owned(o);
18248         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18249         o_conv = UpdateFee_clone(&o_conv);
18250         LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
18251         *ret_conv = CResult_UpdateFeeDecodeErrorZ_ok(o_conv);
18252         return tag_ptr(ret_conv, true);
18253 }
18254
18255 uint64_t  __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_err"))) TS_CResult_UpdateFeeDecodeErrorZ_err(uint64_t e) {
18256         LDKDecodeError e_conv;
18257         e_conv.inner = untag_ptr(e);
18258         e_conv.is_owned = ptr_is_owned(e);
18259         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18260         e_conv = DecodeError_clone(&e_conv);
18261         LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
18262         *ret_conv = CResult_UpdateFeeDecodeErrorZ_err(e_conv);
18263         return tag_ptr(ret_conv, true);
18264 }
18265
18266 jboolean  __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_is_ok"))) TS_CResult_UpdateFeeDecodeErrorZ_is_ok(uint64_t o) {
18267         LDKCResult_UpdateFeeDecodeErrorZ* o_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)untag_ptr(o);
18268         jboolean ret_conv = CResult_UpdateFeeDecodeErrorZ_is_ok(o_conv);
18269         return ret_conv;
18270 }
18271
18272 void  __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_free"))) TS_CResult_UpdateFeeDecodeErrorZ_free(uint64_t _res) {
18273         if (!ptr_is_owned(_res)) return;
18274         void* _res_ptr = untag_ptr(_res);
18275         CHECK_ACCESS(_res_ptr);
18276         LDKCResult_UpdateFeeDecodeErrorZ _res_conv = *(LDKCResult_UpdateFeeDecodeErrorZ*)(_res_ptr);
18277         FREE(untag_ptr(_res));
18278         CResult_UpdateFeeDecodeErrorZ_free(_res_conv);
18279 }
18280
18281 static inline uint64_t CResult_UpdateFeeDecodeErrorZ_clone_ptr(LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR arg) {
18282         LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
18283         *ret_conv = CResult_UpdateFeeDecodeErrorZ_clone(arg);
18284         return tag_ptr(ret_conv, true);
18285 }
18286 int64_t  __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_clone_ptr"))) TS_CResult_UpdateFeeDecodeErrorZ_clone_ptr(uint64_t arg) {
18287         LDKCResult_UpdateFeeDecodeErrorZ* arg_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)untag_ptr(arg);
18288         int64_t ret_conv = CResult_UpdateFeeDecodeErrorZ_clone_ptr(arg_conv);
18289         return ret_conv;
18290 }
18291
18292 uint64_t  __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_clone"))) TS_CResult_UpdateFeeDecodeErrorZ_clone(uint64_t orig) {
18293         LDKCResult_UpdateFeeDecodeErrorZ* orig_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)untag_ptr(orig);
18294         LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
18295         *ret_conv = CResult_UpdateFeeDecodeErrorZ_clone(orig_conv);
18296         return tag_ptr(ret_conv, true);
18297 }
18298
18299 uint64_t  __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_ok"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_ok(uint64_t o) {
18300         LDKUpdateFulfillHTLC o_conv;
18301         o_conv.inner = untag_ptr(o);
18302         o_conv.is_owned = ptr_is_owned(o);
18303         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18304         o_conv = UpdateFulfillHTLC_clone(&o_conv);
18305         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
18306         *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_ok(o_conv);
18307         return tag_ptr(ret_conv, true);
18308 }
18309
18310 uint64_t  __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_err"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_err(uint64_t e) {
18311         LDKDecodeError e_conv;
18312         e_conv.inner = untag_ptr(e);
18313         e_conv.is_owned = ptr_is_owned(e);
18314         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18315         e_conv = DecodeError_clone(&e_conv);
18316         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
18317         *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_err(e_conv);
18318         return tag_ptr(ret_conv, true);
18319 }
18320
18321 jboolean  __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_is_ok"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_is_ok(uint64_t o) {
18322         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)untag_ptr(o);
18323         jboolean ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_is_ok(o_conv);
18324         return ret_conv;
18325 }
18326
18327 void  __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_free"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_free(uint64_t _res) {
18328         if (!ptr_is_owned(_res)) return;
18329         void* _res_ptr = untag_ptr(_res);
18330         CHECK_ACCESS(_res_ptr);
18331         LDKCResult_UpdateFulfillHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(_res_ptr);
18332         FREE(untag_ptr(_res));
18333         CResult_UpdateFulfillHTLCDecodeErrorZ_free(_res_conv);
18334 }
18335
18336 static inline uint64_t CResult_UpdateFulfillHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR arg) {
18337         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
18338         *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_clone(arg);
18339         return tag_ptr(ret_conv, true);
18340 }
18341 int64_t  __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_clone_ptr"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_clone_ptr(uint64_t arg) {
18342         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)untag_ptr(arg);
18343         int64_t ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_clone_ptr(arg_conv);
18344         return ret_conv;
18345 }
18346
18347 uint64_t  __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_clone"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_clone(uint64_t orig) {
18348         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)untag_ptr(orig);
18349         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
18350         *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_clone(orig_conv);
18351         return tag_ptr(ret_conv, true);
18352 }
18353
18354 uint64_t  __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_ok"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_ok(uint64_t o) {
18355         LDKUpdateAddHTLC o_conv;
18356         o_conv.inner = untag_ptr(o);
18357         o_conv.is_owned = ptr_is_owned(o);
18358         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18359         o_conv = UpdateAddHTLC_clone(&o_conv);
18360         LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
18361         *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_ok(o_conv);
18362         return tag_ptr(ret_conv, true);
18363 }
18364
18365 uint64_t  __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_err"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_err(uint64_t e) {
18366         LDKDecodeError e_conv;
18367         e_conv.inner = untag_ptr(e);
18368         e_conv.is_owned = ptr_is_owned(e);
18369         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18370         e_conv = DecodeError_clone(&e_conv);
18371         LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
18372         *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_err(e_conv);
18373         return tag_ptr(ret_conv, true);
18374 }
18375
18376 jboolean  __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_is_ok"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_is_ok(uint64_t o) {
18377         LDKCResult_UpdateAddHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)untag_ptr(o);
18378         jboolean ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_is_ok(o_conv);
18379         return ret_conv;
18380 }
18381
18382 void  __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_free"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_free(uint64_t _res) {
18383         if (!ptr_is_owned(_res)) return;
18384         void* _res_ptr = untag_ptr(_res);
18385         CHECK_ACCESS(_res_ptr);
18386         LDKCResult_UpdateAddHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateAddHTLCDecodeErrorZ*)(_res_ptr);
18387         FREE(untag_ptr(_res));
18388         CResult_UpdateAddHTLCDecodeErrorZ_free(_res_conv);
18389 }
18390
18391 static inline uint64_t CResult_UpdateAddHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR arg) {
18392         LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
18393         *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_clone(arg);
18394         return tag_ptr(ret_conv, true);
18395 }
18396 int64_t  __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_clone_ptr"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_clone_ptr(uint64_t arg) {
18397         LDKCResult_UpdateAddHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)untag_ptr(arg);
18398         int64_t ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_clone_ptr(arg_conv);
18399         return ret_conv;
18400 }
18401
18402 uint64_t  __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_clone"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_clone(uint64_t orig) {
18403         LDKCResult_UpdateAddHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)untag_ptr(orig);
18404         LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
18405         *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_clone(orig_conv);
18406         return tag_ptr(ret_conv, true);
18407 }
18408
18409 uint64_t  __attribute__((export_name("TS_CResult_PingDecodeErrorZ_ok"))) TS_CResult_PingDecodeErrorZ_ok(uint64_t o) {
18410         LDKPing o_conv;
18411         o_conv.inner = untag_ptr(o);
18412         o_conv.is_owned = ptr_is_owned(o);
18413         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18414         o_conv = Ping_clone(&o_conv);
18415         LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
18416         *ret_conv = CResult_PingDecodeErrorZ_ok(o_conv);
18417         return tag_ptr(ret_conv, true);
18418 }
18419
18420 uint64_t  __attribute__((export_name("TS_CResult_PingDecodeErrorZ_err"))) TS_CResult_PingDecodeErrorZ_err(uint64_t e) {
18421         LDKDecodeError e_conv;
18422         e_conv.inner = untag_ptr(e);
18423         e_conv.is_owned = ptr_is_owned(e);
18424         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18425         e_conv = DecodeError_clone(&e_conv);
18426         LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
18427         *ret_conv = CResult_PingDecodeErrorZ_err(e_conv);
18428         return tag_ptr(ret_conv, true);
18429 }
18430
18431 jboolean  __attribute__((export_name("TS_CResult_PingDecodeErrorZ_is_ok"))) TS_CResult_PingDecodeErrorZ_is_ok(uint64_t o) {
18432         LDKCResult_PingDecodeErrorZ* o_conv = (LDKCResult_PingDecodeErrorZ*)untag_ptr(o);
18433         jboolean ret_conv = CResult_PingDecodeErrorZ_is_ok(o_conv);
18434         return ret_conv;
18435 }
18436
18437 void  __attribute__((export_name("TS_CResult_PingDecodeErrorZ_free"))) TS_CResult_PingDecodeErrorZ_free(uint64_t _res) {
18438         if (!ptr_is_owned(_res)) return;
18439         void* _res_ptr = untag_ptr(_res);
18440         CHECK_ACCESS(_res_ptr);
18441         LDKCResult_PingDecodeErrorZ _res_conv = *(LDKCResult_PingDecodeErrorZ*)(_res_ptr);
18442         FREE(untag_ptr(_res));
18443         CResult_PingDecodeErrorZ_free(_res_conv);
18444 }
18445
18446 static inline uint64_t CResult_PingDecodeErrorZ_clone_ptr(LDKCResult_PingDecodeErrorZ *NONNULL_PTR arg) {
18447         LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
18448         *ret_conv = CResult_PingDecodeErrorZ_clone(arg);
18449         return tag_ptr(ret_conv, true);
18450 }
18451 int64_t  __attribute__((export_name("TS_CResult_PingDecodeErrorZ_clone_ptr"))) TS_CResult_PingDecodeErrorZ_clone_ptr(uint64_t arg) {
18452         LDKCResult_PingDecodeErrorZ* arg_conv = (LDKCResult_PingDecodeErrorZ*)untag_ptr(arg);
18453         int64_t ret_conv = CResult_PingDecodeErrorZ_clone_ptr(arg_conv);
18454         return ret_conv;
18455 }
18456
18457 uint64_t  __attribute__((export_name("TS_CResult_PingDecodeErrorZ_clone"))) TS_CResult_PingDecodeErrorZ_clone(uint64_t orig) {
18458         LDKCResult_PingDecodeErrorZ* orig_conv = (LDKCResult_PingDecodeErrorZ*)untag_ptr(orig);
18459         LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
18460         *ret_conv = CResult_PingDecodeErrorZ_clone(orig_conv);
18461         return tag_ptr(ret_conv, true);
18462 }
18463
18464 uint64_t  __attribute__((export_name("TS_CResult_PongDecodeErrorZ_ok"))) TS_CResult_PongDecodeErrorZ_ok(uint64_t o) {
18465         LDKPong o_conv;
18466         o_conv.inner = untag_ptr(o);
18467         o_conv.is_owned = ptr_is_owned(o);
18468         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18469         o_conv = Pong_clone(&o_conv);
18470         LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
18471         *ret_conv = CResult_PongDecodeErrorZ_ok(o_conv);
18472         return tag_ptr(ret_conv, true);
18473 }
18474
18475 uint64_t  __attribute__((export_name("TS_CResult_PongDecodeErrorZ_err"))) TS_CResult_PongDecodeErrorZ_err(uint64_t e) {
18476         LDKDecodeError e_conv;
18477         e_conv.inner = untag_ptr(e);
18478         e_conv.is_owned = ptr_is_owned(e);
18479         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18480         e_conv = DecodeError_clone(&e_conv);
18481         LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
18482         *ret_conv = CResult_PongDecodeErrorZ_err(e_conv);
18483         return tag_ptr(ret_conv, true);
18484 }
18485
18486 jboolean  __attribute__((export_name("TS_CResult_PongDecodeErrorZ_is_ok"))) TS_CResult_PongDecodeErrorZ_is_ok(uint64_t o) {
18487         LDKCResult_PongDecodeErrorZ* o_conv = (LDKCResult_PongDecodeErrorZ*)untag_ptr(o);
18488         jboolean ret_conv = CResult_PongDecodeErrorZ_is_ok(o_conv);
18489         return ret_conv;
18490 }
18491
18492 void  __attribute__((export_name("TS_CResult_PongDecodeErrorZ_free"))) TS_CResult_PongDecodeErrorZ_free(uint64_t _res) {
18493         if (!ptr_is_owned(_res)) return;
18494         void* _res_ptr = untag_ptr(_res);
18495         CHECK_ACCESS(_res_ptr);
18496         LDKCResult_PongDecodeErrorZ _res_conv = *(LDKCResult_PongDecodeErrorZ*)(_res_ptr);
18497         FREE(untag_ptr(_res));
18498         CResult_PongDecodeErrorZ_free(_res_conv);
18499 }
18500
18501 static inline uint64_t CResult_PongDecodeErrorZ_clone_ptr(LDKCResult_PongDecodeErrorZ *NONNULL_PTR arg) {
18502         LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
18503         *ret_conv = CResult_PongDecodeErrorZ_clone(arg);
18504         return tag_ptr(ret_conv, true);
18505 }
18506 int64_t  __attribute__((export_name("TS_CResult_PongDecodeErrorZ_clone_ptr"))) TS_CResult_PongDecodeErrorZ_clone_ptr(uint64_t arg) {
18507         LDKCResult_PongDecodeErrorZ* arg_conv = (LDKCResult_PongDecodeErrorZ*)untag_ptr(arg);
18508         int64_t ret_conv = CResult_PongDecodeErrorZ_clone_ptr(arg_conv);
18509         return ret_conv;
18510 }
18511
18512 uint64_t  __attribute__((export_name("TS_CResult_PongDecodeErrorZ_clone"))) TS_CResult_PongDecodeErrorZ_clone(uint64_t orig) {
18513         LDKCResult_PongDecodeErrorZ* orig_conv = (LDKCResult_PongDecodeErrorZ*)untag_ptr(orig);
18514         LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
18515         *ret_conv = CResult_PongDecodeErrorZ_clone(orig_conv);
18516         return tag_ptr(ret_conv, true);
18517 }
18518
18519 uint64_t  __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(uint64_t o) {
18520         LDKUnsignedChannelAnnouncement o_conv;
18521         o_conv.inner = untag_ptr(o);
18522         o_conv.is_owned = ptr_is_owned(o);
18523         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18524         o_conv = UnsignedChannelAnnouncement_clone(&o_conv);
18525         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
18526         *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(o_conv);
18527         return tag_ptr(ret_conv, true);
18528 }
18529
18530 uint64_t  __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_err"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(uint64_t e) {
18531         LDKDecodeError e_conv;
18532         e_conv.inner = untag_ptr(e);
18533         e_conv.is_owned = ptr_is_owned(e);
18534         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18535         e_conv = DecodeError_clone(&e_conv);
18536         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
18537         *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(e_conv);
18538         return tag_ptr(ret_conv, true);
18539 }
18540
18541 jboolean  __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_is_ok"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_is_ok(uint64_t o) {
18542         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* o_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)untag_ptr(o);
18543         jboolean ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_is_ok(o_conv);
18544         return ret_conv;
18545 }
18546
18547 void  __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_free"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(uint64_t _res) {
18548         if (!ptr_is_owned(_res)) return;
18549         void* _res_ptr = untag_ptr(_res);
18550         CHECK_ACCESS(_res_ptr);
18551         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(_res_ptr);
18552         FREE(untag_ptr(_res));
18553         CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(_res_conv);
18554 }
18555
18556 static inline uint64_t CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
18557         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
18558         *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(arg);
18559         return tag_ptr(ret_conv, true);
18560 }
18561 int64_t  __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone_ptr"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone_ptr(uint64_t arg) {
18562         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)untag_ptr(arg);
18563         int64_t ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
18564         return ret_conv;
18565 }
18566
18567 uint64_t  __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(uint64_t orig) {
18568         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)untag_ptr(orig);
18569         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
18570         *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(orig_conv);
18571         return tag_ptr(ret_conv, true);
18572 }
18573
18574 uint64_t  __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_ok"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_ok(uint64_t o) {
18575         LDKChannelAnnouncement o_conv;
18576         o_conv.inner = untag_ptr(o);
18577         o_conv.is_owned = ptr_is_owned(o);
18578         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18579         o_conv = ChannelAnnouncement_clone(&o_conv);
18580         LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
18581         *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_ok(o_conv);
18582         return tag_ptr(ret_conv, true);
18583 }
18584
18585 uint64_t  __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_err"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_err(uint64_t e) {
18586         LDKDecodeError e_conv;
18587         e_conv.inner = untag_ptr(e);
18588         e_conv.is_owned = ptr_is_owned(e);
18589         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18590         e_conv = DecodeError_clone(&e_conv);
18591         LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
18592         *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_err(e_conv);
18593         return tag_ptr(ret_conv, true);
18594 }
18595
18596 jboolean  __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_is_ok"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_is_ok(uint64_t o) {
18597         LDKCResult_ChannelAnnouncementDecodeErrorZ* o_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)untag_ptr(o);
18598         jboolean ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_is_ok(o_conv);
18599         return ret_conv;
18600 }
18601
18602 void  __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_free"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_free(uint64_t _res) {
18603         if (!ptr_is_owned(_res)) return;
18604         void* _res_ptr = untag_ptr(_res);
18605         CHECK_ACCESS(_res_ptr);
18606         LDKCResult_ChannelAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_ChannelAnnouncementDecodeErrorZ*)(_res_ptr);
18607         FREE(untag_ptr(_res));
18608         CResult_ChannelAnnouncementDecodeErrorZ_free(_res_conv);
18609 }
18610
18611 static inline uint64_t CResult_ChannelAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
18612         LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
18613         *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_clone(arg);
18614         return tag_ptr(ret_conv, true);
18615 }
18616 int64_t  __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_clone_ptr(uint64_t arg) {
18617         LDKCResult_ChannelAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)untag_ptr(arg);
18618         int64_t ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
18619         return ret_conv;
18620 }
18621
18622 uint64_t  __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_clone"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_clone(uint64_t orig) {
18623         LDKCResult_ChannelAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)untag_ptr(orig);
18624         LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
18625         *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_clone(orig_conv);
18626         return tag_ptr(ret_conv, true);
18627 }
18628
18629 uint64_t  __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_ok"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_ok(uint64_t o) {
18630         LDKUnsignedChannelUpdate o_conv;
18631         o_conv.inner = untag_ptr(o);
18632         o_conv.is_owned = ptr_is_owned(o);
18633         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18634         o_conv = UnsignedChannelUpdate_clone(&o_conv);
18635         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
18636         *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_ok(o_conv);
18637         return tag_ptr(ret_conv, true);
18638 }
18639
18640 uint64_t  __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_err"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_err(uint64_t e) {
18641         LDKDecodeError e_conv;
18642         e_conv.inner = untag_ptr(e);
18643         e_conv.is_owned = ptr_is_owned(e);
18644         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18645         e_conv = DecodeError_clone(&e_conv);
18646         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
18647         *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_err(e_conv);
18648         return tag_ptr(ret_conv, true);
18649 }
18650
18651 jboolean  __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_is_ok"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_is_ok(uint64_t o) {
18652         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* o_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)untag_ptr(o);
18653         jboolean ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_is_ok(o_conv);
18654         return ret_conv;
18655 }
18656
18657 void  __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_free"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_free(uint64_t _res) {
18658         if (!ptr_is_owned(_res)) return;
18659         void* _res_ptr = untag_ptr(_res);
18660         CHECK_ACCESS(_res_ptr);
18661         LDKCResult_UnsignedChannelUpdateDecodeErrorZ _res_conv = *(LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(_res_ptr);
18662         FREE(untag_ptr(_res));
18663         CResult_UnsignedChannelUpdateDecodeErrorZ_free(_res_conv);
18664 }
18665
18666 static inline uint64_t CResult_UnsignedChannelUpdateDecodeErrorZ_clone_ptr(LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR arg) {
18667         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
18668         *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_clone(arg);
18669         return tag_ptr(ret_conv, true);
18670 }
18671 int64_t  __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_clone_ptr"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_clone_ptr(uint64_t arg) {
18672         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* arg_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)untag_ptr(arg);
18673         int64_t ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_clone_ptr(arg_conv);
18674         return ret_conv;
18675 }
18676
18677 uint64_t  __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_clone"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_clone(uint64_t orig) {
18678         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* orig_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)untag_ptr(orig);
18679         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
18680         *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_clone(orig_conv);
18681         return tag_ptr(ret_conv, true);
18682 }
18683
18684 uint64_t  __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_ok"))) TS_CResult_ChannelUpdateDecodeErrorZ_ok(uint64_t o) {
18685         LDKChannelUpdate o_conv;
18686         o_conv.inner = untag_ptr(o);
18687         o_conv.is_owned = ptr_is_owned(o);
18688         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18689         o_conv = ChannelUpdate_clone(&o_conv);
18690         LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
18691         *ret_conv = CResult_ChannelUpdateDecodeErrorZ_ok(o_conv);
18692         return tag_ptr(ret_conv, true);
18693 }
18694
18695 uint64_t  __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_err"))) TS_CResult_ChannelUpdateDecodeErrorZ_err(uint64_t e) {
18696         LDKDecodeError e_conv;
18697         e_conv.inner = untag_ptr(e);
18698         e_conv.is_owned = ptr_is_owned(e);
18699         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18700         e_conv = DecodeError_clone(&e_conv);
18701         LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
18702         *ret_conv = CResult_ChannelUpdateDecodeErrorZ_err(e_conv);
18703         return tag_ptr(ret_conv, true);
18704 }
18705
18706 jboolean  __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_is_ok"))) TS_CResult_ChannelUpdateDecodeErrorZ_is_ok(uint64_t o) {
18707         LDKCResult_ChannelUpdateDecodeErrorZ* o_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)untag_ptr(o);
18708         jboolean ret_conv = CResult_ChannelUpdateDecodeErrorZ_is_ok(o_conv);
18709         return ret_conv;
18710 }
18711
18712 void  __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_free"))) TS_CResult_ChannelUpdateDecodeErrorZ_free(uint64_t _res) {
18713         if (!ptr_is_owned(_res)) return;
18714         void* _res_ptr = untag_ptr(_res);
18715         CHECK_ACCESS(_res_ptr);
18716         LDKCResult_ChannelUpdateDecodeErrorZ _res_conv = *(LDKCResult_ChannelUpdateDecodeErrorZ*)(_res_ptr);
18717         FREE(untag_ptr(_res));
18718         CResult_ChannelUpdateDecodeErrorZ_free(_res_conv);
18719 }
18720
18721 static inline uint64_t CResult_ChannelUpdateDecodeErrorZ_clone_ptr(LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR arg) {
18722         LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
18723         *ret_conv = CResult_ChannelUpdateDecodeErrorZ_clone(arg);
18724         return tag_ptr(ret_conv, true);
18725 }
18726 int64_t  __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelUpdateDecodeErrorZ_clone_ptr(uint64_t arg) {
18727         LDKCResult_ChannelUpdateDecodeErrorZ* arg_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)untag_ptr(arg);
18728         int64_t ret_conv = CResult_ChannelUpdateDecodeErrorZ_clone_ptr(arg_conv);
18729         return ret_conv;
18730 }
18731
18732 uint64_t  __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_clone"))) TS_CResult_ChannelUpdateDecodeErrorZ_clone(uint64_t orig) {
18733         LDKCResult_ChannelUpdateDecodeErrorZ* orig_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)untag_ptr(orig);
18734         LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
18735         *ret_conv = CResult_ChannelUpdateDecodeErrorZ_clone(orig_conv);
18736         return tag_ptr(ret_conv, true);
18737 }
18738
18739 uint64_t  __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_ok"))) TS_CResult_ErrorMessageDecodeErrorZ_ok(uint64_t o) {
18740         LDKErrorMessage o_conv;
18741         o_conv.inner = untag_ptr(o);
18742         o_conv.is_owned = ptr_is_owned(o);
18743         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18744         o_conv = ErrorMessage_clone(&o_conv);
18745         LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
18746         *ret_conv = CResult_ErrorMessageDecodeErrorZ_ok(o_conv);
18747         return tag_ptr(ret_conv, true);
18748 }
18749
18750 uint64_t  __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_err"))) TS_CResult_ErrorMessageDecodeErrorZ_err(uint64_t e) {
18751         LDKDecodeError e_conv;
18752         e_conv.inner = untag_ptr(e);
18753         e_conv.is_owned = ptr_is_owned(e);
18754         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18755         e_conv = DecodeError_clone(&e_conv);
18756         LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
18757         *ret_conv = CResult_ErrorMessageDecodeErrorZ_err(e_conv);
18758         return tag_ptr(ret_conv, true);
18759 }
18760
18761 jboolean  __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_is_ok"))) TS_CResult_ErrorMessageDecodeErrorZ_is_ok(uint64_t o) {
18762         LDKCResult_ErrorMessageDecodeErrorZ* o_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)untag_ptr(o);
18763         jboolean ret_conv = CResult_ErrorMessageDecodeErrorZ_is_ok(o_conv);
18764         return ret_conv;
18765 }
18766
18767 void  __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_free"))) TS_CResult_ErrorMessageDecodeErrorZ_free(uint64_t _res) {
18768         if (!ptr_is_owned(_res)) return;
18769         void* _res_ptr = untag_ptr(_res);
18770         CHECK_ACCESS(_res_ptr);
18771         LDKCResult_ErrorMessageDecodeErrorZ _res_conv = *(LDKCResult_ErrorMessageDecodeErrorZ*)(_res_ptr);
18772         FREE(untag_ptr(_res));
18773         CResult_ErrorMessageDecodeErrorZ_free(_res_conv);
18774 }
18775
18776 static inline uint64_t CResult_ErrorMessageDecodeErrorZ_clone_ptr(LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR arg) {
18777         LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
18778         *ret_conv = CResult_ErrorMessageDecodeErrorZ_clone(arg);
18779         return tag_ptr(ret_conv, true);
18780 }
18781 int64_t  __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_clone_ptr"))) TS_CResult_ErrorMessageDecodeErrorZ_clone_ptr(uint64_t arg) {
18782         LDKCResult_ErrorMessageDecodeErrorZ* arg_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)untag_ptr(arg);
18783         int64_t ret_conv = CResult_ErrorMessageDecodeErrorZ_clone_ptr(arg_conv);
18784         return ret_conv;
18785 }
18786
18787 uint64_t  __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_clone"))) TS_CResult_ErrorMessageDecodeErrorZ_clone(uint64_t orig) {
18788         LDKCResult_ErrorMessageDecodeErrorZ* orig_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)untag_ptr(orig);
18789         LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
18790         *ret_conv = CResult_ErrorMessageDecodeErrorZ_clone(orig_conv);
18791         return tag_ptr(ret_conv, true);
18792 }
18793
18794 uint64_t  __attribute__((export_name("TS_CResult_WarningMessageDecodeErrorZ_ok"))) TS_CResult_WarningMessageDecodeErrorZ_ok(uint64_t o) {
18795         LDKWarningMessage o_conv;
18796         o_conv.inner = untag_ptr(o);
18797         o_conv.is_owned = ptr_is_owned(o);
18798         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18799         o_conv = WarningMessage_clone(&o_conv);
18800         LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
18801         *ret_conv = CResult_WarningMessageDecodeErrorZ_ok(o_conv);
18802         return tag_ptr(ret_conv, true);
18803 }
18804
18805 uint64_t  __attribute__((export_name("TS_CResult_WarningMessageDecodeErrorZ_err"))) TS_CResult_WarningMessageDecodeErrorZ_err(uint64_t e) {
18806         LDKDecodeError e_conv;
18807         e_conv.inner = untag_ptr(e);
18808         e_conv.is_owned = ptr_is_owned(e);
18809         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18810         e_conv = DecodeError_clone(&e_conv);
18811         LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
18812         *ret_conv = CResult_WarningMessageDecodeErrorZ_err(e_conv);
18813         return tag_ptr(ret_conv, true);
18814 }
18815
18816 jboolean  __attribute__((export_name("TS_CResult_WarningMessageDecodeErrorZ_is_ok"))) TS_CResult_WarningMessageDecodeErrorZ_is_ok(uint64_t o) {
18817         LDKCResult_WarningMessageDecodeErrorZ* o_conv = (LDKCResult_WarningMessageDecodeErrorZ*)untag_ptr(o);
18818         jboolean ret_conv = CResult_WarningMessageDecodeErrorZ_is_ok(o_conv);
18819         return ret_conv;
18820 }
18821
18822 void  __attribute__((export_name("TS_CResult_WarningMessageDecodeErrorZ_free"))) TS_CResult_WarningMessageDecodeErrorZ_free(uint64_t _res) {
18823         if (!ptr_is_owned(_res)) return;
18824         void* _res_ptr = untag_ptr(_res);
18825         CHECK_ACCESS(_res_ptr);
18826         LDKCResult_WarningMessageDecodeErrorZ _res_conv = *(LDKCResult_WarningMessageDecodeErrorZ*)(_res_ptr);
18827         FREE(untag_ptr(_res));
18828         CResult_WarningMessageDecodeErrorZ_free(_res_conv);
18829 }
18830
18831 static inline uint64_t CResult_WarningMessageDecodeErrorZ_clone_ptr(LDKCResult_WarningMessageDecodeErrorZ *NONNULL_PTR arg) {
18832         LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
18833         *ret_conv = CResult_WarningMessageDecodeErrorZ_clone(arg);
18834         return tag_ptr(ret_conv, true);
18835 }
18836 int64_t  __attribute__((export_name("TS_CResult_WarningMessageDecodeErrorZ_clone_ptr"))) TS_CResult_WarningMessageDecodeErrorZ_clone_ptr(uint64_t arg) {
18837         LDKCResult_WarningMessageDecodeErrorZ* arg_conv = (LDKCResult_WarningMessageDecodeErrorZ*)untag_ptr(arg);
18838         int64_t ret_conv = CResult_WarningMessageDecodeErrorZ_clone_ptr(arg_conv);
18839         return ret_conv;
18840 }
18841
18842 uint64_t  __attribute__((export_name("TS_CResult_WarningMessageDecodeErrorZ_clone"))) TS_CResult_WarningMessageDecodeErrorZ_clone(uint64_t orig) {
18843         LDKCResult_WarningMessageDecodeErrorZ* orig_conv = (LDKCResult_WarningMessageDecodeErrorZ*)untag_ptr(orig);
18844         LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
18845         *ret_conv = CResult_WarningMessageDecodeErrorZ_clone(orig_conv);
18846         return tag_ptr(ret_conv, true);
18847 }
18848
18849 uint64_t  __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(uint64_t o) {
18850         LDKUnsignedNodeAnnouncement o_conv;
18851         o_conv.inner = untag_ptr(o);
18852         o_conv.is_owned = ptr_is_owned(o);
18853         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18854         o_conv = UnsignedNodeAnnouncement_clone(&o_conv);
18855         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
18856         *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(o_conv);
18857         return tag_ptr(ret_conv, true);
18858 }
18859
18860 uint64_t  __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_err"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(uint64_t e) {
18861         LDKDecodeError e_conv;
18862         e_conv.inner = untag_ptr(e);
18863         e_conv.is_owned = ptr_is_owned(e);
18864         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18865         e_conv = DecodeError_clone(&e_conv);
18866         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
18867         *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(e_conv);
18868         return tag_ptr(ret_conv, true);
18869 }
18870
18871 jboolean  __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_is_ok"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_is_ok(uint64_t o) {
18872         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* o_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)untag_ptr(o);
18873         jboolean ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_is_ok(o_conv);
18874         return ret_conv;
18875 }
18876
18877 void  __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_free"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(uint64_t _res) {
18878         if (!ptr_is_owned(_res)) return;
18879         void* _res_ptr = untag_ptr(_res);
18880         CHECK_ACCESS(_res_ptr);
18881         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(_res_ptr);
18882         FREE(untag_ptr(_res));
18883         CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(_res_conv);
18884 }
18885
18886 static inline uint64_t CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
18887         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
18888         *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(arg);
18889         return tag_ptr(ret_conv, true);
18890 }
18891 int64_t  __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone_ptr"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone_ptr(uint64_t arg) {
18892         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)untag_ptr(arg);
18893         int64_t ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
18894         return ret_conv;
18895 }
18896
18897 uint64_t  __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(uint64_t orig) {
18898         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)untag_ptr(orig);
18899         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
18900         *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(orig_conv);
18901         return tag_ptr(ret_conv, true);
18902 }
18903
18904 uint64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_ok"))) TS_CResult_NodeAnnouncementDecodeErrorZ_ok(uint64_t o) {
18905         LDKNodeAnnouncement o_conv;
18906         o_conv.inner = untag_ptr(o);
18907         o_conv.is_owned = ptr_is_owned(o);
18908         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18909         o_conv = NodeAnnouncement_clone(&o_conv);
18910         LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
18911         *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_ok(o_conv);
18912         return tag_ptr(ret_conv, true);
18913 }
18914
18915 uint64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_err"))) TS_CResult_NodeAnnouncementDecodeErrorZ_err(uint64_t e) {
18916         LDKDecodeError e_conv;
18917         e_conv.inner = untag_ptr(e);
18918         e_conv.is_owned = ptr_is_owned(e);
18919         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18920         e_conv = DecodeError_clone(&e_conv);
18921         LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
18922         *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_err(e_conv);
18923         return tag_ptr(ret_conv, true);
18924 }
18925
18926 jboolean  __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_is_ok"))) TS_CResult_NodeAnnouncementDecodeErrorZ_is_ok(uint64_t o) {
18927         LDKCResult_NodeAnnouncementDecodeErrorZ* o_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)untag_ptr(o);
18928         jboolean ret_conv = CResult_NodeAnnouncementDecodeErrorZ_is_ok(o_conv);
18929         return ret_conv;
18930 }
18931
18932 void  __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_free"))) TS_CResult_NodeAnnouncementDecodeErrorZ_free(uint64_t _res) {
18933         if (!ptr_is_owned(_res)) return;
18934         void* _res_ptr = untag_ptr(_res);
18935         CHECK_ACCESS(_res_ptr);
18936         LDKCResult_NodeAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_NodeAnnouncementDecodeErrorZ*)(_res_ptr);
18937         FREE(untag_ptr(_res));
18938         CResult_NodeAnnouncementDecodeErrorZ_free(_res_conv);
18939 }
18940
18941 static inline uint64_t CResult_NodeAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
18942         LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
18943         *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_clone(arg);
18944         return tag_ptr(ret_conv, true);
18945 }
18946 int64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_clone_ptr"))) TS_CResult_NodeAnnouncementDecodeErrorZ_clone_ptr(uint64_t arg) {
18947         LDKCResult_NodeAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)untag_ptr(arg);
18948         int64_t ret_conv = CResult_NodeAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
18949         return ret_conv;
18950 }
18951
18952 uint64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_clone"))) TS_CResult_NodeAnnouncementDecodeErrorZ_clone(uint64_t orig) {
18953         LDKCResult_NodeAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)untag_ptr(orig);
18954         LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
18955         *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_clone(orig_conv);
18956         return tag_ptr(ret_conv, true);
18957 }
18958
18959 uint64_t  __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_ok"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_ok(uint64_t o) {
18960         LDKQueryShortChannelIds o_conv;
18961         o_conv.inner = untag_ptr(o);
18962         o_conv.is_owned = ptr_is_owned(o);
18963         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18964         o_conv = QueryShortChannelIds_clone(&o_conv);
18965         LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
18966         *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_ok(o_conv);
18967         return tag_ptr(ret_conv, true);
18968 }
18969
18970 uint64_t  __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_err"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_err(uint64_t e) {
18971         LDKDecodeError e_conv;
18972         e_conv.inner = untag_ptr(e);
18973         e_conv.is_owned = ptr_is_owned(e);
18974         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18975         e_conv = DecodeError_clone(&e_conv);
18976         LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
18977         *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_err(e_conv);
18978         return tag_ptr(ret_conv, true);
18979 }
18980
18981 jboolean  __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_is_ok"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_is_ok(uint64_t o) {
18982         LDKCResult_QueryShortChannelIdsDecodeErrorZ* o_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)untag_ptr(o);
18983         jboolean ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_is_ok(o_conv);
18984         return ret_conv;
18985 }
18986
18987 void  __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_free"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_free(uint64_t _res) {
18988         if (!ptr_is_owned(_res)) return;
18989         void* _res_ptr = untag_ptr(_res);
18990         CHECK_ACCESS(_res_ptr);
18991         LDKCResult_QueryShortChannelIdsDecodeErrorZ _res_conv = *(LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(_res_ptr);
18992         FREE(untag_ptr(_res));
18993         CResult_QueryShortChannelIdsDecodeErrorZ_free(_res_conv);
18994 }
18995
18996 static inline uint64_t CResult_QueryShortChannelIdsDecodeErrorZ_clone_ptr(LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR arg) {
18997         LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
18998         *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_clone(arg);
18999         return tag_ptr(ret_conv, true);
19000 }
19001 int64_t  __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_clone_ptr"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_clone_ptr(uint64_t arg) {
19002         LDKCResult_QueryShortChannelIdsDecodeErrorZ* arg_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)untag_ptr(arg);
19003         int64_t ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_clone_ptr(arg_conv);
19004         return ret_conv;
19005 }
19006
19007 uint64_t  __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_clone"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_clone(uint64_t orig) {
19008         LDKCResult_QueryShortChannelIdsDecodeErrorZ* orig_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)untag_ptr(orig);
19009         LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
19010         *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_clone(orig_conv);
19011         return tag_ptr(ret_conv, true);
19012 }
19013
19014 uint64_t  __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(uint64_t o) {
19015         LDKReplyShortChannelIdsEnd o_conv;
19016         o_conv.inner = untag_ptr(o);
19017         o_conv.is_owned = ptr_is_owned(o);
19018         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19019         o_conv = ReplyShortChannelIdsEnd_clone(&o_conv);
19020         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
19021         *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(o_conv);
19022         return tag_ptr(ret_conv, true);
19023 }
19024
19025 uint64_t  __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_err"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(uint64_t e) {
19026         LDKDecodeError e_conv;
19027         e_conv.inner = untag_ptr(e);
19028         e_conv.is_owned = ptr_is_owned(e);
19029         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
19030         e_conv = DecodeError_clone(&e_conv);
19031         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
19032         *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(e_conv);
19033         return tag_ptr(ret_conv, true);
19034 }
19035
19036 jboolean  __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_is_ok"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_is_ok(uint64_t o) {
19037         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* o_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)untag_ptr(o);
19038         jboolean ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_is_ok(o_conv);
19039         return ret_conv;
19040 }
19041
19042 void  __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_free"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(uint64_t _res) {
19043         if (!ptr_is_owned(_res)) return;
19044         void* _res_ptr = untag_ptr(_res);
19045         CHECK_ACCESS(_res_ptr);
19046         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ _res_conv = *(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(_res_ptr);
19047         FREE(untag_ptr(_res));
19048         CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(_res_conv);
19049 }
19050
19051 static inline uint64_t CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone_ptr(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR arg) {
19052         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
19053         *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(arg);
19054         return tag_ptr(ret_conv, true);
19055 }
19056 int64_t  __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone_ptr"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone_ptr(uint64_t arg) {
19057         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* arg_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)untag_ptr(arg);
19058         int64_t ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone_ptr(arg_conv);
19059         return ret_conv;
19060 }
19061
19062 uint64_t  __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(uint64_t orig) {
19063         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* orig_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)untag_ptr(orig);
19064         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
19065         *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(orig_conv);
19066         return tag_ptr(ret_conv, true);
19067 }
19068
19069 uint64_t  __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_ok"))) TS_CResult_QueryChannelRangeDecodeErrorZ_ok(uint64_t o) {
19070         LDKQueryChannelRange o_conv;
19071         o_conv.inner = untag_ptr(o);
19072         o_conv.is_owned = ptr_is_owned(o);
19073         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19074         o_conv = QueryChannelRange_clone(&o_conv);
19075         LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
19076         *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_ok(o_conv);
19077         return tag_ptr(ret_conv, true);
19078 }
19079
19080 uint64_t  __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_err"))) TS_CResult_QueryChannelRangeDecodeErrorZ_err(uint64_t e) {
19081         LDKDecodeError e_conv;
19082         e_conv.inner = untag_ptr(e);
19083         e_conv.is_owned = ptr_is_owned(e);
19084         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
19085         e_conv = DecodeError_clone(&e_conv);
19086         LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
19087         *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_err(e_conv);
19088         return tag_ptr(ret_conv, true);
19089 }
19090
19091 jboolean  __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_is_ok"))) TS_CResult_QueryChannelRangeDecodeErrorZ_is_ok(uint64_t o) {
19092         LDKCResult_QueryChannelRangeDecodeErrorZ* o_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)untag_ptr(o);
19093         jboolean ret_conv = CResult_QueryChannelRangeDecodeErrorZ_is_ok(o_conv);
19094         return ret_conv;
19095 }
19096
19097 void  __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_free"))) TS_CResult_QueryChannelRangeDecodeErrorZ_free(uint64_t _res) {
19098         if (!ptr_is_owned(_res)) return;
19099         void* _res_ptr = untag_ptr(_res);
19100         CHECK_ACCESS(_res_ptr);
19101         LDKCResult_QueryChannelRangeDecodeErrorZ _res_conv = *(LDKCResult_QueryChannelRangeDecodeErrorZ*)(_res_ptr);
19102         FREE(untag_ptr(_res));
19103         CResult_QueryChannelRangeDecodeErrorZ_free(_res_conv);
19104 }
19105
19106 static inline uint64_t CResult_QueryChannelRangeDecodeErrorZ_clone_ptr(LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR arg) {
19107         LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
19108         *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_clone(arg);
19109         return tag_ptr(ret_conv, true);
19110 }
19111 int64_t  __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_clone_ptr"))) TS_CResult_QueryChannelRangeDecodeErrorZ_clone_ptr(uint64_t arg) {
19112         LDKCResult_QueryChannelRangeDecodeErrorZ* arg_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)untag_ptr(arg);
19113         int64_t ret_conv = CResult_QueryChannelRangeDecodeErrorZ_clone_ptr(arg_conv);
19114         return ret_conv;
19115 }
19116
19117 uint64_t  __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_clone"))) TS_CResult_QueryChannelRangeDecodeErrorZ_clone(uint64_t orig) {
19118         LDKCResult_QueryChannelRangeDecodeErrorZ* orig_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)untag_ptr(orig);
19119         LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
19120         *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_clone(orig_conv);
19121         return tag_ptr(ret_conv, true);
19122 }
19123
19124 uint64_t  __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_ok"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_ok(uint64_t o) {
19125         LDKReplyChannelRange o_conv;
19126         o_conv.inner = untag_ptr(o);
19127         o_conv.is_owned = ptr_is_owned(o);
19128         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19129         o_conv = ReplyChannelRange_clone(&o_conv);
19130         LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
19131         *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_ok(o_conv);
19132         return tag_ptr(ret_conv, true);
19133 }
19134
19135 uint64_t  __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_err"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_err(uint64_t e) {
19136         LDKDecodeError e_conv;
19137         e_conv.inner = untag_ptr(e);
19138         e_conv.is_owned = ptr_is_owned(e);
19139         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
19140         e_conv = DecodeError_clone(&e_conv);
19141         LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
19142         *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_err(e_conv);
19143         return tag_ptr(ret_conv, true);
19144 }
19145
19146 jboolean  __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_is_ok"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_is_ok(uint64_t o) {
19147         LDKCResult_ReplyChannelRangeDecodeErrorZ* o_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)untag_ptr(o);
19148         jboolean ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_is_ok(o_conv);
19149         return ret_conv;
19150 }
19151
19152 void  __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_free"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_free(uint64_t _res) {
19153         if (!ptr_is_owned(_res)) return;
19154         void* _res_ptr = untag_ptr(_res);
19155         CHECK_ACCESS(_res_ptr);
19156         LDKCResult_ReplyChannelRangeDecodeErrorZ _res_conv = *(LDKCResult_ReplyChannelRangeDecodeErrorZ*)(_res_ptr);
19157         FREE(untag_ptr(_res));
19158         CResult_ReplyChannelRangeDecodeErrorZ_free(_res_conv);
19159 }
19160
19161 static inline uint64_t CResult_ReplyChannelRangeDecodeErrorZ_clone_ptr(LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR arg) {
19162         LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
19163         *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_clone(arg);
19164         return tag_ptr(ret_conv, true);
19165 }
19166 int64_t  __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_clone_ptr"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_clone_ptr(uint64_t arg) {
19167         LDKCResult_ReplyChannelRangeDecodeErrorZ* arg_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)untag_ptr(arg);
19168         int64_t ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_clone_ptr(arg_conv);
19169         return ret_conv;
19170 }
19171
19172 uint64_t  __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_clone"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_clone(uint64_t orig) {
19173         LDKCResult_ReplyChannelRangeDecodeErrorZ* orig_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)untag_ptr(orig);
19174         LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
19175         *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_clone(orig_conv);
19176         return tag_ptr(ret_conv, true);
19177 }
19178
19179 uint64_t  __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_ok"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_ok(uint64_t o) {
19180         LDKGossipTimestampFilter o_conv;
19181         o_conv.inner = untag_ptr(o);
19182         o_conv.is_owned = ptr_is_owned(o);
19183         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19184         o_conv = GossipTimestampFilter_clone(&o_conv);
19185         LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
19186         *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_ok(o_conv);
19187         return tag_ptr(ret_conv, true);
19188 }
19189
19190 uint64_t  __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_err"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_err(uint64_t e) {
19191         LDKDecodeError e_conv;
19192         e_conv.inner = untag_ptr(e);
19193         e_conv.is_owned = ptr_is_owned(e);
19194         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
19195         e_conv = DecodeError_clone(&e_conv);
19196         LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
19197         *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_err(e_conv);
19198         return tag_ptr(ret_conv, true);
19199 }
19200
19201 jboolean  __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_is_ok"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_is_ok(uint64_t o) {
19202         LDKCResult_GossipTimestampFilterDecodeErrorZ* o_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)untag_ptr(o);
19203         jboolean ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_is_ok(o_conv);
19204         return ret_conv;
19205 }
19206
19207 void  __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_free"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_free(uint64_t _res) {
19208         if (!ptr_is_owned(_res)) return;
19209         void* _res_ptr = untag_ptr(_res);
19210         CHECK_ACCESS(_res_ptr);
19211         LDKCResult_GossipTimestampFilterDecodeErrorZ _res_conv = *(LDKCResult_GossipTimestampFilterDecodeErrorZ*)(_res_ptr);
19212         FREE(untag_ptr(_res));
19213         CResult_GossipTimestampFilterDecodeErrorZ_free(_res_conv);
19214 }
19215
19216 static inline uint64_t CResult_GossipTimestampFilterDecodeErrorZ_clone_ptr(LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR arg) {
19217         LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
19218         *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_clone(arg);
19219         return tag_ptr(ret_conv, true);
19220 }
19221 int64_t  __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_clone_ptr"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_clone_ptr(uint64_t arg) {
19222         LDKCResult_GossipTimestampFilterDecodeErrorZ* arg_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)untag_ptr(arg);
19223         int64_t ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_clone_ptr(arg_conv);
19224         return ret_conv;
19225 }
19226
19227 uint64_t  __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_clone"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_clone(uint64_t orig) {
19228         LDKCResult_GossipTimestampFilterDecodeErrorZ* orig_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)untag_ptr(orig);
19229         LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
19230         *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_clone(orig_conv);
19231         return tag_ptr(ret_conv, true);
19232 }
19233
19234 uint64_t  __attribute__((export_name("TS_CResult_InvoiceSignOrCreationErrorZ_ok"))) TS_CResult_InvoiceSignOrCreationErrorZ_ok(uint64_t o) {
19235         LDKInvoice o_conv;
19236         o_conv.inner = untag_ptr(o);
19237         o_conv.is_owned = ptr_is_owned(o);
19238         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19239         o_conv = Invoice_clone(&o_conv);
19240         LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
19241         *ret_conv = CResult_InvoiceSignOrCreationErrorZ_ok(o_conv);
19242         return tag_ptr(ret_conv, true);
19243 }
19244
19245 uint64_t  __attribute__((export_name("TS_CResult_InvoiceSignOrCreationErrorZ_err"))) TS_CResult_InvoiceSignOrCreationErrorZ_err(uint64_t e) {
19246         void* e_ptr = untag_ptr(e);
19247         CHECK_ACCESS(e_ptr);
19248         LDKSignOrCreationError e_conv = *(LDKSignOrCreationError*)(e_ptr);
19249         e_conv = SignOrCreationError_clone((LDKSignOrCreationError*)untag_ptr(e));
19250         LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
19251         *ret_conv = CResult_InvoiceSignOrCreationErrorZ_err(e_conv);
19252         return tag_ptr(ret_conv, true);
19253 }
19254
19255 jboolean  __attribute__((export_name("TS_CResult_InvoiceSignOrCreationErrorZ_is_ok"))) TS_CResult_InvoiceSignOrCreationErrorZ_is_ok(uint64_t o) {
19256         LDKCResult_InvoiceSignOrCreationErrorZ* o_conv = (LDKCResult_InvoiceSignOrCreationErrorZ*)untag_ptr(o);
19257         jboolean ret_conv = CResult_InvoiceSignOrCreationErrorZ_is_ok(o_conv);
19258         return ret_conv;
19259 }
19260
19261 void  __attribute__((export_name("TS_CResult_InvoiceSignOrCreationErrorZ_free"))) TS_CResult_InvoiceSignOrCreationErrorZ_free(uint64_t _res) {
19262         if (!ptr_is_owned(_res)) return;
19263         void* _res_ptr = untag_ptr(_res);
19264         CHECK_ACCESS(_res_ptr);
19265         LDKCResult_InvoiceSignOrCreationErrorZ _res_conv = *(LDKCResult_InvoiceSignOrCreationErrorZ*)(_res_ptr);
19266         FREE(untag_ptr(_res));
19267         CResult_InvoiceSignOrCreationErrorZ_free(_res_conv);
19268 }
19269
19270 static inline uint64_t CResult_InvoiceSignOrCreationErrorZ_clone_ptr(LDKCResult_InvoiceSignOrCreationErrorZ *NONNULL_PTR arg) {
19271         LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
19272         *ret_conv = CResult_InvoiceSignOrCreationErrorZ_clone(arg);
19273         return tag_ptr(ret_conv, true);
19274 }
19275 int64_t  __attribute__((export_name("TS_CResult_InvoiceSignOrCreationErrorZ_clone_ptr"))) TS_CResult_InvoiceSignOrCreationErrorZ_clone_ptr(uint64_t arg) {
19276         LDKCResult_InvoiceSignOrCreationErrorZ* arg_conv = (LDKCResult_InvoiceSignOrCreationErrorZ*)untag_ptr(arg);
19277         int64_t ret_conv = CResult_InvoiceSignOrCreationErrorZ_clone_ptr(arg_conv);
19278         return ret_conv;
19279 }
19280
19281 uint64_t  __attribute__((export_name("TS_CResult_InvoiceSignOrCreationErrorZ_clone"))) TS_CResult_InvoiceSignOrCreationErrorZ_clone(uint64_t orig) {
19282         LDKCResult_InvoiceSignOrCreationErrorZ* orig_conv = (LDKCResult_InvoiceSignOrCreationErrorZ*)untag_ptr(orig);
19283         LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
19284         *ret_conv = CResult_InvoiceSignOrCreationErrorZ_clone(orig_conv);
19285         return tag_ptr(ret_conv, true);
19286 }
19287
19288 uint64_t  __attribute__((export_name("TS_COption_FilterZ_some"))) TS_COption_FilterZ_some(uint64_t o) {
19289         void* o_ptr = untag_ptr(o);
19290         CHECK_ACCESS(o_ptr);
19291         LDKFilter o_conv = *(LDKFilter*)(o_ptr);
19292         if (o_conv.free == LDKFilter_JCalls_free) {
19293                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
19294                 LDKFilter_JCalls_cloned(&o_conv);
19295         }
19296         LDKCOption_FilterZ *ret_copy = MALLOC(sizeof(LDKCOption_FilterZ), "LDKCOption_FilterZ");
19297         *ret_copy = COption_FilterZ_some(o_conv);
19298         uint64_t ret_ref = tag_ptr(ret_copy, true);
19299         return ret_ref;
19300 }
19301
19302 uint64_t  __attribute__((export_name("TS_COption_FilterZ_none"))) TS_COption_FilterZ_none() {
19303         LDKCOption_FilterZ *ret_copy = MALLOC(sizeof(LDKCOption_FilterZ), "LDKCOption_FilterZ");
19304         *ret_copy = COption_FilterZ_none();
19305         uint64_t ret_ref = tag_ptr(ret_copy, true);
19306         return ret_ref;
19307 }
19308
19309 void  __attribute__((export_name("TS_COption_FilterZ_free"))) TS_COption_FilterZ_free(uint64_t _res) {
19310         if (!ptr_is_owned(_res)) return;
19311         void* _res_ptr = untag_ptr(_res);
19312         CHECK_ACCESS(_res_ptr);
19313         LDKCOption_FilterZ _res_conv = *(LDKCOption_FilterZ*)(_res_ptr);
19314         FREE(untag_ptr(_res));
19315         COption_FilterZ_free(_res_conv);
19316 }
19317
19318 uint64_t  __attribute__((export_name("TS_CResult_LockedChannelMonitorNoneZ_ok"))) TS_CResult_LockedChannelMonitorNoneZ_ok(uint64_t o) {
19319         LDKLockedChannelMonitor o_conv;
19320         o_conv.inner = untag_ptr(o);
19321         o_conv.is_owned = ptr_is_owned(o);
19322         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19323         // WARNING: we need a move here but no clone is available for LDKLockedChannelMonitor
19324         
19325         LDKCResult_LockedChannelMonitorNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_LockedChannelMonitorNoneZ), "LDKCResult_LockedChannelMonitorNoneZ");
19326         *ret_conv = CResult_LockedChannelMonitorNoneZ_ok(o_conv);
19327         return tag_ptr(ret_conv, true);
19328 }
19329
19330 uint64_t  __attribute__((export_name("TS_CResult_LockedChannelMonitorNoneZ_err"))) TS_CResult_LockedChannelMonitorNoneZ_err() {
19331         LDKCResult_LockedChannelMonitorNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_LockedChannelMonitorNoneZ), "LDKCResult_LockedChannelMonitorNoneZ");
19332         *ret_conv = CResult_LockedChannelMonitorNoneZ_err();
19333         return tag_ptr(ret_conv, true);
19334 }
19335
19336 jboolean  __attribute__((export_name("TS_CResult_LockedChannelMonitorNoneZ_is_ok"))) TS_CResult_LockedChannelMonitorNoneZ_is_ok(uint64_t o) {
19337         LDKCResult_LockedChannelMonitorNoneZ* o_conv = (LDKCResult_LockedChannelMonitorNoneZ*)untag_ptr(o);
19338         jboolean ret_conv = CResult_LockedChannelMonitorNoneZ_is_ok(o_conv);
19339         return ret_conv;
19340 }
19341
19342 void  __attribute__((export_name("TS_CResult_LockedChannelMonitorNoneZ_free"))) TS_CResult_LockedChannelMonitorNoneZ_free(uint64_t _res) {
19343         if (!ptr_is_owned(_res)) return;
19344         void* _res_ptr = untag_ptr(_res);
19345         CHECK_ACCESS(_res_ptr);
19346         LDKCResult_LockedChannelMonitorNoneZ _res_conv = *(LDKCResult_LockedChannelMonitorNoneZ*)(_res_ptr);
19347         FREE(untag_ptr(_res));
19348         CResult_LockedChannelMonitorNoneZ_free(_res_conv);
19349 }
19350
19351 void  __attribute__((export_name("TS_CVec_OutPointZ_free"))) TS_CVec_OutPointZ_free(uint64_tArray _res) {
19352         LDKCVec_OutPointZ _res_constr;
19353         _res_constr.datalen = _res->arr_len;
19354         if (_res_constr.datalen > 0)
19355                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKOutPoint), "LDKCVec_OutPointZ Elements");
19356         else
19357                 _res_constr.data = NULL;
19358         uint64_t* _res_vals = _res->elems;
19359         for (size_t k = 0; k < _res_constr.datalen; k++) {
19360                 uint64_t _res_conv_10 = _res_vals[k];
19361                 LDKOutPoint _res_conv_10_conv;
19362                 _res_conv_10_conv.inner = untag_ptr(_res_conv_10);
19363                 _res_conv_10_conv.is_owned = ptr_is_owned(_res_conv_10);
19364                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_10_conv);
19365                 _res_constr.data[k] = _res_conv_10_conv;
19366         }
19367         FREE(_res);
19368         CVec_OutPointZ_free(_res_constr);
19369 }
19370
19371 void  __attribute__((export_name("TS_PaymentPurpose_free"))) TS_PaymentPurpose_free(uint64_t this_ptr) {
19372         if (!ptr_is_owned(this_ptr)) return;
19373         void* this_ptr_ptr = untag_ptr(this_ptr);
19374         CHECK_ACCESS(this_ptr_ptr);
19375         LDKPaymentPurpose this_ptr_conv = *(LDKPaymentPurpose*)(this_ptr_ptr);
19376         FREE(untag_ptr(this_ptr));
19377         PaymentPurpose_free(this_ptr_conv);
19378 }
19379
19380 static inline uint64_t PaymentPurpose_clone_ptr(LDKPaymentPurpose *NONNULL_PTR arg) {
19381         LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
19382         *ret_copy = PaymentPurpose_clone(arg);
19383         uint64_t ret_ref = tag_ptr(ret_copy, true);
19384         return ret_ref;
19385 }
19386 int64_t  __attribute__((export_name("TS_PaymentPurpose_clone_ptr"))) TS_PaymentPurpose_clone_ptr(uint64_t arg) {
19387         LDKPaymentPurpose* arg_conv = (LDKPaymentPurpose*)untag_ptr(arg);
19388         int64_t ret_conv = PaymentPurpose_clone_ptr(arg_conv);
19389         return ret_conv;
19390 }
19391
19392 uint64_t  __attribute__((export_name("TS_PaymentPurpose_clone"))) TS_PaymentPurpose_clone(uint64_t orig) {
19393         LDKPaymentPurpose* orig_conv = (LDKPaymentPurpose*)untag_ptr(orig);
19394         LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
19395         *ret_copy = PaymentPurpose_clone(orig_conv);
19396         uint64_t ret_ref = tag_ptr(ret_copy, true);
19397         return ret_ref;
19398 }
19399
19400 uint64_t  __attribute__((export_name("TS_PaymentPurpose_invoice_payment"))) TS_PaymentPurpose_invoice_payment(int8_tArray payment_preimage, int8_tArray payment_secret) {
19401         LDKThirtyTwoBytes payment_preimage_ref;
19402         CHECK(payment_preimage->arr_len == 32);
19403         memcpy(payment_preimage_ref.data, payment_preimage->elems, 32); FREE(payment_preimage);
19404         LDKThirtyTwoBytes payment_secret_ref;
19405         CHECK(payment_secret->arr_len == 32);
19406         memcpy(payment_secret_ref.data, payment_secret->elems, 32); FREE(payment_secret);
19407         LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
19408         *ret_copy = PaymentPurpose_invoice_payment(payment_preimage_ref, payment_secret_ref);
19409         uint64_t ret_ref = tag_ptr(ret_copy, true);
19410         return ret_ref;
19411 }
19412
19413 uint64_t  __attribute__((export_name("TS_PaymentPurpose_spontaneous_payment"))) TS_PaymentPurpose_spontaneous_payment(int8_tArray a) {
19414         LDKThirtyTwoBytes a_ref;
19415         CHECK(a->arr_len == 32);
19416         memcpy(a_ref.data, a->elems, 32); FREE(a);
19417         LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
19418         *ret_copy = PaymentPurpose_spontaneous_payment(a_ref);
19419         uint64_t ret_ref = tag_ptr(ret_copy, true);
19420         return ret_ref;
19421 }
19422
19423 int8_tArray  __attribute__((export_name("TS_PaymentPurpose_write"))) TS_PaymentPurpose_write(uint64_t obj) {
19424         LDKPaymentPurpose* obj_conv = (LDKPaymentPurpose*)untag_ptr(obj);
19425         LDKCVec_u8Z ret_var = PaymentPurpose_write(obj_conv);
19426         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
19427         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
19428         CVec_u8Z_free(ret_var);
19429         return ret_arr;
19430 }
19431
19432 uint64_t  __attribute__((export_name("TS_PaymentPurpose_read"))) TS_PaymentPurpose_read(int8_tArray ser) {
19433         LDKu8slice ser_ref;
19434         ser_ref.datalen = ser->arr_len;
19435         ser_ref.data = ser->elems;
19436         LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
19437         *ret_conv = PaymentPurpose_read(ser_ref);
19438         FREE(ser);
19439         return tag_ptr(ret_conv, true);
19440 }
19441
19442 void  __attribute__((export_name("TS_ClosureReason_free"))) TS_ClosureReason_free(uint64_t this_ptr) {
19443         if (!ptr_is_owned(this_ptr)) return;
19444         void* this_ptr_ptr = untag_ptr(this_ptr);
19445         CHECK_ACCESS(this_ptr_ptr);
19446         LDKClosureReason this_ptr_conv = *(LDKClosureReason*)(this_ptr_ptr);
19447         FREE(untag_ptr(this_ptr));
19448         ClosureReason_free(this_ptr_conv);
19449 }
19450
19451 static inline uint64_t ClosureReason_clone_ptr(LDKClosureReason *NONNULL_PTR arg) {
19452         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
19453         *ret_copy = ClosureReason_clone(arg);
19454         uint64_t ret_ref = tag_ptr(ret_copy, true);
19455         return ret_ref;
19456 }
19457 int64_t  __attribute__((export_name("TS_ClosureReason_clone_ptr"))) TS_ClosureReason_clone_ptr(uint64_t arg) {
19458         LDKClosureReason* arg_conv = (LDKClosureReason*)untag_ptr(arg);
19459         int64_t ret_conv = ClosureReason_clone_ptr(arg_conv);
19460         return ret_conv;
19461 }
19462
19463 uint64_t  __attribute__((export_name("TS_ClosureReason_clone"))) TS_ClosureReason_clone(uint64_t orig) {
19464         LDKClosureReason* orig_conv = (LDKClosureReason*)untag_ptr(orig);
19465         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
19466         *ret_copy = ClosureReason_clone(orig_conv);
19467         uint64_t ret_ref = tag_ptr(ret_copy, true);
19468         return ret_ref;
19469 }
19470
19471 uint64_t  __attribute__((export_name("TS_ClosureReason_counterparty_force_closed"))) TS_ClosureReason_counterparty_force_closed(jstring peer_msg) {
19472         LDKStr peer_msg_conv = str_ref_to_owned_c(peer_msg);
19473         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
19474         *ret_copy = ClosureReason_counterparty_force_closed(peer_msg_conv);
19475         uint64_t ret_ref = tag_ptr(ret_copy, true);
19476         return ret_ref;
19477 }
19478
19479 uint64_t  __attribute__((export_name("TS_ClosureReason_holder_force_closed"))) TS_ClosureReason_holder_force_closed() {
19480         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
19481         *ret_copy = ClosureReason_holder_force_closed();
19482         uint64_t ret_ref = tag_ptr(ret_copy, true);
19483         return ret_ref;
19484 }
19485
19486 uint64_t  __attribute__((export_name("TS_ClosureReason_cooperative_closure"))) TS_ClosureReason_cooperative_closure() {
19487         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
19488         *ret_copy = ClosureReason_cooperative_closure();
19489         uint64_t ret_ref = tag_ptr(ret_copy, true);
19490         return ret_ref;
19491 }
19492
19493 uint64_t  __attribute__((export_name("TS_ClosureReason_commitment_tx_confirmed"))) TS_ClosureReason_commitment_tx_confirmed() {
19494         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
19495         *ret_copy = ClosureReason_commitment_tx_confirmed();
19496         uint64_t ret_ref = tag_ptr(ret_copy, true);
19497         return ret_ref;
19498 }
19499
19500 uint64_t  __attribute__((export_name("TS_ClosureReason_funding_timed_out"))) TS_ClosureReason_funding_timed_out() {
19501         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
19502         *ret_copy = ClosureReason_funding_timed_out();
19503         uint64_t ret_ref = tag_ptr(ret_copy, true);
19504         return ret_ref;
19505 }
19506
19507 uint64_t  __attribute__((export_name("TS_ClosureReason_processing_error"))) TS_ClosureReason_processing_error(jstring err) {
19508         LDKStr err_conv = str_ref_to_owned_c(err);
19509         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
19510         *ret_copy = ClosureReason_processing_error(err_conv);
19511         uint64_t ret_ref = tag_ptr(ret_copy, true);
19512         return ret_ref;
19513 }
19514
19515 uint64_t  __attribute__((export_name("TS_ClosureReason_disconnected_peer"))) TS_ClosureReason_disconnected_peer() {
19516         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
19517         *ret_copy = ClosureReason_disconnected_peer();
19518         uint64_t ret_ref = tag_ptr(ret_copy, true);
19519         return ret_ref;
19520 }
19521
19522 uint64_t  __attribute__((export_name("TS_ClosureReason_outdated_channel_manager"))) TS_ClosureReason_outdated_channel_manager() {
19523         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
19524         *ret_copy = ClosureReason_outdated_channel_manager();
19525         uint64_t ret_ref = tag_ptr(ret_copy, true);
19526         return ret_ref;
19527 }
19528
19529 int8_tArray  __attribute__((export_name("TS_ClosureReason_write"))) TS_ClosureReason_write(uint64_t obj) {
19530         LDKClosureReason* obj_conv = (LDKClosureReason*)untag_ptr(obj);
19531         LDKCVec_u8Z ret_var = ClosureReason_write(obj_conv);
19532         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
19533         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
19534         CVec_u8Z_free(ret_var);
19535         return ret_arr;
19536 }
19537
19538 uint64_t  __attribute__((export_name("TS_ClosureReason_read"))) TS_ClosureReason_read(int8_tArray ser) {
19539         LDKu8slice ser_ref;
19540         ser_ref.datalen = ser->arr_len;
19541         ser_ref.data = ser->elems;
19542         LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
19543         *ret_conv = ClosureReason_read(ser_ref);
19544         FREE(ser);
19545         return tag_ptr(ret_conv, true);
19546 }
19547
19548 void  __attribute__((export_name("TS_HTLCDestination_free"))) TS_HTLCDestination_free(uint64_t this_ptr) {
19549         if (!ptr_is_owned(this_ptr)) return;
19550         void* this_ptr_ptr = untag_ptr(this_ptr);
19551         CHECK_ACCESS(this_ptr_ptr);
19552         LDKHTLCDestination this_ptr_conv = *(LDKHTLCDestination*)(this_ptr_ptr);
19553         FREE(untag_ptr(this_ptr));
19554         HTLCDestination_free(this_ptr_conv);
19555 }
19556
19557 static inline uint64_t HTLCDestination_clone_ptr(LDKHTLCDestination *NONNULL_PTR arg) {
19558         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
19559         *ret_copy = HTLCDestination_clone(arg);
19560         uint64_t ret_ref = tag_ptr(ret_copy, true);
19561         return ret_ref;
19562 }
19563 int64_t  __attribute__((export_name("TS_HTLCDestination_clone_ptr"))) TS_HTLCDestination_clone_ptr(uint64_t arg) {
19564         LDKHTLCDestination* arg_conv = (LDKHTLCDestination*)untag_ptr(arg);
19565         int64_t ret_conv = HTLCDestination_clone_ptr(arg_conv);
19566         return ret_conv;
19567 }
19568
19569 uint64_t  __attribute__((export_name("TS_HTLCDestination_clone"))) TS_HTLCDestination_clone(uint64_t orig) {
19570         LDKHTLCDestination* orig_conv = (LDKHTLCDestination*)untag_ptr(orig);
19571         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
19572         *ret_copy = HTLCDestination_clone(orig_conv);
19573         uint64_t ret_ref = tag_ptr(ret_copy, true);
19574         return ret_ref;
19575 }
19576
19577 uint64_t  __attribute__((export_name("TS_HTLCDestination_next_hop_channel"))) TS_HTLCDestination_next_hop_channel(int8_tArray node_id, int8_tArray channel_id) {
19578         LDKPublicKey node_id_ref;
19579         CHECK(node_id->arr_len == 33);
19580         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
19581         LDKThirtyTwoBytes channel_id_ref;
19582         CHECK(channel_id->arr_len == 32);
19583         memcpy(channel_id_ref.data, channel_id->elems, 32); FREE(channel_id);
19584         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
19585         *ret_copy = HTLCDestination_next_hop_channel(node_id_ref, channel_id_ref);
19586         uint64_t ret_ref = tag_ptr(ret_copy, true);
19587         return ret_ref;
19588 }
19589
19590 uint64_t  __attribute__((export_name("TS_HTLCDestination_unknown_next_hop"))) TS_HTLCDestination_unknown_next_hop(int64_t requested_forward_scid) {
19591         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
19592         *ret_copy = HTLCDestination_unknown_next_hop(requested_forward_scid);
19593         uint64_t ret_ref = tag_ptr(ret_copy, true);
19594         return ret_ref;
19595 }
19596
19597 uint64_t  __attribute__((export_name("TS_HTLCDestination_failed_payment"))) TS_HTLCDestination_failed_payment(int8_tArray payment_hash) {
19598         LDKThirtyTwoBytes payment_hash_ref;
19599         CHECK(payment_hash->arr_len == 32);
19600         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
19601         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
19602         *ret_copy = HTLCDestination_failed_payment(payment_hash_ref);
19603         uint64_t ret_ref = tag_ptr(ret_copy, true);
19604         return ret_ref;
19605 }
19606
19607 int8_tArray  __attribute__((export_name("TS_HTLCDestination_write"))) TS_HTLCDestination_write(uint64_t obj) {
19608         LDKHTLCDestination* obj_conv = (LDKHTLCDestination*)untag_ptr(obj);
19609         LDKCVec_u8Z ret_var = HTLCDestination_write(obj_conv);
19610         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
19611         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
19612         CVec_u8Z_free(ret_var);
19613         return ret_arr;
19614 }
19615
19616 uint64_t  __attribute__((export_name("TS_HTLCDestination_read"))) TS_HTLCDestination_read(int8_tArray ser) {
19617         LDKu8slice ser_ref;
19618         ser_ref.datalen = ser->arr_len;
19619         ser_ref.data = ser->elems;
19620         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ), "LDKCResult_COption_HTLCDestinationZDecodeErrorZ");
19621         *ret_conv = HTLCDestination_read(ser_ref);
19622         FREE(ser);
19623         return tag_ptr(ret_conv, true);
19624 }
19625
19626 void  __attribute__((export_name("TS_Event_free"))) TS_Event_free(uint64_t this_ptr) {
19627         if (!ptr_is_owned(this_ptr)) return;
19628         void* this_ptr_ptr = untag_ptr(this_ptr);
19629         CHECK_ACCESS(this_ptr_ptr);
19630         LDKEvent this_ptr_conv = *(LDKEvent*)(this_ptr_ptr);
19631         FREE(untag_ptr(this_ptr));
19632         Event_free(this_ptr_conv);
19633 }
19634
19635 static inline uint64_t Event_clone_ptr(LDKEvent *NONNULL_PTR arg) {
19636         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
19637         *ret_copy = Event_clone(arg);
19638         uint64_t ret_ref = tag_ptr(ret_copy, true);
19639         return ret_ref;
19640 }
19641 int64_t  __attribute__((export_name("TS_Event_clone_ptr"))) TS_Event_clone_ptr(uint64_t arg) {
19642         LDKEvent* arg_conv = (LDKEvent*)untag_ptr(arg);
19643         int64_t ret_conv = Event_clone_ptr(arg_conv);
19644         return ret_conv;
19645 }
19646
19647 uint64_t  __attribute__((export_name("TS_Event_clone"))) TS_Event_clone(uint64_t orig) {
19648         LDKEvent* orig_conv = (LDKEvent*)untag_ptr(orig);
19649         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
19650         *ret_copy = Event_clone(orig_conv);
19651         uint64_t ret_ref = tag_ptr(ret_copy, true);
19652         return ret_ref;
19653 }
19654
19655 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) {
19656         LDKThirtyTwoBytes temporary_channel_id_ref;
19657         CHECK(temporary_channel_id->arr_len == 32);
19658         memcpy(temporary_channel_id_ref.data, temporary_channel_id->elems, 32); FREE(temporary_channel_id);
19659         LDKPublicKey counterparty_node_id_ref;
19660         CHECK(counterparty_node_id->arr_len == 33);
19661         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
19662         LDKCVec_u8Z output_script_ref;
19663         output_script_ref.datalen = output_script->arr_len;
19664         output_script_ref.data = MALLOC(output_script_ref.datalen, "LDKCVec_u8Z Bytes");
19665         memcpy(output_script_ref.data, output_script->elems, output_script_ref.datalen); FREE(output_script);
19666         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
19667         *ret_copy = Event_funding_generation_ready(temporary_channel_id_ref, counterparty_node_id_ref, channel_value_satoshis, output_script_ref, user_channel_id);
19668         uint64_t ret_ref = tag_ptr(ret_copy, true);
19669         return ret_ref;
19670 }
19671
19672 uint64_t  __attribute__((export_name("TS_Event_payment_received"))) TS_Event_payment_received(int8_tArray payment_hash, int64_t amount_msat, uint64_t purpose) {
19673         LDKThirtyTwoBytes payment_hash_ref;
19674         CHECK(payment_hash->arr_len == 32);
19675         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
19676         void* purpose_ptr = untag_ptr(purpose);
19677         CHECK_ACCESS(purpose_ptr);
19678         LDKPaymentPurpose purpose_conv = *(LDKPaymentPurpose*)(purpose_ptr);
19679         purpose_conv = PaymentPurpose_clone((LDKPaymentPurpose*)untag_ptr(purpose));
19680         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
19681         *ret_copy = Event_payment_received(payment_hash_ref, amount_msat, purpose_conv);
19682         uint64_t ret_ref = tag_ptr(ret_copy, true);
19683         return ret_ref;
19684 }
19685
19686 uint64_t  __attribute__((export_name("TS_Event_payment_claimed"))) TS_Event_payment_claimed(int8_tArray payment_hash, int64_t amount_msat, uint64_t purpose) {
19687         LDKThirtyTwoBytes payment_hash_ref;
19688         CHECK(payment_hash->arr_len == 32);
19689         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
19690         void* purpose_ptr = untag_ptr(purpose);
19691         CHECK_ACCESS(purpose_ptr);
19692         LDKPaymentPurpose purpose_conv = *(LDKPaymentPurpose*)(purpose_ptr);
19693         purpose_conv = PaymentPurpose_clone((LDKPaymentPurpose*)untag_ptr(purpose));
19694         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
19695         *ret_copy = Event_payment_claimed(payment_hash_ref, amount_msat, purpose_conv);
19696         uint64_t ret_ref = tag_ptr(ret_copy, true);
19697         return ret_ref;
19698 }
19699
19700 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) {
19701         LDKThirtyTwoBytes payment_id_ref;
19702         CHECK(payment_id->arr_len == 32);
19703         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
19704         LDKThirtyTwoBytes payment_preimage_ref;
19705         CHECK(payment_preimage->arr_len == 32);
19706         memcpy(payment_preimage_ref.data, payment_preimage->elems, 32); FREE(payment_preimage);
19707         LDKThirtyTwoBytes payment_hash_ref;
19708         CHECK(payment_hash->arr_len == 32);
19709         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
19710         void* fee_paid_msat_ptr = untag_ptr(fee_paid_msat);
19711         CHECK_ACCESS(fee_paid_msat_ptr);
19712         LDKCOption_u64Z fee_paid_msat_conv = *(LDKCOption_u64Z*)(fee_paid_msat_ptr);
19713         fee_paid_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(fee_paid_msat));
19714         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
19715         *ret_copy = Event_payment_sent(payment_id_ref, payment_preimage_ref, payment_hash_ref, fee_paid_msat_conv);
19716         uint64_t ret_ref = tag_ptr(ret_copy, true);
19717         return ret_ref;
19718 }
19719
19720 uint64_t  __attribute__((export_name("TS_Event_payment_failed"))) TS_Event_payment_failed(int8_tArray payment_id, int8_tArray payment_hash) {
19721         LDKThirtyTwoBytes payment_id_ref;
19722         CHECK(payment_id->arr_len == 32);
19723         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
19724         LDKThirtyTwoBytes payment_hash_ref;
19725         CHECK(payment_hash->arr_len == 32);
19726         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
19727         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
19728         *ret_copy = Event_payment_failed(payment_id_ref, payment_hash_ref);
19729         uint64_t ret_ref = tag_ptr(ret_copy, true);
19730         return ret_ref;
19731 }
19732
19733 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) {
19734         LDKThirtyTwoBytes payment_id_ref;
19735         CHECK(payment_id->arr_len == 32);
19736         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
19737         LDKThirtyTwoBytes payment_hash_ref;
19738         CHECK(payment_hash->arr_len == 32);
19739         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
19740         LDKCVec_RouteHopZ path_constr;
19741         path_constr.datalen = path->arr_len;
19742         if (path_constr.datalen > 0)
19743                 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
19744         else
19745                 path_constr.data = NULL;
19746         uint64_t* path_vals = path->elems;
19747         for (size_t k = 0; k < path_constr.datalen; k++) {
19748                 uint64_t path_conv_10 = path_vals[k];
19749                 LDKRouteHop path_conv_10_conv;
19750                 path_conv_10_conv.inner = untag_ptr(path_conv_10);
19751                 path_conv_10_conv.is_owned = ptr_is_owned(path_conv_10);
19752                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
19753                 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
19754                 path_constr.data[k] = path_conv_10_conv;
19755         }
19756         FREE(path);
19757         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
19758         *ret_copy = Event_payment_path_successful(payment_id_ref, payment_hash_ref, path_constr);
19759         uint64_t ret_ref = tag_ptr(ret_copy, true);
19760         return ret_ref;
19761 }
19762
19763 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) {
19764         LDKThirtyTwoBytes payment_id_ref;
19765         CHECK(payment_id->arr_len == 32);
19766         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
19767         LDKThirtyTwoBytes payment_hash_ref;
19768         CHECK(payment_hash->arr_len == 32);
19769         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
19770         void* network_update_ptr = untag_ptr(network_update);
19771         CHECK_ACCESS(network_update_ptr);
19772         LDKCOption_NetworkUpdateZ network_update_conv = *(LDKCOption_NetworkUpdateZ*)(network_update_ptr);
19773         network_update_conv = COption_NetworkUpdateZ_clone((LDKCOption_NetworkUpdateZ*)untag_ptr(network_update));
19774         LDKCVec_RouteHopZ path_constr;
19775         path_constr.datalen = path->arr_len;
19776         if (path_constr.datalen > 0)
19777                 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
19778         else
19779                 path_constr.data = NULL;
19780         uint64_t* path_vals = path->elems;
19781         for (size_t k = 0; k < path_constr.datalen; k++) {
19782                 uint64_t path_conv_10 = path_vals[k];
19783                 LDKRouteHop path_conv_10_conv;
19784                 path_conv_10_conv.inner = untag_ptr(path_conv_10);
19785                 path_conv_10_conv.is_owned = ptr_is_owned(path_conv_10);
19786                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
19787                 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
19788                 path_constr.data[k] = path_conv_10_conv;
19789         }
19790         FREE(path);
19791         void* short_channel_id_ptr = untag_ptr(short_channel_id);
19792         CHECK_ACCESS(short_channel_id_ptr);
19793         LDKCOption_u64Z short_channel_id_conv = *(LDKCOption_u64Z*)(short_channel_id_ptr);
19794         short_channel_id_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(short_channel_id));
19795         LDKRouteParameters retry_conv;
19796         retry_conv.inner = untag_ptr(retry);
19797         retry_conv.is_owned = ptr_is_owned(retry);
19798         CHECK_INNER_FIELD_ACCESS_OR_NULL(retry_conv);
19799         retry_conv = RouteParameters_clone(&retry_conv);
19800         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
19801         *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);
19802         uint64_t ret_ref = tag_ptr(ret_copy, true);
19803         return ret_ref;
19804 }
19805
19806 uint64_t  __attribute__((export_name("TS_Event_probe_successful"))) TS_Event_probe_successful(int8_tArray payment_id, int8_tArray payment_hash, uint64_tArray path) {
19807         LDKThirtyTwoBytes payment_id_ref;
19808         CHECK(payment_id->arr_len == 32);
19809         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
19810         LDKThirtyTwoBytes payment_hash_ref;
19811         CHECK(payment_hash->arr_len == 32);
19812         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
19813         LDKCVec_RouteHopZ path_constr;
19814         path_constr.datalen = path->arr_len;
19815         if (path_constr.datalen > 0)
19816                 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
19817         else
19818                 path_constr.data = NULL;
19819         uint64_t* path_vals = path->elems;
19820         for (size_t k = 0; k < path_constr.datalen; k++) {
19821                 uint64_t path_conv_10 = path_vals[k];
19822                 LDKRouteHop path_conv_10_conv;
19823                 path_conv_10_conv.inner = untag_ptr(path_conv_10);
19824                 path_conv_10_conv.is_owned = ptr_is_owned(path_conv_10);
19825                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
19826                 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
19827                 path_constr.data[k] = path_conv_10_conv;
19828         }
19829         FREE(path);
19830         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
19831         *ret_copy = Event_probe_successful(payment_id_ref, payment_hash_ref, path_constr);
19832         uint64_t ret_ref = tag_ptr(ret_copy, true);
19833         return ret_ref;
19834 }
19835
19836 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) {
19837         LDKThirtyTwoBytes payment_id_ref;
19838         CHECK(payment_id->arr_len == 32);
19839         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
19840         LDKThirtyTwoBytes payment_hash_ref;
19841         CHECK(payment_hash->arr_len == 32);
19842         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
19843         LDKCVec_RouteHopZ path_constr;
19844         path_constr.datalen = path->arr_len;
19845         if (path_constr.datalen > 0)
19846                 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
19847         else
19848                 path_constr.data = NULL;
19849         uint64_t* path_vals = path->elems;
19850         for (size_t k = 0; k < path_constr.datalen; k++) {
19851                 uint64_t path_conv_10 = path_vals[k];
19852                 LDKRouteHop path_conv_10_conv;
19853                 path_conv_10_conv.inner = untag_ptr(path_conv_10);
19854                 path_conv_10_conv.is_owned = ptr_is_owned(path_conv_10);
19855                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
19856                 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
19857                 path_constr.data[k] = path_conv_10_conv;
19858         }
19859         FREE(path);
19860         void* short_channel_id_ptr = untag_ptr(short_channel_id);
19861         CHECK_ACCESS(short_channel_id_ptr);
19862         LDKCOption_u64Z short_channel_id_conv = *(LDKCOption_u64Z*)(short_channel_id_ptr);
19863         short_channel_id_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(short_channel_id));
19864         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
19865         *ret_copy = Event_probe_failed(payment_id_ref, payment_hash_ref, path_constr, short_channel_id_conv);
19866         uint64_t ret_ref = tag_ptr(ret_copy, true);
19867         return ret_ref;
19868 }
19869
19870 uint64_t  __attribute__((export_name("TS_Event_pending_htlcs_forwardable"))) TS_Event_pending_htlcs_forwardable(int64_t time_forwardable) {
19871         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
19872         *ret_copy = Event_pending_htlcs_forwardable(time_forwardable);
19873         uint64_t ret_ref = tag_ptr(ret_copy, true);
19874         return ret_ref;
19875 }
19876
19877 uint64_t  __attribute__((export_name("TS_Event_spendable_outputs"))) TS_Event_spendable_outputs(uint64_tArray outputs) {
19878         LDKCVec_SpendableOutputDescriptorZ outputs_constr;
19879         outputs_constr.datalen = outputs->arr_len;
19880         if (outputs_constr.datalen > 0)
19881                 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
19882         else
19883                 outputs_constr.data = NULL;
19884         uint64_t* outputs_vals = outputs->elems;
19885         for (size_t b = 0; b < outputs_constr.datalen; b++) {
19886                 uint64_t outputs_conv_27 = outputs_vals[b];
19887                 void* outputs_conv_27_ptr = untag_ptr(outputs_conv_27);
19888                 CHECK_ACCESS(outputs_conv_27_ptr);
19889                 LDKSpendableOutputDescriptor outputs_conv_27_conv = *(LDKSpendableOutputDescriptor*)(outputs_conv_27_ptr);
19890                 outputs_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(outputs_conv_27));
19891                 outputs_constr.data[b] = outputs_conv_27_conv;
19892         }
19893         FREE(outputs);
19894         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
19895         *ret_copy = Event_spendable_outputs(outputs_constr);
19896         uint64_t ret_ref = tag_ptr(ret_copy, true);
19897         return ret_ref;
19898 }
19899
19900 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) {
19901         LDKThirtyTwoBytes prev_channel_id_ref;
19902         CHECK(prev_channel_id->arr_len == 32);
19903         memcpy(prev_channel_id_ref.data, prev_channel_id->elems, 32); FREE(prev_channel_id);
19904         LDKThirtyTwoBytes next_channel_id_ref;
19905         CHECK(next_channel_id->arr_len == 32);
19906         memcpy(next_channel_id_ref.data, next_channel_id->elems, 32); FREE(next_channel_id);
19907         void* fee_earned_msat_ptr = untag_ptr(fee_earned_msat);
19908         CHECK_ACCESS(fee_earned_msat_ptr);
19909         LDKCOption_u64Z fee_earned_msat_conv = *(LDKCOption_u64Z*)(fee_earned_msat_ptr);
19910         fee_earned_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(fee_earned_msat));
19911         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
19912         *ret_copy = Event_payment_forwarded(prev_channel_id_ref, next_channel_id_ref, fee_earned_msat_conv, claim_from_onchain_tx);
19913         uint64_t ret_ref = tag_ptr(ret_copy, true);
19914         return ret_ref;
19915 }
19916
19917 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) {
19918         LDKThirtyTwoBytes channel_id_ref;
19919         CHECK(channel_id->arr_len == 32);
19920         memcpy(channel_id_ref.data, channel_id->elems, 32); FREE(channel_id);
19921         void* reason_ptr = untag_ptr(reason);
19922         CHECK_ACCESS(reason_ptr);
19923         LDKClosureReason reason_conv = *(LDKClosureReason*)(reason_ptr);
19924         reason_conv = ClosureReason_clone((LDKClosureReason*)untag_ptr(reason));
19925         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
19926         *ret_copy = Event_channel_closed(channel_id_ref, user_channel_id, reason_conv);
19927         uint64_t ret_ref = tag_ptr(ret_copy, true);
19928         return ret_ref;
19929 }
19930
19931 uint64_t  __attribute__((export_name("TS_Event_discard_funding"))) TS_Event_discard_funding(int8_tArray channel_id, int8_tArray transaction) {
19932         LDKThirtyTwoBytes channel_id_ref;
19933         CHECK(channel_id->arr_len == 32);
19934         memcpy(channel_id_ref.data, channel_id->elems, 32); FREE(channel_id);
19935         LDKTransaction transaction_ref;
19936         transaction_ref.datalen = transaction->arr_len;
19937         transaction_ref.data = MALLOC(transaction_ref.datalen, "LDKTransaction Bytes");
19938         memcpy(transaction_ref.data, transaction->elems, transaction_ref.datalen); FREE(transaction);
19939         transaction_ref.data_is_owned = true;
19940         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
19941         *ret_copy = Event_discard_funding(channel_id_ref, transaction_ref);
19942         uint64_t ret_ref = tag_ptr(ret_copy, true);
19943         return ret_ref;
19944 }
19945
19946 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) {
19947         LDKThirtyTwoBytes temporary_channel_id_ref;
19948         CHECK(temporary_channel_id->arr_len == 32);
19949         memcpy(temporary_channel_id_ref.data, temporary_channel_id->elems, 32); FREE(temporary_channel_id);
19950         LDKPublicKey counterparty_node_id_ref;
19951         CHECK(counterparty_node_id->arr_len == 33);
19952         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
19953         LDKChannelTypeFeatures channel_type_conv;
19954         channel_type_conv.inner = untag_ptr(channel_type);
19955         channel_type_conv.is_owned = ptr_is_owned(channel_type);
19956         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_conv);
19957         channel_type_conv = ChannelTypeFeatures_clone(&channel_type_conv);
19958         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
19959         *ret_copy = Event_open_channel_request(temporary_channel_id_ref, counterparty_node_id_ref, funding_satoshis, push_msat, channel_type_conv);
19960         uint64_t ret_ref = tag_ptr(ret_copy, true);
19961         return ret_ref;
19962 }
19963
19964 uint64_t  __attribute__((export_name("TS_Event_htlchandling_failed"))) TS_Event_htlchandling_failed(int8_tArray prev_channel_id, uint64_t failed_next_destination) {
19965         LDKThirtyTwoBytes prev_channel_id_ref;
19966         CHECK(prev_channel_id->arr_len == 32);
19967         memcpy(prev_channel_id_ref.data, prev_channel_id->elems, 32); FREE(prev_channel_id);
19968         void* failed_next_destination_ptr = untag_ptr(failed_next_destination);
19969         CHECK_ACCESS(failed_next_destination_ptr);
19970         LDKHTLCDestination failed_next_destination_conv = *(LDKHTLCDestination*)(failed_next_destination_ptr);
19971         failed_next_destination_conv = HTLCDestination_clone((LDKHTLCDestination*)untag_ptr(failed_next_destination));
19972         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
19973         *ret_copy = Event_htlchandling_failed(prev_channel_id_ref, failed_next_destination_conv);
19974         uint64_t ret_ref = tag_ptr(ret_copy, true);
19975         return ret_ref;
19976 }
19977
19978 int8_tArray  __attribute__((export_name("TS_Event_write"))) TS_Event_write(uint64_t obj) {
19979         LDKEvent* obj_conv = (LDKEvent*)untag_ptr(obj);
19980         LDKCVec_u8Z ret_var = Event_write(obj_conv);
19981         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
19982         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
19983         CVec_u8Z_free(ret_var);
19984         return ret_arr;
19985 }
19986
19987 uint64_t  __attribute__((export_name("TS_Event_read"))) TS_Event_read(int8_tArray ser) {
19988         LDKu8slice ser_ref;
19989         ser_ref.datalen = ser->arr_len;
19990         ser_ref.data = ser->elems;
19991         LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
19992         *ret_conv = Event_read(ser_ref);
19993         FREE(ser);
19994         return tag_ptr(ret_conv, true);
19995 }
19996
19997 void  __attribute__((export_name("TS_MessageSendEvent_free"))) TS_MessageSendEvent_free(uint64_t this_ptr) {
19998         if (!ptr_is_owned(this_ptr)) return;
19999         void* this_ptr_ptr = untag_ptr(this_ptr);
20000         CHECK_ACCESS(this_ptr_ptr);
20001         LDKMessageSendEvent this_ptr_conv = *(LDKMessageSendEvent*)(this_ptr_ptr);
20002         FREE(untag_ptr(this_ptr));
20003         MessageSendEvent_free(this_ptr_conv);
20004 }
20005
20006 static inline uint64_t MessageSendEvent_clone_ptr(LDKMessageSendEvent *NONNULL_PTR arg) {
20007         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
20008         *ret_copy = MessageSendEvent_clone(arg);
20009         uint64_t ret_ref = tag_ptr(ret_copy, true);
20010         return ret_ref;
20011 }
20012 int64_t  __attribute__((export_name("TS_MessageSendEvent_clone_ptr"))) TS_MessageSendEvent_clone_ptr(uint64_t arg) {
20013         LDKMessageSendEvent* arg_conv = (LDKMessageSendEvent*)untag_ptr(arg);
20014         int64_t ret_conv = MessageSendEvent_clone_ptr(arg_conv);
20015         return ret_conv;
20016 }
20017
20018 uint64_t  __attribute__((export_name("TS_MessageSendEvent_clone"))) TS_MessageSendEvent_clone(uint64_t orig) {
20019         LDKMessageSendEvent* orig_conv = (LDKMessageSendEvent*)untag_ptr(orig);
20020         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
20021         *ret_copy = MessageSendEvent_clone(orig_conv);
20022         uint64_t ret_ref = tag_ptr(ret_copy, true);
20023         return ret_ref;
20024 }
20025
20026 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_accept_channel"))) TS_MessageSendEvent_send_accept_channel(int8_tArray node_id, uint64_t msg) {
20027         LDKPublicKey node_id_ref;
20028         CHECK(node_id->arr_len == 33);
20029         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
20030         LDKAcceptChannel msg_conv;
20031         msg_conv.inner = untag_ptr(msg);
20032         msg_conv.is_owned = ptr_is_owned(msg);
20033         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
20034         msg_conv = AcceptChannel_clone(&msg_conv);
20035         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
20036         *ret_copy = MessageSendEvent_send_accept_channel(node_id_ref, msg_conv);
20037         uint64_t ret_ref = tag_ptr(ret_copy, true);
20038         return ret_ref;
20039 }
20040
20041 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_open_channel"))) TS_MessageSendEvent_send_open_channel(int8_tArray node_id, uint64_t msg) {
20042         LDKPublicKey node_id_ref;
20043         CHECK(node_id->arr_len == 33);
20044         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
20045         LDKOpenChannel msg_conv;
20046         msg_conv.inner = untag_ptr(msg);
20047         msg_conv.is_owned = ptr_is_owned(msg);
20048         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
20049         msg_conv = OpenChannel_clone(&msg_conv);
20050         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
20051         *ret_copy = MessageSendEvent_send_open_channel(node_id_ref, msg_conv);
20052         uint64_t ret_ref = tag_ptr(ret_copy, true);
20053         return ret_ref;
20054 }
20055
20056 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_funding_created"))) TS_MessageSendEvent_send_funding_created(int8_tArray node_id, uint64_t msg) {
20057         LDKPublicKey node_id_ref;
20058         CHECK(node_id->arr_len == 33);
20059         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
20060         LDKFundingCreated msg_conv;
20061         msg_conv.inner = untag_ptr(msg);
20062         msg_conv.is_owned = ptr_is_owned(msg);
20063         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
20064         msg_conv = FundingCreated_clone(&msg_conv);
20065         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
20066         *ret_copy = MessageSendEvent_send_funding_created(node_id_ref, msg_conv);
20067         uint64_t ret_ref = tag_ptr(ret_copy, true);
20068         return ret_ref;
20069 }
20070
20071 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_funding_signed"))) TS_MessageSendEvent_send_funding_signed(int8_tArray node_id, uint64_t msg) {
20072         LDKPublicKey node_id_ref;
20073         CHECK(node_id->arr_len == 33);
20074         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
20075         LDKFundingSigned msg_conv;
20076         msg_conv.inner = untag_ptr(msg);
20077         msg_conv.is_owned = ptr_is_owned(msg);
20078         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
20079         msg_conv = FundingSigned_clone(&msg_conv);
20080         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
20081         *ret_copy = MessageSendEvent_send_funding_signed(node_id_ref, msg_conv);
20082         uint64_t ret_ref = tag_ptr(ret_copy, true);
20083         return ret_ref;
20084 }
20085
20086 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_channel_ready"))) TS_MessageSendEvent_send_channel_ready(int8_tArray node_id, uint64_t msg) {
20087         LDKPublicKey node_id_ref;
20088         CHECK(node_id->arr_len == 33);
20089         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
20090         LDKChannelReady msg_conv;
20091         msg_conv.inner = untag_ptr(msg);
20092         msg_conv.is_owned = ptr_is_owned(msg);
20093         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
20094         msg_conv = ChannelReady_clone(&msg_conv);
20095         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
20096         *ret_copy = MessageSendEvent_send_channel_ready(node_id_ref, msg_conv);
20097         uint64_t ret_ref = tag_ptr(ret_copy, true);
20098         return ret_ref;
20099 }
20100
20101 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_announcement_signatures"))) TS_MessageSendEvent_send_announcement_signatures(int8_tArray node_id, uint64_t msg) {
20102         LDKPublicKey node_id_ref;
20103         CHECK(node_id->arr_len == 33);
20104         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
20105         LDKAnnouncementSignatures msg_conv;
20106         msg_conv.inner = untag_ptr(msg);
20107         msg_conv.is_owned = ptr_is_owned(msg);
20108         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
20109         msg_conv = AnnouncementSignatures_clone(&msg_conv);
20110         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
20111         *ret_copy = MessageSendEvent_send_announcement_signatures(node_id_ref, msg_conv);
20112         uint64_t ret_ref = tag_ptr(ret_copy, true);
20113         return ret_ref;
20114 }
20115
20116 uint64_t  __attribute__((export_name("TS_MessageSendEvent_update_htlcs"))) TS_MessageSendEvent_update_htlcs(int8_tArray node_id, uint64_t updates) {
20117         LDKPublicKey node_id_ref;
20118         CHECK(node_id->arr_len == 33);
20119         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
20120         LDKCommitmentUpdate updates_conv;
20121         updates_conv.inner = untag_ptr(updates);
20122         updates_conv.is_owned = ptr_is_owned(updates);
20123         CHECK_INNER_FIELD_ACCESS_OR_NULL(updates_conv);
20124         updates_conv = CommitmentUpdate_clone(&updates_conv);
20125         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
20126         *ret_copy = MessageSendEvent_update_htlcs(node_id_ref, updates_conv);
20127         uint64_t ret_ref = tag_ptr(ret_copy, true);
20128         return ret_ref;
20129 }
20130
20131 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_revoke_and_ack"))) TS_MessageSendEvent_send_revoke_and_ack(int8_tArray node_id, uint64_t msg) {
20132         LDKPublicKey node_id_ref;
20133         CHECK(node_id->arr_len == 33);
20134         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
20135         LDKRevokeAndACK msg_conv;
20136         msg_conv.inner = untag_ptr(msg);
20137         msg_conv.is_owned = ptr_is_owned(msg);
20138         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
20139         msg_conv = RevokeAndACK_clone(&msg_conv);
20140         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
20141         *ret_copy = MessageSendEvent_send_revoke_and_ack(node_id_ref, msg_conv);
20142         uint64_t ret_ref = tag_ptr(ret_copy, true);
20143         return ret_ref;
20144 }
20145
20146 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_closing_signed"))) TS_MessageSendEvent_send_closing_signed(int8_tArray node_id, uint64_t msg) {
20147         LDKPublicKey node_id_ref;
20148         CHECK(node_id->arr_len == 33);
20149         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
20150         LDKClosingSigned msg_conv;
20151         msg_conv.inner = untag_ptr(msg);
20152         msg_conv.is_owned = ptr_is_owned(msg);
20153         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
20154         msg_conv = ClosingSigned_clone(&msg_conv);
20155         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
20156         *ret_copy = MessageSendEvent_send_closing_signed(node_id_ref, msg_conv);
20157         uint64_t ret_ref = tag_ptr(ret_copy, true);
20158         return ret_ref;
20159 }
20160
20161 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_shutdown"))) TS_MessageSendEvent_send_shutdown(int8_tArray node_id, uint64_t msg) {
20162         LDKPublicKey node_id_ref;
20163         CHECK(node_id->arr_len == 33);
20164         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
20165         LDKShutdown msg_conv;
20166         msg_conv.inner = untag_ptr(msg);
20167         msg_conv.is_owned = ptr_is_owned(msg);
20168         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
20169         msg_conv = Shutdown_clone(&msg_conv);
20170         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
20171         *ret_copy = MessageSendEvent_send_shutdown(node_id_ref, msg_conv);
20172         uint64_t ret_ref = tag_ptr(ret_copy, true);
20173         return ret_ref;
20174 }
20175
20176 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_channel_reestablish"))) TS_MessageSendEvent_send_channel_reestablish(int8_tArray node_id, uint64_t msg) {
20177         LDKPublicKey node_id_ref;
20178         CHECK(node_id->arr_len == 33);
20179         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
20180         LDKChannelReestablish msg_conv;
20181         msg_conv.inner = untag_ptr(msg);
20182         msg_conv.is_owned = ptr_is_owned(msg);
20183         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
20184         msg_conv = ChannelReestablish_clone(&msg_conv);
20185         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
20186         *ret_copy = MessageSendEvent_send_channel_reestablish(node_id_ref, msg_conv);
20187         uint64_t ret_ref = tag_ptr(ret_copy, true);
20188         return ret_ref;
20189 }
20190
20191 uint64_t  __attribute__((export_name("TS_MessageSendEvent_broadcast_channel_announcement"))) TS_MessageSendEvent_broadcast_channel_announcement(uint64_t msg, uint64_t update_msg) {
20192         LDKChannelAnnouncement msg_conv;
20193         msg_conv.inner = untag_ptr(msg);
20194         msg_conv.is_owned = ptr_is_owned(msg);
20195         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
20196         msg_conv = ChannelAnnouncement_clone(&msg_conv);
20197         LDKChannelUpdate update_msg_conv;
20198         update_msg_conv.inner = untag_ptr(update_msg);
20199         update_msg_conv.is_owned = ptr_is_owned(update_msg);
20200         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_msg_conv);
20201         update_msg_conv = ChannelUpdate_clone(&update_msg_conv);
20202         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
20203         *ret_copy = MessageSendEvent_broadcast_channel_announcement(msg_conv, update_msg_conv);
20204         uint64_t ret_ref = tag_ptr(ret_copy, true);
20205         return ret_ref;
20206 }
20207
20208 uint64_t  __attribute__((export_name("TS_MessageSendEvent_broadcast_node_announcement"))) TS_MessageSendEvent_broadcast_node_announcement(uint64_t msg) {
20209         LDKNodeAnnouncement msg_conv;
20210         msg_conv.inner = untag_ptr(msg);
20211         msg_conv.is_owned = ptr_is_owned(msg);
20212         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
20213         msg_conv = NodeAnnouncement_clone(&msg_conv);
20214         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
20215         *ret_copy = MessageSendEvent_broadcast_node_announcement(msg_conv);
20216         uint64_t ret_ref = tag_ptr(ret_copy, true);
20217         return ret_ref;
20218 }
20219
20220 uint64_t  __attribute__((export_name("TS_MessageSendEvent_broadcast_channel_update"))) TS_MessageSendEvent_broadcast_channel_update(uint64_t msg) {
20221         LDKChannelUpdate msg_conv;
20222         msg_conv.inner = untag_ptr(msg);
20223         msg_conv.is_owned = ptr_is_owned(msg);
20224         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
20225         msg_conv = ChannelUpdate_clone(&msg_conv);
20226         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
20227         *ret_copy = MessageSendEvent_broadcast_channel_update(msg_conv);
20228         uint64_t ret_ref = tag_ptr(ret_copy, true);
20229         return ret_ref;
20230 }
20231
20232 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_channel_update"))) TS_MessageSendEvent_send_channel_update(int8_tArray node_id, uint64_t msg) {
20233         LDKPublicKey node_id_ref;
20234         CHECK(node_id->arr_len == 33);
20235         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
20236         LDKChannelUpdate msg_conv;
20237         msg_conv.inner = untag_ptr(msg);
20238         msg_conv.is_owned = ptr_is_owned(msg);
20239         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
20240         msg_conv = ChannelUpdate_clone(&msg_conv);
20241         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
20242         *ret_copy = MessageSendEvent_send_channel_update(node_id_ref, msg_conv);
20243         uint64_t ret_ref = tag_ptr(ret_copy, true);
20244         return ret_ref;
20245 }
20246
20247 uint64_t  __attribute__((export_name("TS_MessageSendEvent_handle_error"))) TS_MessageSendEvent_handle_error(int8_tArray node_id, uint64_t action) {
20248         LDKPublicKey node_id_ref;
20249         CHECK(node_id->arr_len == 33);
20250         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
20251         void* action_ptr = untag_ptr(action);
20252         CHECK_ACCESS(action_ptr);
20253         LDKErrorAction action_conv = *(LDKErrorAction*)(action_ptr);
20254         action_conv = ErrorAction_clone((LDKErrorAction*)untag_ptr(action));
20255         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
20256         *ret_copy = MessageSendEvent_handle_error(node_id_ref, action_conv);
20257         uint64_t ret_ref = tag_ptr(ret_copy, true);
20258         return ret_ref;
20259 }
20260
20261 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_channel_range_query"))) TS_MessageSendEvent_send_channel_range_query(int8_tArray node_id, uint64_t msg) {
20262         LDKPublicKey node_id_ref;
20263         CHECK(node_id->arr_len == 33);
20264         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
20265         LDKQueryChannelRange msg_conv;
20266         msg_conv.inner = untag_ptr(msg);
20267         msg_conv.is_owned = ptr_is_owned(msg);
20268         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
20269         msg_conv = QueryChannelRange_clone(&msg_conv);
20270         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
20271         *ret_copy = MessageSendEvent_send_channel_range_query(node_id_ref, msg_conv);
20272         uint64_t ret_ref = tag_ptr(ret_copy, true);
20273         return ret_ref;
20274 }
20275
20276 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_short_ids_query"))) TS_MessageSendEvent_send_short_ids_query(int8_tArray node_id, uint64_t msg) {
20277         LDKPublicKey node_id_ref;
20278         CHECK(node_id->arr_len == 33);
20279         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
20280         LDKQueryShortChannelIds msg_conv;
20281         msg_conv.inner = untag_ptr(msg);
20282         msg_conv.is_owned = ptr_is_owned(msg);
20283         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
20284         msg_conv = QueryShortChannelIds_clone(&msg_conv);
20285         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
20286         *ret_copy = MessageSendEvent_send_short_ids_query(node_id_ref, msg_conv);
20287         uint64_t ret_ref = tag_ptr(ret_copy, true);
20288         return ret_ref;
20289 }
20290
20291 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_reply_channel_range"))) TS_MessageSendEvent_send_reply_channel_range(int8_tArray node_id, uint64_t msg) {
20292         LDKPublicKey node_id_ref;
20293         CHECK(node_id->arr_len == 33);
20294         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
20295         LDKReplyChannelRange msg_conv;
20296         msg_conv.inner = untag_ptr(msg);
20297         msg_conv.is_owned = ptr_is_owned(msg);
20298         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
20299         msg_conv = ReplyChannelRange_clone(&msg_conv);
20300         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
20301         *ret_copy = MessageSendEvent_send_reply_channel_range(node_id_ref, msg_conv);
20302         uint64_t ret_ref = tag_ptr(ret_copy, true);
20303         return ret_ref;
20304 }
20305
20306 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_gossip_timestamp_filter"))) TS_MessageSendEvent_send_gossip_timestamp_filter(int8_tArray node_id, uint64_t msg) {
20307         LDKPublicKey node_id_ref;
20308         CHECK(node_id->arr_len == 33);
20309         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
20310         LDKGossipTimestampFilter msg_conv;
20311         msg_conv.inner = untag_ptr(msg);
20312         msg_conv.is_owned = ptr_is_owned(msg);
20313         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
20314         msg_conv = GossipTimestampFilter_clone(&msg_conv);
20315         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
20316         *ret_copy = MessageSendEvent_send_gossip_timestamp_filter(node_id_ref, msg_conv);
20317         uint64_t ret_ref = tag_ptr(ret_copy, true);
20318         return ret_ref;
20319 }
20320
20321 void  __attribute__((export_name("TS_MessageSendEventsProvider_free"))) TS_MessageSendEventsProvider_free(uint64_t this_ptr) {
20322         if (!ptr_is_owned(this_ptr)) return;
20323         void* this_ptr_ptr = untag_ptr(this_ptr);
20324         CHECK_ACCESS(this_ptr_ptr);
20325         LDKMessageSendEventsProvider this_ptr_conv = *(LDKMessageSendEventsProvider*)(this_ptr_ptr);
20326         FREE(untag_ptr(this_ptr));
20327         MessageSendEventsProvider_free(this_ptr_conv);
20328 }
20329
20330 void  __attribute__((export_name("TS_EventsProvider_free"))) TS_EventsProvider_free(uint64_t this_ptr) {
20331         if (!ptr_is_owned(this_ptr)) return;
20332         void* this_ptr_ptr = untag_ptr(this_ptr);
20333         CHECK_ACCESS(this_ptr_ptr);
20334         LDKEventsProvider this_ptr_conv = *(LDKEventsProvider*)(this_ptr_ptr);
20335         FREE(untag_ptr(this_ptr));
20336         EventsProvider_free(this_ptr_conv);
20337 }
20338
20339 void  __attribute__((export_name("TS_EventHandler_free"))) TS_EventHandler_free(uint64_t this_ptr) {
20340         if (!ptr_is_owned(this_ptr)) return;
20341         void* this_ptr_ptr = untag_ptr(this_ptr);
20342         CHECK_ACCESS(this_ptr_ptr);
20343         LDKEventHandler this_ptr_conv = *(LDKEventHandler*)(this_ptr_ptr);
20344         FREE(untag_ptr(this_ptr));
20345         EventHandler_free(this_ptr_conv);
20346 }
20347
20348 void  __attribute__((export_name("TS_APIError_free"))) TS_APIError_free(uint64_t this_ptr) {
20349         if (!ptr_is_owned(this_ptr)) return;
20350         void* this_ptr_ptr = untag_ptr(this_ptr);
20351         CHECK_ACCESS(this_ptr_ptr);
20352         LDKAPIError this_ptr_conv = *(LDKAPIError*)(this_ptr_ptr);
20353         FREE(untag_ptr(this_ptr));
20354         APIError_free(this_ptr_conv);
20355 }
20356
20357 static inline uint64_t APIError_clone_ptr(LDKAPIError *NONNULL_PTR arg) {
20358         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
20359         *ret_copy = APIError_clone(arg);
20360         uint64_t ret_ref = tag_ptr(ret_copy, true);
20361         return ret_ref;
20362 }
20363 int64_t  __attribute__((export_name("TS_APIError_clone_ptr"))) TS_APIError_clone_ptr(uint64_t arg) {
20364         LDKAPIError* arg_conv = (LDKAPIError*)untag_ptr(arg);
20365         int64_t ret_conv = APIError_clone_ptr(arg_conv);
20366         return ret_conv;
20367 }
20368
20369 uint64_t  __attribute__((export_name("TS_APIError_clone"))) TS_APIError_clone(uint64_t orig) {
20370         LDKAPIError* orig_conv = (LDKAPIError*)untag_ptr(orig);
20371         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
20372         *ret_copy = APIError_clone(orig_conv);
20373         uint64_t ret_ref = tag_ptr(ret_copy, true);
20374         return ret_ref;
20375 }
20376
20377 uint64_t  __attribute__((export_name("TS_APIError_apimisuse_error"))) TS_APIError_apimisuse_error(jstring err) {
20378         LDKStr err_conv = str_ref_to_owned_c(err);
20379         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
20380         *ret_copy = APIError_apimisuse_error(err_conv);
20381         uint64_t ret_ref = tag_ptr(ret_copy, true);
20382         return ret_ref;
20383 }
20384
20385 uint64_t  __attribute__((export_name("TS_APIError_fee_rate_too_high"))) TS_APIError_fee_rate_too_high(jstring err, int32_t feerate) {
20386         LDKStr err_conv = str_ref_to_owned_c(err);
20387         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
20388         *ret_copy = APIError_fee_rate_too_high(err_conv, feerate);
20389         uint64_t ret_ref = tag_ptr(ret_copy, true);
20390         return ret_ref;
20391 }
20392
20393 uint64_t  __attribute__((export_name("TS_APIError_route_error"))) TS_APIError_route_error(jstring err) {
20394         LDKStr err_conv = str_ref_to_owned_c(err);
20395         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
20396         *ret_copy = APIError_route_error(err_conv);
20397         uint64_t ret_ref = tag_ptr(ret_copy, true);
20398         return ret_ref;
20399 }
20400
20401 uint64_t  __attribute__((export_name("TS_APIError_channel_unavailable"))) TS_APIError_channel_unavailable(jstring err) {
20402         LDKStr err_conv = str_ref_to_owned_c(err);
20403         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
20404         *ret_copy = APIError_channel_unavailable(err_conv);
20405         uint64_t ret_ref = tag_ptr(ret_copy, true);
20406         return ret_ref;
20407 }
20408
20409 uint64_t  __attribute__((export_name("TS_APIError_monitor_update_failed"))) TS_APIError_monitor_update_failed() {
20410         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
20411         *ret_copy = APIError_monitor_update_failed();
20412         uint64_t ret_ref = tag_ptr(ret_copy, true);
20413         return ret_ref;
20414 }
20415
20416 uint64_t  __attribute__((export_name("TS_APIError_incompatible_shutdown_script"))) TS_APIError_incompatible_shutdown_script(uint64_t script) {
20417         LDKShutdownScript script_conv;
20418         script_conv.inner = untag_ptr(script);
20419         script_conv.is_owned = ptr_is_owned(script);
20420         CHECK_INNER_FIELD_ACCESS_OR_NULL(script_conv);
20421         script_conv = ShutdownScript_clone(&script_conv);
20422         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
20423         *ret_copy = APIError_incompatible_shutdown_script(script_conv);
20424         uint64_t ret_ref = tag_ptr(ret_copy, true);
20425         return ret_ref;
20426 }
20427
20428 void  __attribute__((export_name("TS_BigSize_free"))) TS_BigSize_free(uint64_t this_obj) {
20429         LDKBigSize this_obj_conv;
20430         this_obj_conv.inner = untag_ptr(this_obj);
20431         this_obj_conv.is_owned = ptr_is_owned(this_obj);
20432         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
20433         BigSize_free(this_obj_conv);
20434 }
20435
20436 int64_t  __attribute__((export_name("TS_BigSize_get_a"))) TS_BigSize_get_a(uint64_t this_ptr) {
20437         LDKBigSize this_ptr_conv;
20438         this_ptr_conv.inner = untag_ptr(this_ptr);
20439         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
20440         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20441         this_ptr_conv.is_owned = false;
20442         int64_t ret_conv = BigSize_get_a(&this_ptr_conv);
20443         return ret_conv;
20444 }
20445
20446 void  __attribute__((export_name("TS_BigSize_set_a"))) TS_BigSize_set_a(uint64_t this_ptr, int64_t val) {
20447         LDKBigSize this_ptr_conv;
20448         this_ptr_conv.inner = untag_ptr(this_ptr);
20449         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
20450         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20451         this_ptr_conv.is_owned = false;
20452         BigSize_set_a(&this_ptr_conv, val);
20453 }
20454
20455 uint64_t  __attribute__((export_name("TS_BigSize_new"))) TS_BigSize_new(int64_t a_arg) {
20456         LDKBigSize ret_var = BigSize_new(a_arg);
20457         uint64_t ret_ref = 0;
20458         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
20459         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
20460         return ret_ref;
20461 }
20462
20463 void  __attribute__((export_name("TS_Hostname_free"))) TS_Hostname_free(uint64_t this_obj) {
20464         LDKHostname this_obj_conv;
20465         this_obj_conv.inner = untag_ptr(this_obj);
20466         this_obj_conv.is_owned = ptr_is_owned(this_obj);
20467         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
20468         Hostname_free(this_obj_conv);
20469 }
20470
20471 static inline uint64_t Hostname_clone_ptr(LDKHostname *NONNULL_PTR arg) {
20472         LDKHostname ret_var = Hostname_clone(arg);
20473         uint64_t ret_ref = 0;
20474         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
20475         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
20476         return ret_ref;
20477 }
20478 int64_t  __attribute__((export_name("TS_Hostname_clone_ptr"))) TS_Hostname_clone_ptr(uint64_t arg) {
20479         LDKHostname arg_conv;
20480         arg_conv.inner = untag_ptr(arg);
20481         arg_conv.is_owned = ptr_is_owned(arg);
20482         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
20483         arg_conv.is_owned = false;
20484         int64_t ret_conv = Hostname_clone_ptr(&arg_conv);
20485         return ret_conv;
20486 }
20487
20488 uint64_t  __attribute__((export_name("TS_Hostname_clone"))) TS_Hostname_clone(uint64_t orig) {
20489         LDKHostname orig_conv;
20490         orig_conv.inner = untag_ptr(orig);
20491         orig_conv.is_owned = ptr_is_owned(orig);
20492         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
20493         orig_conv.is_owned = false;
20494         LDKHostname ret_var = Hostname_clone(&orig_conv);
20495         uint64_t ret_ref = 0;
20496         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
20497         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
20498         return ret_ref;
20499 }
20500
20501 int8_t  __attribute__((export_name("TS_Hostname_len"))) TS_Hostname_len(uint64_t this_arg) {
20502         LDKHostname this_arg_conv;
20503         this_arg_conv.inner = untag_ptr(this_arg);
20504         this_arg_conv.is_owned = ptr_is_owned(this_arg);
20505         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
20506         this_arg_conv.is_owned = false;
20507         int8_t ret_conv = Hostname_len(&this_arg_conv);
20508         return ret_conv;
20509 }
20510
20511 uint64_t  __attribute__((export_name("TS_sign"))) TS_sign(int8_tArray msg, int8_tArray sk) {
20512         LDKu8slice msg_ref;
20513         msg_ref.datalen = msg->arr_len;
20514         msg_ref.data = msg->elems;
20515         unsigned char sk_arr[32];
20516         CHECK(sk->arr_len == 32);
20517         memcpy(sk_arr, sk->elems, 32); FREE(sk);
20518         unsigned char (*sk_ref)[32] = &sk_arr;
20519         LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
20520         *ret_conv = sign(msg_ref, sk_ref);
20521         FREE(msg);
20522         return tag_ptr(ret_conv, true);
20523 }
20524
20525 uint64_t  __attribute__((export_name("TS_recover_pk"))) TS_recover_pk(int8_tArray msg, jstring sig) {
20526         LDKu8slice msg_ref;
20527         msg_ref.datalen = msg->arr_len;
20528         msg_ref.data = msg->elems;
20529         LDKStr sig_conv = str_ref_to_owned_c(sig);
20530         LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
20531         *ret_conv = recover_pk(msg_ref, sig_conv);
20532         FREE(msg);
20533         return tag_ptr(ret_conv, true);
20534 }
20535
20536 jboolean  __attribute__((export_name("TS_verify"))) TS_verify(int8_tArray msg, jstring sig, int8_tArray pk) {
20537         LDKu8slice msg_ref;
20538         msg_ref.datalen = msg->arr_len;
20539         msg_ref.data = msg->elems;
20540         LDKStr sig_conv = str_ref_to_owned_c(sig);
20541         LDKPublicKey pk_ref;
20542         CHECK(pk->arr_len == 33);
20543         memcpy(pk_ref.compressed_form, pk->elems, 33); FREE(pk);
20544         jboolean ret_conv = verify(msg_ref, sig_conv, pk_ref);
20545         FREE(msg);
20546         return ret_conv;
20547 }
20548
20549 int8_tArray  __attribute__((export_name("TS_construct_invoice_preimage"))) TS_construct_invoice_preimage(int8_tArray hrp_bytes, ptrArray data_without_signature) {
20550         LDKu8slice hrp_bytes_ref;
20551         hrp_bytes_ref.datalen = hrp_bytes->arr_len;
20552         hrp_bytes_ref.data = hrp_bytes->elems;
20553         LDKCVec_u5Z data_without_signature_constr;
20554         data_without_signature_constr.datalen = data_without_signature->arr_len;
20555         if (data_without_signature_constr.datalen > 0)
20556                 data_without_signature_constr.data = MALLOC(data_without_signature_constr.datalen * sizeof(LDKu5), "LDKCVec_u5Z Elements");
20557         else
20558                 data_without_signature_constr.data = NULL;
20559         int8_t* data_without_signature_vals = (void*) data_without_signature->elems;
20560         for (size_t h = 0; h < data_without_signature_constr.datalen; h++) {
20561                 int8_t data_without_signature_conv_7 = data_without_signature_vals[h];
20562                 
20563                 data_without_signature_constr.data[h] = (LDKu5){ ._0 = data_without_signature_conv_7 };
20564         }
20565         FREE(data_without_signature);
20566         LDKCVec_u8Z ret_var = construct_invoice_preimage(hrp_bytes_ref, data_without_signature_constr);
20567         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
20568         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
20569         CVec_u8Z_free(ret_var);
20570         FREE(hrp_bytes);
20571         return ret_arr;
20572 }
20573
20574 void  __attribute__((export_name("TS_Persister_free"))) TS_Persister_free(uint64_t this_ptr) {
20575         if (!ptr_is_owned(this_ptr)) return;
20576         void* this_ptr_ptr = untag_ptr(this_ptr);
20577         CHECK_ACCESS(this_ptr_ptr);
20578         LDKPersister this_ptr_conv = *(LDKPersister*)(this_ptr_ptr);
20579         FREE(untag_ptr(this_ptr));
20580         Persister_free(this_ptr_conv);
20581 }
20582
20583 uint32_t  __attribute__((export_name("TS_Level_clone"))) TS_Level_clone(uint64_t orig) {
20584         LDKLevel* orig_conv = (LDKLevel*)untag_ptr(orig);
20585         uint32_t ret_conv = LDKLevel_to_js(Level_clone(orig_conv));
20586         return ret_conv;
20587 }
20588
20589 uint32_t  __attribute__((export_name("TS_Level_gossip"))) TS_Level_gossip() {
20590         uint32_t ret_conv = LDKLevel_to_js(Level_gossip());
20591         return ret_conv;
20592 }
20593
20594 uint32_t  __attribute__((export_name("TS_Level_trace"))) TS_Level_trace() {
20595         uint32_t ret_conv = LDKLevel_to_js(Level_trace());
20596         return ret_conv;
20597 }
20598
20599 uint32_t  __attribute__((export_name("TS_Level_debug"))) TS_Level_debug() {
20600         uint32_t ret_conv = LDKLevel_to_js(Level_debug());
20601         return ret_conv;
20602 }
20603
20604 uint32_t  __attribute__((export_name("TS_Level_info"))) TS_Level_info() {
20605         uint32_t ret_conv = LDKLevel_to_js(Level_info());
20606         return ret_conv;
20607 }
20608
20609 uint32_t  __attribute__((export_name("TS_Level_warn"))) TS_Level_warn() {
20610         uint32_t ret_conv = LDKLevel_to_js(Level_warn());
20611         return ret_conv;
20612 }
20613
20614 uint32_t  __attribute__((export_name("TS_Level_error"))) TS_Level_error() {
20615         uint32_t ret_conv = LDKLevel_to_js(Level_error());
20616         return ret_conv;
20617 }
20618
20619 jboolean  __attribute__((export_name("TS_Level_eq"))) TS_Level_eq(uint64_t a, uint64_t b) {
20620         LDKLevel* a_conv = (LDKLevel*)untag_ptr(a);
20621         LDKLevel* b_conv = (LDKLevel*)untag_ptr(b);
20622         jboolean ret_conv = Level_eq(a_conv, b_conv);
20623         return ret_conv;
20624 }
20625
20626 int64_t  __attribute__((export_name("TS_Level_hash"))) TS_Level_hash(uint64_t o) {
20627         LDKLevel* o_conv = (LDKLevel*)untag_ptr(o);
20628         int64_t ret_conv = Level_hash(o_conv);
20629         return ret_conv;
20630 }
20631
20632 uint32_t  __attribute__((export_name("TS_Level_max"))) TS_Level_max() {
20633         uint32_t ret_conv = LDKLevel_to_js(Level_max());
20634         return ret_conv;
20635 }
20636
20637 void  __attribute__((export_name("TS_Record_free"))) TS_Record_free(uint64_t this_obj) {
20638         LDKRecord this_obj_conv;
20639         this_obj_conv.inner = untag_ptr(this_obj);
20640         this_obj_conv.is_owned = ptr_is_owned(this_obj);
20641         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
20642         Record_free(this_obj_conv);
20643 }
20644
20645 uint32_t  __attribute__((export_name("TS_Record_get_level"))) TS_Record_get_level(uint64_t this_ptr) {
20646         LDKRecord this_ptr_conv;
20647         this_ptr_conv.inner = untag_ptr(this_ptr);
20648         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
20649         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20650         this_ptr_conv.is_owned = false;
20651         uint32_t ret_conv = LDKLevel_to_js(Record_get_level(&this_ptr_conv));
20652         return ret_conv;
20653 }
20654
20655 void  __attribute__((export_name("TS_Record_set_level"))) TS_Record_set_level(uint64_t this_ptr, uint32_t val) {
20656         LDKRecord this_ptr_conv;
20657         this_ptr_conv.inner = untag_ptr(this_ptr);
20658         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
20659         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20660         this_ptr_conv.is_owned = false;
20661         LDKLevel val_conv = LDKLevel_from_js(val);
20662         Record_set_level(&this_ptr_conv, val_conv);
20663 }
20664
20665 jstring  __attribute__((export_name("TS_Record_get_args"))) TS_Record_get_args(uint64_t this_ptr) {
20666         LDKRecord this_ptr_conv;
20667         this_ptr_conv.inner = untag_ptr(this_ptr);
20668         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
20669         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20670         this_ptr_conv.is_owned = false;
20671         LDKStr ret_str = Record_get_args(&this_ptr_conv);
20672         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
20673         Str_free(ret_str);
20674         return ret_conv;
20675 }
20676
20677 void  __attribute__((export_name("TS_Record_set_args"))) TS_Record_set_args(uint64_t this_ptr, jstring val) {
20678         LDKRecord this_ptr_conv;
20679         this_ptr_conv.inner = untag_ptr(this_ptr);
20680         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
20681         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20682         this_ptr_conv.is_owned = false;
20683         LDKStr val_conv = str_ref_to_owned_c(val);
20684         Record_set_args(&this_ptr_conv, val_conv);
20685 }
20686
20687 jstring  __attribute__((export_name("TS_Record_get_module_path"))) TS_Record_get_module_path(uint64_t this_ptr) {
20688         LDKRecord this_ptr_conv;
20689         this_ptr_conv.inner = untag_ptr(this_ptr);
20690         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
20691         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20692         this_ptr_conv.is_owned = false;
20693         LDKStr ret_str = Record_get_module_path(&this_ptr_conv);
20694         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
20695         Str_free(ret_str);
20696         return ret_conv;
20697 }
20698
20699 void  __attribute__((export_name("TS_Record_set_module_path"))) TS_Record_set_module_path(uint64_t this_ptr, jstring val) {
20700         LDKRecord this_ptr_conv;
20701         this_ptr_conv.inner = untag_ptr(this_ptr);
20702         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
20703         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20704         this_ptr_conv.is_owned = false;
20705         LDKStr val_conv = str_ref_to_owned_c(val);
20706         Record_set_module_path(&this_ptr_conv, val_conv);
20707 }
20708
20709 jstring  __attribute__((export_name("TS_Record_get_file"))) TS_Record_get_file(uint64_t this_ptr) {
20710         LDKRecord this_ptr_conv;
20711         this_ptr_conv.inner = untag_ptr(this_ptr);
20712         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
20713         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20714         this_ptr_conv.is_owned = false;
20715         LDKStr ret_str = Record_get_file(&this_ptr_conv);
20716         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
20717         Str_free(ret_str);
20718         return ret_conv;
20719 }
20720
20721 void  __attribute__((export_name("TS_Record_set_file"))) TS_Record_set_file(uint64_t this_ptr, jstring val) {
20722         LDKRecord this_ptr_conv;
20723         this_ptr_conv.inner = untag_ptr(this_ptr);
20724         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
20725         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20726         this_ptr_conv.is_owned = false;
20727         LDKStr val_conv = str_ref_to_owned_c(val);
20728         Record_set_file(&this_ptr_conv, val_conv);
20729 }
20730
20731 int32_t  __attribute__((export_name("TS_Record_get_line"))) TS_Record_get_line(uint64_t this_ptr) {
20732         LDKRecord this_ptr_conv;
20733         this_ptr_conv.inner = untag_ptr(this_ptr);
20734         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
20735         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20736         this_ptr_conv.is_owned = false;
20737         int32_t ret_conv = Record_get_line(&this_ptr_conv);
20738         return ret_conv;
20739 }
20740
20741 void  __attribute__((export_name("TS_Record_set_line"))) TS_Record_set_line(uint64_t this_ptr, int32_t val) {
20742         LDKRecord this_ptr_conv;
20743         this_ptr_conv.inner = untag_ptr(this_ptr);
20744         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
20745         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20746         this_ptr_conv.is_owned = false;
20747         Record_set_line(&this_ptr_conv, val);
20748 }
20749
20750 static inline uint64_t Record_clone_ptr(LDKRecord *NONNULL_PTR arg) {
20751         LDKRecord ret_var = Record_clone(arg);
20752         uint64_t ret_ref = 0;
20753         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
20754         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
20755         return ret_ref;
20756 }
20757 int64_t  __attribute__((export_name("TS_Record_clone_ptr"))) TS_Record_clone_ptr(uint64_t arg) {
20758         LDKRecord arg_conv;
20759         arg_conv.inner = untag_ptr(arg);
20760         arg_conv.is_owned = ptr_is_owned(arg);
20761         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
20762         arg_conv.is_owned = false;
20763         int64_t ret_conv = Record_clone_ptr(&arg_conv);
20764         return ret_conv;
20765 }
20766
20767 uint64_t  __attribute__((export_name("TS_Record_clone"))) TS_Record_clone(uint64_t orig) {
20768         LDKRecord orig_conv;
20769         orig_conv.inner = untag_ptr(orig);
20770         orig_conv.is_owned = ptr_is_owned(orig);
20771         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
20772         orig_conv.is_owned = false;
20773         LDKRecord ret_var = Record_clone(&orig_conv);
20774         uint64_t ret_ref = 0;
20775         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
20776         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
20777         return ret_ref;
20778 }
20779
20780 void  __attribute__((export_name("TS_Logger_free"))) TS_Logger_free(uint64_t this_ptr) {
20781         if (!ptr_is_owned(this_ptr)) return;
20782         void* this_ptr_ptr = untag_ptr(this_ptr);
20783         CHECK_ACCESS(this_ptr_ptr);
20784         LDKLogger this_ptr_conv = *(LDKLogger*)(this_ptr_ptr);
20785         FREE(untag_ptr(this_ptr));
20786         Logger_free(this_ptr_conv);
20787 }
20788
20789 void  __attribute__((export_name("TS_ChannelHandshakeConfig_free"))) TS_ChannelHandshakeConfig_free(uint64_t this_obj) {
20790         LDKChannelHandshakeConfig this_obj_conv;
20791         this_obj_conv.inner = untag_ptr(this_obj);
20792         this_obj_conv.is_owned = ptr_is_owned(this_obj);
20793         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
20794         ChannelHandshakeConfig_free(this_obj_conv);
20795 }
20796
20797 int32_t  __attribute__((export_name("TS_ChannelHandshakeConfig_get_minimum_depth"))) TS_ChannelHandshakeConfig_get_minimum_depth(uint64_t this_ptr) {
20798         LDKChannelHandshakeConfig this_ptr_conv;
20799         this_ptr_conv.inner = untag_ptr(this_ptr);
20800         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
20801         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20802         this_ptr_conv.is_owned = false;
20803         int32_t ret_conv = ChannelHandshakeConfig_get_minimum_depth(&this_ptr_conv);
20804         return ret_conv;
20805 }
20806
20807 void  __attribute__((export_name("TS_ChannelHandshakeConfig_set_minimum_depth"))) TS_ChannelHandshakeConfig_set_minimum_depth(uint64_t this_ptr, int32_t val) {
20808         LDKChannelHandshakeConfig this_ptr_conv;
20809         this_ptr_conv.inner = untag_ptr(this_ptr);
20810         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
20811         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20812         this_ptr_conv.is_owned = false;
20813         ChannelHandshakeConfig_set_minimum_depth(&this_ptr_conv, val);
20814 }
20815
20816 int16_t  __attribute__((export_name("TS_ChannelHandshakeConfig_get_our_to_self_delay"))) TS_ChannelHandshakeConfig_get_our_to_self_delay(uint64_t this_ptr) {
20817         LDKChannelHandshakeConfig this_ptr_conv;
20818         this_ptr_conv.inner = untag_ptr(this_ptr);
20819         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
20820         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20821         this_ptr_conv.is_owned = false;
20822         int16_t ret_conv = ChannelHandshakeConfig_get_our_to_self_delay(&this_ptr_conv);
20823         return ret_conv;
20824 }
20825
20826 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) {
20827         LDKChannelHandshakeConfig this_ptr_conv;
20828         this_ptr_conv.inner = untag_ptr(this_ptr);
20829         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
20830         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20831         this_ptr_conv.is_owned = false;
20832         ChannelHandshakeConfig_set_our_to_self_delay(&this_ptr_conv, val);
20833 }
20834
20835 int64_t  __attribute__((export_name("TS_ChannelHandshakeConfig_get_our_htlc_minimum_msat"))) TS_ChannelHandshakeConfig_get_our_htlc_minimum_msat(uint64_t this_ptr) {
20836         LDKChannelHandshakeConfig this_ptr_conv;
20837         this_ptr_conv.inner = untag_ptr(this_ptr);
20838         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
20839         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20840         this_ptr_conv.is_owned = false;
20841         int64_t ret_conv = ChannelHandshakeConfig_get_our_htlc_minimum_msat(&this_ptr_conv);
20842         return ret_conv;
20843 }
20844
20845 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) {
20846         LDKChannelHandshakeConfig this_ptr_conv;
20847         this_ptr_conv.inner = untag_ptr(this_ptr);
20848         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
20849         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20850         this_ptr_conv.is_owned = false;
20851         ChannelHandshakeConfig_set_our_htlc_minimum_msat(&this_ptr_conv, val);
20852 }
20853
20854 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) {
20855         LDKChannelHandshakeConfig this_ptr_conv;
20856         this_ptr_conv.inner = untag_ptr(this_ptr);
20857         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
20858         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20859         this_ptr_conv.is_owned = false;
20860         int8_t ret_conv = ChannelHandshakeConfig_get_max_inbound_htlc_value_in_flight_percent_of_channel(&this_ptr_conv);
20861         return ret_conv;
20862 }
20863
20864 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) {
20865         LDKChannelHandshakeConfig this_ptr_conv;
20866         this_ptr_conv.inner = untag_ptr(this_ptr);
20867         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
20868         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20869         this_ptr_conv.is_owned = false;
20870         ChannelHandshakeConfig_set_max_inbound_htlc_value_in_flight_percent_of_channel(&this_ptr_conv, val);
20871 }
20872
20873 jboolean  __attribute__((export_name("TS_ChannelHandshakeConfig_get_negotiate_scid_privacy"))) TS_ChannelHandshakeConfig_get_negotiate_scid_privacy(uint64_t this_ptr) {
20874         LDKChannelHandshakeConfig this_ptr_conv;
20875         this_ptr_conv.inner = untag_ptr(this_ptr);
20876         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
20877         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20878         this_ptr_conv.is_owned = false;
20879         jboolean ret_conv = ChannelHandshakeConfig_get_negotiate_scid_privacy(&this_ptr_conv);
20880         return ret_conv;
20881 }
20882
20883 void  __attribute__((export_name("TS_ChannelHandshakeConfig_set_negotiate_scid_privacy"))) TS_ChannelHandshakeConfig_set_negotiate_scid_privacy(uint64_t this_ptr, jboolean val) {
20884         LDKChannelHandshakeConfig this_ptr_conv;
20885         this_ptr_conv.inner = untag_ptr(this_ptr);
20886         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
20887         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20888         this_ptr_conv.is_owned = false;
20889         ChannelHandshakeConfig_set_negotiate_scid_privacy(&this_ptr_conv, val);
20890 }
20891
20892 jboolean  __attribute__((export_name("TS_ChannelHandshakeConfig_get_announced_channel"))) TS_ChannelHandshakeConfig_get_announced_channel(uint64_t this_ptr) {
20893         LDKChannelHandshakeConfig this_ptr_conv;
20894         this_ptr_conv.inner = untag_ptr(this_ptr);
20895         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
20896         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20897         this_ptr_conv.is_owned = false;
20898         jboolean ret_conv = ChannelHandshakeConfig_get_announced_channel(&this_ptr_conv);
20899         return ret_conv;
20900 }
20901
20902 void  __attribute__((export_name("TS_ChannelHandshakeConfig_set_announced_channel"))) TS_ChannelHandshakeConfig_set_announced_channel(uint64_t this_ptr, jboolean val) {
20903         LDKChannelHandshakeConfig this_ptr_conv;
20904         this_ptr_conv.inner = untag_ptr(this_ptr);
20905         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
20906         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20907         this_ptr_conv.is_owned = false;
20908         ChannelHandshakeConfig_set_announced_channel(&this_ptr_conv, val);
20909 }
20910
20911 jboolean  __attribute__((export_name("TS_ChannelHandshakeConfig_get_commit_upfront_shutdown_pubkey"))) TS_ChannelHandshakeConfig_get_commit_upfront_shutdown_pubkey(uint64_t this_ptr) {
20912         LDKChannelHandshakeConfig this_ptr_conv;
20913         this_ptr_conv.inner = untag_ptr(this_ptr);
20914         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
20915         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20916         this_ptr_conv.is_owned = false;
20917         jboolean ret_conv = ChannelHandshakeConfig_get_commit_upfront_shutdown_pubkey(&this_ptr_conv);
20918         return ret_conv;
20919 }
20920
20921 void  __attribute__((export_name("TS_ChannelHandshakeConfig_set_commit_upfront_shutdown_pubkey"))) TS_ChannelHandshakeConfig_set_commit_upfront_shutdown_pubkey(uint64_t this_ptr, jboolean val) {
20922         LDKChannelHandshakeConfig this_ptr_conv;
20923         this_ptr_conv.inner = untag_ptr(this_ptr);
20924         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
20925         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20926         this_ptr_conv.is_owned = false;
20927         ChannelHandshakeConfig_set_commit_upfront_shutdown_pubkey(&this_ptr_conv, val);
20928 }
20929
20930 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) {
20931         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);
20932         uint64_t ret_ref = 0;
20933         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
20934         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
20935         return ret_ref;
20936 }
20937
20938 static inline uint64_t ChannelHandshakeConfig_clone_ptr(LDKChannelHandshakeConfig *NONNULL_PTR arg) {
20939         LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_clone(arg);
20940         uint64_t ret_ref = 0;
20941         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
20942         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
20943         return ret_ref;
20944 }
20945 int64_t  __attribute__((export_name("TS_ChannelHandshakeConfig_clone_ptr"))) TS_ChannelHandshakeConfig_clone_ptr(uint64_t arg) {
20946         LDKChannelHandshakeConfig arg_conv;
20947         arg_conv.inner = untag_ptr(arg);
20948         arg_conv.is_owned = ptr_is_owned(arg);
20949         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
20950         arg_conv.is_owned = false;
20951         int64_t ret_conv = ChannelHandshakeConfig_clone_ptr(&arg_conv);
20952         return ret_conv;
20953 }
20954
20955 uint64_t  __attribute__((export_name("TS_ChannelHandshakeConfig_clone"))) TS_ChannelHandshakeConfig_clone(uint64_t orig) {
20956         LDKChannelHandshakeConfig orig_conv;
20957         orig_conv.inner = untag_ptr(orig);
20958         orig_conv.is_owned = ptr_is_owned(orig);
20959         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
20960         orig_conv.is_owned = false;
20961         LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_clone(&orig_conv);
20962         uint64_t ret_ref = 0;
20963         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
20964         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
20965         return ret_ref;
20966 }
20967
20968 uint64_t  __attribute__((export_name("TS_ChannelHandshakeConfig_default"))) TS_ChannelHandshakeConfig_default() {
20969         LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_default();
20970         uint64_t ret_ref = 0;
20971         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
20972         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
20973         return ret_ref;
20974 }
20975
20976 void  __attribute__((export_name("TS_ChannelHandshakeLimits_free"))) TS_ChannelHandshakeLimits_free(uint64_t this_obj) {
20977         LDKChannelHandshakeLimits this_obj_conv;
20978         this_obj_conv.inner = untag_ptr(this_obj);
20979         this_obj_conv.is_owned = ptr_is_owned(this_obj);
20980         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
20981         ChannelHandshakeLimits_free(this_obj_conv);
20982 }
20983
20984 int64_t  __attribute__((export_name("TS_ChannelHandshakeLimits_get_min_funding_satoshis"))) TS_ChannelHandshakeLimits_get_min_funding_satoshis(uint64_t this_ptr) {
20985         LDKChannelHandshakeLimits this_ptr_conv;
20986         this_ptr_conv.inner = untag_ptr(this_ptr);
20987         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
20988         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20989         this_ptr_conv.is_owned = false;
20990         int64_t ret_conv = ChannelHandshakeLimits_get_min_funding_satoshis(&this_ptr_conv);
20991         return ret_conv;
20992 }
20993
20994 void  __attribute__((export_name("TS_ChannelHandshakeLimits_set_min_funding_satoshis"))) TS_ChannelHandshakeLimits_set_min_funding_satoshis(uint64_t this_ptr, int64_t val) {
20995         LDKChannelHandshakeLimits this_ptr_conv;
20996         this_ptr_conv.inner = untag_ptr(this_ptr);
20997         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
20998         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20999         this_ptr_conv.is_owned = false;
21000         ChannelHandshakeLimits_set_min_funding_satoshis(&this_ptr_conv, val);
21001 }
21002
21003 int64_t  __attribute__((export_name("TS_ChannelHandshakeLimits_get_max_funding_satoshis"))) TS_ChannelHandshakeLimits_get_max_funding_satoshis(uint64_t this_ptr) {
21004         LDKChannelHandshakeLimits this_ptr_conv;
21005         this_ptr_conv.inner = untag_ptr(this_ptr);
21006         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
21007         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21008         this_ptr_conv.is_owned = false;
21009         int64_t ret_conv = ChannelHandshakeLimits_get_max_funding_satoshis(&this_ptr_conv);
21010         return ret_conv;
21011 }
21012
21013 void  __attribute__((export_name("TS_ChannelHandshakeLimits_set_max_funding_satoshis"))) TS_ChannelHandshakeLimits_set_max_funding_satoshis(uint64_t this_ptr, int64_t val) {
21014         LDKChannelHandshakeLimits this_ptr_conv;
21015         this_ptr_conv.inner = untag_ptr(this_ptr);
21016         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
21017         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21018         this_ptr_conv.is_owned = false;
21019         ChannelHandshakeLimits_set_max_funding_satoshis(&this_ptr_conv, val);
21020 }
21021
21022 int64_t  __attribute__((export_name("TS_ChannelHandshakeLimits_get_max_htlc_minimum_msat"))) TS_ChannelHandshakeLimits_get_max_htlc_minimum_msat(uint64_t this_ptr) {
21023         LDKChannelHandshakeLimits this_ptr_conv;
21024         this_ptr_conv.inner = untag_ptr(this_ptr);
21025         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
21026         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21027         this_ptr_conv.is_owned = false;
21028         int64_t ret_conv = ChannelHandshakeLimits_get_max_htlc_minimum_msat(&this_ptr_conv);
21029         return ret_conv;
21030 }
21031
21032 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) {
21033         LDKChannelHandshakeLimits this_ptr_conv;
21034         this_ptr_conv.inner = untag_ptr(this_ptr);
21035         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
21036         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21037         this_ptr_conv.is_owned = false;
21038         ChannelHandshakeLimits_set_max_htlc_minimum_msat(&this_ptr_conv, val);
21039 }
21040
21041 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) {
21042         LDKChannelHandshakeLimits this_ptr_conv;
21043         this_ptr_conv.inner = untag_ptr(this_ptr);
21044         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
21045         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21046         this_ptr_conv.is_owned = false;
21047         int64_t ret_conv = ChannelHandshakeLimits_get_min_max_htlc_value_in_flight_msat(&this_ptr_conv);
21048         return ret_conv;
21049 }
21050
21051 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) {
21052         LDKChannelHandshakeLimits this_ptr_conv;
21053         this_ptr_conv.inner = untag_ptr(this_ptr);
21054         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
21055         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21056         this_ptr_conv.is_owned = false;
21057         ChannelHandshakeLimits_set_min_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
21058 }
21059
21060 int64_t  __attribute__((export_name("TS_ChannelHandshakeLimits_get_max_channel_reserve_satoshis"))) TS_ChannelHandshakeLimits_get_max_channel_reserve_satoshis(uint64_t this_ptr) {
21061         LDKChannelHandshakeLimits this_ptr_conv;
21062         this_ptr_conv.inner = untag_ptr(this_ptr);
21063         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
21064         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21065         this_ptr_conv.is_owned = false;
21066         int64_t ret_conv = ChannelHandshakeLimits_get_max_channel_reserve_satoshis(&this_ptr_conv);
21067         return ret_conv;
21068 }
21069
21070 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) {
21071         LDKChannelHandshakeLimits this_ptr_conv;
21072         this_ptr_conv.inner = untag_ptr(this_ptr);
21073         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
21074         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21075         this_ptr_conv.is_owned = false;
21076         ChannelHandshakeLimits_set_max_channel_reserve_satoshis(&this_ptr_conv, val);
21077 }
21078
21079 int16_t  __attribute__((export_name("TS_ChannelHandshakeLimits_get_min_max_accepted_htlcs"))) TS_ChannelHandshakeLimits_get_min_max_accepted_htlcs(uint64_t this_ptr) {
21080         LDKChannelHandshakeLimits this_ptr_conv;
21081         this_ptr_conv.inner = untag_ptr(this_ptr);
21082         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
21083         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21084         this_ptr_conv.is_owned = false;
21085         int16_t ret_conv = ChannelHandshakeLimits_get_min_max_accepted_htlcs(&this_ptr_conv);
21086         return ret_conv;
21087 }
21088
21089 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) {
21090         LDKChannelHandshakeLimits this_ptr_conv;
21091         this_ptr_conv.inner = untag_ptr(this_ptr);
21092         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
21093         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21094         this_ptr_conv.is_owned = false;
21095         ChannelHandshakeLimits_set_min_max_accepted_htlcs(&this_ptr_conv, val);
21096 }
21097
21098 int32_t  __attribute__((export_name("TS_ChannelHandshakeLimits_get_max_minimum_depth"))) TS_ChannelHandshakeLimits_get_max_minimum_depth(uint64_t this_ptr) {
21099         LDKChannelHandshakeLimits this_ptr_conv;
21100         this_ptr_conv.inner = untag_ptr(this_ptr);
21101         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
21102         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21103         this_ptr_conv.is_owned = false;
21104         int32_t ret_conv = ChannelHandshakeLimits_get_max_minimum_depth(&this_ptr_conv);
21105         return ret_conv;
21106 }
21107
21108 void  __attribute__((export_name("TS_ChannelHandshakeLimits_set_max_minimum_depth"))) TS_ChannelHandshakeLimits_set_max_minimum_depth(uint64_t this_ptr, int32_t val) {
21109         LDKChannelHandshakeLimits this_ptr_conv;
21110         this_ptr_conv.inner = untag_ptr(this_ptr);
21111         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
21112         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21113         this_ptr_conv.is_owned = false;
21114         ChannelHandshakeLimits_set_max_minimum_depth(&this_ptr_conv, val);
21115 }
21116
21117 jboolean  __attribute__((export_name("TS_ChannelHandshakeLimits_get_trust_own_funding_0conf"))) TS_ChannelHandshakeLimits_get_trust_own_funding_0conf(uint64_t this_ptr) {
21118         LDKChannelHandshakeLimits this_ptr_conv;
21119         this_ptr_conv.inner = untag_ptr(this_ptr);
21120         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
21121         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21122         this_ptr_conv.is_owned = false;
21123         jboolean ret_conv = ChannelHandshakeLimits_get_trust_own_funding_0conf(&this_ptr_conv);
21124         return ret_conv;
21125 }
21126
21127 void  __attribute__((export_name("TS_ChannelHandshakeLimits_set_trust_own_funding_0conf"))) TS_ChannelHandshakeLimits_set_trust_own_funding_0conf(uint64_t this_ptr, jboolean val) {
21128         LDKChannelHandshakeLimits this_ptr_conv;
21129         this_ptr_conv.inner = untag_ptr(this_ptr);
21130         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
21131         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21132         this_ptr_conv.is_owned = false;
21133         ChannelHandshakeLimits_set_trust_own_funding_0conf(&this_ptr_conv, val);
21134 }
21135
21136 jboolean  __attribute__((export_name("TS_ChannelHandshakeLimits_get_force_announced_channel_preference"))) TS_ChannelHandshakeLimits_get_force_announced_channel_preference(uint64_t this_ptr) {
21137         LDKChannelHandshakeLimits this_ptr_conv;
21138         this_ptr_conv.inner = untag_ptr(this_ptr);
21139         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
21140         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21141         this_ptr_conv.is_owned = false;
21142         jboolean ret_conv = ChannelHandshakeLimits_get_force_announced_channel_preference(&this_ptr_conv);
21143         return ret_conv;
21144 }
21145
21146 void  __attribute__((export_name("TS_ChannelHandshakeLimits_set_force_announced_channel_preference"))) TS_ChannelHandshakeLimits_set_force_announced_channel_preference(uint64_t this_ptr, jboolean val) {
21147         LDKChannelHandshakeLimits this_ptr_conv;
21148         this_ptr_conv.inner = untag_ptr(this_ptr);
21149         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
21150         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21151         this_ptr_conv.is_owned = false;
21152         ChannelHandshakeLimits_set_force_announced_channel_preference(&this_ptr_conv, val);
21153 }
21154
21155 int16_t  __attribute__((export_name("TS_ChannelHandshakeLimits_get_their_to_self_delay"))) TS_ChannelHandshakeLimits_get_their_to_self_delay(uint64_t this_ptr) {
21156         LDKChannelHandshakeLimits this_ptr_conv;
21157         this_ptr_conv.inner = untag_ptr(this_ptr);
21158         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
21159         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21160         this_ptr_conv.is_owned = false;
21161         int16_t ret_conv = ChannelHandshakeLimits_get_their_to_self_delay(&this_ptr_conv);
21162         return ret_conv;
21163 }
21164
21165 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) {
21166         LDKChannelHandshakeLimits this_ptr_conv;
21167         this_ptr_conv.inner = untag_ptr(this_ptr);
21168         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
21169         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21170         this_ptr_conv.is_owned = false;
21171         ChannelHandshakeLimits_set_their_to_self_delay(&this_ptr_conv, val);
21172 }
21173
21174 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) {
21175         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);
21176         uint64_t ret_ref = 0;
21177         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21178         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
21179         return ret_ref;
21180 }
21181
21182 static inline uint64_t ChannelHandshakeLimits_clone_ptr(LDKChannelHandshakeLimits *NONNULL_PTR arg) {
21183         LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_clone(arg);
21184         uint64_t ret_ref = 0;
21185         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21186         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
21187         return ret_ref;
21188 }
21189 int64_t  __attribute__((export_name("TS_ChannelHandshakeLimits_clone_ptr"))) TS_ChannelHandshakeLimits_clone_ptr(uint64_t arg) {
21190         LDKChannelHandshakeLimits arg_conv;
21191         arg_conv.inner = untag_ptr(arg);
21192         arg_conv.is_owned = ptr_is_owned(arg);
21193         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
21194         arg_conv.is_owned = false;
21195         int64_t ret_conv = ChannelHandshakeLimits_clone_ptr(&arg_conv);
21196         return ret_conv;
21197 }
21198
21199 uint64_t  __attribute__((export_name("TS_ChannelHandshakeLimits_clone"))) TS_ChannelHandshakeLimits_clone(uint64_t orig) {
21200         LDKChannelHandshakeLimits orig_conv;
21201         orig_conv.inner = untag_ptr(orig);
21202         orig_conv.is_owned = ptr_is_owned(orig);
21203         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
21204         orig_conv.is_owned = false;
21205         LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_clone(&orig_conv);
21206         uint64_t ret_ref = 0;
21207         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21208         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
21209         return ret_ref;
21210 }
21211
21212 uint64_t  __attribute__((export_name("TS_ChannelHandshakeLimits_default"))) TS_ChannelHandshakeLimits_default() {
21213         LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_default();
21214         uint64_t ret_ref = 0;
21215         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21216         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
21217         return ret_ref;
21218 }
21219
21220 void  __attribute__((export_name("TS_ChannelConfig_free"))) TS_ChannelConfig_free(uint64_t this_obj) {
21221         LDKChannelConfig this_obj_conv;
21222         this_obj_conv.inner = untag_ptr(this_obj);
21223         this_obj_conv.is_owned = ptr_is_owned(this_obj);
21224         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
21225         ChannelConfig_free(this_obj_conv);
21226 }
21227
21228 int32_t  __attribute__((export_name("TS_ChannelConfig_get_forwarding_fee_proportional_millionths"))) TS_ChannelConfig_get_forwarding_fee_proportional_millionths(uint64_t this_ptr) {
21229         LDKChannelConfig this_ptr_conv;
21230         this_ptr_conv.inner = untag_ptr(this_ptr);
21231         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
21232         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21233         this_ptr_conv.is_owned = false;
21234         int32_t ret_conv = ChannelConfig_get_forwarding_fee_proportional_millionths(&this_ptr_conv);
21235         return ret_conv;
21236 }
21237
21238 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) {
21239         LDKChannelConfig this_ptr_conv;
21240         this_ptr_conv.inner = untag_ptr(this_ptr);
21241         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
21242         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21243         this_ptr_conv.is_owned = false;
21244         ChannelConfig_set_forwarding_fee_proportional_millionths(&this_ptr_conv, val);
21245 }
21246
21247 int32_t  __attribute__((export_name("TS_ChannelConfig_get_forwarding_fee_base_msat"))) TS_ChannelConfig_get_forwarding_fee_base_msat(uint64_t this_ptr) {
21248         LDKChannelConfig this_ptr_conv;
21249         this_ptr_conv.inner = untag_ptr(this_ptr);
21250         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
21251         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21252         this_ptr_conv.is_owned = false;
21253         int32_t ret_conv = ChannelConfig_get_forwarding_fee_base_msat(&this_ptr_conv);
21254         return ret_conv;
21255 }
21256
21257 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) {
21258         LDKChannelConfig this_ptr_conv;
21259         this_ptr_conv.inner = untag_ptr(this_ptr);
21260         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
21261         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21262         this_ptr_conv.is_owned = false;
21263         ChannelConfig_set_forwarding_fee_base_msat(&this_ptr_conv, val);
21264 }
21265
21266 int16_t  __attribute__((export_name("TS_ChannelConfig_get_cltv_expiry_delta"))) TS_ChannelConfig_get_cltv_expiry_delta(uint64_t this_ptr) {
21267         LDKChannelConfig this_ptr_conv;
21268         this_ptr_conv.inner = untag_ptr(this_ptr);
21269         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
21270         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21271         this_ptr_conv.is_owned = false;
21272         int16_t ret_conv = ChannelConfig_get_cltv_expiry_delta(&this_ptr_conv);
21273         return ret_conv;
21274 }
21275
21276 void  __attribute__((export_name("TS_ChannelConfig_set_cltv_expiry_delta"))) TS_ChannelConfig_set_cltv_expiry_delta(uint64_t this_ptr, int16_t val) {
21277         LDKChannelConfig this_ptr_conv;
21278         this_ptr_conv.inner = untag_ptr(this_ptr);
21279         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
21280         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21281         this_ptr_conv.is_owned = false;
21282         ChannelConfig_set_cltv_expiry_delta(&this_ptr_conv, val);
21283 }
21284
21285 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) {
21286         LDKChannelConfig this_ptr_conv;
21287         this_ptr_conv.inner = untag_ptr(this_ptr);
21288         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
21289         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21290         this_ptr_conv.is_owned = false;
21291         int64_t ret_conv = ChannelConfig_get_max_dust_htlc_exposure_msat(&this_ptr_conv);
21292         return ret_conv;
21293 }
21294
21295 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) {
21296         LDKChannelConfig this_ptr_conv;
21297         this_ptr_conv.inner = untag_ptr(this_ptr);
21298         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
21299         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21300         this_ptr_conv.is_owned = false;
21301         ChannelConfig_set_max_dust_htlc_exposure_msat(&this_ptr_conv, val);
21302 }
21303
21304 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) {
21305         LDKChannelConfig this_ptr_conv;
21306         this_ptr_conv.inner = untag_ptr(this_ptr);
21307         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
21308         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21309         this_ptr_conv.is_owned = false;
21310         int64_t ret_conv = ChannelConfig_get_force_close_avoidance_max_fee_satoshis(&this_ptr_conv);
21311         return ret_conv;
21312 }
21313
21314 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) {
21315         LDKChannelConfig this_ptr_conv;
21316         this_ptr_conv.inner = untag_ptr(this_ptr);
21317         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
21318         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21319         this_ptr_conv.is_owned = false;
21320         ChannelConfig_set_force_close_avoidance_max_fee_satoshis(&this_ptr_conv, val);
21321 }
21322
21323 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) {
21324         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);
21325         uint64_t ret_ref = 0;
21326         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21327         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
21328         return ret_ref;
21329 }
21330
21331 static inline uint64_t ChannelConfig_clone_ptr(LDKChannelConfig *NONNULL_PTR arg) {
21332         LDKChannelConfig ret_var = ChannelConfig_clone(arg);
21333         uint64_t ret_ref = 0;
21334         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21335         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
21336         return ret_ref;
21337 }
21338 int64_t  __attribute__((export_name("TS_ChannelConfig_clone_ptr"))) TS_ChannelConfig_clone_ptr(uint64_t arg) {
21339         LDKChannelConfig arg_conv;
21340         arg_conv.inner = untag_ptr(arg);
21341         arg_conv.is_owned = ptr_is_owned(arg);
21342         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
21343         arg_conv.is_owned = false;
21344         int64_t ret_conv = ChannelConfig_clone_ptr(&arg_conv);
21345         return ret_conv;
21346 }
21347
21348 uint64_t  __attribute__((export_name("TS_ChannelConfig_clone"))) TS_ChannelConfig_clone(uint64_t orig) {
21349         LDKChannelConfig orig_conv;
21350         orig_conv.inner = untag_ptr(orig);
21351         orig_conv.is_owned = ptr_is_owned(orig);
21352         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
21353         orig_conv.is_owned = false;
21354         LDKChannelConfig ret_var = ChannelConfig_clone(&orig_conv);
21355         uint64_t ret_ref = 0;
21356         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21357         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
21358         return ret_ref;
21359 }
21360
21361 uint64_t  __attribute__((export_name("TS_ChannelConfig_default"))) TS_ChannelConfig_default() {
21362         LDKChannelConfig ret_var = ChannelConfig_default();
21363         uint64_t ret_ref = 0;
21364         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21365         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
21366         return ret_ref;
21367 }
21368
21369 int8_tArray  __attribute__((export_name("TS_ChannelConfig_write"))) TS_ChannelConfig_write(uint64_t obj) {
21370         LDKChannelConfig obj_conv;
21371         obj_conv.inner = untag_ptr(obj);
21372         obj_conv.is_owned = ptr_is_owned(obj);
21373         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
21374         obj_conv.is_owned = false;
21375         LDKCVec_u8Z ret_var = ChannelConfig_write(&obj_conv);
21376         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
21377         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
21378         CVec_u8Z_free(ret_var);
21379         return ret_arr;
21380 }
21381
21382 uint64_t  __attribute__((export_name("TS_ChannelConfig_read"))) TS_ChannelConfig_read(int8_tArray ser) {
21383         LDKu8slice ser_ref;
21384         ser_ref.datalen = ser->arr_len;
21385         ser_ref.data = ser->elems;
21386         LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
21387         *ret_conv = ChannelConfig_read(ser_ref);
21388         FREE(ser);
21389         return tag_ptr(ret_conv, true);
21390 }
21391
21392 void  __attribute__((export_name("TS_UserConfig_free"))) TS_UserConfig_free(uint64_t this_obj) {
21393         LDKUserConfig this_obj_conv;
21394         this_obj_conv.inner = untag_ptr(this_obj);
21395         this_obj_conv.is_owned = ptr_is_owned(this_obj);
21396         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
21397         UserConfig_free(this_obj_conv);
21398 }
21399
21400 uint64_t  __attribute__((export_name("TS_UserConfig_get_channel_handshake_config"))) TS_UserConfig_get_channel_handshake_config(uint64_t this_ptr) {
21401         LDKUserConfig this_ptr_conv;
21402         this_ptr_conv.inner = untag_ptr(this_ptr);
21403         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
21404         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21405         this_ptr_conv.is_owned = false;
21406         LDKChannelHandshakeConfig ret_var = UserConfig_get_channel_handshake_config(&this_ptr_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 void  __attribute__((export_name("TS_UserConfig_set_channel_handshake_config"))) TS_UserConfig_set_channel_handshake_config(uint64_t this_ptr, uint64_t val) {
21414         LDKUserConfig this_ptr_conv;
21415         this_ptr_conv.inner = untag_ptr(this_ptr);
21416         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
21417         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21418         this_ptr_conv.is_owned = false;
21419         LDKChannelHandshakeConfig val_conv;
21420         val_conv.inner = untag_ptr(val);
21421         val_conv.is_owned = ptr_is_owned(val);
21422         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
21423         val_conv = ChannelHandshakeConfig_clone(&val_conv);
21424         UserConfig_set_channel_handshake_config(&this_ptr_conv, val_conv);
21425 }
21426
21427 uint64_t  __attribute__((export_name("TS_UserConfig_get_channel_handshake_limits"))) TS_UserConfig_get_channel_handshake_limits(uint64_t this_ptr) {
21428         LDKUserConfig this_ptr_conv;
21429         this_ptr_conv.inner = untag_ptr(this_ptr);
21430         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
21431         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21432         this_ptr_conv.is_owned = false;
21433         LDKChannelHandshakeLimits ret_var = UserConfig_get_channel_handshake_limits(&this_ptr_conv);
21434         uint64_t ret_ref = 0;
21435         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21436         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
21437         return ret_ref;
21438 }
21439
21440 void  __attribute__((export_name("TS_UserConfig_set_channel_handshake_limits"))) TS_UserConfig_set_channel_handshake_limits(uint64_t this_ptr, uint64_t val) {
21441         LDKUserConfig this_ptr_conv;
21442         this_ptr_conv.inner = untag_ptr(this_ptr);
21443         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
21444         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21445         this_ptr_conv.is_owned = false;
21446         LDKChannelHandshakeLimits val_conv;
21447         val_conv.inner = untag_ptr(val);
21448         val_conv.is_owned = ptr_is_owned(val);
21449         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
21450         val_conv = ChannelHandshakeLimits_clone(&val_conv);
21451         UserConfig_set_channel_handshake_limits(&this_ptr_conv, val_conv);
21452 }
21453
21454 uint64_t  __attribute__((export_name("TS_UserConfig_get_channel_config"))) TS_UserConfig_get_channel_config(uint64_t this_ptr) {
21455         LDKUserConfig this_ptr_conv;
21456         this_ptr_conv.inner = untag_ptr(this_ptr);
21457         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
21458         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21459         this_ptr_conv.is_owned = false;
21460         LDKChannelConfig ret_var = UserConfig_get_channel_config(&this_ptr_conv);
21461         uint64_t ret_ref = 0;
21462         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21463         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
21464         return ret_ref;
21465 }
21466
21467 void  __attribute__((export_name("TS_UserConfig_set_channel_config"))) TS_UserConfig_set_channel_config(uint64_t this_ptr, uint64_t val) {
21468         LDKUserConfig 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         LDKChannelConfig val_conv;
21474         val_conv.inner = untag_ptr(val);
21475         val_conv.is_owned = ptr_is_owned(val);
21476         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
21477         val_conv = ChannelConfig_clone(&val_conv);
21478         UserConfig_set_channel_config(&this_ptr_conv, val_conv);
21479 }
21480
21481 jboolean  __attribute__((export_name("TS_UserConfig_get_accept_forwards_to_priv_channels"))) TS_UserConfig_get_accept_forwards_to_priv_channels(uint64_t this_ptr) {
21482         LDKUserConfig this_ptr_conv;
21483         this_ptr_conv.inner = untag_ptr(this_ptr);
21484         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
21485         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21486         this_ptr_conv.is_owned = false;
21487         jboolean ret_conv = UserConfig_get_accept_forwards_to_priv_channels(&this_ptr_conv);
21488         return ret_conv;
21489 }
21490
21491 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) {
21492         LDKUserConfig this_ptr_conv;
21493         this_ptr_conv.inner = untag_ptr(this_ptr);
21494         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
21495         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21496         this_ptr_conv.is_owned = false;
21497         UserConfig_set_accept_forwards_to_priv_channels(&this_ptr_conv, val);
21498 }
21499
21500 jboolean  __attribute__((export_name("TS_UserConfig_get_accept_inbound_channels"))) TS_UserConfig_get_accept_inbound_channels(uint64_t this_ptr) {
21501         LDKUserConfig this_ptr_conv;
21502         this_ptr_conv.inner = untag_ptr(this_ptr);
21503         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
21504         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21505         this_ptr_conv.is_owned = false;
21506         jboolean ret_conv = UserConfig_get_accept_inbound_channels(&this_ptr_conv);
21507         return ret_conv;
21508 }
21509
21510 void  __attribute__((export_name("TS_UserConfig_set_accept_inbound_channels"))) TS_UserConfig_set_accept_inbound_channels(uint64_t this_ptr, jboolean val) {
21511         LDKUserConfig this_ptr_conv;
21512         this_ptr_conv.inner = untag_ptr(this_ptr);
21513         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
21514         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21515         this_ptr_conv.is_owned = false;
21516         UserConfig_set_accept_inbound_channels(&this_ptr_conv, val);
21517 }
21518
21519 jboolean  __attribute__((export_name("TS_UserConfig_get_manually_accept_inbound_channels"))) TS_UserConfig_get_manually_accept_inbound_channels(uint64_t this_ptr) {
21520         LDKUserConfig this_ptr_conv;
21521         this_ptr_conv.inner = untag_ptr(this_ptr);
21522         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
21523         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21524         this_ptr_conv.is_owned = false;
21525         jboolean ret_conv = UserConfig_get_manually_accept_inbound_channels(&this_ptr_conv);
21526         return ret_conv;
21527 }
21528
21529 void  __attribute__((export_name("TS_UserConfig_set_manually_accept_inbound_channels"))) TS_UserConfig_set_manually_accept_inbound_channels(uint64_t this_ptr, jboolean val) {
21530         LDKUserConfig this_ptr_conv;
21531         this_ptr_conv.inner = untag_ptr(this_ptr);
21532         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
21533         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21534         this_ptr_conv.is_owned = false;
21535         UserConfig_set_manually_accept_inbound_channels(&this_ptr_conv, val);
21536 }
21537
21538 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) {
21539         LDKChannelHandshakeConfig channel_handshake_config_arg_conv;
21540         channel_handshake_config_arg_conv.inner = untag_ptr(channel_handshake_config_arg);
21541         channel_handshake_config_arg_conv.is_owned = ptr_is_owned(channel_handshake_config_arg);
21542         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_handshake_config_arg_conv);
21543         channel_handshake_config_arg_conv = ChannelHandshakeConfig_clone(&channel_handshake_config_arg_conv);
21544         LDKChannelHandshakeLimits channel_handshake_limits_arg_conv;
21545         channel_handshake_limits_arg_conv.inner = untag_ptr(channel_handshake_limits_arg);
21546         channel_handshake_limits_arg_conv.is_owned = ptr_is_owned(channel_handshake_limits_arg);
21547         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_handshake_limits_arg_conv);
21548         channel_handshake_limits_arg_conv = ChannelHandshakeLimits_clone(&channel_handshake_limits_arg_conv);
21549         LDKChannelConfig channel_config_arg_conv;
21550         channel_config_arg_conv.inner = untag_ptr(channel_config_arg);
21551         channel_config_arg_conv.is_owned = ptr_is_owned(channel_config_arg);
21552         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_config_arg_conv);
21553         channel_config_arg_conv = ChannelConfig_clone(&channel_config_arg_conv);
21554         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);
21555         uint64_t ret_ref = 0;
21556         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21557         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
21558         return ret_ref;
21559 }
21560
21561 static inline uint64_t UserConfig_clone_ptr(LDKUserConfig *NONNULL_PTR arg) {
21562         LDKUserConfig ret_var = UserConfig_clone(arg);
21563         uint64_t ret_ref = 0;
21564         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21565         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
21566         return ret_ref;
21567 }
21568 int64_t  __attribute__((export_name("TS_UserConfig_clone_ptr"))) TS_UserConfig_clone_ptr(uint64_t arg) {
21569         LDKUserConfig arg_conv;
21570         arg_conv.inner = untag_ptr(arg);
21571         arg_conv.is_owned = ptr_is_owned(arg);
21572         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
21573         arg_conv.is_owned = false;
21574         int64_t ret_conv = UserConfig_clone_ptr(&arg_conv);
21575         return ret_conv;
21576 }
21577
21578 uint64_t  __attribute__((export_name("TS_UserConfig_clone"))) TS_UserConfig_clone(uint64_t orig) {
21579         LDKUserConfig orig_conv;
21580         orig_conv.inner = untag_ptr(orig);
21581         orig_conv.is_owned = ptr_is_owned(orig);
21582         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
21583         orig_conv.is_owned = false;
21584         LDKUserConfig ret_var = UserConfig_clone(&orig_conv);
21585         uint64_t ret_ref = 0;
21586         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21587         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
21588         return ret_ref;
21589 }
21590
21591 uint64_t  __attribute__((export_name("TS_UserConfig_default"))) TS_UserConfig_default() {
21592         LDKUserConfig ret_var = UserConfig_default();
21593         uint64_t ret_ref = 0;
21594         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21595         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
21596         return ret_ref;
21597 }
21598
21599 void  __attribute__((export_name("TS_BestBlock_free"))) TS_BestBlock_free(uint64_t this_obj) {
21600         LDKBestBlock this_obj_conv;
21601         this_obj_conv.inner = untag_ptr(this_obj);
21602         this_obj_conv.is_owned = ptr_is_owned(this_obj);
21603         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
21604         BestBlock_free(this_obj_conv);
21605 }
21606
21607 static inline uint64_t BestBlock_clone_ptr(LDKBestBlock *NONNULL_PTR arg) {
21608         LDKBestBlock ret_var = BestBlock_clone(arg);
21609         uint64_t ret_ref = 0;
21610         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21611         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
21612         return ret_ref;
21613 }
21614 int64_t  __attribute__((export_name("TS_BestBlock_clone_ptr"))) TS_BestBlock_clone_ptr(uint64_t arg) {
21615         LDKBestBlock arg_conv;
21616         arg_conv.inner = untag_ptr(arg);
21617         arg_conv.is_owned = ptr_is_owned(arg);
21618         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
21619         arg_conv.is_owned = false;
21620         int64_t ret_conv = BestBlock_clone_ptr(&arg_conv);
21621         return ret_conv;
21622 }
21623
21624 uint64_t  __attribute__((export_name("TS_BestBlock_clone"))) TS_BestBlock_clone(uint64_t orig) {
21625         LDKBestBlock orig_conv;
21626         orig_conv.inner = untag_ptr(orig);
21627         orig_conv.is_owned = ptr_is_owned(orig);
21628         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
21629         orig_conv.is_owned = false;
21630         LDKBestBlock ret_var = BestBlock_clone(&orig_conv);
21631         uint64_t ret_ref = 0;
21632         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21633         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
21634         return ret_ref;
21635 }
21636
21637 uint64_t  __attribute__((export_name("TS_BestBlock_from_genesis"))) TS_BestBlock_from_genesis(uint32_t network) {
21638         LDKNetwork network_conv = LDKNetwork_from_js(network);
21639         LDKBestBlock ret_var = BestBlock_from_genesis(network_conv);
21640         uint64_t ret_ref = 0;
21641         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21642         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
21643         return ret_ref;
21644 }
21645
21646 uint64_t  __attribute__((export_name("TS_BestBlock_new"))) TS_BestBlock_new(int8_tArray block_hash, int32_t height) {
21647         LDKThirtyTwoBytes block_hash_ref;
21648         CHECK(block_hash->arr_len == 32);
21649         memcpy(block_hash_ref.data, block_hash->elems, 32); FREE(block_hash);
21650         LDKBestBlock ret_var = BestBlock_new(block_hash_ref, height);
21651         uint64_t ret_ref = 0;
21652         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21653         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
21654         return ret_ref;
21655 }
21656
21657 int8_tArray  __attribute__((export_name("TS_BestBlock_block_hash"))) TS_BestBlock_block_hash(uint64_t this_arg) {
21658         LDKBestBlock this_arg_conv;
21659         this_arg_conv.inner = untag_ptr(this_arg);
21660         this_arg_conv.is_owned = ptr_is_owned(this_arg);
21661         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
21662         this_arg_conv.is_owned = false;
21663         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
21664         memcpy(ret_arr->elems, BestBlock_block_hash(&this_arg_conv).data, 32);
21665         return ret_arr;
21666 }
21667
21668 int32_t  __attribute__((export_name("TS_BestBlock_height"))) TS_BestBlock_height(uint64_t this_arg) {
21669         LDKBestBlock this_arg_conv;
21670         this_arg_conv.inner = untag_ptr(this_arg);
21671         this_arg_conv.is_owned = ptr_is_owned(this_arg);
21672         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
21673         this_arg_conv.is_owned = false;
21674         int32_t ret_conv = BestBlock_height(&this_arg_conv);
21675         return ret_conv;
21676 }
21677
21678 uint32_t  __attribute__((export_name("TS_AccessError_clone"))) TS_AccessError_clone(uint64_t orig) {
21679         LDKAccessError* orig_conv = (LDKAccessError*)untag_ptr(orig);
21680         uint32_t ret_conv = LDKAccessError_to_js(AccessError_clone(orig_conv));
21681         return ret_conv;
21682 }
21683
21684 uint32_t  __attribute__((export_name("TS_AccessError_unknown_chain"))) TS_AccessError_unknown_chain() {
21685         uint32_t ret_conv = LDKAccessError_to_js(AccessError_unknown_chain());
21686         return ret_conv;
21687 }
21688
21689 uint32_t  __attribute__((export_name("TS_AccessError_unknown_tx"))) TS_AccessError_unknown_tx() {
21690         uint32_t ret_conv = LDKAccessError_to_js(AccessError_unknown_tx());
21691         return ret_conv;
21692 }
21693
21694 void  __attribute__((export_name("TS_Access_free"))) TS_Access_free(uint64_t this_ptr) {
21695         if (!ptr_is_owned(this_ptr)) return;
21696         void* this_ptr_ptr = untag_ptr(this_ptr);
21697         CHECK_ACCESS(this_ptr_ptr);
21698         LDKAccess this_ptr_conv = *(LDKAccess*)(this_ptr_ptr);
21699         FREE(untag_ptr(this_ptr));
21700         Access_free(this_ptr_conv);
21701 }
21702
21703 void  __attribute__((export_name("TS_Listen_free"))) TS_Listen_free(uint64_t this_ptr) {
21704         if (!ptr_is_owned(this_ptr)) return;
21705         void* this_ptr_ptr = untag_ptr(this_ptr);
21706         CHECK_ACCESS(this_ptr_ptr);
21707         LDKListen this_ptr_conv = *(LDKListen*)(this_ptr_ptr);
21708         FREE(untag_ptr(this_ptr));
21709         Listen_free(this_ptr_conv);
21710 }
21711
21712 void  __attribute__((export_name("TS_Confirm_free"))) TS_Confirm_free(uint64_t this_ptr) {
21713         if (!ptr_is_owned(this_ptr)) return;
21714         void* this_ptr_ptr = untag_ptr(this_ptr);
21715         CHECK_ACCESS(this_ptr_ptr);
21716         LDKConfirm this_ptr_conv = *(LDKConfirm*)(this_ptr_ptr);
21717         FREE(untag_ptr(this_ptr));
21718         Confirm_free(this_ptr_conv);
21719 }
21720
21721 uint32_t  __attribute__((export_name("TS_ChannelMonitorUpdateErr_clone"))) TS_ChannelMonitorUpdateErr_clone(uint64_t orig) {
21722         LDKChannelMonitorUpdateErr* orig_conv = (LDKChannelMonitorUpdateErr*)untag_ptr(orig);
21723         uint32_t ret_conv = LDKChannelMonitorUpdateErr_to_js(ChannelMonitorUpdateErr_clone(orig_conv));
21724         return ret_conv;
21725 }
21726
21727 uint32_t  __attribute__((export_name("TS_ChannelMonitorUpdateErr_temporary_failure"))) TS_ChannelMonitorUpdateErr_temporary_failure() {
21728         uint32_t ret_conv = LDKChannelMonitorUpdateErr_to_js(ChannelMonitorUpdateErr_temporary_failure());
21729         return ret_conv;
21730 }
21731
21732 uint32_t  __attribute__((export_name("TS_ChannelMonitorUpdateErr_permanent_failure"))) TS_ChannelMonitorUpdateErr_permanent_failure() {
21733         uint32_t ret_conv = LDKChannelMonitorUpdateErr_to_js(ChannelMonitorUpdateErr_permanent_failure());
21734         return ret_conv;
21735 }
21736
21737 void  __attribute__((export_name("TS_Watch_free"))) TS_Watch_free(uint64_t this_ptr) {
21738         if (!ptr_is_owned(this_ptr)) return;
21739         void* this_ptr_ptr = untag_ptr(this_ptr);
21740         CHECK_ACCESS(this_ptr_ptr);
21741         LDKWatch this_ptr_conv = *(LDKWatch*)(this_ptr_ptr);
21742         FREE(untag_ptr(this_ptr));
21743         Watch_free(this_ptr_conv);
21744 }
21745
21746 void  __attribute__((export_name("TS_Filter_free"))) TS_Filter_free(uint64_t this_ptr) {
21747         if (!ptr_is_owned(this_ptr)) return;
21748         void* this_ptr_ptr = untag_ptr(this_ptr);
21749         CHECK_ACCESS(this_ptr_ptr);
21750         LDKFilter this_ptr_conv = *(LDKFilter*)(this_ptr_ptr);
21751         FREE(untag_ptr(this_ptr));
21752         Filter_free(this_ptr_conv);
21753 }
21754
21755 void  __attribute__((export_name("TS_WatchedOutput_free"))) TS_WatchedOutput_free(uint64_t this_obj) {
21756         LDKWatchedOutput this_obj_conv;
21757         this_obj_conv.inner = untag_ptr(this_obj);
21758         this_obj_conv.is_owned = ptr_is_owned(this_obj);
21759         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
21760         WatchedOutput_free(this_obj_conv);
21761 }
21762
21763 int8_tArray  __attribute__((export_name("TS_WatchedOutput_get_block_hash"))) TS_WatchedOutput_get_block_hash(uint64_t this_ptr) {
21764         LDKWatchedOutput this_ptr_conv;
21765         this_ptr_conv.inner = untag_ptr(this_ptr);
21766         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
21767         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21768         this_ptr_conv.is_owned = false;
21769         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
21770         memcpy(ret_arr->elems, WatchedOutput_get_block_hash(&this_ptr_conv).data, 32);
21771         return ret_arr;
21772 }
21773
21774 void  __attribute__((export_name("TS_WatchedOutput_set_block_hash"))) TS_WatchedOutput_set_block_hash(uint64_t this_ptr, int8_tArray val) {
21775         LDKWatchedOutput this_ptr_conv;
21776         this_ptr_conv.inner = untag_ptr(this_ptr);
21777         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
21778         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21779         this_ptr_conv.is_owned = false;
21780         LDKThirtyTwoBytes val_ref;
21781         CHECK(val->arr_len == 32);
21782         memcpy(val_ref.data, val->elems, 32); FREE(val);
21783         WatchedOutput_set_block_hash(&this_ptr_conv, val_ref);
21784 }
21785
21786 uint64_t  __attribute__((export_name("TS_WatchedOutput_get_outpoint"))) TS_WatchedOutput_get_outpoint(uint64_t this_ptr) {
21787         LDKWatchedOutput this_ptr_conv;
21788         this_ptr_conv.inner = untag_ptr(this_ptr);
21789         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
21790         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21791         this_ptr_conv.is_owned = false;
21792         LDKOutPoint ret_var = WatchedOutput_get_outpoint(&this_ptr_conv);
21793         uint64_t ret_ref = 0;
21794         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21795         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
21796         return ret_ref;
21797 }
21798
21799 void  __attribute__((export_name("TS_WatchedOutput_set_outpoint"))) TS_WatchedOutput_set_outpoint(uint64_t this_ptr, uint64_t val) {
21800         LDKWatchedOutput this_ptr_conv;
21801         this_ptr_conv.inner = untag_ptr(this_ptr);
21802         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
21803         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21804         this_ptr_conv.is_owned = false;
21805         LDKOutPoint val_conv;
21806         val_conv.inner = untag_ptr(val);
21807         val_conv.is_owned = ptr_is_owned(val);
21808         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
21809         val_conv = OutPoint_clone(&val_conv);
21810         WatchedOutput_set_outpoint(&this_ptr_conv, val_conv);
21811 }
21812
21813 int8_tArray  __attribute__((export_name("TS_WatchedOutput_get_script_pubkey"))) TS_WatchedOutput_get_script_pubkey(uint64_t this_ptr) {
21814         LDKWatchedOutput this_ptr_conv;
21815         this_ptr_conv.inner = untag_ptr(this_ptr);
21816         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
21817         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21818         this_ptr_conv.is_owned = false;
21819         LDKu8slice ret_var = WatchedOutput_get_script_pubkey(&this_ptr_conv);
21820         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
21821         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
21822         return ret_arr;
21823 }
21824
21825 void  __attribute__((export_name("TS_WatchedOutput_set_script_pubkey"))) TS_WatchedOutput_set_script_pubkey(uint64_t this_ptr, int8_tArray val) {
21826         LDKWatchedOutput this_ptr_conv;
21827         this_ptr_conv.inner = untag_ptr(this_ptr);
21828         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
21829         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21830         this_ptr_conv.is_owned = false;
21831         LDKCVec_u8Z val_ref;
21832         val_ref.datalen = val->arr_len;
21833         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
21834         memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
21835         WatchedOutput_set_script_pubkey(&this_ptr_conv, val_ref);
21836 }
21837
21838 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) {
21839         LDKThirtyTwoBytes block_hash_arg_ref;
21840         CHECK(block_hash_arg->arr_len == 32);
21841         memcpy(block_hash_arg_ref.data, block_hash_arg->elems, 32); FREE(block_hash_arg);
21842         LDKOutPoint outpoint_arg_conv;
21843         outpoint_arg_conv.inner = untag_ptr(outpoint_arg);
21844         outpoint_arg_conv.is_owned = ptr_is_owned(outpoint_arg);
21845         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
21846         outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
21847         LDKCVec_u8Z script_pubkey_arg_ref;
21848         script_pubkey_arg_ref.datalen = script_pubkey_arg->arr_len;
21849         script_pubkey_arg_ref.data = MALLOC(script_pubkey_arg_ref.datalen, "LDKCVec_u8Z Bytes");
21850         memcpy(script_pubkey_arg_ref.data, script_pubkey_arg->elems, script_pubkey_arg_ref.datalen); FREE(script_pubkey_arg);
21851         LDKWatchedOutput ret_var = WatchedOutput_new(block_hash_arg_ref, outpoint_arg_conv, script_pubkey_arg_ref);
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 static inline uint64_t WatchedOutput_clone_ptr(LDKWatchedOutput *NONNULL_PTR arg) {
21859         LDKWatchedOutput ret_var = WatchedOutput_clone(arg);
21860         uint64_t ret_ref = 0;
21861         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21862         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
21863         return ret_ref;
21864 }
21865 int64_t  __attribute__((export_name("TS_WatchedOutput_clone_ptr"))) TS_WatchedOutput_clone_ptr(uint64_t arg) {
21866         LDKWatchedOutput arg_conv;
21867         arg_conv.inner = untag_ptr(arg);
21868         arg_conv.is_owned = ptr_is_owned(arg);
21869         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
21870         arg_conv.is_owned = false;
21871         int64_t ret_conv = WatchedOutput_clone_ptr(&arg_conv);
21872         return ret_conv;
21873 }
21874
21875 uint64_t  __attribute__((export_name("TS_WatchedOutput_clone"))) TS_WatchedOutput_clone(uint64_t orig) {
21876         LDKWatchedOutput orig_conv;
21877         orig_conv.inner = untag_ptr(orig);
21878         orig_conv.is_owned = ptr_is_owned(orig);
21879         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
21880         orig_conv.is_owned = false;
21881         LDKWatchedOutput ret_var = WatchedOutput_clone(&orig_conv);
21882         uint64_t ret_ref = 0;
21883         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21884         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
21885         return ret_ref;
21886 }
21887
21888 int64_t  __attribute__((export_name("TS_WatchedOutput_hash"))) TS_WatchedOutput_hash(uint64_t o) {
21889         LDKWatchedOutput o_conv;
21890         o_conv.inner = untag_ptr(o);
21891         o_conv.is_owned = ptr_is_owned(o);
21892         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21893         o_conv.is_owned = false;
21894         int64_t ret_conv = WatchedOutput_hash(&o_conv);
21895         return ret_conv;
21896 }
21897
21898 void  __attribute__((export_name("TS_BroadcasterInterface_free"))) TS_BroadcasterInterface_free(uint64_t this_ptr) {
21899         if (!ptr_is_owned(this_ptr)) return;
21900         void* this_ptr_ptr = untag_ptr(this_ptr);
21901         CHECK_ACCESS(this_ptr_ptr);
21902         LDKBroadcasterInterface this_ptr_conv = *(LDKBroadcasterInterface*)(this_ptr_ptr);
21903         FREE(untag_ptr(this_ptr));
21904         BroadcasterInterface_free(this_ptr_conv);
21905 }
21906
21907 uint32_t  __attribute__((export_name("TS_ConfirmationTarget_clone"))) TS_ConfirmationTarget_clone(uint64_t orig) {
21908         LDKConfirmationTarget* orig_conv = (LDKConfirmationTarget*)untag_ptr(orig);
21909         uint32_t ret_conv = LDKConfirmationTarget_to_js(ConfirmationTarget_clone(orig_conv));
21910         return ret_conv;
21911 }
21912
21913 uint32_t  __attribute__((export_name("TS_ConfirmationTarget_background"))) TS_ConfirmationTarget_background() {
21914         uint32_t ret_conv = LDKConfirmationTarget_to_js(ConfirmationTarget_background());
21915         return ret_conv;
21916 }
21917
21918 uint32_t  __attribute__((export_name("TS_ConfirmationTarget_normal"))) TS_ConfirmationTarget_normal() {
21919         uint32_t ret_conv = LDKConfirmationTarget_to_js(ConfirmationTarget_normal());
21920         return ret_conv;
21921 }
21922
21923 uint32_t  __attribute__((export_name("TS_ConfirmationTarget_high_priority"))) TS_ConfirmationTarget_high_priority() {
21924         uint32_t ret_conv = LDKConfirmationTarget_to_js(ConfirmationTarget_high_priority());
21925         return ret_conv;
21926 }
21927
21928 jboolean  __attribute__((export_name("TS_ConfirmationTarget_eq"))) TS_ConfirmationTarget_eq(uint64_t a, uint64_t b) {
21929         LDKConfirmationTarget* a_conv = (LDKConfirmationTarget*)untag_ptr(a);
21930         LDKConfirmationTarget* b_conv = (LDKConfirmationTarget*)untag_ptr(b);
21931         jboolean ret_conv = ConfirmationTarget_eq(a_conv, b_conv);
21932         return ret_conv;
21933 }
21934
21935 void  __attribute__((export_name("TS_FeeEstimator_free"))) TS_FeeEstimator_free(uint64_t this_ptr) {
21936         if (!ptr_is_owned(this_ptr)) return;
21937         void* this_ptr_ptr = untag_ptr(this_ptr);
21938         CHECK_ACCESS(this_ptr_ptr);
21939         LDKFeeEstimator this_ptr_conv = *(LDKFeeEstimator*)(this_ptr_ptr);
21940         FREE(untag_ptr(this_ptr));
21941         FeeEstimator_free(this_ptr_conv);
21942 }
21943
21944 void  __attribute__((export_name("TS_MonitorUpdateId_free"))) TS_MonitorUpdateId_free(uint64_t this_obj) {
21945         LDKMonitorUpdateId this_obj_conv;
21946         this_obj_conv.inner = untag_ptr(this_obj);
21947         this_obj_conv.is_owned = ptr_is_owned(this_obj);
21948         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
21949         MonitorUpdateId_free(this_obj_conv);
21950 }
21951
21952 static inline uint64_t MonitorUpdateId_clone_ptr(LDKMonitorUpdateId *NONNULL_PTR arg) {
21953         LDKMonitorUpdateId ret_var = MonitorUpdateId_clone(arg);
21954         uint64_t ret_ref = 0;
21955         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21956         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
21957         return ret_ref;
21958 }
21959 int64_t  __attribute__((export_name("TS_MonitorUpdateId_clone_ptr"))) TS_MonitorUpdateId_clone_ptr(uint64_t arg) {
21960         LDKMonitorUpdateId arg_conv;
21961         arg_conv.inner = untag_ptr(arg);
21962         arg_conv.is_owned = ptr_is_owned(arg);
21963         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
21964         arg_conv.is_owned = false;
21965         int64_t ret_conv = MonitorUpdateId_clone_ptr(&arg_conv);
21966         return ret_conv;
21967 }
21968
21969 uint64_t  __attribute__((export_name("TS_MonitorUpdateId_clone"))) TS_MonitorUpdateId_clone(uint64_t orig) {
21970         LDKMonitorUpdateId orig_conv;
21971         orig_conv.inner = untag_ptr(orig);
21972         orig_conv.is_owned = ptr_is_owned(orig);
21973         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
21974         orig_conv.is_owned = false;
21975         LDKMonitorUpdateId ret_var = MonitorUpdateId_clone(&orig_conv);
21976         uint64_t ret_ref = 0;
21977         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21978         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
21979         return ret_ref;
21980 }
21981
21982 int64_t  __attribute__((export_name("TS_MonitorUpdateId_hash"))) TS_MonitorUpdateId_hash(uint64_t o) {
21983         LDKMonitorUpdateId o_conv;
21984         o_conv.inner = untag_ptr(o);
21985         o_conv.is_owned = ptr_is_owned(o);
21986         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21987         o_conv.is_owned = false;
21988         int64_t ret_conv = MonitorUpdateId_hash(&o_conv);
21989         return ret_conv;
21990 }
21991
21992 jboolean  __attribute__((export_name("TS_MonitorUpdateId_eq"))) TS_MonitorUpdateId_eq(uint64_t a, uint64_t b) {
21993         LDKMonitorUpdateId a_conv;
21994         a_conv.inner = untag_ptr(a);
21995         a_conv.is_owned = ptr_is_owned(a);
21996         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
21997         a_conv.is_owned = false;
21998         LDKMonitorUpdateId b_conv;
21999         b_conv.inner = untag_ptr(b);
22000         b_conv.is_owned = ptr_is_owned(b);
22001         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
22002         b_conv.is_owned = false;
22003         jboolean ret_conv = MonitorUpdateId_eq(&a_conv, &b_conv);
22004         return ret_conv;
22005 }
22006
22007 void  __attribute__((export_name("TS_Persist_free"))) TS_Persist_free(uint64_t this_ptr) {
22008         if (!ptr_is_owned(this_ptr)) return;
22009         void* this_ptr_ptr = untag_ptr(this_ptr);
22010         CHECK_ACCESS(this_ptr_ptr);
22011         LDKPersist this_ptr_conv = *(LDKPersist*)(this_ptr_ptr);
22012         FREE(untag_ptr(this_ptr));
22013         Persist_free(this_ptr_conv);
22014 }
22015
22016 void  __attribute__((export_name("TS_LockedChannelMonitor_free"))) TS_LockedChannelMonitor_free(uint64_t this_obj) {
22017         LDKLockedChannelMonitor this_obj_conv;
22018         this_obj_conv.inner = untag_ptr(this_obj);
22019         this_obj_conv.is_owned = ptr_is_owned(this_obj);
22020         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
22021         LockedChannelMonitor_free(this_obj_conv);
22022 }
22023
22024 void  __attribute__((export_name("TS_ChainMonitor_free"))) TS_ChainMonitor_free(uint64_t this_obj) {
22025         LDKChainMonitor this_obj_conv;
22026         this_obj_conv.inner = untag_ptr(this_obj);
22027         this_obj_conv.is_owned = ptr_is_owned(this_obj);
22028         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
22029         ChainMonitor_free(this_obj_conv);
22030 }
22031
22032 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) {
22033         void* chain_source_ptr = untag_ptr(chain_source);
22034         CHECK_ACCESS(chain_source_ptr);
22035         LDKCOption_FilterZ chain_source_conv = *(LDKCOption_FilterZ*)(chain_source_ptr);
22036         // WARNING: we may need a move here but no clone is available for LDKCOption_FilterZ
22037         if (chain_source_conv.tag == LDKCOption_FilterZ_Some) {
22038                 // Manually implement clone for Java trait instances
22039                 if (chain_source_conv.some.free == LDKFilter_JCalls_free) {
22040                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
22041                         LDKFilter_JCalls_cloned(&chain_source_conv.some);
22042                 }
22043         }
22044         void* broadcaster_ptr = untag_ptr(broadcaster);
22045         CHECK_ACCESS(broadcaster_ptr);
22046         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
22047         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
22048                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
22049                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
22050         }
22051         void* logger_ptr = untag_ptr(logger);
22052         CHECK_ACCESS(logger_ptr);
22053         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
22054         if (logger_conv.free == LDKLogger_JCalls_free) {
22055                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
22056                 LDKLogger_JCalls_cloned(&logger_conv);
22057         }
22058         void* feeest_ptr = untag_ptr(feeest);
22059         CHECK_ACCESS(feeest_ptr);
22060         LDKFeeEstimator feeest_conv = *(LDKFeeEstimator*)(feeest_ptr);
22061         if (feeest_conv.free == LDKFeeEstimator_JCalls_free) {
22062                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
22063                 LDKFeeEstimator_JCalls_cloned(&feeest_conv);
22064         }
22065         void* persister_ptr = untag_ptr(persister);
22066         CHECK_ACCESS(persister_ptr);
22067         LDKPersist persister_conv = *(LDKPersist*)(persister_ptr);
22068         if (persister_conv.free == LDKPersist_JCalls_free) {
22069                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
22070                 LDKPersist_JCalls_cloned(&persister_conv);
22071         }
22072         LDKChainMonitor ret_var = ChainMonitor_new(chain_source_conv, broadcaster_conv, logger_conv, feeest_conv, persister_conv);
22073         uint64_t ret_ref = 0;
22074         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22075         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
22076         return ret_ref;
22077 }
22078
22079 uint64_tArray  __attribute__((export_name("TS_ChainMonitor_get_claimable_balances"))) TS_ChainMonitor_get_claimable_balances(uint64_t this_arg, uint64_tArray ignored_channels) {
22080         LDKChainMonitor this_arg_conv;
22081         this_arg_conv.inner = untag_ptr(this_arg);
22082         this_arg_conv.is_owned = ptr_is_owned(this_arg);
22083         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
22084         this_arg_conv.is_owned = false;
22085         LDKCVec_ChannelDetailsZ ignored_channels_constr;
22086         ignored_channels_constr.datalen = ignored_channels->arr_len;
22087         if (ignored_channels_constr.datalen > 0)
22088                 ignored_channels_constr.data = MALLOC(ignored_channels_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
22089         else
22090                 ignored_channels_constr.data = NULL;
22091         uint64_t* ignored_channels_vals = ignored_channels->elems;
22092         for (size_t q = 0; q < ignored_channels_constr.datalen; q++) {
22093                 uint64_t ignored_channels_conv_16 = ignored_channels_vals[q];
22094                 LDKChannelDetails ignored_channels_conv_16_conv;
22095                 ignored_channels_conv_16_conv.inner = untag_ptr(ignored_channels_conv_16);
22096                 ignored_channels_conv_16_conv.is_owned = ptr_is_owned(ignored_channels_conv_16);
22097                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ignored_channels_conv_16_conv);
22098                 ignored_channels_conv_16_conv = ChannelDetails_clone(&ignored_channels_conv_16_conv);
22099                 ignored_channels_constr.data[q] = ignored_channels_conv_16_conv;
22100         }
22101         FREE(ignored_channels);
22102         LDKCVec_BalanceZ ret_var = ChainMonitor_get_claimable_balances(&this_arg_conv, ignored_channels_constr);
22103         uint64_tArray ret_arr = NULL;
22104         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
22105         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
22106         for (size_t j = 0; j < ret_var.datalen; j++) {
22107                 LDKBalance *ret_conv_9_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
22108                 *ret_conv_9_copy = ret_var.data[j];
22109                 uint64_t ret_conv_9_ref = tag_ptr(ret_conv_9_copy, true);
22110                 ret_arr_ptr[j] = ret_conv_9_ref;
22111         }
22112         
22113         FREE(ret_var.data);
22114         return ret_arr;
22115 }
22116
22117 uint64_t  __attribute__((export_name("TS_ChainMonitor_get_monitor"))) TS_ChainMonitor_get_monitor(uint64_t this_arg, uint64_t funding_txo) {
22118         LDKChainMonitor this_arg_conv;
22119         this_arg_conv.inner = untag_ptr(this_arg);
22120         this_arg_conv.is_owned = ptr_is_owned(this_arg);
22121         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
22122         this_arg_conv.is_owned = false;
22123         LDKOutPoint funding_txo_conv;
22124         funding_txo_conv.inner = untag_ptr(funding_txo);
22125         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
22126         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
22127         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
22128         LDKCResult_LockedChannelMonitorNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_LockedChannelMonitorNoneZ), "LDKCResult_LockedChannelMonitorNoneZ");
22129         *ret_conv = ChainMonitor_get_monitor(&this_arg_conv, funding_txo_conv);
22130         return tag_ptr(ret_conv, true);
22131 }
22132
22133 uint64_tArray  __attribute__((export_name("TS_ChainMonitor_list_monitors"))) TS_ChainMonitor_list_monitors(uint64_t this_arg) {
22134         LDKChainMonitor this_arg_conv;
22135         this_arg_conv.inner = untag_ptr(this_arg);
22136         this_arg_conv.is_owned = ptr_is_owned(this_arg);
22137         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
22138         this_arg_conv.is_owned = false;
22139         LDKCVec_OutPointZ ret_var = ChainMonitor_list_monitors(&this_arg_conv);
22140         uint64_tArray ret_arr = NULL;
22141         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
22142         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
22143         for (size_t k = 0; k < ret_var.datalen; k++) {
22144                 LDKOutPoint ret_conv_10_var = ret_var.data[k];
22145                 uint64_t ret_conv_10_ref = 0;
22146                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_10_var);
22147                 ret_conv_10_ref = tag_ptr(ret_conv_10_var.inner, ret_conv_10_var.is_owned);
22148                 ret_arr_ptr[k] = ret_conv_10_ref;
22149         }
22150         
22151         FREE(ret_var.data);
22152         return ret_arr;
22153 }
22154
22155 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) {
22156         LDKChainMonitor this_arg_conv;
22157         this_arg_conv.inner = untag_ptr(this_arg);
22158         this_arg_conv.is_owned = ptr_is_owned(this_arg);
22159         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
22160         this_arg_conv.is_owned = false;
22161         LDKOutPoint funding_txo_conv;
22162         funding_txo_conv.inner = untag_ptr(funding_txo);
22163         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
22164         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
22165         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
22166         LDKMonitorUpdateId completed_update_id_conv;
22167         completed_update_id_conv.inner = untag_ptr(completed_update_id);
22168         completed_update_id_conv.is_owned = ptr_is_owned(completed_update_id);
22169         CHECK_INNER_FIELD_ACCESS_OR_NULL(completed_update_id_conv);
22170         completed_update_id_conv = MonitorUpdateId_clone(&completed_update_id_conv);
22171         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
22172         *ret_conv = ChainMonitor_channel_monitor_updated(&this_arg_conv, funding_txo_conv, completed_update_id_conv);
22173         return tag_ptr(ret_conv, true);
22174 }
22175
22176 uint64_t  __attribute__((export_name("TS_ChainMonitor_as_Listen"))) TS_ChainMonitor_as_Listen(uint64_t this_arg) {
22177         LDKChainMonitor this_arg_conv;
22178         this_arg_conv.inner = untag_ptr(this_arg);
22179         this_arg_conv.is_owned = ptr_is_owned(this_arg);
22180         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
22181         this_arg_conv.is_owned = false;
22182         LDKListen* ret_ret = MALLOC(sizeof(LDKListen), "LDKListen");
22183         *ret_ret = ChainMonitor_as_Listen(&this_arg_conv);
22184         return tag_ptr(ret_ret, true);
22185 }
22186
22187 uint64_t  __attribute__((export_name("TS_ChainMonitor_as_Confirm"))) TS_ChainMonitor_as_Confirm(uint64_t this_arg) {
22188         LDKChainMonitor this_arg_conv;
22189         this_arg_conv.inner = untag_ptr(this_arg);
22190         this_arg_conv.is_owned = ptr_is_owned(this_arg);
22191         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
22192         this_arg_conv.is_owned = false;
22193         LDKConfirm* ret_ret = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
22194         *ret_ret = ChainMonitor_as_Confirm(&this_arg_conv);
22195         return tag_ptr(ret_ret, true);
22196 }
22197
22198 uint64_t  __attribute__((export_name("TS_ChainMonitor_as_Watch"))) TS_ChainMonitor_as_Watch(uint64_t this_arg) {
22199         LDKChainMonitor this_arg_conv;
22200         this_arg_conv.inner = untag_ptr(this_arg);
22201         this_arg_conv.is_owned = ptr_is_owned(this_arg);
22202         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
22203         this_arg_conv.is_owned = false;
22204         LDKWatch* ret_ret = MALLOC(sizeof(LDKWatch), "LDKWatch");
22205         *ret_ret = ChainMonitor_as_Watch(&this_arg_conv);
22206         return tag_ptr(ret_ret, true);
22207 }
22208
22209 uint64_t  __attribute__((export_name("TS_ChainMonitor_as_EventsProvider"))) TS_ChainMonitor_as_EventsProvider(uint64_t this_arg) {
22210         LDKChainMonitor this_arg_conv;
22211         this_arg_conv.inner = untag_ptr(this_arg);
22212         this_arg_conv.is_owned = ptr_is_owned(this_arg);
22213         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
22214         this_arg_conv.is_owned = false;
22215         LDKEventsProvider* ret_ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
22216         *ret_ret = ChainMonitor_as_EventsProvider(&this_arg_conv);
22217         return tag_ptr(ret_ret, true);
22218 }
22219
22220 void  __attribute__((export_name("TS_ChannelMonitorUpdate_free"))) TS_ChannelMonitorUpdate_free(uint64_t this_obj) {
22221         LDKChannelMonitorUpdate this_obj_conv;
22222         this_obj_conv.inner = untag_ptr(this_obj);
22223         this_obj_conv.is_owned = ptr_is_owned(this_obj);
22224         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
22225         ChannelMonitorUpdate_free(this_obj_conv);
22226 }
22227
22228 int64_t  __attribute__((export_name("TS_ChannelMonitorUpdate_get_update_id"))) TS_ChannelMonitorUpdate_get_update_id(uint64_t this_ptr) {
22229         LDKChannelMonitorUpdate this_ptr_conv;
22230         this_ptr_conv.inner = untag_ptr(this_ptr);
22231         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22232         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22233         this_ptr_conv.is_owned = false;
22234         int64_t ret_conv = ChannelMonitorUpdate_get_update_id(&this_ptr_conv);
22235         return ret_conv;
22236 }
22237
22238 void  __attribute__((export_name("TS_ChannelMonitorUpdate_set_update_id"))) TS_ChannelMonitorUpdate_set_update_id(uint64_t this_ptr, int64_t val) {
22239         LDKChannelMonitorUpdate this_ptr_conv;
22240         this_ptr_conv.inner = untag_ptr(this_ptr);
22241         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22242         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22243         this_ptr_conv.is_owned = false;
22244         ChannelMonitorUpdate_set_update_id(&this_ptr_conv, val);
22245 }
22246
22247 static inline uint64_t ChannelMonitorUpdate_clone_ptr(LDKChannelMonitorUpdate *NONNULL_PTR arg) {
22248         LDKChannelMonitorUpdate ret_var = ChannelMonitorUpdate_clone(arg);
22249         uint64_t ret_ref = 0;
22250         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22251         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
22252         return ret_ref;
22253 }
22254 int64_t  __attribute__((export_name("TS_ChannelMonitorUpdate_clone_ptr"))) TS_ChannelMonitorUpdate_clone_ptr(uint64_t arg) {
22255         LDKChannelMonitorUpdate arg_conv;
22256         arg_conv.inner = untag_ptr(arg);
22257         arg_conv.is_owned = ptr_is_owned(arg);
22258         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
22259         arg_conv.is_owned = false;
22260         int64_t ret_conv = ChannelMonitorUpdate_clone_ptr(&arg_conv);
22261         return ret_conv;
22262 }
22263
22264 uint64_t  __attribute__((export_name("TS_ChannelMonitorUpdate_clone"))) TS_ChannelMonitorUpdate_clone(uint64_t orig) {
22265         LDKChannelMonitorUpdate orig_conv;
22266         orig_conv.inner = untag_ptr(orig);
22267         orig_conv.is_owned = ptr_is_owned(orig);
22268         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
22269         orig_conv.is_owned = false;
22270         LDKChannelMonitorUpdate ret_var = ChannelMonitorUpdate_clone(&orig_conv);
22271         uint64_t ret_ref = 0;
22272         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22273         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
22274         return ret_ref;
22275 }
22276
22277 int8_tArray  __attribute__((export_name("TS_ChannelMonitorUpdate_write"))) TS_ChannelMonitorUpdate_write(uint64_t obj) {
22278         LDKChannelMonitorUpdate obj_conv;
22279         obj_conv.inner = untag_ptr(obj);
22280         obj_conv.is_owned = ptr_is_owned(obj);
22281         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
22282         obj_conv.is_owned = false;
22283         LDKCVec_u8Z ret_var = ChannelMonitorUpdate_write(&obj_conv);
22284         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
22285         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
22286         CVec_u8Z_free(ret_var);
22287         return ret_arr;
22288 }
22289
22290 uint64_t  __attribute__((export_name("TS_ChannelMonitorUpdate_read"))) TS_ChannelMonitorUpdate_read(int8_tArray ser) {
22291         LDKu8slice ser_ref;
22292         ser_ref.datalen = ser->arr_len;
22293         ser_ref.data = ser->elems;
22294         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
22295         *ret_conv = ChannelMonitorUpdate_read(ser_ref);
22296         FREE(ser);
22297         return tag_ptr(ret_conv, true);
22298 }
22299
22300 void  __attribute__((export_name("TS_MonitorEvent_free"))) TS_MonitorEvent_free(uint64_t this_ptr) {
22301         if (!ptr_is_owned(this_ptr)) return;
22302         void* this_ptr_ptr = untag_ptr(this_ptr);
22303         CHECK_ACCESS(this_ptr_ptr);
22304         LDKMonitorEvent this_ptr_conv = *(LDKMonitorEvent*)(this_ptr_ptr);
22305         FREE(untag_ptr(this_ptr));
22306         MonitorEvent_free(this_ptr_conv);
22307 }
22308
22309 static inline uint64_t MonitorEvent_clone_ptr(LDKMonitorEvent *NONNULL_PTR arg) {
22310         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
22311         *ret_copy = MonitorEvent_clone(arg);
22312         uint64_t ret_ref = tag_ptr(ret_copy, true);
22313         return ret_ref;
22314 }
22315 int64_t  __attribute__((export_name("TS_MonitorEvent_clone_ptr"))) TS_MonitorEvent_clone_ptr(uint64_t arg) {
22316         LDKMonitorEvent* arg_conv = (LDKMonitorEvent*)untag_ptr(arg);
22317         int64_t ret_conv = MonitorEvent_clone_ptr(arg_conv);
22318         return ret_conv;
22319 }
22320
22321 uint64_t  __attribute__((export_name("TS_MonitorEvent_clone"))) TS_MonitorEvent_clone(uint64_t orig) {
22322         LDKMonitorEvent* orig_conv = (LDKMonitorEvent*)untag_ptr(orig);
22323         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
22324         *ret_copy = MonitorEvent_clone(orig_conv);
22325         uint64_t ret_ref = tag_ptr(ret_copy, true);
22326         return ret_ref;
22327 }
22328
22329 uint64_t  __attribute__((export_name("TS_MonitorEvent_htlcevent"))) TS_MonitorEvent_htlcevent(uint64_t a) {
22330         LDKHTLCUpdate a_conv;
22331         a_conv.inner = untag_ptr(a);
22332         a_conv.is_owned = ptr_is_owned(a);
22333         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
22334         a_conv = HTLCUpdate_clone(&a_conv);
22335         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
22336         *ret_copy = MonitorEvent_htlcevent(a_conv);
22337         uint64_t ret_ref = tag_ptr(ret_copy, true);
22338         return ret_ref;
22339 }
22340
22341 uint64_t  __attribute__((export_name("TS_MonitorEvent_commitment_tx_confirmed"))) TS_MonitorEvent_commitment_tx_confirmed(uint64_t a) {
22342         LDKOutPoint a_conv;
22343         a_conv.inner = untag_ptr(a);
22344         a_conv.is_owned = ptr_is_owned(a);
22345         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
22346         a_conv = OutPoint_clone(&a_conv);
22347         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
22348         *ret_copy = MonitorEvent_commitment_tx_confirmed(a_conv);
22349         uint64_t ret_ref = tag_ptr(ret_copy, true);
22350         return ret_ref;
22351 }
22352
22353 uint64_t  __attribute__((export_name("TS_MonitorEvent_update_completed"))) TS_MonitorEvent_update_completed(uint64_t funding_txo, int64_t monitor_update_id) {
22354         LDKOutPoint funding_txo_conv;
22355         funding_txo_conv.inner = untag_ptr(funding_txo);
22356         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
22357         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
22358         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
22359         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
22360         *ret_copy = MonitorEvent_update_completed(funding_txo_conv, monitor_update_id);
22361         uint64_t ret_ref = tag_ptr(ret_copy, true);
22362         return ret_ref;
22363 }
22364
22365 uint64_t  __attribute__((export_name("TS_MonitorEvent_update_failed"))) TS_MonitorEvent_update_failed(uint64_t a) {
22366         LDKOutPoint a_conv;
22367         a_conv.inner = untag_ptr(a);
22368         a_conv.is_owned = ptr_is_owned(a);
22369         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
22370         a_conv = OutPoint_clone(&a_conv);
22371         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
22372         *ret_copy = MonitorEvent_update_failed(a_conv);
22373         uint64_t ret_ref = tag_ptr(ret_copy, true);
22374         return ret_ref;
22375 }
22376
22377 int8_tArray  __attribute__((export_name("TS_MonitorEvent_write"))) TS_MonitorEvent_write(uint64_t obj) {
22378         LDKMonitorEvent* obj_conv = (LDKMonitorEvent*)untag_ptr(obj);
22379         LDKCVec_u8Z ret_var = MonitorEvent_write(obj_conv);
22380         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
22381         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
22382         CVec_u8Z_free(ret_var);
22383         return ret_arr;
22384 }
22385
22386 uint64_t  __attribute__((export_name("TS_MonitorEvent_read"))) TS_MonitorEvent_read(int8_tArray ser) {
22387         LDKu8slice ser_ref;
22388         ser_ref.datalen = ser->arr_len;
22389         ser_ref.data = ser->elems;
22390         LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
22391         *ret_conv = MonitorEvent_read(ser_ref);
22392         FREE(ser);
22393         return tag_ptr(ret_conv, true);
22394 }
22395
22396 void  __attribute__((export_name("TS_HTLCUpdate_free"))) TS_HTLCUpdate_free(uint64_t this_obj) {
22397         LDKHTLCUpdate this_obj_conv;
22398         this_obj_conv.inner = untag_ptr(this_obj);
22399         this_obj_conv.is_owned = ptr_is_owned(this_obj);
22400         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
22401         HTLCUpdate_free(this_obj_conv);
22402 }
22403
22404 static inline uint64_t HTLCUpdate_clone_ptr(LDKHTLCUpdate *NONNULL_PTR arg) {
22405         LDKHTLCUpdate ret_var = HTLCUpdate_clone(arg);
22406         uint64_t ret_ref = 0;
22407         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22408         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
22409         return ret_ref;
22410 }
22411 int64_t  __attribute__((export_name("TS_HTLCUpdate_clone_ptr"))) TS_HTLCUpdate_clone_ptr(uint64_t arg) {
22412         LDKHTLCUpdate arg_conv;
22413         arg_conv.inner = untag_ptr(arg);
22414         arg_conv.is_owned = ptr_is_owned(arg);
22415         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
22416         arg_conv.is_owned = false;
22417         int64_t ret_conv = HTLCUpdate_clone_ptr(&arg_conv);
22418         return ret_conv;
22419 }
22420
22421 uint64_t  __attribute__((export_name("TS_HTLCUpdate_clone"))) TS_HTLCUpdate_clone(uint64_t orig) {
22422         LDKHTLCUpdate orig_conv;
22423         orig_conv.inner = untag_ptr(orig);
22424         orig_conv.is_owned = ptr_is_owned(orig);
22425         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
22426         orig_conv.is_owned = false;
22427         LDKHTLCUpdate ret_var = HTLCUpdate_clone(&orig_conv);
22428         uint64_t ret_ref = 0;
22429         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22430         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
22431         return ret_ref;
22432 }
22433
22434 int8_tArray  __attribute__((export_name("TS_HTLCUpdate_write"))) TS_HTLCUpdate_write(uint64_t obj) {
22435         LDKHTLCUpdate obj_conv;
22436         obj_conv.inner = untag_ptr(obj);
22437         obj_conv.is_owned = ptr_is_owned(obj);
22438         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
22439         obj_conv.is_owned = false;
22440         LDKCVec_u8Z ret_var = HTLCUpdate_write(&obj_conv);
22441         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
22442         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
22443         CVec_u8Z_free(ret_var);
22444         return ret_arr;
22445 }
22446
22447 uint64_t  __attribute__((export_name("TS_HTLCUpdate_read"))) TS_HTLCUpdate_read(int8_tArray ser) {
22448         LDKu8slice ser_ref;
22449         ser_ref.datalen = ser->arr_len;
22450         ser_ref.data = ser->elems;
22451         LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
22452         *ret_conv = HTLCUpdate_read(ser_ref);
22453         FREE(ser);
22454         return tag_ptr(ret_conv, true);
22455 }
22456
22457 void  __attribute__((export_name("TS_Balance_free"))) TS_Balance_free(uint64_t this_ptr) {
22458         if (!ptr_is_owned(this_ptr)) return;
22459         void* this_ptr_ptr = untag_ptr(this_ptr);
22460         CHECK_ACCESS(this_ptr_ptr);
22461         LDKBalance this_ptr_conv = *(LDKBalance*)(this_ptr_ptr);
22462         FREE(untag_ptr(this_ptr));
22463         Balance_free(this_ptr_conv);
22464 }
22465
22466 static inline uint64_t Balance_clone_ptr(LDKBalance *NONNULL_PTR arg) {
22467         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
22468         *ret_copy = Balance_clone(arg);
22469         uint64_t ret_ref = tag_ptr(ret_copy, true);
22470         return ret_ref;
22471 }
22472 int64_t  __attribute__((export_name("TS_Balance_clone_ptr"))) TS_Balance_clone_ptr(uint64_t arg) {
22473         LDKBalance* arg_conv = (LDKBalance*)untag_ptr(arg);
22474         int64_t ret_conv = Balance_clone_ptr(arg_conv);
22475         return ret_conv;
22476 }
22477
22478 uint64_t  __attribute__((export_name("TS_Balance_clone"))) TS_Balance_clone(uint64_t orig) {
22479         LDKBalance* orig_conv = (LDKBalance*)untag_ptr(orig);
22480         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
22481         *ret_copy = Balance_clone(orig_conv);
22482         uint64_t ret_ref = tag_ptr(ret_copy, true);
22483         return ret_ref;
22484 }
22485
22486 uint64_t  __attribute__((export_name("TS_Balance_claimable_on_channel_close"))) TS_Balance_claimable_on_channel_close(int64_t claimable_amount_satoshis) {
22487         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
22488         *ret_copy = Balance_claimable_on_channel_close(claimable_amount_satoshis);
22489         uint64_t ret_ref = tag_ptr(ret_copy, true);
22490         return ret_ref;
22491 }
22492
22493 uint64_t  __attribute__((export_name("TS_Balance_claimable_awaiting_confirmations"))) TS_Balance_claimable_awaiting_confirmations(int64_t claimable_amount_satoshis, int32_t confirmation_height) {
22494         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
22495         *ret_copy = Balance_claimable_awaiting_confirmations(claimable_amount_satoshis, confirmation_height);
22496         uint64_t ret_ref = tag_ptr(ret_copy, true);
22497         return ret_ref;
22498 }
22499
22500 uint64_t  __attribute__((export_name("TS_Balance_contentious_claimable"))) TS_Balance_contentious_claimable(int64_t claimable_amount_satoshis, int32_t timeout_height) {
22501         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
22502         *ret_copy = Balance_contentious_claimable(claimable_amount_satoshis, timeout_height);
22503         uint64_t ret_ref = tag_ptr(ret_copy, true);
22504         return ret_ref;
22505 }
22506
22507 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) {
22508         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
22509         *ret_copy = Balance_maybe_claimable_htlcawaiting_timeout(claimable_amount_satoshis, claimable_height);
22510         uint64_t ret_ref = tag_ptr(ret_copy, true);
22511         return ret_ref;
22512 }
22513
22514 jboolean  __attribute__((export_name("TS_Balance_eq"))) TS_Balance_eq(uint64_t a, uint64_t b) {
22515         LDKBalance* a_conv = (LDKBalance*)untag_ptr(a);
22516         LDKBalance* b_conv = (LDKBalance*)untag_ptr(b);
22517         jboolean ret_conv = Balance_eq(a_conv, b_conv);
22518         return ret_conv;
22519 }
22520
22521 void  __attribute__((export_name("TS_ChannelMonitor_free"))) TS_ChannelMonitor_free(uint64_t this_obj) {
22522         LDKChannelMonitor this_obj_conv;
22523         this_obj_conv.inner = untag_ptr(this_obj);
22524         this_obj_conv.is_owned = ptr_is_owned(this_obj);
22525         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
22526         ChannelMonitor_free(this_obj_conv);
22527 }
22528
22529 static inline uint64_t ChannelMonitor_clone_ptr(LDKChannelMonitor *NONNULL_PTR arg) {
22530         LDKChannelMonitor ret_var = ChannelMonitor_clone(arg);
22531         uint64_t ret_ref = 0;
22532         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22533         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
22534         return ret_ref;
22535 }
22536 int64_t  __attribute__((export_name("TS_ChannelMonitor_clone_ptr"))) TS_ChannelMonitor_clone_ptr(uint64_t arg) {
22537         LDKChannelMonitor arg_conv;
22538         arg_conv.inner = untag_ptr(arg);
22539         arg_conv.is_owned = ptr_is_owned(arg);
22540         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
22541         arg_conv.is_owned = false;
22542         int64_t ret_conv = ChannelMonitor_clone_ptr(&arg_conv);
22543         return ret_conv;
22544 }
22545
22546 uint64_t  __attribute__((export_name("TS_ChannelMonitor_clone"))) TS_ChannelMonitor_clone(uint64_t orig) {
22547         LDKChannelMonitor orig_conv;
22548         orig_conv.inner = untag_ptr(orig);
22549         orig_conv.is_owned = ptr_is_owned(orig);
22550         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
22551         orig_conv.is_owned = false;
22552         LDKChannelMonitor ret_var = ChannelMonitor_clone(&orig_conv);
22553         uint64_t ret_ref = 0;
22554         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22555         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
22556         return ret_ref;
22557 }
22558
22559 int8_tArray  __attribute__((export_name("TS_ChannelMonitor_write"))) TS_ChannelMonitor_write(uint64_t obj) {
22560         LDKChannelMonitor obj_conv;
22561         obj_conv.inner = untag_ptr(obj);
22562         obj_conv.is_owned = ptr_is_owned(obj);
22563         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
22564         obj_conv.is_owned = false;
22565         LDKCVec_u8Z ret_var = ChannelMonitor_write(&obj_conv);
22566         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
22567         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
22568         CVec_u8Z_free(ret_var);
22569         return ret_arr;
22570 }
22571
22572 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) {
22573         LDKChannelMonitor this_arg_conv;
22574         this_arg_conv.inner = untag_ptr(this_arg);
22575         this_arg_conv.is_owned = ptr_is_owned(this_arg);
22576         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
22577         this_arg_conv.is_owned = false;
22578         LDKChannelMonitorUpdate updates_conv;
22579         updates_conv.inner = untag_ptr(updates);
22580         updates_conv.is_owned = ptr_is_owned(updates);
22581         CHECK_INNER_FIELD_ACCESS_OR_NULL(updates_conv);
22582         updates_conv.is_owned = false;
22583         void* broadcaster_ptr = untag_ptr(broadcaster);
22584         if (ptr_is_owned(broadcaster)) { CHECK_ACCESS(broadcaster_ptr); }
22585         LDKBroadcasterInterface* broadcaster_conv = (LDKBroadcasterInterface*)broadcaster_ptr;
22586         void* fee_estimator_ptr = untag_ptr(fee_estimator);
22587         CHECK_ACCESS(fee_estimator_ptr);
22588         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
22589         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
22590                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
22591                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
22592         }
22593         void* logger_ptr = untag_ptr(logger);
22594         if (ptr_is_owned(logger)) { CHECK_ACCESS(logger_ptr); }
22595         LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
22596         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
22597         *ret_conv = ChannelMonitor_update_monitor(&this_arg_conv, &updates_conv, broadcaster_conv, fee_estimator_conv, logger_conv);
22598         return tag_ptr(ret_conv, true);
22599 }
22600
22601 int64_t  __attribute__((export_name("TS_ChannelMonitor_get_latest_update_id"))) TS_ChannelMonitor_get_latest_update_id(uint64_t this_arg) {
22602         LDKChannelMonitor this_arg_conv;
22603         this_arg_conv.inner = untag_ptr(this_arg);
22604         this_arg_conv.is_owned = ptr_is_owned(this_arg);
22605         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
22606         this_arg_conv.is_owned = false;
22607         int64_t ret_conv = ChannelMonitor_get_latest_update_id(&this_arg_conv);
22608         return ret_conv;
22609 }
22610
22611 uint64_t  __attribute__((export_name("TS_ChannelMonitor_get_funding_txo"))) TS_ChannelMonitor_get_funding_txo(uint64_t this_arg) {
22612         LDKChannelMonitor this_arg_conv;
22613         this_arg_conv.inner = untag_ptr(this_arg);
22614         this_arg_conv.is_owned = ptr_is_owned(this_arg);
22615         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
22616         this_arg_conv.is_owned = false;
22617         LDKC2Tuple_OutPointScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
22618         *ret_conv = ChannelMonitor_get_funding_txo(&this_arg_conv);
22619         return tag_ptr(ret_conv, true);
22620 }
22621
22622 uint64_tArray  __attribute__((export_name("TS_ChannelMonitor_get_outputs_to_watch"))) TS_ChannelMonitor_get_outputs_to_watch(uint64_t this_arg) {
22623         LDKChannelMonitor this_arg_conv;
22624         this_arg_conv.inner = untag_ptr(this_arg);
22625         this_arg_conv.is_owned = ptr_is_owned(this_arg);
22626         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
22627         this_arg_conv.is_owned = false;
22628         LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ ret_var = ChannelMonitor_get_outputs_to_watch(&this_arg_conv);
22629         uint64_tArray ret_arr = NULL;
22630         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
22631         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
22632         for (size_t o = 0; o < ret_var.datalen; o++) {
22633                 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_conv_40_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
22634                 *ret_conv_40_conv = ret_var.data[o];
22635                 ret_arr_ptr[o] = tag_ptr(ret_conv_40_conv, true);
22636         }
22637         
22638         FREE(ret_var.data);
22639         return ret_arr;
22640 }
22641
22642 void  __attribute__((export_name("TS_ChannelMonitor_load_outputs_to_watch"))) TS_ChannelMonitor_load_outputs_to_watch(uint64_t this_arg, uint64_t filter) {
22643         LDKChannelMonitor this_arg_conv;
22644         this_arg_conv.inner = untag_ptr(this_arg);
22645         this_arg_conv.is_owned = ptr_is_owned(this_arg);
22646         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
22647         this_arg_conv.is_owned = false;
22648         void* filter_ptr = untag_ptr(filter);
22649         if (ptr_is_owned(filter)) { CHECK_ACCESS(filter_ptr); }
22650         LDKFilter* filter_conv = (LDKFilter*)filter_ptr;
22651         ChannelMonitor_load_outputs_to_watch(&this_arg_conv, filter_conv);
22652 }
22653
22654 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) {
22655         LDKChannelMonitor this_arg_conv;
22656         this_arg_conv.inner = untag_ptr(this_arg);
22657         this_arg_conv.is_owned = ptr_is_owned(this_arg);
22658         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
22659         this_arg_conv.is_owned = false;
22660         LDKCVec_MonitorEventZ ret_var = ChannelMonitor_get_and_clear_pending_monitor_events(&this_arg_conv);
22661         uint64_tArray ret_arr = NULL;
22662         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
22663         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
22664         for (size_t o = 0; o < ret_var.datalen; o++) {
22665                 LDKMonitorEvent *ret_conv_14_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
22666                 *ret_conv_14_copy = ret_var.data[o];
22667                 uint64_t ret_conv_14_ref = tag_ptr(ret_conv_14_copy, true);
22668                 ret_arr_ptr[o] = ret_conv_14_ref;
22669         }
22670         
22671         FREE(ret_var.data);
22672         return ret_arr;
22673 }
22674
22675 uint64_tArray  __attribute__((export_name("TS_ChannelMonitor_get_and_clear_pending_events"))) TS_ChannelMonitor_get_and_clear_pending_events(uint64_t this_arg) {
22676         LDKChannelMonitor this_arg_conv;
22677         this_arg_conv.inner = untag_ptr(this_arg);
22678         this_arg_conv.is_owned = ptr_is_owned(this_arg);
22679         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
22680         this_arg_conv.is_owned = false;
22681         LDKCVec_EventZ ret_var = ChannelMonitor_get_and_clear_pending_events(&this_arg_conv);
22682         uint64_tArray ret_arr = NULL;
22683         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
22684         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
22685         for (size_t h = 0; h < ret_var.datalen; h++) {
22686                 LDKEvent *ret_conv_7_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
22687                 *ret_conv_7_copy = ret_var.data[h];
22688                 uint64_t ret_conv_7_ref = tag_ptr(ret_conv_7_copy, true);
22689                 ret_arr_ptr[h] = ret_conv_7_ref;
22690         }
22691         
22692         FREE(ret_var.data);
22693         return ret_arr;
22694 }
22695
22696 int8_tArray  __attribute__((export_name("TS_ChannelMonitor_get_counterparty_node_id"))) TS_ChannelMonitor_get_counterparty_node_id(uint64_t this_arg) {
22697         LDKChannelMonitor this_arg_conv;
22698         this_arg_conv.inner = untag_ptr(this_arg);
22699         this_arg_conv.is_owned = ptr_is_owned(this_arg);
22700         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
22701         this_arg_conv.is_owned = false;
22702         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
22703         memcpy(ret_arr->elems, ChannelMonitor_get_counterparty_node_id(&this_arg_conv).compressed_form, 33);
22704         return ret_arr;
22705 }
22706
22707 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) {
22708         LDKChannelMonitor this_arg_conv;
22709         this_arg_conv.inner = untag_ptr(this_arg);
22710         this_arg_conv.is_owned = ptr_is_owned(this_arg);
22711         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
22712         this_arg_conv.is_owned = false;
22713         void* logger_ptr = untag_ptr(logger);
22714         if (ptr_is_owned(logger)) { CHECK_ACCESS(logger_ptr); }
22715         LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
22716         LDKCVec_TransactionZ ret_var = ChannelMonitor_get_latest_holder_commitment_txn(&this_arg_conv, logger_conv);
22717         ptrArray ret_arr = NULL;
22718         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
22719         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
22720         for (size_t m = 0; m < ret_var.datalen; m++) {
22721                 LDKTransaction ret_conv_12_var = ret_var.data[m];
22722                 int8_tArray ret_conv_12_arr = init_int8_tArray(ret_conv_12_var.datalen, __LINE__);
22723                 memcpy(ret_conv_12_arr->elems, ret_conv_12_var.data, ret_conv_12_var.datalen);
22724                 Transaction_free(ret_conv_12_var);
22725                 ret_arr_ptr[m] = ret_conv_12_arr;
22726         }
22727         
22728         FREE(ret_var.data);
22729         return ret_arr;
22730 }
22731
22732 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) {
22733         LDKChannelMonitor this_arg_conv;
22734         this_arg_conv.inner = untag_ptr(this_arg);
22735         this_arg_conv.is_owned = ptr_is_owned(this_arg);
22736         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
22737         this_arg_conv.is_owned = false;
22738         unsigned char header_arr[80];
22739         CHECK(header->arr_len == 80);
22740         memcpy(header_arr, header->elems, 80); FREE(header);
22741         unsigned char (*header_ref)[80] = &header_arr;
22742         LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
22743         txdata_constr.datalen = txdata->arr_len;
22744         if (txdata_constr.datalen > 0)
22745                 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
22746         else
22747                 txdata_constr.data = NULL;
22748         uint64_t* txdata_vals = txdata->elems;
22749         for (size_t c = 0; c < txdata_constr.datalen; c++) {
22750                 uint64_t txdata_conv_28 = txdata_vals[c];
22751                 void* txdata_conv_28_ptr = untag_ptr(txdata_conv_28);
22752                 CHECK_ACCESS(txdata_conv_28_ptr);
22753                 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
22754                 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)untag_ptr(txdata_conv_28));
22755                 txdata_constr.data[c] = txdata_conv_28_conv;
22756         }
22757         FREE(txdata);
22758         void* broadcaster_ptr = untag_ptr(broadcaster);
22759         CHECK_ACCESS(broadcaster_ptr);
22760         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
22761         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
22762                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
22763                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
22764         }
22765         void* fee_estimator_ptr = untag_ptr(fee_estimator);
22766         CHECK_ACCESS(fee_estimator_ptr);
22767         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
22768         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
22769                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
22770                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
22771         }
22772         void* logger_ptr = untag_ptr(logger);
22773         CHECK_ACCESS(logger_ptr);
22774         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
22775         if (logger_conv.free == LDKLogger_JCalls_free) {
22776                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
22777                 LDKLogger_JCalls_cloned(&logger_conv);
22778         }
22779         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);
22780         uint64_tArray ret_arr = NULL;
22781         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
22782         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
22783         for (size_t n = 0; n < ret_var.datalen; n++) {
22784                 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv_39_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
22785                 *ret_conv_39_conv = ret_var.data[n];
22786                 ret_arr_ptr[n] = tag_ptr(ret_conv_39_conv, true);
22787         }
22788         
22789         FREE(ret_var.data);
22790         return ret_arr;
22791 }
22792
22793 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) {
22794         LDKChannelMonitor this_arg_conv;
22795         this_arg_conv.inner = untag_ptr(this_arg);
22796         this_arg_conv.is_owned = ptr_is_owned(this_arg);
22797         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
22798         this_arg_conv.is_owned = false;
22799         unsigned char header_arr[80];
22800         CHECK(header->arr_len == 80);
22801         memcpy(header_arr, header->elems, 80); FREE(header);
22802         unsigned char (*header_ref)[80] = &header_arr;
22803         void* broadcaster_ptr = untag_ptr(broadcaster);
22804         CHECK_ACCESS(broadcaster_ptr);
22805         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
22806         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
22807                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
22808                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
22809         }
22810         void* fee_estimator_ptr = untag_ptr(fee_estimator);
22811         CHECK_ACCESS(fee_estimator_ptr);
22812         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
22813         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
22814                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
22815                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
22816         }
22817         void* logger_ptr = untag_ptr(logger);
22818         CHECK_ACCESS(logger_ptr);
22819         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
22820         if (logger_conv.free == LDKLogger_JCalls_free) {
22821                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
22822                 LDKLogger_JCalls_cloned(&logger_conv);
22823         }
22824         ChannelMonitor_block_disconnected(&this_arg_conv, header_ref, height, broadcaster_conv, fee_estimator_conv, logger_conv);
22825 }
22826
22827 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) {
22828         LDKChannelMonitor this_arg_conv;
22829         this_arg_conv.inner = untag_ptr(this_arg);
22830         this_arg_conv.is_owned = ptr_is_owned(this_arg);
22831         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
22832         this_arg_conv.is_owned = false;
22833         unsigned char header_arr[80];
22834         CHECK(header->arr_len == 80);
22835         memcpy(header_arr, header->elems, 80); FREE(header);
22836         unsigned char (*header_ref)[80] = &header_arr;
22837         LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
22838         txdata_constr.datalen = txdata->arr_len;
22839         if (txdata_constr.datalen > 0)
22840                 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
22841         else
22842                 txdata_constr.data = NULL;
22843         uint64_t* txdata_vals = txdata->elems;
22844         for (size_t c = 0; c < txdata_constr.datalen; c++) {
22845                 uint64_t txdata_conv_28 = txdata_vals[c];
22846                 void* txdata_conv_28_ptr = untag_ptr(txdata_conv_28);
22847                 CHECK_ACCESS(txdata_conv_28_ptr);
22848                 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
22849                 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)untag_ptr(txdata_conv_28));
22850                 txdata_constr.data[c] = txdata_conv_28_conv;
22851         }
22852         FREE(txdata);
22853         void* broadcaster_ptr = untag_ptr(broadcaster);
22854         CHECK_ACCESS(broadcaster_ptr);
22855         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
22856         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
22857                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
22858                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
22859         }
22860         void* fee_estimator_ptr = untag_ptr(fee_estimator);
22861         CHECK_ACCESS(fee_estimator_ptr);
22862         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
22863         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
22864                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
22865                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
22866         }
22867         void* logger_ptr = untag_ptr(logger);
22868         CHECK_ACCESS(logger_ptr);
22869         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
22870         if (logger_conv.free == LDKLogger_JCalls_free) {
22871                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
22872                 LDKLogger_JCalls_cloned(&logger_conv);
22873         }
22874         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);
22875         uint64_tArray ret_arr = NULL;
22876         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
22877         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
22878         for (size_t n = 0; n < ret_var.datalen; n++) {
22879                 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv_39_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
22880                 *ret_conv_39_conv = ret_var.data[n];
22881                 ret_arr_ptr[n] = tag_ptr(ret_conv_39_conv, true);
22882         }
22883         
22884         FREE(ret_var.data);
22885         return ret_arr;
22886 }
22887
22888 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) {
22889         LDKChannelMonitor this_arg_conv;
22890         this_arg_conv.inner = untag_ptr(this_arg);
22891         this_arg_conv.is_owned = ptr_is_owned(this_arg);
22892         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
22893         this_arg_conv.is_owned = false;
22894         unsigned char txid_arr[32];
22895         CHECK(txid->arr_len == 32);
22896         memcpy(txid_arr, txid->elems, 32); FREE(txid);
22897         unsigned char (*txid_ref)[32] = &txid_arr;
22898         void* broadcaster_ptr = untag_ptr(broadcaster);
22899         CHECK_ACCESS(broadcaster_ptr);
22900         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
22901         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
22902                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
22903                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
22904         }
22905         void* fee_estimator_ptr = untag_ptr(fee_estimator);
22906         CHECK_ACCESS(fee_estimator_ptr);
22907         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
22908         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
22909                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
22910                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
22911         }
22912         void* logger_ptr = untag_ptr(logger);
22913         CHECK_ACCESS(logger_ptr);
22914         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
22915         if (logger_conv.free == LDKLogger_JCalls_free) {
22916                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
22917                 LDKLogger_JCalls_cloned(&logger_conv);
22918         }
22919         ChannelMonitor_transaction_unconfirmed(&this_arg_conv, txid_ref, broadcaster_conv, fee_estimator_conv, logger_conv);
22920 }
22921
22922 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) {
22923         LDKChannelMonitor this_arg_conv;
22924         this_arg_conv.inner = untag_ptr(this_arg);
22925         this_arg_conv.is_owned = ptr_is_owned(this_arg);
22926         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
22927         this_arg_conv.is_owned = false;
22928         unsigned char header_arr[80];
22929         CHECK(header->arr_len == 80);
22930         memcpy(header_arr, header->elems, 80); FREE(header);
22931         unsigned char (*header_ref)[80] = &header_arr;
22932         void* broadcaster_ptr = untag_ptr(broadcaster);
22933         CHECK_ACCESS(broadcaster_ptr);
22934         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
22935         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
22936                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
22937                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
22938         }
22939         void* fee_estimator_ptr = untag_ptr(fee_estimator);
22940         CHECK_ACCESS(fee_estimator_ptr);
22941         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
22942         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
22943                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
22944                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
22945         }
22946         void* logger_ptr = untag_ptr(logger);
22947         CHECK_ACCESS(logger_ptr);
22948         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
22949         if (logger_conv.free == LDKLogger_JCalls_free) {
22950                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
22951                 LDKLogger_JCalls_cloned(&logger_conv);
22952         }
22953         LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ ret_var = ChannelMonitor_best_block_updated(&this_arg_conv, header_ref, height, broadcaster_conv, fee_estimator_conv, logger_conv);
22954         uint64_tArray ret_arr = NULL;
22955         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
22956         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
22957         for (size_t n = 0; n < ret_var.datalen; n++) {
22958                 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv_39_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
22959                 *ret_conv_39_conv = ret_var.data[n];
22960                 ret_arr_ptr[n] = tag_ptr(ret_conv_39_conv, true);
22961         }
22962         
22963         FREE(ret_var.data);
22964         return ret_arr;
22965 }
22966
22967 ptrArray  __attribute__((export_name("TS_ChannelMonitor_get_relevant_txids"))) TS_ChannelMonitor_get_relevant_txids(uint64_t this_arg) {
22968         LDKChannelMonitor this_arg_conv;
22969         this_arg_conv.inner = untag_ptr(this_arg);
22970         this_arg_conv.is_owned = ptr_is_owned(this_arg);
22971         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
22972         this_arg_conv.is_owned = false;
22973         LDKCVec_TxidZ ret_var = ChannelMonitor_get_relevant_txids(&this_arg_conv);
22974         ptrArray ret_arr = NULL;
22975         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
22976         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
22977         for (size_t m = 0; m < ret_var.datalen; m++) {
22978                 int8_tArray ret_conv_12_arr = init_int8_tArray(32, __LINE__);
22979                 memcpy(ret_conv_12_arr->elems, ret_var.data[m].data, 32);
22980                 ret_arr_ptr[m] = ret_conv_12_arr;
22981         }
22982         
22983         FREE(ret_var.data);
22984         return ret_arr;
22985 }
22986
22987 uint64_t  __attribute__((export_name("TS_ChannelMonitor_current_best_block"))) TS_ChannelMonitor_current_best_block(uint64_t this_arg) {
22988         LDKChannelMonitor this_arg_conv;
22989         this_arg_conv.inner = untag_ptr(this_arg);
22990         this_arg_conv.is_owned = ptr_is_owned(this_arg);
22991         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
22992         this_arg_conv.is_owned = false;
22993         LDKBestBlock ret_var = ChannelMonitor_current_best_block(&this_arg_conv);
22994         uint64_t ret_ref = 0;
22995         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22996         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
22997         return ret_ref;
22998 }
22999
23000 uint64_tArray  __attribute__((export_name("TS_ChannelMonitor_get_claimable_balances"))) TS_ChannelMonitor_get_claimable_balances(uint64_t this_arg) {
23001         LDKChannelMonitor this_arg_conv;
23002         this_arg_conv.inner = untag_ptr(this_arg);
23003         this_arg_conv.is_owned = ptr_is_owned(this_arg);
23004         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
23005         this_arg_conv.is_owned = false;
23006         LDKCVec_BalanceZ ret_var = ChannelMonitor_get_claimable_balances(&this_arg_conv);
23007         uint64_tArray ret_arr = NULL;
23008         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
23009         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
23010         for (size_t j = 0; j < ret_var.datalen; j++) {
23011                 LDKBalance *ret_conv_9_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
23012                 *ret_conv_9_copy = ret_var.data[j];
23013                 uint64_t ret_conv_9_ref = tag_ptr(ret_conv_9_copy, true);
23014                 ret_arr_ptr[j] = ret_conv_9_ref;
23015         }
23016         
23017         FREE(ret_var.data);
23018         return ret_arr;
23019 }
23020
23021 uint64_t  __attribute__((export_name("TS_C2Tuple_BlockHashChannelMonitorZ_read"))) TS_C2Tuple_BlockHashChannelMonitorZ_read(int8_tArray ser, uint64_t arg) {
23022         LDKu8slice ser_ref;
23023         ser_ref.datalen = ser->arr_len;
23024         ser_ref.data = ser->elems;
23025         void* arg_ptr = untag_ptr(arg);
23026         if (ptr_is_owned(arg)) { CHECK_ACCESS(arg_ptr); }
23027         LDKKeysInterface* arg_conv = (LDKKeysInterface*)arg_ptr;
23028         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
23029         *ret_conv = C2Tuple_BlockHashChannelMonitorZ_read(ser_ref, arg_conv);
23030         FREE(ser);
23031         return tag_ptr(ret_conv, true);
23032 }
23033
23034 void  __attribute__((export_name("TS_OutPoint_free"))) TS_OutPoint_free(uint64_t this_obj) {
23035         LDKOutPoint this_obj_conv;
23036         this_obj_conv.inner = untag_ptr(this_obj);
23037         this_obj_conv.is_owned = ptr_is_owned(this_obj);
23038         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
23039         OutPoint_free(this_obj_conv);
23040 }
23041
23042 int8_tArray  __attribute__((export_name("TS_OutPoint_get_txid"))) TS_OutPoint_get_txid(uint64_t this_ptr) {
23043         LDKOutPoint this_ptr_conv;
23044         this_ptr_conv.inner = untag_ptr(this_ptr);
23045         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23046         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23047         this_ptr_conv.is_owned = false;
23048         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
23049         memcpy(ret_arr->elems, *OutPoint_get_txid(&this_ptr_conv), 32);
23050         return ret_arr;
23051 }
23052
23053 void  __attribute__((export_name("TS_OutPoint_set_txid"))) TS_OutPoint_set_txid(uint64_t this_ptr, int8_tArray val) {
23054         LDKOutPoint this_ptr_conv;
23055         this_ptr_conv.inner = untag_ptr(this_ptr);
23056         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23057         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23058         this_ptr_conv.is_owned = false;
23059         LDKThirtyTwoBytes val_ref;
23060         CHECK(val->arr_len == 32);
23061         memcpy(val_ref.data, val->elems, 32); FREE(val);
23062         OutPoint_set_txid(&this_ptr_conv, val_ref);
23063 }
23064
23065 int16_t  __attribute__((export_name("TS_OutPoint_get_index"))) TS_OutPoint_get_index(uint64_t this_ptr) {
23066         LDKOutPoint this_ptr_conv;
23067         this_ptr_conv.inner = untag_ptr(this_ptr);
23068         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23069         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23070         this_ptr_conv.is_owned = false;
23071         int16_t ret_conv = OutPoint_get_index(&this_ptr_conv);
23072         return ret_conv;
23073 }
23074
23075 void  __attribute__((export_name("TS_OutPoint_set_index"))) TS_OutPoint_set_index(uint64_t this_ptr, int16_t val) {
23076         LDKOutPoint this_ptr_conv;
23077         this_ptr_conv.inner = untag_ptr(this_ptr);
23078         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23079         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23080         this_ptr_conv.is_owned = false;
23081         OutPoint_set_index(&this_ptr_conv, val);
23082 }
23083
23084 uint64_t  __attribute__((export_name("TS_OutPoint_new"))) TS_OutPoint_new(int8_tArray txid_arg, int16_t index_arg) {
23085         LDKThirtyTwoBytes txid_arg_ref;
23086         CHECK(txid_arg->arr_len == 32);
23087         memcpy(txid_arg_ref.data, txid_arg->elems, 32); FREE(txid_arg);
23088         LDKOutPoint ret_var = OutPoint_new(txid_arg_ref, index_arg);
23089         uint64_t ret_ref = 0;
23090         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23091         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
23092         return ret_ref;
23093 }
23094
23095 static inline uint64_t OutPoint_clone_ptr(LDKOutPoint *NONNULL_PTR arg) {
23096         LDKOutPoint ret_var = OutPoint_clone(arg);
23097         uint64_t ret_ref = 0;
23098         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23099         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
23100         return ret_ref;
23101 }
23102 int64_t  __attribute__((export_name("TS_OutPoint_clone_ptr"))) TS_OutPoint_clone_ptr(uint64_t arg) {
23103         LDKOutPoint arg_conv;
23104         arg_conv.inner = untag_ptr(arg);
23105         arg_conv.is_owned = ptr_is_owned(arg);
23106         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
23107         arg_conv.is_owned = false;
23108         int64_t ret_conv = OutPoint_clone_ptr(&arg_conv);
23109         return ret_conv;
23110 }
23111
23112 uint64_t  __attribute__((export_name("TS_OutPoint_clone"))) TS_OutPoint_clone(uint64_t orig) {
23113         LDKOutPoint orig_conv;
23114         orig_conv.inner = untag_ptr(orig);
23115         orig_conv.is_owned = ptr_is_owned(orig);
23116         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
23117         orig_conv.is_owned = false;
23118         LDKOutPoint ret_var = OutPoint_clone(&orig_conv);
23119         uint64_t ret_ref = 0;
23120         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23121         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
23122         return ret_ref;
23123 }
23124
23125 jboolean  __attribute__((export_name("TS_OutPoint_eq"))) TS_OutPoint_eq(uint64_t a, uint64_t b) {
23126         LDKOutPoint a_conv;
23127         a_conv.inner = untag_ptr(a);
23128         a_conv.is_owned = ptr_is_owned(a);
23129         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
23130         a_conv.is_owned = false;
23131         LDKOutPoint b_conv;
23132         b_conv.inner = untag_ptr(b);
23133         b_conv.is_owned = ptr_is_owned(b);
23134         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
23135         b_conv.is_owned = false;
23136         jboolean ret_conv = OutPoint_eq(&a_conv, &b_conv);
23137         return ret_conv;
23138 }
23139
23140 int64_t  __attribute__((export_name("TS_OutPoint_hash"))) TS_OutPoint_hash(uint64_t o) {
23141         LDKOutPoint o_conv;
23142         o_conv.inner = untag_ptr(o);
23143         o_conv.is_owned = ptr_is_owned(o);
23144         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23145         o_conv.is_owned = false;
23146         int64_t ret_conv = OutPoint_hash(&o_conv);
23147         return ret_conv;
23148 }
23149
23150 int8_tArray  __attribute__((export_name("TS_OutPoint_to_channel_id"))) TS_OutPoint_to_channel_id(uint64_t this_arg) {
23151         LDKOutPoint this_arg_conv;
23152         this_arg_conv.inner = untag_ptr(this_arg);
23153         this_arg_conv.is_owned = ptr_is_owned(this_arg);
23154         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
23155         this_arg_conv.is_owned = false;
23156         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
23157         memcpy(ret_arr->elems, OutPoint_to_channel_id(&this_arg_conv).data, 32);
23158         return ret_arr;
23159 }
23160
23161 int8_tArray  __attribute__((export_name("TS_OutPoint_write"))) TS_OutPoint_write(uint64_t obj) {
23162         LDKOutPoint obj_conv;
23163         obj_conv.inner = untag_ptr(obj);
23164         obj_conv.is_owned = ptr_is_owned(obj);
23165         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
23166         obj_conv.is_owned = false;
23167         LDKCVec_u8Z ret_var = OutPoint_write(&obj_conv);
23168         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
23169         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
23170         CVec_u8Z_free(ret_var);
23171         return ret_arr;
23172 }
23173
23174 uint64_t  __attribute__((export_name("TS_OutPoint_read"))) TS_OutPoint_read(int8_tArray ser) {
23175         LDKu8slice ser_ref;
23176         ser_ref.datalen = ser->arr_len;
23177         ser_ref.data = ser->elems;
23178         LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
23179         *ret_conv = OutPoint_read(ser_ref);
23180         FREE(ser);
23181         return tag_ptr(ret_conv, true);
23182 }
23183
23184 void  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_free"))) TS_DelayedPaymentOutputDescriptor_free(uint64_t this_obj) {
23185         LDKDelayedPaymentOutputDescriptor this_obj_conv;
23186         this_obj_conv.inner = untag_ptr(this_obj);
23187         this_obj_conv.is_owned = ptr_is_owned(this_obj);
23188         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
23189         DelayedPaymentOutputDescriptor_free(this_obj_conv);
23190 }
23191
23192 uint64_t  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_get_outpoint"))) TS_DelayedPaymentOutputDescriptor_get_outpoint(uint64_t this_ptr) {
23193         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
23194         this_ptr_conv.inner = untag_ptr(this_ptr);
23195         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23196         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23197         this_ptr_conv.is_owned = false;
23198         LDKOutPoint ret_var = DelayedPaymentOutputDescriptor_get_outpoint(&this_ptr_conv);
23199         uint64_t ret_ref = 0;
23200         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23201         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
23202         return ret_ref;
23203 }
23204
23205 void  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_set_outpoint"))) TS_DelayedPaymentOutputDescriptor_set_outpoint(uint64_t this_ptr, uint64_t val) {
23206         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
23207         this_ptr_conv.inner = untag_ptr(this_ptr);
23208         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23209         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23210         this_ptr_conv.is_owned = false;
23211         LDKOutPoint val_conv;
23212         val_conv.inner = untag_ptr(val);
23213         val_conv.is_owned = ptr_is_owned(val);
23214         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
23215         val_conv = OutPoint_clone(&val_conv);
23216         DelayedPaymentOutputDescriptor_set_outpoint(&this_ptr_conv, val_conv);
23217 }
23218
23219 int8_tArray  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_get_per_commitment_point"))) TS_DelayedPaymentOutputDescriptor_get_per_commitment_point(uint64_t this_ptr) {
23220         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
23221         this_ptr_conv.inner = untag_ptr(this_ptr);
23222         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23223         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23224         this_ptr_conv.is_owned = false;
23225         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
23226         memcpy(ret_arr->elems, DelayedPaymentOutputDescriptor_get_per_commitment_point(&this_ptr_conv).compressed_form, 33);
23227         return ret_arr;
23228 }
23229
23230 void  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_set_per_commitment_point"))) TS_DelayedPaymentOutputDescriptor_set_per_commitment_point(uint64_t this_ptr, int8_tArray val) {
23231         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
23232         this_ptr_conv.inner = untag_ptr(this_ptr);
23233         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23234         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23235         this_ptr_conv.is_owned = false;
23236         LDKPublicKey val_ref;
23237         CHECK(val->arr_len == 33);
23238         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
23239         DelayedPaymentOutputDescriptor_set_per_commitment_point(&this_ptr_conv, val_ref);
23240 }
23241
23242 int16_t  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_get_to_self_delay"))) TS_DelayedPaymentOutputDescriptor_get_to_self_delay(uint64_t this_ptr) {
23243         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
23244         this_ptr_conv.inner = untag_ptr(this_ptr);
23245         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23246         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23247         this_ptr_conv.is_owned = false;
23248         int16_t ret_conv = DelayedPaymentOutputDescriptor_get_to_self_delay(&this_ptr_conv);
23249         return ret_conv;
23250 }
23251
23252 void  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_set_to_self_delay"))) TS_DelayedPaymentOutputDescriptor_set_to_self_delay(uint64_t this_ptr, int16_t val) {
23253         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
23254         this_ptr_conv.inner = untag_ptr(this_ptr);
23255         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23256         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23257         this_ptr_conv.is_owned = false;
23258         DelayedPaymentOutputDescriptor_set_to_self_delay(&this_ptr_conv, val);
23259 }
23260
23261 uint64_t  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_get_output"))) TS_DelayedPaymentOutputDescriptor_get_output(uint64_t this_ptr) {
23262         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
23263         this_ptr_conv.inner = untag_ptr(this_ptr);
23264         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23265         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23266         this_ptr_conv.is_owned = false;
23267         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
23268         *ret_ref = DelayedPaymentOutputDescriptor_get_output(&this_ptr_conv);
23269         return tag_ptr(ret_ref, true);
23270 }
23271
23272 void  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_set_output"))) TS_DelayedPaymentOutputDescriptor_set_output(uint64_t this_ptr, uint64_t val) {
23273         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
23274         this_ptr_conv.inner = untag_ptr(this_ptr);
23275         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23276         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23277         this_ptr_conv.is_owned = false;
23278         void* val_ptr = untag_ptr(val);
23279         CHECK_ACCESS(val_ptr);
23280         LDKTxOut val_conv = *(LDKTxOut*)(val_ptr);
23281         val_conv = TxOut_clone((LDKTxOut*)untag_ptr(val));
23282         DelayedPaymentOutputDescriptor_set_output(&this_ptr_conv, val_conv);
23283 }
23284
23285 int8_tArray  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_get_revocation_pubkey"))) TS_DelayedPaymentOutputDescriptor_get_revocation_pubkey(uint64_t this_ptr) {
23286         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
23287         this_ptr_conv.inner = untag_ptr(this_ptr);
23288         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23289         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23290         this_ptr_conv.is_owned = false;
23291         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
23292         memcpy(ret_arr->elems, DelayedPaymentOutputDescriptor_get_revocation_pubkey(&this_ptr_conv).compressed_form, 33);
23293         return ret_arr;
23294 }
23295
23296 void  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_set_revocation_pubkey"))) TS_DelayedPaymentOutputDescriptor_set_revocation_pubkey(uint64_t this_ptr, int8_tArray val) {
23297         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
23298         this_ptr_conv.inner = untag_ptr(this_ptr);
23299         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23300         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23301         this_ptr_conv.is_owned = false;
23302         LDKPublicKey val_ref;
23303         CHECK(val->arr_len == 33);
23304         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
23305         DelayedPaymentOutputDescriptor_set_revocation_pubkey(&this_ptr_conv, val_ref);
23306 }
23307
23308 int8_tArray  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_get_channel_keys_id"))) TS_DelayedPaymentOutputDescriptor_get_channel_keys_id(uint64_t this_ptr) {
23309         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
23310         this_ptr_conv.inner = untag_ptr(this_ptr);
23311         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23312         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23313         this_ptr_conv.is_owned = false;
23314         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
23315         memcpy(ret_arr->elems, *DelayedPaymentOutputDescriptor_get_channel_keys_id(&this_ptr_conv), 32);
23316         return ret_arr;
23317 }
23318
23319 void  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_set_channel_keys_id"))) TS_DelayedPaymentOutputDescriptor_set_channel_keys_id(uint64_t this_ptr, int8_tArray val) {
23320         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
23321         this_ptr_conv.inner = untag_ptr(this_ptr);
23322         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23323         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23324         this_ptr_conv.is_owned = false;
23325         LDKThirtyTwoBytes val_ref;
23326         CHECK(val->arr_len == 32);
23327         memcpy(val_ref.data, val->elems, 32); FREE(val);
23328         DelayedPaymentOutputDescriptor_set_channel_keys_id(&this_ptr_conv, val_ref);
23329 }
23330
23331 int64_t  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_get_channel_value_satoshis"))) TS_DelayedPaymentOutputDescriptor_get_channel_value_satoshis(uint64_t this_ptr) {
23332         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
23333         this_ptr_conv.inner = untag_ptr(this_ptr);
23334         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23335         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23336         this_ptr_conv.is_owned = false;
23337         int64_t ret_conv = DelayedPaymentOutputDescriptor_get_channel_value_satoshis(&this_ptr_conv);
23338         return ret_conv;
23339 }
23340
23341 void  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_set_channel_value_satoshis"))) TS_DelayedPaymentOutputDescriptor_set_channel_value_satoshis(uint64_t this_ptr, int64_t val) {
23342         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
23343         this_ptr_conv.inner = untag_ptr(this_ptr);
23344         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23345         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23346         this_ptr_conv.is_owned = false;
23347         DelayedPaymentOutputDescriptor_set_channel_value_satoshis(&this_ptr_conv, val);
23348 }
23349
23350 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) {
23351         LDKOutPoint outpoint_arg_conv;
23352         outpoint_arg_conv.inner = untag_ptr(outpoint_arg);
23353         outpoint_arg_conv.is_owned = ptr_is_owned(outpoint_arg);
23354         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
23355         outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
23356         LDKPublicKey per_commitment_point_arg_ref;
23357         CHECK(per_commitment_point_arg->arr_len == 33);
23358         memcpy(per_commitment_point_arg_ref.compressed_form, per_commitment_point_arg->elems, 33); FREE(per_commitment_point_arg);
23359         void* output_arg_ptr = untag_ptr(output_arg);
23360         CHECK_ACCESS(output_arg_ptr);
23361         LDKTxOut output_arg_conv = *(LDKTxOut*)(output_arg_ptr);
23362         output_arg_conv = TxOut_clone((LDKTxOut*)untag_ptr(output_arg));
23363         LDKPublicKey revocation_pubkey_arg_ref;
23364         CHECK(revocation_pubkey_arg->arr_len == 33);
23365         memcpy(revocation_pubkey_arg_ref.compressed_form, revocation_pubkey_arg->elems, 33); FREE(revocation_pubkey_arg);
23366         LDKThirtyTwoBytes channel_keys_id_arg_ref;
23367         CHECK(channel_keys_id_arg->arr_len == 32);
23368         memcpy(channel_keys_id_arg_ref.data, channel_keys_id_arg->elems, 32); FREE(channel_keys_id_arg);
23369         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);
23370         uint64_t ret_ref = 0;
23371         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23372         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
23373         return ret_ref;
23374 }
23375
23376 static inline uint64_t DelayedPaymentOutputDescriptor_clone_ptr(LDKDelayedPaymentOutputDescriptor *NONNULL_PTR arg) {
23377         LDKDelayedPaymentOutputDescriptor ret_var = DelayedPaymentOutputDescriptor_clone(arg);
23378         uint64_t ret_ref = 0;
23379         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23380         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
23381         return ret_ref;
23382 }
23383 int64_t  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_clone_ptr"))) TS_DelayedPaymentOutputDescriptor_clone_ptr(uint64_t arg) {
23384         LDKDelayedPaymentOutputDescriptor arg_conv;
23385         arg_conv.inner = untag_ptr(arg);
23386         arg_conv.is_owned = ptr_is_owned(arg);
23387         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
23388         arg_conv.is_owned = false;
23389         int64_t ret_conv = DelayedPaymentOutputDescriptor_clone_ptr(&arg_conv);
23390         return ret_conv;
23391 }
23392
23393 uint64_t  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_clone"))) TS_DelayedPaymentOutputDescriptor_clone(uint64_t orig) {
23394         LDKDelayedPaymentOutputDescriptor orig_conv;
23395         orig_conv.inner = untag_ptr(orig);
23396         orig_conv.is_owned = ptr_is_owned(orig);
23397         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
23398         orig_conv.is_owned = false;
23399         LDKDelayedPaymentOutputDescriptor ret_var = DelayedPaymentOutputDescriptor_clone(&orig_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 int8_tArray  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_write"))) TS_DelayedPaymentOutputDescriptor_write(uint64_t obj) {
23407         LDKDelayedPaymentOutputDescriptor obj_conv;
23408         obj_conv.inner = untag_ptr(obj);
23409         obj_conv.is_owned = ptr_is_owned(obj);
23410         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
23411         obj_conv.is_owned = false;
23412         LDKCVec_u8Z ret_var = DelayedPaymentOutputDescriptor_write(&obj_conv);
23413         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
23414         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
23415         CVec_u8Z_free(ret_var);
23416         return ret_arr;
23417 }
23418
23419 uint64_t  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_read"))) TS_DelayedPaymentOutputDescriptor_read(int8_tArray ser) {
23420         LDKu8slice ser_ref;
23421         ser_ref.datalen = ser->arr_len;
23422         ser_ref.data = ser->elems;
23423         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
23424         *ret_conv = DelayedPaymentOutputDescriptor_read(ser_ref);
23425         FREE(ser);
23426         return tag_ptr(ret_conv, true);
23427 }
23428
23429 void  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_free"))) TS_StaticPaymentOutputDescriptor_free(uint64_t this_obj) {
23430         LDKStaticPaymentOutputDescriptor this_obj_conv;
23431         this_obj_conv.inner = untag_ptr(this_obj);
23432         this_obj_conv.is_owned = ptr_is_owned(this_obj);
23433         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
23434         StaticPaymentOutputDescriptor_free(this_obj_conv);
23435 }
23436
23437 uint64_t  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_get_outpoint"))) TS_StaticPaymentOutputDescriptor_get_outpoint(uint64_t this_ptr) {
23438         LDKStaticPaymentOutputDescriptor this_ptr_conv;
23439         this_ptr_conv.inner = untag_ptr(this_ptr);
23440         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23441         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23442         this_ptr_conv.is_owned = false;
23443         LDKOutPoint ret_var = StaticPaymentOutputDescriptor_get_outpoint(&this_ptr_conv);
23444         uint64_t ret_ref = 0;
23445         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23446         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
23447         return ret_ref;
23448 }
23449
23450 void  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_set_outpoint"))) TS_StaticPaymentOutputDescriptor_set_outpoint(uint64_t this_ptr, uint64_t val) {
23451         LDKStaticPaymentOutputDescriptor this_ptr_conv;
23452         this_ptr_conv.inner = untag_ptr(this_ptr);
23453         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23454         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23455         this_ptr_conv.is_owned = false;
23456         LDKOutPoint val_conv;
23457         val_conv.inner = untag_ptr(val);
23458         val_conv.is_owned = ptr_is_owned(val);
23459         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
23460         val_conv = OutPoint_clone(&val_conv);
23461         StaticPaymentOutputDescriptor_set_outpoint(&this_ptr_conv, val_conv);
23462 }
23463
23464 uint64_t  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_get_output"))) TS_StaticPaymentOutputDescriptor_get_output(uint64_t this_ptr) {
23465         LDKStaticPaymentOutputDescriptor this_ptr_conv;
23466         this_ptr_conv.inner = untag_ptr(this_ptr);
23467         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23468         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23469         this_ptr_conv.is_owned = false;
23470         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
23471         *ret_ref = StaticPaymentOutputDescriptor_get_output(&this_ptr_conv);
23472         return tag_ptr(ret_ref, true);
23473 }
23474
23475 void  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_set_output"))) TS_StaticPaymentOutputDescriptor_set_output(uint64_t this_ptr, uint64_t val) {
23476         LDKStaticPaymentOutputDescriptor this_ptr_conv;
23477         this_ptr_conv.inner = untag_ptr(this_ptr);
23478         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23479         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23480         this_ptr_conv.is_owned = false;
23481         void* val_ptr = untag_ptr(val);
23482         CHECK_ACCESS(val_ptr);
23483         LDKTxOut val_conv = *(LDKTxOut*)(val_ptr);
23484         val_conv = TxOut_clone((LDKTxOut*)untag_ptr(val));
23485         StaticPaymentOutputDescriptor_set_output(&this_ptr_conv, val_conv);
23486 }
23487
23488 int8_tArray  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_get_channel_keys_id"))) TS_StaticPaymentOutputDescriptor_get_channel_keys_id(uint64_t this_ptr) {
23489         LDKStaticPaymentOutputDescriptor this_ptr_conv;
23490         this_ptr_conv.inner = untag_ptr(this_ptr);
23491         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23492         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23493         this_ptr_conv.is_owned = false;
23494         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
23495         memcpy(ret_arr->elems, *StaticPaymentOutputDescriptor_get_channel_keys_id(&this_ptr_conv), 32);
23496         return ret_arr;
23497 }
23498
23499 void  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_set_channel_keys_id"))) TS_StaticPaymentOutputDescriptor_set_channel_keys_id(uint64_t this_ptr, int8_tArray val) {
23500         LDKStaticPaymentOutputDescriptor this_ptr_conv;
23501         this_ptr_conv.inner = untag_ptr(this_ptr);
23502         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23503         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23504         this_ptr_conv.is_owned = false;
23505         LDKThirtyTwoBytes val_ref;
23506         CHECK(val->arr_len == 32);
23507         memcpy(val_ref.data, val->elems, 32); FREE(val);
23508         StaticPaymentOutputDescriptor_set_channel_keys_id(&this_ptr_conv, val_ref);
23509 }
23510
23511 int64_t  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_get_channel_value_satoshis"))) TS_StaticPaymentOutputDescriptor_get_channel_value_satoshis(uint64_t this_ptr) {
23512         LDKStaticPaymentOutputDescriptor this_ptr_conv;
23513         this_ptr_conv.inner = untag_ptr(this_ptr);
23514         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23515         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23516         this_ptr_conv.is_owned = false;
23517         int64_t ret_conv = StaticPaymentOutputDescriptor_get_channel_value_satoshis(&this_ptr_conv);
23518         return ret_conv;
23519 }
23520
23521 void  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_set_channel_value_satoshis"))) TS_StaticPaymentOutputDescriptor_set_channel_value_satoshis(uint64_t this_ptr, int64_t val) {
23522         LDKStaticPaymentOutputDescriptor this_ptr_conv;
23523         this_ptr_conv.inner = untag_ptr(this_ptr);
23524         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23525         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23526         this_ptr_conv.is_owned = false;
23527         StaticPaymentOutputDescriptor_set_channel_value_satoshis(&this_ptr_conv, val);
23528 }
23529
23530 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) {
23531         LDKOutPoint outpoint_arg_conv;
23532         outpoint_arg_conv.inner = untag_ptr(outpoint_arg);
23533         outpoint_arg_conv.is_owned = ptr_is_owned(outpoint_arg);
23534         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
23535         outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
23536         void* output_arg_ptr = untag_ptr(output_arg);
23537         CHECK_ACCESS(output_arg_ptr);
23538         LDKTxOut output_arg_conv = *(LDKTxOut*)(output_arg_ptr);
23539         output_arg_conv = TxOut_clone((LDKTxOut*)untag_ptr(output_arg));
23540         LDKThirtyTwoBytes channel_keys_id_arg_ref;
23541         CHECK(channel_keys_id_arg->arr_len == 32);
23542         memcpy(channel_keys_id_arg_ref.data, channel_keys_id_arg->elems, 32); FREE(channel_keys_id_arg);
23543         LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_new(outpoint_arg_conv, output_arg_conv, channel_keys_id_arg_ref, channel_value_satoshis_arg);
23544         uint64_t ret_ref = 0;
23545         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23546         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
23547         return ret_ref;
23548 }
23549
23550 static inline uint64_t StaticPaymentOutputDescriptor_clone_ptr(LDKStaticPaymentOutputDescriptor *NONNULL_PTR arg) {
23551         LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_clone(arg);
23552         uint64_t ret_ref = 0;
23553         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23554         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
23555         return ret_ref;
23556 }
23557 int64_t  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_clone_ptr"))) TS_StaticPaymentOutputDescriptor_clone_ptr(uint64_t arg) {
23558         LDKStaticPaymentOutputDescriptor arg_conv;
23559         arg_conv.inner = untag_ptr(arg);
23560         arg_conv.is_owned = ptr_is_owned(arg);
23561         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
23562         arg_conv.is_owned = false;
23563         int64_t ret_conv = StaticPaymentOutputDescriptor_clone_ptr(&arg_conv);
23564         return ret_conv;
23565 }
23566
23567 uint64_t  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_clone"))) TS_StaticPaymentOutputDescriptor_clone(uint64_t orig) {
23568         LDKStaticPaymentOutputDescriptor orig_conv;
23569         orig_conv.inner = untag_ptr(orig);
23570         orig_conv.is_owned = ptr_is_owned(orig);
23571         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
23572         orig_conv.is_owned = false;
23573         LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_clone(&orig_conv);
23574         uint64_t ret_ref = 0;
23575         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23576         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
23577         return ret_ref;
23578 }
23579
23580 int8_tArray  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_write"))) TS_StaticPaymentOutputDescriptor_write(uint64_t obj) {
23581         LDKStaticPaymentOutputDescriptor obj_conv;
23582         obj_conv.inner = untag_ptr(obj);
23583         obj_conv.is_owned = ptr_is_owned(obj);
23584         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
23585         obj_conv.is_owned = false;
23586         LDKCVec_u8Z ret_var = StaticPaymentOutputDescriptor_write(&obj_conv);
23587         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
23588         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
23589         CVec_u8Z_free(ret_var);
23590         return ret_arr;
23591 }
23592
23593 uint64_t  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_read"))) TS_StaticPaymentOutputDescriptor_read(int8_tArray ser) {
23594         LDKu8slice ser_ref;
23595         ser_ref.datalen = ser->arr_len;
23596         ser_ref.data = ser->elems;
23597         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
23598         *ret_conv = StaticPaymentOutputDescriptor_read(ser_ref);
23599         FREE(ser);
23600         return tag_ptr(ret_conv, true);
23601 }
23602
23603 void  __attribute__((export_name("TS_SpendableOutputDescriptor_free"))) TS_SpendableOutputDescriptor_free(uint64_t this_ptr) {
23604         if (!ptr_is_owned(this_ptr)) return;
23605         void* this_ptr_ptr = untag_ptr(this_ptr);
23606         CHECK_ACCESS(this_ptr_ptr);
23607         LDKSpendableOutputDescriptor this_ptr_conv = *(LDKSpendableOutputDescriptor*)(this_ptr_ptr);
23608         FREE(untag_ptr(this_ptr));
23609         SpendableOutputDescriptor_free(this_ptr_conv);
23610 }
23611
23612 static inline uint64_t SpendableOutputDescriptor_clone_ptr(LDKSpendableOutputDescriptor *NONNULL_PTR arg) {
23613         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
23614         *ret_copy = SpendableOutputDescriptor_clone(arg);
23615         uint64_t ret_ref = tag_ptr(ret_copy, true);
23616         return ret_ref;
23617 }
23618 int64_t  __attribute__((export_name("TS_SpendableOutputDescriptor_clone_ptr"))) TS_SpendableOutputDescriptor_clone_ptr(uint64_t arg) {
23619         LDKSpendableOutputDescriptor* arg_conv = (LDKSpendableOutputDescriptor*)untag_ptr(arg);
23620         int64_t ret_conv = SpendableOutputDescriptor_clone_ptr(arg_conv);
23621         return ret_conv;
23622 }
23623
23624 uint64_t  __attribute__((export_name("TS_SpendableOutputDescriptor_clone"))) TS_SpendableOutputDescriptor_clone(uint64_t orig) {
23625         LDKSpendableOutputDescriptor* orig_conv = (LDKSpendableOutputDescriptor*)untag_ptr(orig);
23626         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
23627         *ret_copy = SpendableOutputDescriptor_clone(orig_conv);
23628         uint64_t ret_ref = tag_ptr(ret_copy, true);
23629         return ret_ref;
23630 }
23631
23632 uint64_t  __attribute__((export_name("TS_SpendableOutputDescriptor_static_output"))) TS_SpendableOutputDescriptor_static_output(uint64_t outpoint, uint64_t output) {
23633         LDKOutPoint outpoint_conv;
23634         outpoint_conv.inner = untag_ptr(outpoint);
23635         outpoint_conv.is_owned = ptr_is_owned(outpoint);
23636         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_conv);
23637         outpoint_conv = OutPoint_clone(&outpoint_conv);
23638         void* output_ptr = untag_ptr(output);
23639         CHECK_ACCESS(output_ptr);
23640         LDKTxOut output_conv = *(LDKTxOut*)(output_ptr);
23641         output_conv = TxOut_clone((LDKTxOut*)untag_ptr(output));
23642         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
23643         *ret_copy = SpendableOutputDescriptor_static_output(outpoint_conv, output_conv);
23644         uint64_t ret_ref = tag_ptr(ret_copy, true);
23645         return ret_ref;
23646 }
23647
23648 uint64_t  __attribute__((export_name("TS_SpendableOutputDescriptor_delayed_payment_output"))) TS_SpendableOutputDescriptor_delayed_payment_output(uint64_t a) {
23649         LDKDelayedPaymentOutputDescriptor a_conv;
23650         a_conv.inner = untag_ptr(a);
23651         a_conv.is_owned = ptr_is_owned(a);
23652         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
23653         a_conv = DelayedPaymentOutputDescriptor_clone(&a_conv);
23654         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
23655         *ret_copy = SpendableOutputDescriptor_delayed_payment_output(a_conv);
23656         uint64_t ret_ref = tag_ptr(ret_copy, true);
23657         return ret_ref;
23658 }
23659
23660 uint64_t  __attribute__((export_name("TS_SpendableOutputDescriptor_static_payment_output"))) TS_SpendableOutputDescriptor_static_payment_output(uint64_t a) {
23661         LDKStaticPaymentOutputDescriptor a_conv;
23662         a_conv.inner = untag_ptr(a);
23663         a_conv.is_owned = ptr_is_owned(a);
23664         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
23665         a_conv = StaticPaymentOutputDescriptor_clone(&a_conv);
23666         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
23667         *ret_copy = SpendableOutputDescriptor_static_payment_output(a_conv);
23668         uint64_t ret_ref = tag_ptr(ret_copy, true);
23669         return ret_ref;
23670 }
23671
23672 int8_tArray  __attribute__((export_name("TS_SpendableOutputDescriptor_write"))) TS_SpendableOutputDescriptor_write(uint64_t obj) {
23673         LDKSpendableOutputDescriptor* obj_conv = (LDKSpendableOutputDescriptor*)untag_ptr(obj);
23674         LDKCVec_u8Z ret_var = SpendableOutputDescriptor_write(obj_conv);
23675         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
23676         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
23677         CVec_u8Z_free(ret_var);
23678         return ret_arr;
23679 }
23680
23681 uint64_t  __attribute__((export_name("TS_SpendableOutputDescriptor_read"))) TS_SpendableOutputDescriptor_read(int8_tArray ser) {
23682         LDKu8slice ser_ref;
23683         ser_ref.datalen = ser->arr_len;
23684         ser_ref.data = ser->elems;
23685         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
23686         *ret_conv = SpendableOutputDescriptor_read(ser_ref);
23687         FREE(ser);
23688         return tag_ptr(ret_conv, true);
23689 }
23690
23691 void  __attribute__((export_name("TS_BaseSign_free"))) TS_BaseSign_free(uint64_t this_ptr) {
23692         if (!ptr_is_owned(this_ptr)) return;
23693         void* this_ptr_ptr = untag_ptr(this_ptr);
23694         CHECK_ACCESS(this_ptr_ptr);
23695         LDKBaseSign this_ptr_conv = *(LDKBaseSign*)(this_ptr_ptr);
23696         FREE(untag_ptr(this_ptr));
23697         BaseSign_free(this_ptr_conv);
23698 }
23699
23700 static inline uint64_t Sign_clone_ptr(LDKSign *NONNULL_PTR arg) {
23701         LDKSign* ret_ret = MALLOC(sizeof(LDKSign), "LDKSign");
23702         *ret_ret = Sign_clone(arg);
23703         return tag_ptr(ret_ret, true);
23704 }
23705 int64_t  __attribute__((export_name("TS_Sign_clone_ptr"))) TS_Sign_clone_ptr(uint64_t arg) {
23706         void* arg_ptr = untag_ptr(arg);
23707         if (ptr_is_owned(arg)) { CHECK_ACCESS(arg_ptr); }
23708         LDKSign* arg_conv = (LDKSign*)arg_ptr;
23709         int64_t ret_conv = Sign_clone_ptr(arg_conv);
23710         return ret_conv;
23711 }
23712
23713 uint64_t  __attribute__((export_name("TS_Sign_clone"))) TS_Sign_clone(uint64_t orig) {
23714         void* orig_ptr = untag_ptr(orig);
23715         if (ptr_is_owned(orig)) { CHECK_ACCESS(orig_ptr); }
23716         LDKSign* orig_conv = (LDKSign*)orig_ptr;
23717         LDKSign* ret_ret = MALLOC(sizeof(LDKSign), "LDKSign");
23718         *ret_ret = Sign_clone(orig_conv);
23719         return tag_ptr(ret_ret, true);
23720 }
23721
23722 void  __attribute__((export_name("TS_Sign_free"))) TS_Sign_free(uint64_t this_ptr) {
23723         if (!ptr_is_owned(this_ptr)) return;
23724         void* this_ptr_ptr = untag_ptr(this_ptr);
23725         CHECK_ACCESS(this_ptr_ptr);
23726         LDKSign this_ptr_conv = *(LDKSign*)(this_ptr_ptr);
23727         FREE(untag_ptr(this_ptr));
23728         Sign_free(this_ptr_conv);
23729 }
23730
23731 uint32_t  __attribute__((export_name("TS_Recipient_clone"))) TS_Recipient_clone(uint64_t orig) {
23732         LDKRecipient* orig_conv = (LDKRecipient*)untag_ptr(orig);
23733         uint32_t ret_conv = LDKRecipient_to_js(Recipient_clone(orig_conv));
23734         return ret_conv;
23735 }
23736
23737 uint32_t  __attribute__((export_name("TS_Recipient_node"))) TS_Recipient_node() {
23738         uint32_t ret_conv = LDKRecipient_to_js(Recipient_node());
23739         return ret_conv;
23740 }
23741
23742 uint32_t  __attribute__((export_name("TS_Recipient_phantom_node"))) TS_Recipient_phantom_node() {
23743         uint32_t ret_conv = LDKRecipient_to_js(Recipient_phantom_node());
23744         return ret_conv;
23745 }
23746
23747 void  __attribute__((export_name("TS_KeysInterface_free"))) TS_KeysInterface_free(uint64_t this_ptr) {
23748         if (!ptr_is_owned(this_ptr)) return;
23749         void* this_ptr_ptr = untag_ptr(this_ptr);
23750         CHECK_ACCESS(this_ptr_ptr);
23751         LDKKeysInterface this_ptr_conv = *(LDKKeysInterface*)(this_ptr_ptr);
23752         FREE(untag_ptr(this_ptr));
23753         KeysInterface_free(this_ptr_conv);
23754 }
23755
23756 void  __attribute__((export_name("TS_InMemorySigner_free"))) TS_InMemorySigner_free(uint64_t this_obj) {
23757         LDKInMemorySigner this_obj_conv;
23758         this_obj_conv.inner = untag_ptr(this_obj);
23759         this_obj_conv.is_owned = ptr_is_owned(this_obj);
23760         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
23761         InMemorySigner_free(this_obj_conv);
23762 }
23763
23764 int8_tArray  __attribute__((export_name("TS_InMemorySigner_get_funding_key"))) TS_InMemorySigner_get_funding_key(uint64_t this_ptr) {
23765         LDKInMemorySigner this_ptr_conv;
23766         this_ptr_conv.inner = untag_ptr(this_ptr);
23767         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23768         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23769         this_ptr_conv.is_owned = false;
23770         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
23771         memcpy(ret_arr->elems, *InMemorySigner_get_funding_key(&this_ptr_conv), 32);
23772         return ret_arr;
23773 }
23774
23775 void  __attribute__((export_name("TS_InMemorySigner_set_funding_key"))) TS_InMemorySigner_set_funding_key(uint64_t this_ptr, int8_tArray val) {
23776         LDKInMemorySigner this_ptr_conv;
23777         this_ptr_conv.inner = untag_ptr(this_ptr);
23778         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23779         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23780         this_ptr_conv.is_owned = false;
23781         LDKSecretKey val_ref;
23782         CHECK(val->arr_len == 32);
23783         memcpy(val_ref.bytes, val->elems, 32); FREE(val);
23784         InMemorySigner_set_funding_key(&this_ptr_conv, val_ref);
23785 }
23786
23787 int8_tArray  __attribute__((export_name("TS_InMemorySigner_get_revocation_base_key"))) TS_InMemorySigner_get_revocation_base_key(uint64_t this_ptr) {
23788         LDKInMemorySigner this_ptr_conv;
23789         this_ptr_conv.inner = untag_ptr(this_ptr);
23790         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23791         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23792         this_ptr_conv.is_owned = false;
23793         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
23794         memcpy(ret_arr->elems, *InMemorySigner_get_revocation_base_key(&this_ptr_conv), 32);
23795         return ret_arr;
23796 }
23797
23798 void  __attribute__((export_name("TS_InMemorySigner_set_revocation_base_key"))) TS_InMemorySigner_set_revocation_base_key(uint64_t this_ptr, int8_tArray val) {
23799         LDKInMemorySigner this_ptr_conv;
23800         this_ptr_conv.inner = untag_ptr(this_ptr);
23801         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23802         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23803         this_ptr_conv.is_owned = false;
23804         LDKSecretKey val_ref;
23805         CHECK(val->arr_len == 32);
23806         memcpy(val_ref.bytes, val->elems, 32); FREE(val);
23807         InMemorySigner_set_revocation_base_key(&this_ptr_conv, val_ref);
23808 }
23809
23810 int8_tArray  __attribute__((export_name("TS_InMemorySigner_get_payment_key"))) TS_InMemorySigner_get_payment_key(uint64_t this_ptr) {
23811         LDKInMemorySigner this_ptr_conv;
23812         this_ptr_conv.inner = untag_ptr(this_ptr);
23813         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23814         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23815         this_ptr_conv.is_owned = false;
23816         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
23817         memcpy(ret_arr->elems, *InMemorySigner_get_payment_key(&this_ptr_conv), 32);
23818         return ret_arr;
23819 }
23820
23821 void  __attribute__((export_name("TS_InMemorySigner_set_payment_key"))) TS_InMemorySigner_set_payment_key(uint64_t this_ptr, int8_tArray val) {
23822         LDKInMemorySigner this_ptr_conv;
23823         this_ptr_conv.inner = untag_ptr(this_ptr);
23824         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23825         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23826         this_ptr_conv.is_owned = false;
23827         LDKSecretKey val_ref;
23828         CHECK(val->arr_len == 32);
23829         memcpy(val_ref.bytes, val->elems, 32); FREE(val);
23830         InMemorySigner_set_payment_key(&this_ptr_conv, val_ref);
23831 }
23832
23833 int8_tArray  __attribute__((export_name("TS_InMemorySigner_get_delayed_payment_base_key"))) TS_InMemorySigner_get_delayed_payment_base_key(uint64_t this_ptr) {
23834         LDKInMemorySigner this_ptr_conv;
23835         this_ptr_conv.inner = untag_ptr(this_ptr);
23836         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23837         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23838         this_ptr_conv.is_owned = false;
23839         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
23840         memcpy(ret_arr->elems, *InMemorySigner_get_delayed_payment_base_key(&this_ptr_conv), 32);
23841         return ret_arr;
23842 }
23843
23844 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) {
23845         LDKInMemorySigner this_ptr_conv;
23846         this_ptr_conv.inner = untag_ptr(this_ptr);
23847         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23848         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23849         this_ptr_conv.is_owned = false;
23850         LDKSecretKey val_ref;
23851         CHECK(val->arr_len == 32);
23852         memcpy(val_ref.bytes, val->elems, 32); FREE(val);
23853         InMemorySigner_set_delayed_payment_base_key(&this_ptr_conv, val_ref);
23854 }
23855
23856 int8_tArray  __attribute__((export_name("TS_InMemorySigner_get_htlc_base_key"))) TS_InMemorySigner_get_htlc_base_key(uint64_t this_ptr) {
23857         LDKInMemorySigner this_ptr_conv;
23858         this_ptr_conv.inner = untag_ptr(this_ptr);
23859         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23860         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23861         this_ptr_conv.is_owned = false;
23862         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
23863         memcpy(ret_arr->elems, *InMemorySigner_get_htlc_base_key(&this_ptr_conv), 32);
23864         return ret_arr;
23865 }
23866
23867 void  __attribute__((export_name("TS_InMemorySigner_set_htlc_base_key"))) TS_InMemorySigner_set_htlc_base_key(uint64_t this_ptr, int8_tArray val) {
23868         LDKInMemorySigner this_ptr_conv;
23869         this_ptr_conv.inner = untag_ptr(this_ptr);
23870         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23871         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23872         this_ptr_conv.is_owned = false;
23873         LDKSecretKey val_ref;
23874         CHECK(val->arr_len == 32);
23875         memcpy(val_ref.bytes, val->elems, 32); FREE(val);
23876         InMemorySigner_set_htlc_base_key(&this_ptr_conv, val_ref);
23877 }
23878
23879 int8_tArray  __attribute__((export_name("TS_InMemorySigner_get_commitment_seed"))) TS_InMemorySigner_get_commitment_seed(uint64_t this_ptr) {
23880         LDKInMemorySigner this_ptr_conv;
23881         this_ptr_conv.inner = untag_ptr(this_ptr);
23882         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23883         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23884         this_ptr_conv.is_owned = false;
23885         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
23886         memcpy(ret_arr->elems, *InMemorySigner_get_commitment_seed(&this_ptr_conv), 32);
23887         return ret_arr;
23888 }
23889
23890 void  __attribute__((export_name("TS_InMemorySigner_set_commitment_seed"))) TS_InMemorySigner_set_commitment_seed(uint64_t this_ptr, int8_tArray val) {
23891         LDKInMemorySigner this_ptr_conv;
23892         this_ptr_conv.inner = untag_ptr(this_ptr);
23893         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23894         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23895         this_ptr_conv.is_owned = false;
23896         LDKThirtyTwoBytes val_ref;
23897         CHECK(val->arr_len == 32);
23898         memcpy(val_ref.data, val->elems, 32); FREE(val);
23899         InMemorySigner_set_commitment_seed(&this_ptr_conv, val_ref);
23900 }
23901
23902 static inline uint64_t InMemorySigner_clone_ptr(LDKInMemorySigner *NONNULL_PTR arg) {
23903         LDKInMemorySigner ret_var = InMemorySigner_clone(arg);
23904         uint64_t ret_ref = 0;
23905         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23906         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
23907         return ret_ref;
23908 }
23909 int64_t  __attribute__((export_name("TS_InMemorySigner_clone_ptr"))) TS_InMemorySigner_clone_ptr(uint64_t arg) {
23910         LDKInMemorySigner arg_conv;
23911         arg_conv.inner = untag_ptr(arg);
23912         arg_conv.is_owned = ptr_is_owned(arg);
23913         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
23914         arg_conv.is_owned = false;
23915         int64_t ret_conv = InMemorySigner_clone_ptr(&arg_conv);
23916         return ret_conv;
23917 }
23918
23919 uint64_t  __attribute__((export_name("TS_InMemorySigner_clone"))) TS_InMemorySigner_clone(uint64_t orig) {
23920         LDKInMemorySigner orig_conv;
23921         orig_conv.inner = untag_ptr(orig);
23922         orig_conv.is_owned = ptr_is_owned(orig);
23923         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
23924         orig_conv.is_owned = false;
23925         LDKInMemorySigner ret_var = InMemorySigner_clone(&orig_conv);
23926         uint64_t ret_ref = 0;
23927         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23928         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
23929         return ret_ref;
23930 }
23931
23932 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) {
23933         LDKSecretKey node_secret_ref;
23934         CHECK(node_secret->arr_len == 32);
23935         memcpy(node_secret_ref.bytes, node_secret->elems, 32); FREE(node_secret);
23936         LDKSecretKey funding_key_ref;
23937         CHECK(funding_key->arr_len == 32);
23938         memcpy(funding_key_ref.bytes, funding_key->elems, 32); FREE(funding_key);
23939         LDKSecretKey revocation_base_key_ref;
23940         CHECK(revocation_base_key->arr_len == 32);
23941         memcpy(revocation_base_key_ref.bytes, revocation_base_key->elems, 32); FREE(revocation_base_key);
23942         LDKSecretKey payment_key_ref;
23943         CHECK(payment_key->arr_len == 32);
23944         memcpy(payment_key_ref.bytes, payment_key->elems, 32); FREE(payment_key);
23945         LDKSecretKey delayed_payment_base_key_ref;
23946         CHECK(delayed_payment_base_key->arr_len == 32);
23947         memcpy(delayed_payment_base_key_ref.bytes, delayed_payment_base_key->elems, 32); FREE(delayed_payment_base_key);
23948         LDKSecretKey htlc_base_key_ref;
23949         CHECK(htlc_base_key->arr_len == 32);
23950         memcpy(htlc_base_key_ref.bytes, htlc_base_key->elems, 32); FREE(htlc_base_key);
23951         LDKThirtyTwoBytes commitment_seed_ref;
23952         CHECK(commitment_seed->arr_len == 32);
23953         memcpy(commitment_seed_ref.data, commitment_seed->elems, 32); FREE(commitment_seed);
23954         LDKThirtyTwoBytes channel_keys_id_ref;
23955         CHECK(channel_keys_id->arr_len == 32);
23956         memcpy(channel_keys_id_ref.data, channel_keys_id->elems, 32); FREE(channel_keys_id);
23957         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);
23958         uint64_t ret_ref = 0;
23959         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23960         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
23961         return ret_ref;
23962 }
23963
23964 uint64_t  __attribute__((export_name("TS_InMemorySigner_counterparty_pubkeys"))) TS_InMemorySigner_counterparty_pubkeys(uint64_t this_arg) {
23965         LDKInMemorySigner this_arg_conv;
23966         this_arg_conv.inner = untag_ptr(this_arg);
23967         this_arg_conv.is_owned = ptr_is_owned(this_arg);
23968         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
23969         this_arg_conv.is_owned = false;
23970         LDKChannelPublicKeys ret_var = InMemorySigner_counterparty_pubkeys(&this_arg_conv);
23971         uint64_t ret_ref = 0;
23972         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23973         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
23974         return ret_ref;
23975 }
23976
23977 int16_t  __attribute__((export_name("TS_InMemorySigner_counterparty_selected_contest_delay"))) TS_InMemorySigner_counterparty_selected_contest_delay(uint64_t this_arg) {
23978         LDKInMemorySigner this_arg_conv;
23979         this_arg_conv.inner = untag_ptr(this_arg);
23980         this_arg_conv.is_owned = ptr_is_owned(this_arg);
23981         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
23982         this_arg_conv.is_owned = false;
23983         int16_t ret_conv = InMemorySigner_counterparty_selected_contest_delay(&this_arg_conv);
23984         return ret_conv;
23985 }
23986
23987 int16_t  __attribute__((export_name("TS_InMemorySigner_holder_selected_contest_delay"))) TS_InMemorySigner_holder_selected_contest_delay(uint64_t this_arg) {
23988         LDKInMemorySigner this_arg_conv;
23989         this_arg_conv.inner = untag_ptr(this_arg);
23990         this_arg_conv.is_owned = ptr_is_owned(this_arg);
23991         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
23992         this_arg_conv.is_owned = false;
23993         int16_t ret_conv = InMemorySigner_holder_selected_contest_delay(&this_arg_conv);
23994         return ret_conv;
23995 }
23996
23997 jboolean  __attribute__((export_name("TS_InMemorySigner_is_outbound"))) TS_InMemorySigner_is_outbound(uint64_t this_arg) {
23998         LDKInMemorySigner this_arg_conv;
23999         this_arg_conv.inner = untag_ptr(this_arg);
24000         this_arg_conv.is_owned = ptr_is_owned(this_arg);
24001         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24002         this_arg_conv.is_owned = false;
24003         jboolean ret_conv = InMemorySigner_is_outbound(&this_arg_conv);
24004         return ret_conv;
24005 }
24006
24007 uint64_t  __attribute__((export_name("TS_InMemorySigner_funding_outpoint"))) TS_InMemorySigner_funding_outpoint(uint64_t this_arg) {
24008         LDKInMemorySigner this_arg_conv;
24009         this_arg_conv.inner = untag_ptr(this_arg);
24010         this_arg_conv.is_owned = ptr_is_owned(this_arg);
24011         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24012         this_arg_conv.is_owned = false;
24013         LDKOutPoint ret_var = InMemorySigner_funding_outpoint(&this_arg_conv);
24014         uint64_t ret_ref = 0;
24015         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24016         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24017         return ret_ref;
24018 }
24019
24020 uint64_t  __attribute__((export_name("TS_InMemorySigner_get_channel_parameters"))) TS_InMemorySigner_get_channel_parameters(uint64_t this_arg) {
24021         LDKInMemorySigner this_arg_conv;
24022         this_arg_conv.inner = untag_ptr(this_arg);
24023         this_arg_conv.is_owned = ptr_is_owned(this_arg);
24024         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24025         this_arg_conv.is_owned = false;
24026         LDKChannelTransactionParameters ret_var = InMemorySigner_get_channel_parameters(&this_arg_conv);
24027         uint64_t ret_ref = 0;
24028         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24029         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24030         return ret_ref;
24031 }
24032
24033 jboolean  __attribute__((export_name("TS_InMemorySigner_opt_anchors"))) TS_InMemorySigner_opt_anchors(uint64_t this_arg) {
24034         LDKInMemorySigner this_arg_conv;
24035         this_arg_conv.inner = untag_ptr(this_arg);
24036         this_arg_conv.is_owned = ptr_is_owned(this_arg);
24037         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24038         this_arg_conv.is_owned = false;
24039         jboolean ret_conv = InMemorySigner_opt_anchors(&this_arg_conv);
24040         return ret_conv;
24041 }
24042
24043 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) {
24044         LDKInMemorySigner this_arg_conv;
24045         this_arg_conv.inner = untag_ptr(this_arg);
24046         this_arg_conv.is_owned = ptr_is_owned(this_arg);
24047         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24048         this_arg_conv.is_owned = false;
24049         LDKTransaction spend_tx_ref;
24050         spend_tx_ref.datalen = spend_tx->arr_len;
24051         spend_tx_ref.data = MALLOC(spend_tx_ref.datalen, "LDKTransaction Bytes");
24052         memcpy(spend_tx_ref.data, spend_tx->elems, spend_tx_ref.datalen); FREE(spend_tx);
24053         spend_tx_ref.data_is_owned = true;
24054         LDKStaticPaymentOutputDescriptor descriptor_conv;
24055         descriptor_conv.inner = untag_ptr(descriptor);
24056         descriptor_conv.is_owned = ptr_is_owned(descriptor);
24057         CHECK_INNER_FIELD_ACCESS_OR_NULL(descriptor_conv);
24058         descriptor_conv.is_owned = false;
24059         LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
24060         *ret_conv = InMemorySigner_sign_counterparty_payment_input(&this_arg_conv, spend_tx_ref, input_idx, &descriptor_conv);
24061         return tag_ptr(ret_conv, true);
24062 }
24063
24064 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) {
24065         LDKInMemorySigner this_arg_conv;
24066         this_arg_conv.inner = untag_ptr(this_arg);
24067         this_arg_conv.is_owned = ptr_is_owned(this_arg);
24068         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24069         this_arg_conv.is_owned = false;
24070         LDKTransaction spend_tx_ref;
24071         spend_tx_ref.datalen = spend_tx->arr_len;
24072         spend_tx_ref.data = MALLOC(spend_tx_ref.datalen, "LDKTransaction Bytes");
24073         memcpy(spend_tx_ref.data, spend_tx->elems, spend_tx_ref.datalen); FREE(spend_tx);
24074         spend_tx_ref.data_is_owned = true;
24075         LDKDelayedPaymentOutputDescriptor descriptor_conv;
24076         descriptor_conv.inner = untag_ptr(descriptor);
24077         descriptor_conv.is_owned = ptr_is_owned(descriptor);
24078         CHECK_INNER_FIELD_ACCESS_OR_NULL(descriptor_conv);
24079         descriptor_conv.is_owned = false;
24080         LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
24081         *ret_conv = InMemorySigner_sign_dynamic_p2wsh_input(&this_arg_conv, spend_tx_ref, input_idx, &descriptor_conv);
24082         return tag_ptr(ret_conv, true);
24083 }
24084
24085 uint64_t  __attribute__((export_name("TS_InMemorySigner_as_BaseSign"))) TS_InMemorySigner_as_BaseSign(uint64_t this_arg) {
24086         LDKInMemorySigner this_arg_conv;
24087         this_arg_conv.inner = untag_ptr(this_arg);
24088         this_arg_conv.is_owned = ptr_is_owned(this_arg);
24089         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24090         this_arg_conv.is_owned = false;
24091         LDKBaseSign* ret_ret = MALLOC(sizeof(LDKBaseSign), "LDKBaseSign");
24092         *ret_ret = InMemorySigner_as_BaseSign(&this_arg_conv);
24093         return tag_ptr(ret_ret, true);
24094 }
24095
24096 uint64_t  __attribute__((export_name("TS_InMemorySigner_as_Sign"))) TS_InMemorySigner_as_Sign(uint64_t this_arg) {
24097         LDKInMemorySigner this_arg_conv;
24098         this_arg_conv.inner = untag_ptr(this_arg);
24099         this_arg_conv.is_owned = ptr_is_owned(this_arg);
24100         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24101         this_arg_conv.is_owned = false;
24102         LDKSign* ret_ret = MALLOC(sizeof(LDKSign), "LDKSign");
24103         *ret_ret = InMemorySigner_as_Sign(&this_arg_conv);
24104         return tag_ptr(ret_ret, true);
24105 }
24106
24107 int8_tArray  __attribute__((export_name("TS_InMemorySigner_write"))) TS_InMemorySigner_write(uint64_t obj) {
24108         LDKInMemorySigner obj_conv;
24109         obj_conv.inner = untag_ptr(obj);
24110         obj_conv.is_owned = ptr_is_owned(obj);
24111         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
24112         obj_conv.is_owned = false;
24113         LDKCVec_u8Z ret_var = InMemorySigner_write(&obj_conv);
24114         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
24115         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
24116         CVec_u8Z_free(ret_var);
24117         return ret_arr;
24118 }
24119
24120 uint64_t  __attribute__((export_name("TS_InMemorySigner_read"))) TS_InMemorySigner_read(int8_tArray ser, int8_tArray arg) {
24121         LDKu8slice ser_ref;
24122         ser_ref.datalen = ser->arr_len;
24123         ser_ref.data = ser->elems;
24124         LDKSecretKey arg_ref;
24125         CHECK(arg->arr_len == 32);
24126         memcpy(arg_ref.bytes, arg->elems, 32); FREE(arg);
24127         LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
24128         *ret_conv = InMemorySigner_read(ser_ref, arg_ref);
24129         FREE(ser);
24130         return tag_ptr(ret_conv, true);
24131 }
24132
24133 void  __attribute__((export_name("TS_KeysManager_free"))) TS_KeysManager_free(uint64_t this_obj) {
24134         LDKKeysManager this_obj_conv;
24135         this_obj_conv.inner = untag_ptr(this_obj);
24136         this_obj_conv.is_owned = ptr_is_owned(this_obj);
24137         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
24138         KeysManager_free(this_obj_conv);
24139 }
24140
24141 uint64_t  __attribute__((export_name("TS_KeysManager_new"))) TS_KeysManager_new(int8_tArray seed, int64_t starting_time_secs, int32_t starting_time_nanos) {
24142         unsigned char seed_arr[32];
24143         CHECK(seed->arr_len == 32);
24144         memcpy(seed_arr, seed->elems, 32); FREE(seed);
24145         unsigned char (*seed_ref)[32] = &seed_arr;
24146         LDKKeysManager ret_var = KeysManager_new(seed_ref, starting_time_secs, starting_time_nanos);
24147         uint64_t ret_ref = 0;
24148         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24149         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24150         return ret_ref;
24151 }
24152
24153 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) {
24154         LDKKeysManager this_arg_conv;
24155         this_arg_conv.inner = untag_ptr(this_arg);
24156         this_arg_conv.is_owned = ptr_is_owned(this_arg);
24157         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24158         this_arg_conv.is_owned = false;
24159         unsigned char params_arr[32];
24160         CHECK(params->arr_len == 32);
24161         memcpy(params_arr, params->elems, 32); FREE(params);
24162         unsigned char (*params_ref)[32] = &params_arr;
24163         LDKInMemorySigner ret_var = KeysManager_derive_channel_keys(&this_arg_conv, channel_value_satoshis, params_ref);
24164         uint64_t ret_ref = 0;
24165         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24166         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24167         return ret_ref;
24168 }
24169
24170 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) {
24171         LDKKeysManager this_arg_conv;
24172         this_arg_conv.inner = untag_ptr(this_arg);
24173         this_arg_conv.is_owned = ptr_is_owned(this_arg);
24174         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24175         this_arg_conv.is_owned = false;
24176         LDKCVec_SpendableOutputDescriptorZ descriptors_constr;
24177         descriptors_constr.datalen = descriptors->arr_len;
24178         if (descriptors_constr.datalen > 0)
24179                 descriptors_constr.data = MALLOC(descriptors_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
24180         else
24181                 descriptors_constr.data = NULL;
24182         uint64_t* descriptors_vals = descriptors->elems;
24183         for (size_t b = 0; b < descriptors_constr.datalen; b++) {
24184                 uint64_t descriptors_conv_27 = descriptors_vals[b];
24185                 void* descriptors_conv_27_ptr = untag_ptr(descriptors_conv_27);
24186                 CHECK_ACCESS(descriptors_conv_27_ptr);
24187                 LDKSpendableOutputDescriptor descriptors_conv_27_conv = *(LDKSpendableOutputDescriptor*)(descriptors_conv_27_ptr);
24188                 descriptors_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(descriptors_conv_27));
24189                 descriptors_constr.data[b] = descriptors_conv_27_conv;
24190         }
24191         FREE(descriptors);
24192         LDKCVec_TxOutZ outputs_constr;
24193         outputs_constr.datalen = outputs->arr_len;
24194         if (outputs_constr.datalen > 0)
24195                 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
24196         else
24197                 outputs_constr.data = NULL;
24198         uint64_t* outputs_vals = outputs->elems;
24199         for (size_t h = 0; h < outputs_constr.datalen; h++) {
24200                 uint64_t outputs_conv_7 = outputs_vals[h];
24201                 void* outputs_conv_7_ptr = untag_ptr(outputs_conv_7);
24202                 CHECK_ACCESS(outputs_conv_7_ptr);
24203                 LDKTxOut outputs_conv_7_conv = *(LDKTxOut*)(outputs_conv_7_ptr);
24204                 outputs_conv_7_conv = TxOut_clone((LDKTxOut*)untag_ptr(outputs_conv_7));
24205                 outputs_constr.data[h] = outputs_conv_7_conv;
24206         }
24207         FREE(outputs);
24208         LDKCVec_u8Z change_destination_script_ref;
24209         change_destination_script_ref.datalen = change_destination_script->arr_len;
24210         change_destination_script_ref.data = MALLOC(change_destination_script_ref.datalen, "LDKCVec_u8Z Bytes");
24211         memcpy(change_destination_script_ref.data, change_destination_script->elems, change_destination_script_ref.datalen); FREE(change_destination_script);
24212         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
24213         *ret_conv = KeysManager_spend_spendable_outputs(&this_arg_conv, descriptors_constr, outputs_constr, change_destination_script_ref, feerate_sat_per_1000_weight);
24214         return tag_ptr(ret_conv, true);
24215 }
24216
24217 uint64_t  __attribute__((export_name("TS_KeysManager_as_KeysInterface"))) TS_KeysManager_as_KeysInterface(uint64_t this_arg) {
24218         LDKKeysManager this_arg_conv;
24219         this_arg_conv.inner = untag_ptr(this_arg);
24220         this_arg_conv.is_owned = ptr_is_owned(this_arg);
24221         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24222         this_arg_conv.is_owned = false;
24223         LDKKeysInterface* ret_ret = MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface");
24224         *ret_ret = KeysManager_as_KeysInterface(&this_arg_conv);
24225         return tag_ptr(ret_ret, true);
24226 }
24227
24228 void  __attribute__((export_name("TS_PhantomKeysManager_free"))) TS_PhantomKeysManager_free(uint64_t this_obj) {
24229         LDKPhantomKeysManager this_obj_conv;
24230         this_obj_conv.inner = untag_ptr(this_obj);
24231         this_obj_conv.is_owned = ptr_is_owned(this_obj);
24232         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
24233         PhantomKeysManager_free(this_obj_conv);
24234 }
24235
24236 uint64_t  __attribute__((export_name("TS_PhantomKeysManager_as_KeysInterface"))) TS_PhantomKeysManager_as_KeysInterface(uint64_t this_arg) {
24237         LDKPhantomKeysManager this_arg_conv;
24238         this_arg_conv.inner = untag_ptr(this_arg);
24239         this_arg_conv.is_owned = ptr_is_owned(this_arg);
24240         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24241         this_arg_conv.is_owned = false;
24242         LDKKeysInterface* ret_ret = MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface");
24243         *ret_ret = PhantomKeysManager_as_KeysInterface(&this_arg_conv);
24244         return tag_ptr(ret_ret, true);
24245 }
24246
24247 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) {
24248         unsigned char seed_arr[32];
24249         CHECK(seed->arr_len == 32);
24250         memcpy(seed_arr, seed->elems, 32); FREE(seed);
24251         unsigned char (*seed_ref)[32] = &seed_arr;
24252         unsigned char cross_node_seed_arr[32];
24253         CHECK(cross_node_seed->arr_len == 32);
24254         memcpy(cross_node_seed_arr, cross_node_seed->elems, 32); FREE(cross_node_seed);
24255         unsigned char (*cross_node_seed_ref)[32] = &cross_node_seed_arr;
24256         LDKPhantomKeysManager ret_var = PhantomKeysManager_new(seed_ref, starting_time_secs, starting_time_nanos, cross_node_seed_ref);
24257         uint64_t ret_ref = 0;
24258         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24259         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24260         return ret_ref;
24261 }
24262
24263 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) {
24264         LDKPhantomKeysManager this_arg_conv;
24265         this_arg_conv.inner = untag_ptr(this_arg);
24266         this_arg_conv.is_owned = ptr_is_owned(this_arg);
24267         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24268         this_arg_conv.is_owned = false;
24269         LDKCVec_SpendableOutputDescriptorZ descriptors_constr;
24270         descriptors_constr.datalen = descriptors->arr_len;
24271         if (descriptors_constr.datalen > 0)
24272                 descriptors_constr.data = MALLOC(descriptors_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
24273         else
24274                 descriptors_constr.data = NULL;
24275         uint64_t* descriptors_vals = descriptors->elems;
24276         for (size_t b = 0; b < descriptors_constr.datalen; b++) {
24277                 uint64_t descriptors_conv_27 = descriptors_vals[b];
24278                 void* descriptors_conv_27_ptr = untag_ptr(descriptors_conv_27);
24279                 CHECK_ACCESS(descriptors_conv_27_ptr);
24280                 LDKSpendableOutputDescriptor descriptors_conv_27_conv = *(LDKSpendableOutputDescriptor*)(descriptors_conv_27_ptr);
24281                 descriptors_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(descriptors_conv_27));
24282                 descriptors_constr.data[b] = descriptors_conv_27_conv;
24283         }
24284         FREE(descriptors);
24285         LDKCVec_TxOutZ outputs_constr;
24286         outputs_constr.datalen = outputs->arr_len;
24287         if (outputs_constr.datalen > 0)
24288                 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
24289         else
24290                 outputs_constr.data = NULL;
24291         uint64_t* outputs_vals = outputs->elems;
24292         for (size_t h = 0; h < outputs_constr.datalen; h++) {
24293                 uint64_t outputs_conv_7 = outputs_vals[h];
24294                 void* outputs_conv_7_ptr = untag_ptr(outputs_conv_7);
24295                 CHECK_ACCESS(outputs_conv_7_ptr);
24296                 LDKTxOut outputs_conv_7_conv = *(LDKTxOut*)(outputs_conv_7_ptr);
24297                 outputs_conv_7_conv = TxOut_clone((LDKTxOut*)untag_ptr(outputs_conv_7));
24298                 outputs_constr.data[h] = outputs_conv_7_conv;
24299         }
24300         FREE(outputs);
24301         LDKCVec_u8Z change_destination_script_ref;
24302         change_destination_script_ref.datalen = change_destination_script->arr_len;
24303         change_destination_script_ref.data = MALLOC(change_destination_script_ref.datalen, "LDKCVec_u8Z Bytes");
24304         memcpy(change_destination_script_ref.data, change_destination_script->elems, change_destination_script_ref.datalen); FREE(change_destination_script);
24305         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
24306         *ret_conv = PhantomKeysManager_spend_spendable_outputs(&this_arg_conv, descriptors_constr, outputs_constr, change_destination_script_ref, feerate_sat_per_1000_weight);
24307         return tag_ptr(ret_conv, true);
24308 }
24309
24310 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) {
24311         LDKPhantomKeysManager this_arg_conv;
24312         this_arg_conv.inner = untag_ptr(this_arg);
24313         this_arg_conv.is_owned = ptr_is_owned(this_arg);
24314         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24315         this_arg_conv.is_owned = false;
24316         unsigned char params_arr[32];
24317         CHECK(params->arr_len == 32);
24318         memcpy(params_arr, params->elems, 32); FREE(params);
24319         unsigned char (*params_ref)[32] = &params_arr;
24320         LDKInMemorySigner ret_var = PhantomKeysManager_derive_channel_keys(&this_arg_conv, channel_value_satoshis, params_ref);
24321         uint64_t ret_ref = 0;
24322         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24323         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24324         return ret_ref;
24325 }
24326
24327 void  __attribute__((export_name("TS_ChannelManager_free"))) TS_ChannelManager_free(uint64_t this_obj) {
24328         LDKChannelManager this_obj_conv;
24329         this_obj_conv.inner = untag_ptr(this_obj);
24330         this_obj_conv.is_owned = ptr_is_owned(this_obj);
24331         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
24332         ChannelManager_free(this_obj_conv);
24333 }
24334
24335 void  __attribute__((export_name("TS_ChainParameters_free"))) TS_ChainParameters_free(uint64_t this_obj) {
24336         LDKChainParameters this_obj_conv;
24337         this_obj_conv.inner = untag_ptr(this_obj);
24338         this_obj_conv.is_owned = ptr_is_owned(this_obj);
24339         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
24340         ChainParameters_free(this_obj_conv);
24341 }
24342
24343 uint32_t  __attribute__((export_name("TS_ChainParameters_get_network"))) TS_ChainParameters_get_network(uint64_t this_ptr) {
24344         LDKChainParameters this_ptr_conv;
24345         this_ptr_conv.inner = untag_ptr(this_ptr);
24346         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24347         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24348         this_ptr_conv.is_owned = false;
24349         uint32_t ret_conv = LDKNetwork_to_js(ChainParameters_get_network(&this_ptr_conv));
24350         return ret_conv;
24351 }
24352
24353 void  __attribute__((export_name("TS_ChainParameters_set_network"))) TS_ChainParameters_set_network(uint64_t this_ptr, uint32_t val) {
24354         LDKChainParameters this_ptr_conv;
24355         this_ptr_conv.inner = untag_ptr(this_ptr);
24356         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24357         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24358         this_ptr_conv.is_owned = false;
24359         LDKNetwork val_conv = LDKNetwork_from_js(val);
24360         ChainParameters_set_network(&this_ptr_conv, val_conv);
24361 }
24362
24363 uint64_t  __attribute__((export_name("TS_ChainParameters_get_best_block"))) TS_ChainParameters_get_best_block(uint64_t this_ptr) {
24364         LDKChainParameters this_ptr_conv;
24365         this_ptr_conv.inner = untag_ptr(this_ptr);
24366         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24367         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24368         this_ptr_conv.is_owned = false;
24369         LDKBestBlock ret_var = ChainParameters_get_best_block(&this_ptr_conv);
24370         uint64_t ret_ref = 0;
24371         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24372         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24373         return ret_ref;
24374 }
24375
24376 void  __attribute__((export_name("TS_ChainParameters_set_best_block"))) TS_ChainParameters_set_best_block(uint64_t this_ptr, uint64_t val) {
24377         LDKChainParameters this_ptr_conv;
24378         this_ptr_conv.inner = untag_ptr(this_ptr);
24379         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24380         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24381         this_ptr_conv.is_owned = false;
24382         LDKBestBlock val_conv;
24383         val_conv.inner = untag_ptr(val);
24384         val_conv.is_owned = ptr_is_owned(val);
24385         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
24386         val_conv = BestBlock_clone(&val_conv);
24387         ChainParameters_set_best_block(&this_ptr_conv, val_conv);
24388 }
24389
24390 uint64_t  __attribute__((export_name("TS_ChainParameters_new"))) TS_ChainParameters_new(uint32_t network_arg, uint64_t best_block_arg) {
24391         LDKNetwork network_arg_conv = LDKNetwork_from_js(network_arg);
24392         LDKBestBlock best_block_arg_conv;
24393         best_block_arg_conv.inner = untag_ptr(best_block_arg);
24394         best_block_arg_conv.is_owned = ptr_is_owned(best_block_arg);
24395         CHECK_INNER_FIELD_ACCESS_OR_NULL(best_block_arg_conv);
24396         best_block_arg_conv = BestBlock_clone(&best_block_arg_conv);
24397         LDKChainParameters ret_var = ChainParameters_new(network_arg_conv, best_block_arg_conv);
24398         uint64_t ret_ref = 0;
24399         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24400         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24401         return ret_ref;
24402 }
24403
24404 static inline uint64_t ChainParameters_clone_ptr(LDKChainParameters *NONNULL_PTR arg) {
24405         LDKChainParameters ret_var = ChainParameters_clone(arg);
24406         uint64_t ret_ref = 0;
24407         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24408         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24409         return ret_ref;
24410 }
24411 int64_t  __attribute__((export_name("TS_ChainParameters_clone_ptr"))) TS_ChainParameters_clone_ptr(uint64_t arg) {
24412         LDKChainParameters arg_conv;
24413         arg_conv.inner = untag_ptr(arg);
24414         arg_conv.is_owned = ptr_is_owned(arg);
24415         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
24416         arg_conv.is_owned = false;
24417         int64_t ret_conv = ChainParameters_clone_ptr(&arg_conv);
24418         return ret_conv;
24419 }
24420
24421 uint64_t  __attribute__((export_name("TS_ChainParameters_clone"))) TS_ChainParameters_clone(uint64_t orig) {
24422         LDKChainParameters orig_conv;
24423         orig_conv.inner = untag_ptr(orig);
24424         orig_conv.is_owned = ptr_is_owned(orig);
24425         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
24426         orig_conv.is_owned = false;
24427         LDKChainParameters ret_var = ChainParameters_clone(&orig_conv);
24428         uint64_t ret_ref = 0;
24429         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24430         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24431         return ret_ref;
24432 }
24433
24434 void  __attribute__((export_name("TS_CounterpartyForwardingInfo_free"))) TS_CounterpartyForwardingInfo_free(uint64_t this_obj) {
24435         LDKCounterpartyForwardingInfo this_obj_conv;
24436         this_obj_conv.inner = untag_ptr(this_obj);
24437         this_obj_conv.is_owned = ptr_is_owned(this_obj);
24438         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
24439         CounterpartyForwardingInfo_free(this_obj_conv);
24440 }
24441
24442 int32_t  __attribute__((export_name("TS_CounterpartyForwardingInfo_get_fee_base_msat"))) TS_CounterpartyForwardingInfo_get_fee_base_msat(uint64_t this_ptr) {
24443         LDKCounterpartyForwardingInfo this_ptr_conv;
24444         this_ptr_conv.inner = untag_ptr(this_ptr);
24445         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24446         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24447         this_ptr_conv.is_owned = false;
24448         int32_t ret_conv = CounterpartyForwardingInfo_get_fee_base_msat(&this_ptr_conv);
24449         return ret_conv;
24450 }
24451
24452 void  __attribute__((export_name("TS_CounterpartyForwardingInfo_set_fee_base_msat"))) TS_CounterpartyForwardingInfo_set_fee_base_msat(uint64_t this_ptr, int32_t val) {
24453         LDKCounterpartyForwardingInfo this_ptr_conv;
24454         this_ptr_conv.inner = untag_ptr(this_ptr);
24455         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24456         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24457         this_ptr_conv.is_owned = false;
24458         CounterpartyForwardingInfo_set_fee_base_msat(&this_ptr_conv, val);
24459 }
24460
24461 int32_t  __attribute__((export_name("TS_CounterpartyForwardingInfo_get_fee_proportional_millionths"))) TS_CounterpartyForwardingInfo_get_fee_proportional_millionths(uint64_t this_ptr) {
24462         LDKCounterpartyForwardingInfo this_ptr_conv;
24463         this_ptr_conv.inner = untag_ptr(this_ptr);
24464         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24465         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24466         this_ptr_conv.is_owned = false;
24467         int32_t ret_conv = CounterpartyForwardingInfo_get_fee_proportional_millionths(&this_ptr_conv);
24468         return ret_conv;
24469 }
24470
24471 void  __attribute__((export_name("TS_CounterpartyForwardingInfo_set_fee_proportional_millionths"))) TS_CounterpartyForwardingInfo_set_fee_proportional_millionths(uint64_t this_ptr, int32_t val) {
24472         LDKCounterpartyForwardingInfo this_ptr_conv;
24473         this_ptr_conv.inner = untag_ptr(this_ptr);
24474         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24475         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24476         this_ptr_conv.is_owned = false;
24477         CounterpartyForwardingInfo_set_fee_proportional_millionths(&this_ptr_conv, val);
24478 }
24479
24480 int16_t  __attribute__((export_name("TS_CounterpartyForwardingInfo_get_cltv_expiry_delta"))) TS_CounterpartyForwardingInfo_get_cltv_expiry_delta(uint64_t this_ptr) {
24481         LDKCounterpartyForwardingInfo this_ptr_conv;
24482         this_ptr_conv.inner = untag_ptr(this_ptr);
24483         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24484         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24485         this_ptr_conv.is_owned = false;
24486         int16_t ret_conv = CounterpartyForwardingInfo_get_cltv_expiry_delta(&this_ptr_conv);
24487         return ret_conv;
24488 }
24489
24490 void  __attribute__((export_name("TS_CounterpartyForwardingInfo_set_cltv_expiry_delta"))) TS_CounterpartyForwardingInfo_set_cltv_expiry_delta(uint64_t this_ptr, int16_t val) {
24491         LDKCounterpartyForwardingInfo this_ptr_conv;
24492         this_ptr_conv.inner = untag_ptr(this_ptr);
24493         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24494         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24495         this_ptr_conv.is_owned = false;
24496         CounterpartyForwardingInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
24497 }
24498
24499 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) {
24500         LDKCounterpartyForwardingInfo ret_var = CounterpartyForwardingInfo_new(fee_base_msat_arg, fee_proportional_millionths_arg, cltv_expiry_delta_arg);
24501         uint64_t ret_ref = 0;
24502         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24503         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24504         return ret_ref;
24505 }
24506
24507 static inline uint64_t CounterpartyForwardingInfo_clone_ptr(LDKCounterpartyForwardingInfo *NONNULL_PTR arg) {
24508         LDKCounterpartyForwardingInfo ret_var = CounterpartyForwardingInfo_clone(arg);
24509         uint64_t ret_ref = 0;
24510         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24511         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24512         return ret_ref;
24513 }
24514 int64_t  __attribute__((export_name("TS_CounterpartyForwardingInfo_clone_ptr"))) TS_CounterpartyForwardingInfo_clone_ptr(uint64_t arg) {
24515         LDKCounterpartyForwardingInfo arg_conv;
24516         arg_conv.inner = untag_ptr(arg);
24517         arg_conv.is_owned = ptr_is_owned(arg);
24518         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
24519         arg_conv.is_owned = false;
24520         int64_t ret_conv = CounterpartyForwardingInfo_clone_ptr(&arg_conv);
24521         return ret_conv;
24522 }
24523
24524 uint64_t  __attribute__((export_name("TS_CounterpartyForwardingInfo_clone"))) TS_CounterpartyForwardingInfo_clone(uint64_t orig) {
24525         LDKCounterpartyForwardingInfo orig_conv;
24526         orig_conv.inner = untag_ptr(orig);
24527         orig_conv.is_owned = ptr_is_owned(orig);
24528         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
24529         orig_conv.is_owned = false;
24530         LDKCounterpartyForwardingInfo ret_var = CounterpartyForwardingInfo_clone(&orig_conv);
24531         uint64_t ret_ref = 0;
24532         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24533         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24534         return ret_ref;
24535 }
24536
24537 void  __attribute__((export_name("TS_ChannelCounterparty_free"))) TS_ChannelCounterparty_free(uint64_t this_obj) {
24538         LDKChannelCounterparty this_obj_conv;
24539         this_obj_conv.inner = untag_ptr(this_obj);
24540         this_obj_conv.is_owned = ptr_is_owned(this_obj);
24541         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
24542         ChannelCounterparty_free(this_obj_conv);
24543 }
24544
24545 int8_tArray  __attribute__((export_name("TS_ChannelCounterparty_get_node_id"))) TS_ChannelCounterparty_get_node_id(uint64_t this_ptr) {
24546         LDKChannelCounterparty this_ptr_conv;
24547         this_ptr_conv.inner = untag_ptr(this_ptr);
24548         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24549         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24550         this_ptr_conv.is_owned = false;
24551         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
24552         memcpy(ret_arr->elems, ChannelCounterparty_get_node_id(&this_ptr_conv).compressed_form, 33);
24553         return ret_arr;
24554 }
24555
24556 void  __attribute__((export_name("TS_ChannelCounterparty_set_node_id"))) TS_ChannelCounterparty_set_node_id(uint64_t this_ptr, int8_tArray val) {
24557         LDKChannelCounterparty this_ptr_conv;
24558         this_ptr_conv.inner = untag_ptr(this_ptr);
24559         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24560         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24561         this_ptr_conv.is_owned = false;
24562         LDKPublicKey val_ref;
24563         CHECK(val->arr_len == 33);
24564         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
24565         ChannelCounterparty_set_node_id(&this_ptr_conv, val_ref);
24566 }
24567
24568 uint64_t  __attribute__((export_name("TS_ChannelCounterparty_get_features"))) TS_ChannelCounterparty_get_features(uint64_t this_ptr) {
24569         LDKChannelCounterparty this_ptr_conv;
24570         this_ptr_conv.inner = untag_ptr(this_ptr);
24571         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24572         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24573         this_ptr_conv.is_owned = false;
24574         LDKInitFeatures ret_var = ChannelCounterparty_get_features(&this_ptr_conv);
24575         uint64_t ret_ref = 0;
24576         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24577         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24578         return ret_ref;
24579 }
24580
24581 void  __attribute__((export_name("TS_ChannelCounterparty_set_features"))) TS_ChannelCounterparty_set_features(uint64_t this_ptr, uint64_t val) {
24582         LDKChannelCounterparty this_ptr_conv;
24583         this_ptr_conv.inner = untag_ptr(this_ptr);
24584         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24585         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24586         this_ptr_conv.is_owned = false;
24587         LDKInitFeatures val_conv;
24588         val_conv.inner = untag_ptr(val);
24589         val_conv.is_owned = ptr_is_owned(val);
24590         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
24591         val_conv = InitFeatures_clone(&val_conv);
24592         ChannelCounterparty_set_features(&this_ptr_conv, val_conv);
24593 }
24594
24595 int64_t  __attribute__((export_name("TS_ChannelCounterparty_get_unspendable_punishment_reserve"))) TS_ChannelCounterparty_get_unspendable_punishment_reserve(uint64_t this_ptr) {
24596         LDKChannelCounterparty this_ptr_conv;
24597         this_ptr_conv.inner = untag_ptr(this_ptr);
24598         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24599         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24600         this_ptr_conv.is_owned = false;
24601         int64_t ret_conv = ChannelCounterparty_get_unspendable_punishment_reserve(&this_ptr_conv);
24602         return ret_conv;
24603 }
24604
24605 void  __attribute__((export_name("TS_ChannelCounterparty_set_unspendable_punishment_reserve"))) TS_ChannelCounterparty_set_unspendable_punishment_reserve(uint64_t this_ptr, int64_t val) {
24606         LDKChannelCounterparty this_ptr_conv;
24607         this_ptr_conv.inner = untag_ptr(this_ptr);
24608         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24609         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24610         this_ptr_conv.is_owned = false;
24611         ChannelCounterparty_set_unspendable_punishment_reserve(&this_ptr_conv, val);
24612 }
24613
24614 uint64_t  __attribute__((export_name("TS_ChannelCounterparty_get_forwarding_info"))) TS_ChannelCounterparty_get_forwarding_info(uint64_t this_ptr) {
24615         LDKChannelCounterparty this_ptr_conv;
24616         this_ptr_conv.inner = untag_ptr(this_ptr);
24617         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24618         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24619         this_ptr_conv.is_owned = false;
24620         LDKCounterpartyForwardingInfo ret_var = ChannelCounterparty_get_forwarding_info(&this_ptr_conv);
24621         uint64_t ret_ref = 0;
24622         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24623         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24624         return ret_ref;
24625 }
24626
24627 void  __attribute__((export_name("TS_ChannelCounterparty_set_forwarding_info"))) TS_ChannelCounterparty_set_forwarding_info(uint64_t this_ptr, uint64_t val) {
24628         LDKChannelCounterparty this_ptr_conv;
24629         this_ptr_conv.inner = untag_ptr(this_ptr);
24630         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24631         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24632         this_ptr_conv.is_owned = false;
24633         LDKCounterpartyForwardingInfo val_conv;
24634         val_conv.inner = untag_ptr(val);
24635         val_conv.is_owned = ptr_is_owned(val);
24636         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
24637         val_conv = CounterpartyForwardingInfo_clone(&val_conv);
24638         ChannelCounterparty_set_forwarding_info(&this_ptr_conv, val_conv);
24639 }
24640
24641 uint64_t  __attribute__((export_name("TS_ChannelCounterparty_get_outbound_htlc_minimum_msat"))) TS_ChannelCounterparty_get_outbound_htlc_minimum_msat(uint64_t this_ptr) {
24642         LDKChannelCounterparty this_ptr_conv;
24643         this_ptr_conv.inner = untag_ptr(this_ptr);
24644         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24645         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24646         this_ptr_conv.is_owned = false;
24647         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
24648         *ret_copy = ChannelCounterparty_get_outbound_htlc_minimum_msat(&this_ptr_conv);
24649         uint64_t ret_ref = tag_ptr(ret_copy, true);
24650         return ret_ref;
24651 }
24652
24653 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) {
24654         LDKChannelCounterparty 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         void* val_ptr = untag_ptr(val);
24660         CHECK_ACCESS(val_ptr);
24661         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
24662         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
24663         ChannelCounterparty_set_outbound_htlc_minimum_msat(&this_ptr_conv, val_conv);
24664 }
24665
24666 uint64_t  __attribute__((export_name("TS_ChannelCounterparty_get_outbound_htlc_maximum_msat"))) TS_ChannelCounterparty_get_outbound_htlc_maximum_msat(uint64_t this_ptr) {
24667         LDKChannelCounterparty this_ptr_conv;
24668         this_ptr_conv.inner = untag_ptr(this_ptr);
24669         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24670         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24671         this_ptr_conv.is_owned = false;
24672         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
24673         *ret_copy = ChannelCounterparty_get_outbound_htlc_maximum_msat(&this_ptr_conv);
24674         uint64_t ret_ref = tag_ptr(ret_copy, true);
24675         return ret_ref;
24676 }
24677
24678 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) {
24679         LDKChannelCounterparty this_ptr_conv;
24680         this_ptr_conv.inner = untag_ptr(this_ptr);
24681         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24682         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24683         this_ptr_conv.is_owned = false;
24684         void* val_ptr = untag_ptr(val);
24685         CHECK_ACCESS(val_ptr);
24686         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
24687         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
24688         ChannelCounterparty_set_outbound_htlc_maximum_msat(&this_ptr_conv, val_conv);
24689 }
24690
24691 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) {
24692         LDKPublicKey node_id_arg_ref;
24693         CHECK(node_id_arg->arr_len == 33);
24694         memcpy(node_id_arg_ref.compressed_form, node_id_arg->elems, 33); FREE(node_id_arg);
24695         LDKInitFeatures features_arg_conv;
24696         features_arg_conv.inner = untag_ptr(features_arg);
24697         features_arg_conv.is_owned = ptr_is_owned(features_arg);
24698         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
24699         features_arg_conv = InitFeatures_clone(&features_arg_conv);
24700         LDKCounterpartyForwardingInfo forwarding_info_arg_conv;
24701         forwarding_info_arg_conv.inner = untag_ptr(forwarding_info_arg);
24702         forwarding_info_arg_conv.is_owned = ptr_is_owned(forwarding_info_arg);
24703         CHECK_INNER_FIELD_ACCESS_OR_NULL(forwarding_info_arg_conv);
24704         forwarding_info_arg_conv = CounterpartyForwardingInfo_clone(&forwarding_info_arg_conv);
24705         void* outbound_htlc_minimum_msat_arg_ptr = untag_ptr(outbound_htlc_minimum_msat_arg);
24706         CHECK_ACCESS(outbound_htlc_minimum_msat_arg_ptr);
24707         LDKCOption_u64Z outbound_htlc_minimum_msat_arg_conv = *(LDKCOption_u64Z*)(outbound_htlc_minimum_msat_arg_ptr);
24708         outbound_htlc_minimum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(outbound_htlc_minimum_msat_arg));
24709         void* outbound_htlc_maximum_msat_arg_ptr = untag_ptr(outbound_htlc_maximum_msat_arg);
24710         CHECK_ACCESS(outbound_htlc_maximum_msat_arg_ptr);
24711         LDKCOption_u64Z outbound_htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(outbound_htlc_maximum_msat_arg_ptr);
24712         outbound_htlc_maximum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(outbound_htlc_maximum_msat_arg));
24713         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);
24714         uint64_t ret_ref = 0;
24715         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24716         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24717         return ret_ref;
24718 }
24719
24720 static inline uint64_t ChannelCounterparty_clone_ptr(LDKChannelCounterparty *NONNULL_PTR arg) {
24721         LDKChannelCounterparty ret_var = ChannelCounterparty_clone(arg);
24722         uint64_t ret_ref = 0;
24723         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24724         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24725         return ret_ref;
24726 }
24727 int64_t  __attribute__((export_name("TS_ChannelCounterparty_clone_ptr"))) TS_ChannelCounterparty_clone_ptr(uint64_t arg) {
24728         LDKChannelCounterparty arg_conv;
24729         arg_conv.inner = untag_ptr(arg);
24730         arg_conv.is_owned = ptr_is_owned(arg);
24731         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
24732         arg_conv.is_owned = false;
24733         int64_t ret_conv = ChannelCounterparty_clone_ptr(&arg_conv);
24734         return ret_conv;
24735 }
24736
24737 uint64_t  __attribute__((export_name("TS_ChannelCounterparty_clone"))) TS_ChannelCounterparty_clone(uint64_t orig) {
24738         LDKChannelCounterparty orig_conv;
24739         orig_conv.inner = untag_ptr(orig);
24740         orig_conv.is_owned = ptr_is_owned(orig);
24741         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
24742         orig_conv.is_owned = false;
24743         LDKChannelCounterparty ret_var = ChannelCounterparty_clone(&orig_conv);
24744         uint64_t ret_ref = 0;
24745         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24746         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24747         return ret_ref;
24748 }
24749
24750 void  __attribute__((export_name("TS_ChannelDetails_free"))) TS_ChannelDetails_free(uint64_t this_obj) {
24751         LDKChannelDetails this_obj_conv;
24752         this_obj_conv.inner = untag_ptr(this_obj);
24753         this_obj_conv.is_owned = ptr_is_owned(this_obj);
24754         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
24755         ChannelDetails_free(this_obj_conv);
24756 }
24757
24758 int8_tArray  __attribute__((export_name("TS_ChannelDetails_get_channel_id"))) TS_ChannelDetails_get_channel_id(uint64_t this_ptr) {
24759         LDKChannelDetails this_ptr_conv;
24760         this_ptr_conv.inner = untag_ptr(this_ptr);
24761         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24762         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24763         this_ptr_conv.is_owned = false;
24764         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
24765         memcpy(ret_arr->elems, *ChannelDetails_get_channel_id(&this_ptr_conv), 32);
24766         return ret_arr;
24767 }
24768
24769 void  __attribute__((export_name("TS_ChannelDetails_set_channel_id"))) TS_ChannelDetails_set_channel_id(uint64_t this_ptr, int8_tArray val) {
24770         LDKChannelDetails 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         LDKThirtyTwoBytes val_ref;
24776         CHECK(val->arr_len == 32);
24777         memcpy(val_ref.data, val->elems, 32); FREE(val);
24778         ChannelDetails_set_channel_id(&this_ptr_conv, val_ref);
24779 }
24780
24781 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_counterparty"))) TS_ChannelDetails_get_counterparty(uint64_t this_ptr) {
24782         LDKChannelDetails this_ptr_conv;
24783         this_ptr_conv.inner = untag_ptr(this_ptr);
24784         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24785         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24786         this_ptr_conv.is_owned = false;
24787         LDKChannelCounterparty ret_var = ChannelDetails_get_counterparty(&this_ptr_conv);
24788         uint64_t ret_ref = 0;
24789         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24790         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24791         return ret_ref;
24792 }
24793
24794 void  __attribute__((export_name("TS_ChannelDetails_set_counterparty"))) TS_ChannelDetails_set_counterparty(uint64_t this_ptr, uint64_t val) {
24795         LDKChannelDetails this_ptr_conv;
24796         this_ptr_conv.inner = untag_ptr(this_ptr);
24797         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24798         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24799         this_ptr_conv.is_owned = false;
24800         LDKChannelCounterparty val_conv;
24801         val_conv.inner = untag_ptr(val);
24802         val_conv.is_owned = ptr_is_owned(val);
24803         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
24804         val_conv = ChannelCounterparty_clone(&val_conv);
24805         ChannelDetails_set_counterparty(&this_ptr_conv, val_conv);
24806 }
24807
24808 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_funding_txo"))) TS_ChannelDetails_get_funding_txo(uint64_t this_ptr) {
24809         LDKChannelDetails this_ptr_conv;
24810         this_ptr_conv.inner = untag_ptr(this_ptr);
24811         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24812         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24813         this_ptr_conv.is_owned = false;
24814         LDKOutPoint ret_var = ChannelDetails_get_funding_txo(&this_ptr_conv);
24815         uint64_t ret_ref = 0;
24816         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24817         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24818         return ret_ref;
24819 }
24820
24821 void  __attribute__((export_name("TS_ChannelDetails_set_funding_txo"))) TS_ChannelDetails_set_funding_txo(uint64_t this_ptr, uint64_t val) {
24822         LDKChannelDetails this_ptr_conv;
24823         this_ptr_conv.inner = untag_ptr(this_ptr);
24824         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24825         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24826         this_ptr_conv.is_owned = false;
24827         LDKOutPoint val_conv;
24828         val_conv.inner = untag_ptr(val);
24829         val_conv.is_owned = ptr_is_owned(val);
24830         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
24831         val_conv = OutPoint_clone(&val_conv);
24832         ChannelDetails_set_funding_txo(&this_ptr_conv, val_conv);
24833 }
24834
24835 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_channel_type"))) TS_ChannelDetails_get_channel_type(uint64_t this_ptr) {
24836         LDKChannelDetails this_ptr_conv;
24837         this_ptr_conv.inner = untag_ptr(this_ptr);
24838         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24839         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24840         this_ptr_conv.is_owned = false;
24841         LDKChannelTypeFeatures ret_var = ChannelDetails_get_channel_type(&this_ptr_conv);
24842         uint64_t ret_ref = 0;
24843         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24844         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24845         return ret_ref;
24846 }
24847
24848 void  __attribute__((export_name("TS_ChannelDetails_set_channel_type"))) TS_ChannelDetails_set_channel_type(uint64_t this_ptr, uint64_t val) {
24849         LDKChannelDetails this_ptr_conv;
24850         this_ptr_conv.inner = untag_ptr(this_ptr);
24851         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24852         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24853         this_ptr_conv.is_owned = false;
24854         LDKChannelTypeFeatures val_conv;
24855         val_conv.inner = untag_ptr(val);
24856         val_conv.is_owned = ptr_is_owned(val);
24857         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
24858         val_conv = ChannelTypeFeatures_clone(&val_conv);
24859         ChannelDetails_set_channel_type(&this_ptr_conv, val_conv);
24860 }
24861
24862 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_short_channel_id"))) TS_ChannelDetails_get_short_channel_id(uint64_t this_ptr) {
24863         LDKChannelDetails this_ptr_conv;
24864         this_ptr_conv.inner = untag_ptr(this_ptr);
24865         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24866         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24867         this_ptr_conv.is_owned = false;
24868         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
24869         *ret_copy = ChannelDetails_get_short_channel_id(&this_ptr_conv);
24870         uint64_t ret_ref = tag_ptr(ret_copy, true);
24871         return ret_ref;
24872 }
24873
24874 void  __attribute__((export_name("TS_ChannelDetails_set_short_channel_id"))) TS_ChannelDetails_set_short_channel_id(uint64_t this_ptr, uint64_t val) {
24875         LDKChannelDetails this_ptr_conv;
24876         this_ptr_conv.inner = untag_ptr(this_ptr);
24877         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24878         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24879         this_ptr_conv.is_owned = false;
24880         void* val_ptr = untag_ptr(val);
24881         CHECK_ACCESS(val_ptr);
24882         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
24883         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
24884         ChannelDetails_set_short_channel_id(&this_ptr_conv, val_conv);
24885 }
24886
24887 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_outbound_scid_alias"))) TS_ChannelDetails_get_outbound_scid_alias(uint64_t this_ptr) {
24888         LDKChannelDetails this_ptr_conv;
24889         this_ptr_conv.inner = untag_ptr(this_ptr);
24890         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24891         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24892         this_ptr_conv.is_owned = false;
24893         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
24894         *ret_copy = ChannelDetails_get_outbound_scid_alias(&this_ptr_conv);
24895         uint64_t ret_ref = tag_ptr(ret_copy, true);
24896         return ret_ref;
24897 }
24898
24899 void  __attribute__((export_name("TS_ChannelDetails_set_outbound_scid_alias"))) TS_ChannelDetails_set_outbound_scid_alias(uint64_t this_ptr, uint64_t val) {
24900         LDKChannelDetails this_ptr_conv;
24901         this_ptr_conv.inner = untag_ptr(this_ptr);
24902         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24903         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24904         this_ptr_conv.is_owned = false;
24905         void* val_ptr = untag_ptr(val);
24906         CHECK_ACCESS(val_ptr);
24907         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
24908         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
24909         ChannelDetails_set_outbound_scid_alias(&this_ptr_conv, val_conv);
24910 }
24911
24912 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_inbound_scid_alias"))) TS_ChannelDetails_get_inbound_scid_alias(uint64_t this_ptr) {
24913         LDKChannelDetails this_ptr_conv;
24914         this_ptr_conv.inner = untag_ptr(this_ptr);
24915         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24916         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24917         this_ptr_conv.is_owned = false;
24918         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
24919         *ret_copy = ChannelDetails_get_inbound_scid_alias(&this_ptr_conv);
24920         uint64_t ret_ref = tag_ptr(ret_copy, true);
24921         return ret_ref;
24922 }
24923
24924 void  __attribute__((export_name("TS_ChannelDetails_set_inbound_scid_alias"))) TS_ChannelDetails_set_inbound_scid_alias(uint64_t this_ptr, uint64_t val) {
24925         LDKChannelDetails this_ptr_conv;
24926         this_ptr_conv.inner = untag_ptr(this_ptr);
24927         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24928         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24929         this_ptr_conv.is_owned = false;
24930         void* val_ptr = untag_ptr(val);
24931         CHECK_ACCESS(val_ptr);
24932         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
24933         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
24934         ChannelDetails_set_inbound_scid_alias(&this_ptr_conv, val_conv);
24935 }
24936
24937 int64_t  __attribute__((export_name("TS_ChannelDetails_get_channel_value_satoshis"))) TS_ChannelDetails_get_channel_value_satoshis(uint64_t this_ptr) {
24938         LDKChannelDetails this_ptr_conv;
24939         this_ptr_conv.inner = untag_ptr(this_ptr);
24940         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24941         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24942         this_ptr_conv.is_owned = false;
24943         int64_t ret_conv = ChannelDetails_get_channel_value_satoshis(&this_ptr_conv);
24944         return ret_conv;
24945 }
24946
24947 void  __attribute__((export_name("TS_ChannelDetails_set_channel_value_satoshis"))) TS_ChannelDetails_set_channel_value_satoshis(uint64_t this_ptr, int64_t val) {
24948         LDKChannelDetails this_ptr_conv;
24949         this_ptr_conv.inner = untag_ptr(this_ptr);
24950         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24951         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24952         this_ptr_conv.is_owned = false;
24953         ChannelDetails_set_channel_value_satoshis(&this_ptr_conv, val);
24954 }
24955
24956 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_unspendable_punishment_reserve"))) TS_ChannelDetails_get_unspendable_punishment_reserve(uint64_t this_ptr) {
24957         LDKChannelDetails this_ptr_conv;
24958         this_ptr_conv.inner = untag_ptr(this_ptr);
24959         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24960         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24961         this_ptr_conv.is_owned = false;
24962         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
24963         *ret_copy = ChannelDetails_get_unspendable_punishment_reserve(&this_ptr_conv);
24964         uint64_t ret_ref = tag_ptr(ret_copy, true);
24965         return ret_ref;
24966 }
24967
24968 void  __attribute__((export_name("TS_ChannelDetails_set_unspendable_punishment_reserve"))) TS_ChannelDetails_set_unspendable_punishment_reserve(uint64_t this_ptr, uint64_t val) {
24969         LDKChannelDetails this_ptr_conv;
24970         this_ptr_conv.inner = untag_ptr(this_ptr);
24971         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24972         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24973         this_ptr_conv.is_owned = false;
24974         void* val_ptr = untag_ptr(val);
24975         CHECK_ACCESS(val_ptr);
24976         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
24977         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
24978         ChannelDetails_set_unspendable_punishment_reserve(&this_ptr_conv, val_conv);
24979 }
24980
24981 int64_t  __attribute__((export_name("TS_ChannelDetails_get_user_channel_id"))) TS_ChannelDetails_get_user_channel_id(uint64_t this_ptr) {
24982         LDKChannelDetails this_ptr_conv;
24983         this_ptr_conv.inner = untag_ptr(this_ptr);
24984         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24985         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24986         this_ptr_conv.is_owned = false;
24987         int64_t ret_conv = ChannelDetails_get_user_channel_id(&this_ptr_conv);
24988         return ret_conv;
24989 }
24990
24991 void  __attribute__((export_name("TS_ChannelDetails_set_user_channel_id"))) TS_ChannelDetails_set_user_channel_id(uint64_t this_ptr, int64_t val) {
24992         LDKChannelDetails this_ptr_conv;
24993         this_ptr_conv.inner = untag_ptr(this_ptr);
24994         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24995         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24996         this_ptr_conv.is_owned = false;
24997         ChannelDetails_set_user_channel_id(&this_ptr_conv, val);
24998 }
24999
25000 int64_t  __attribute__((export_name("TS_ChannelDetails_get_balance_msat"))) TS_ChannelDetails_get_balance_msat(uint64_t this_ptr) {
25001         LDKChannelDetails this_ptr_conv;
25002         this_ptr_conv.inner = untag_ptr(this_ptr);
25003         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25004         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25005         this_ptr_conv.is_owned = false;
25006         int64_t ret_conv = ChannelDetails_get_balance_msat(&this_ptr_conv);
25007         return ret_conv;
25008 }
25009
25010 void  __attribute__((export_name("TS_ChannelDetails_set_balance_msat"))) TS_ChannelDetails_set_balance_msat(uint64_t this_ptr, int64_t val) {
25011         LDKChannelDetails this_ptr_conv;
25012         this_ptr_conv.inner = untag_ptr(this_ptr);
25013         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25014         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25015         this_ptr_conv.is_owned = false;
25016         ChannelDetails_set_balance_msat(&this_ptr_conv, val);
25017 }
25018
25019 int64_t  __attribute__((export_name("TS_ChannelDetails_get_outbound_capacity_msat"))) TS_ChannelDetails_get_outbound_capacity_msat(uint64_t this_ptr) {
25020         LDKChannelDetails this_ptr_conv;
25021         this_ptr_conv.inner = untag_ptr(this_ptr);
25022         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25023         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25024         this_ptr_conv.is_owned = false;
25025         int64_t ret_conv = ChannelDetails_get_outbound_capacity_msat(&this_ptr_conv);
25026         return ret_conv;
25027 }
25028
25029 void  __attribute__((export_name("TS_ChannelDetails_set_outbound_capacity_msat"))) TS_ChannelDetails_set_outbound_capacity_msat(uint64_t this_ptr, int64_t val) {
25030         LDKChannelDetails this_ptr_conv;
25031         this_ptr_conv.inner = untag_ptr(this_ptr);
25032         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25033         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25034         this_ptr_conv.is_owned = false;
25035         ChannelDetails_set_outbound_capacity_msat(&this_ptr_conv, val);
25036 }
25037
25038 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) {
25039         LDKChannelDetails this_ptr_conv;
25040         this_ptr_conv.inner = untag_ptr(this_ptr);
25041         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25042         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25043         this_ptr_conv.is_owned = false;
25044         int64_t ret_conv = ChannelDetails_get_next_outbound_htlc_limit_msat(&this_ptr_conv);
25045         return ret_conv;
25046 }
25047
25048 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) {
25049         LDKChannelDetails this_ptr_conv;
25050         this_ptr_conv.inner = untag_ptr(this_ptr);
25051         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25052         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25053         this_ptr_conv.is_owned = false;
25054         ChannelDetails_set_next_outbound_htlc_limit_msat(&this_ptr_conv, val);
25055 }
25056
25057 int64_t  __attribute__((export_name("TS_ChannelDetails_get_inbound_capacity_msat"))) TS_ChannelDetails_get_inbound_capacity_msat(uint64_t this_ptr) {
25058         LDKChannelDetails this_ptr_conv;
25059         this_ptr_conv.inner = untag_ptr(this_ptr);
25060         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25061         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25062         this_ptr_conv.is_owned = false;
25063         int64_t ret_conv = ChannelDetails_get_inbound_capacity_msat(&this_ptr_conv);
25064         return ret_conv;
25065 }
25066
25067 void  __attribute__((export_name("TS_ChannelDetails_set_inbound_capacity_msat"))) TS_ChannelDetails_set_inbound_capacity_msat(uint64_t this_ptr, int64_t val) {
25068         LDKChannelDetails this_ptr_conv;
25069         this_ptr_conv.inner = untag_ptr(this_ptr);
25070         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25071         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25072         this_ptr_conv.is_owned = false;
25073         ChannelDetails_set_inbound_capacity_msat(&this_ptr_conv, val);
25074 }
25075
25076 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_confirmations_required"))) TS_ChannelDetails_get_confirmations_required(uint64_t this_ptr) {
25077         LDKChannelDetails this_ptr_conv;
25078         this_ptr_conv.inner = untag_ptr(this_ptr);
25079         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25080         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25081         this_ptr_conv.is_owned = false;
25082         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
25083         *ret_copy = ChannelDetails_get_confirmations_required(&this_ptr_conv);
25084         uint64_t ret_ref = tag_ptr(ret_copy, true);
25085         return ret_ref;
25086 }
25087
25088 void  __attribute__((export_name("TS_ChannelDetails_set_confirmations_required"))) TS_ChannelDetails_set_confirmations_required(uint64_t this_ptr, uint64_t val) {
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         void* val_ptr = untag_ptr(val);
25095         CHECK_ACCESS(val_ptr);
25096         LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
25097         val_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(val));
25098         ChannelDetails_set_confirmations_required(&this_ptr_conv, val_conv);
25099 }
25100
25101 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_force_close_spend_delay"))) TS_ChannelDetails_get_force_close_spend_delay(uint64_t this_ptr) {
25102         LDKChannelDetails this_ptr_conv;
25103         this_ptr_conv.inner = untag_ptr(this_ptr);
25104         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25105         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25106         this_ptr_conv.is_owned = false;
25107         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
25108         *ret_copy = ChannelDetails_get_force_close_spend_delay(&this_ptr_conv);
25109         uint64_t ret_ref = tag_ptr(ret_copy, true);
25110         return ret_ref;
25111 }
25112
25113 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) {
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         void* val_ptr = untag_ptr(val);
25120         CHECK_ACCESS(val_ptr);
25121         LDKCOption_u16Z val_conv = *(LDKCOption_u16Z*)(val_ptr);
25122         val_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(val));
25123         ChannelDetails_set_force_close_spend_delay(&this_ptr_conv, val_conv);
25124 }
25125
25126 jboolean  __attribute__((export_name("TS_ChannelDetails_get_is_outbound"))) TS_ChannelDetails_get_is_outbound(uint64_t this_ptr) {
25127         LDKChannelDetails this_ptr_conv;
25128         this_ptr_conv.inner = untag_ptr(this_ptr);
25129         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25130         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25131         this_ptr_conv.is_owned = false;
25132         jboolean ret_conv = ChannelDetails_get_is_outbound(&this_ptr_conv);
25133         return ret_conv;
25134 }
25135
25136 void  __attribute__((export_name("TS_ChannelDetails_set_is_outbound"))) TS_ChannelDetails_set_is_outbound(uint64_t this_ptr, jboolean val) {
25137         LDKChannelDetails this_ptr_conv;
25138         this_ptr_conv.inner = untag_ptr(this_ptr);
25139         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25140         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25141         this_ptr_conv.is_owned = false;
25142         ChannelDetails_set_is_outbound(&this_ptr_conv, val);
25143 }
25144
25145 jboolean  __attribute__((export_name("TS_ChannelDetails_get_is_channel_ready"))) TS_ChannelDetails_get_is_channel_ready(uint64_t this_ptr) {
25146         LDKChannelDetails this_ptr_conv;
25147         this_ptr_conv.inner = untag_ptr(this_ptr);
25148         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25149         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25150         this_ptr_conv.is_owned = false;
25151         jboolean ret_conv = ChannelDetails_get_is_channel_ready(&this_ptr_conv);
25152         return ret_conv;
25153 }
25154
25155 void  __attribute__((export_name("TS_ChannelDetails_set_is_channel_ready"))) TS_ChannelDetails_set_is_channel_ready(uint64_t this_ptr, jboolean val) {
25156         LDKChannelDetails this_ptr_conv;
25157         this_ptr_conv.inner = untag_ptr(this_ptr);
25158         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25159         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25160         this_ptr_conv.is_owned = false;
25161         ChannelDetails_set_is_channel_ready(&this_ptr_conv, val);
25162 }
25163
25164 jboolean  __attribute__((export_name("TS_ChannelDetails_get_is_usable"))) TS_ChannelDetails_get_is_usable(uint64_t this_ptr) {
25165         LDKChannelDetails this_ptr_conv;
25166         this_ptr_conv.inner = untag_ptr(this_ptr);
25167         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25168         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25169         this_ptr_conv.is_owned = false;
25170         jboolean ret_conv = ChannelDetails_get_is_usable(&this_ptr_conv);
25171         return ret_conv;
25172 }
25173
25174 void  __attribute__((export_name("TS_ChannelDetails_set_is_usable"))) TS_ChannelDetails_set_is_usable(uint64_t this_ptr, jboolean val) {
25175         LDKChannelDetails this_ptr_conv;
25176         this_ptr_conv.inner = untag_ptr(this_ptr);
25177         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25178         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25179         this_ptr_conv.is_owned = false;
25180         ChannelDetails_set_is_usable(&this_ptr_conv, val);
25181 }
25182
25183 jboolean  __attribute__((export_name("TS_ChannelDetails_get_is_public"))) TS_ChannelDetails_get_is_public(uint64_t this_ptr) {
25184         LDKChannelDetails this_ptr_conv;
25185         this_ptr_conv.inner = untag_ptr(this_ptr);
25186         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25187         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25188         this_ptr_conv.is_owned = false;
25189         jboolean ret_conv = ChannelDetails_get_is_public(&this_ptr_conv);
25190         return ret_conv;
25191 }
25192
25193 void  __attribute__((export_name("TS_ChannelDetails_set_is_public"))) TS_ChannelDetails_set_is_public(uint64_t this_ptr, jboolean val) {
25194         LDKChannelDetails this_ptr_conv;
25195         this_ptr_conv.inner = untag_ptr(this_ptr);
25196         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25197         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25198         this_ptr_conv.is_owned = false;
25199         ChannelDetails_set_is_public(&this_ptr_conv, val);
25200 }
25201
25202 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_inbound_htlc_minimum_msat"))) TS_ChannelDetails_get_inbound_htlc_minimum_msat(uint64_t this_ptr) {
25203         LDKChannelDetails this_ptr_conv;
25204         this_ptr_conv.inner = untag_ptr(this_ptr);
25205         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25206         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25207         this_ptr_conv.is_owned = false;
25208         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
25209         *ret_copy = ChannelDetails_get_inbound_htlc_minimum_msat(&this_ptr_conv);
25210         uint64_t ret_ref = tag_ptr(ret_copy, true);
25211         return ret_ref;
25212 }
25213
25214 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) {
25215         LDKChannelDetails this_ptr_conv;
25216         this_ptr_conv.inner = untag_ptr(this_ptr);
25217         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25218         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25219         this_ptr_conv.is_owned = false;
25220         void* val_ptr = untag_ptr(val);
25221         CHECK_ACCESS(val_ptr);
25222         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
25223         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
25224         ChannelDetails_set_inbound_htlc_minimum_msat(&this_ptr_conv, val_conv);
25225 }
25226
25227 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_inbound_htlc_maximum_msat"))) TS_ChannelDetails_get_inbound_htlc_maximum_msat(uint64_t this_ptr) {
25228         LDKChannelDetails this_ptr_conv;
25229         this_ptr_conv.inner = untag_ptr(this_ptr);
25230         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25231         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25232         this_ptr_conv.is_owned = false;
25233         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
25234         *ret_copy = ChannelDetails_get_inbound_htlc_maximum_msat(&this_ptr_conv);
25235         uint64_t ret_ref = tag_ptr(ret_copy, true);
25236         return ret_ref;
25237 }
25238
25239 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) {
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         void* val_ptr = untag_ptr(val);
25246         CHECK_ACCESS(val_ptr);
25247         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
25248         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
25249         ChannelDetails_set_inbound_htlc_maximum_msat(&this_ptr_conv, val_conv);
25250 }
25251
25252 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_config"))) TS_ChannelDetails_get_config(uint64_t this_ptr) {
25253         LDKChannelDetails this_ptr_conv;
25254         this_ptr_conv.inner = untag_ptr(this_ptr);
25255         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25256         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25257         this_ptr_conv.is_owned = false;
25258         LDKChannelConfig ret_var = ChannelDetails_get_config(&this_ptr_conv);
25259         uint64_t ret_ref = 0;
25260         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25261         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
25262         return ret_ref;
25263 }
25264
25265 void  __attribute__((export_name("TS_ChannelDetails_set_config"))) TS_ChannelDetails_set_config(uint64_t this_ptr, uint64_t val) {
25266         LDKChannelDetails this_ptr_conv;
25267         this_ptr_conv.inner = untag_ptr(this_ptr);
25268         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25269         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25270         this_ptr_conv.is_owned = false;
25271         LDKChannelConfig val_conv;
25272         val_conv.inner = untag_ptr(val);
25273         val_conv.is_owned = ptr_is_owned(val);
25274         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
25275         val_conv = ChannelConfig_clone(&val_conv);
25276         ChannelDetails_set_config(&this_ptr_conv, val_conv);
25277 }
25278
25279 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) {
25280         LDKThirtyTwoBytes channel_id_arg_ref;
25281         CHECK(channel_id_arg->arr_len == 32);
25282         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
25283         LDKChannelCounterparty counterparty_arg_conv;
25284         counterparty_arg_conv.inner = untag_ptr(counterparty_arg);
25285         counterparty_arg_conv.is_owned = ptr_is_owned(counterparty_arg);
25286         CHECK_INNER_FIELD_ACCESS_OR_NULL(counterparty_arg_conv);
25287         counterparty_arg_conv = ChannelCounterparty_clone(&counterparty_arg_conv);
25288         LDKOutPoint funding_txo_arg_conv;
25289         funding_txo_arg_conv.inner = untag_ptr(funding_txo_arg);
25290         funding_txo_arg_conv.is_owned = ptr_is_owned(funding_txo_arg);
25291         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_arg_conv);
25292         funding_txo_arg_conv = OutPoint_clone(&funding_txo_arg_conv);
25293         LDKChannelTypeFeatures channel_type_arg_conv;
25294         channel_type_arg_conv.inner = untag_ptr(channel_type_arg);
25295         channel_type_arg_conv.is_owned = ptr_is_owned(channel_type_arg);
25296         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_arg_conv);
25297         channel_type_arg_conv = ChannelTypeFeatures_clone(&channel_type_arg_conv);
25298         void* short_channel_id_arg_ptr = untag_ptr(short_channel_id_arg);
25299         CHECK_ACCESS(short_channel_id_arg_ptr);
25300         LDKCOption_u64Z short_channel_id_arg_conv = *(LDKCOption_u64Z*)(short_channel_id_arg_ptr);
25301         short_channel_id_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(short_channel_id_arg));
25302         void* outbound_scid_alias_arg_ptr = untag_ptr(outbound_scid_alias_arg);
25303         CHECK_ACCESS(outbound_scid_alias_arg_ptr);
25304         LDKCOption_u64Z outbound_scid_alias_arg_conv = *(LDKCOption_u64Z*)(outbound_scid_alias_arg_ptr);
25305         outbound_scid_alias_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(outbound_scid_alias_arg));
25306         void* inbound_scid_alias_arg_ptr = untag_ptr(inbound_scid_alias_arg);
25307         CHECK_ACCESS(inbound_scid_alias_arg_ptr);
25308         LDKCOption_u64Z inbound_scid_alias_arg_conv = *(LDKCOption_u64Z*)(inbound_scid_alias_arg_ptr);
25309         inbound_scid_alias_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(inbound_scid_alias_arg));
25310         void* unspendable_punishment_reserve_arg_ptr = untag_ptr(unspendable_punishment_reserve_arg);
25311         CHECK_ACCESS(unspendable_punishment_reserve_arg_ptr);
25312         LDKCOption_u64Z unspendable_punishment_reserve_arg_conv = *(LDKCOption_u64Z*)(unspendable_punishment_reserve_arg_ptr);
25313         void* confirmations_required_arg_ptr = untag_ptr(confirmations_required_arg);
25314         CHECK_ACCESS(confirmations_required_arg_ptr);
25315         LDKCOption_u32Z confirmations_required_arg_conv = *(LDKCOption_u32Z*)(confirmations_required_arg_ptr);
25316         confirmations_required_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(confirmations_required_arg));
25317         void* force_close_spend_delay_arg_ptr = untag_ptr(force_close_spend_delay_arg);
25318         CHECK_ACCESS(force_close_spend_delay_arg_ptr);
25319         LDKCOption_u16Z force_close_spend_delay_arg_conv = *(LDKCOption_u16Z*)(force_close_spend_delay_arg_ptr);
25320         force_close_spend_delay_arg_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(force_close_spend_delay_arg));
25321         void* inbound_htlc_minimum_msat_arg_ptr = untag_ptr(inbound_htlc_minimum_msat_arg);
25322         CHECK_ACCESS(inbound_htlc_minimum_msat_arg_ptr);
25323         LDKCOption_u64Z inbound_htlc_minimum_msat_arg_conv = *(LDKCOption_u64Z*)(inbound_htlc_minimum_msat_arg_ptr);
25324         inbound_htlc_minimum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(inbound_htlc_minimum_msat_arg));
25325         void* inbound_htlc_maximum_msat_arg_ptr = untag_ptr(inbound_htlc_maximum_msat_arg);
25326         CHECK_ACCESS(inbound_htlc_maximum_msat_arg_ptr);
25327         LDKCOption_u64Z inbound_htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(inbound_htlc_maximum_msat_arg_ptr);
25328         inbound_htlc_maximum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(inbound_htlc_maximum_msat_arg));
25329         LDKChannelConfig config_arg_conv;
25330         config_arg_conv.inner = untag_ptr(config_arg);
25331         config_arg_conv.is_owned = ptr_is_owned(config_arg);
25332         CHECK_INNER_FIELD_ACCESS_OR_NULL(config_arg_conv);
25333         config_arg_conv = ChannelConfig_clone(&config_arg_conv);
25334         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);
25335         uint64_t ret_ref = 0;
25336         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25337         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
25338         return ret_ref;
25339 }
25340
25341 static inline uint64_t ChannelDetails_clone_ptr(LDKChannelDetails *NONNULL_PTR arg) {
25342         LDKChannelDetails ret_var = ChannelDetails_clone(arg);
25343         uint64_t ret_ref = 0;
25344         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25345         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
25346         return ret_ref;
25347 }
25348 int64_t  __attribute__((export_name("TS_ChannelDetails_clone_ptr"))) TS_ChannelDetails_clone_ptr(uint64_t arg) {
25349         LDKChannelDetails arg_conv;
25350         arg_conv.inner = untag_ptr(arg);
25351         arg_conv.is_owned = ptr_is_owned(arg);
25352         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
25353         arg_conv.is_owned = false;
25354         int64_t ret_conv = ChannelDetails_clone_ptr(&arg_conv);
25355         return ret_conv;
25356 }
25357
25358 uint64_t  __attribute__((export_name("TS_ChannelDetails_clone"))) TS_ChannelDetails_clone(uint64_t orig) {
25359         LDKChannelDetails orig_conv;
25360         orig_conv.inner = untag_ptr(orig);
25361         orig_conv.is_owned = ptr_is_owned(orig);
25362         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
25363         orig_conv.is_owned = false;
25364         LDKChannelDetails ret_var = ChannelDetails_clone(&orig_conv);
25365         uint64_t ret_ref = 0;
25366         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25367         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
25368         return ret_ref;
25369 }
25370
25371 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_inbound_payment_scid"))) TS_ChannelDetails_get_inbound_payment_scid(uint64_t this_arg) {
25372         LDKChannelDetails this_arg_conv;
25373         this_arg_conv.inner = untag_ptr(this_arg);
25374         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25375         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25376         this_arg_conv.is_owned = false;
25377         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
25378         *ret_copy = ChannelDetails_get_inbound_payment_scid(&this_arg_conv);
25379         uint64_t ret_ref = tag_ptr(ret_copy, true);
25380         return ret_ref;
25381 }
25382
25383 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_outbound_payment_scid"))) TS_ChannelDetails_get_outbound_payment_scid(uint64_t this_arg) {
25384         LDKChannelDetails this_arg_conv;
25385         this_arg_conv.inner = untag_ptr(this_arg);
25386         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25387         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25388         this_arg_conv.is_owned = false;
25389         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
25390         *ret_copy = ChannelDetails_get_outbound_payment_scid(&this_arg_conv);
25391         uint64_t ret_ref = tag_ptr(ret_copy, true);
25392         return ret_ref;
25393 }
25394
25395 void  __attribute__((export_name("TS_PaymentSendFailure_free"))) TS_PaymentSendFailure_free(uint64_t this_ptr) {
25396         if (!ptr_is_owned(this_ptr)) return;
25397         void* this_ptr_ptr = untag_ptr(this_ptr);
25398         CHECK_ACCESS(this_ptr_ptr);
25399         LDKPaymentSendFailure this_ptr_conv = *(LDKPaymentSendFailure*)(this_ptr_ptr);
25400         FREE(untag_ptr(this_ptr));
25401         PaymentSendFailure_free(this_ptr_conv);
25402 }
25403
25404 static inline uint64_t PaymentSendFailure_clone_ptr(LDKPaymentSendFailure *NONNULL_PTR arg) {
25405         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
25406         *ret_copy = PaymentSendFailure_clone(arg);
25407         uint64_t ret_ref = tag_ptr(ret_copy, true);
25408         return ret_ref;
25409 }
25410 int64_t  __attribute__((export_name("TS_PaymentSendFailure_clone_ptr"))) TS_PaymentSendFailure_clone_ptr(uint64_t arg) {
25411         LDKPaymentSendFailure* arg_conv = (LDKPaymentSendFailure*)untag_ptr(arg);
25412         int64_t ret_conv = PaymentSendFailure_clone_ptr(arg_conv);
25413         return ret_conv;
25414 }
25415
25416 uint64_t  __attribute__((export_name("TS_PaymentSendFailure_clone"))) TS_PaymentSendFailure_clone(uint64_t orig) {
25417         LDKPaymentSendFailure* orig_conv = (LDKPaymentSendFailure*)untag_ptr(orig);
25418         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
25419         *ret_copy = PaymentSendFailure_clone(orig_conv);
25420         uint64_t ret_ref = tag_ptr(ret_copy, true);
25421         return ret_ref;
25422 }
25423
25424 uint64_t  __attribute__((export_name("TS_PaymentSendFailure_parameter_error"))) TS_PaymentSendFailure_parameter_error(uint64_t a) {
25425         void* a_ptr = untag_ptr(a);
25426         CHECK_ACCESS(a_ptr);
25427         LDKAPIError a_conv = *(LDKAPIError*)(a_ptr);
25428         a_conv = APIError_clone((LDKAPIError*)untag_ptr(a));
25429         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
25430         *ret_copy = PaymentSendFailure_parameter_error(a_conv);
25431         uint64_t ret_ref = tag_ptr(ret_copy, true);
25432         return ret_ref;
25433 }
25434
25435 uint64_t  __attribute__((export_name("TS_PaymentSendFailure_path_parameter_error"))) TS_PaymentSendFailure_path_parameter_error(uint64_tArray a) {
25436         LDKCVec_CResult_NoneAPIErrorZZ a_constr;
25437         a_constr.datalen = a->arr_len;
25438         if (a_constr.datalen > 0)
25439                 a_constr.data = MALLOC(a_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
25440         else
25441                 a_constr.data = NULL;
25442         uint64_t* a_vals = a->elems;
25443         for (size_t w = 0; w < a_constr.datalen; w++) {
25444                 uint64_t a_conv_22 = a_vals[w];
25445                 void* a_conv_22_ptr = untag_ptr(a_conv_22);
25446                 CHECK_ACCESS(a_conv_22_ptr);
25447                 LDKCResult_NoneAPIErrorZ a_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(a_conv_22_ptr);
25448                 a_conv_22_conv = CResult_NoneAPIErrorZ_clone((LDKCResult_NoneAPIErrorZ*)untag_ptr(a_conv_22));
25449                 a_constr.data[w] = a_conv_22_conv;
25450         }
25451         FREE(a);
25452         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
25453         *ret_copy = PaymentSendFailure_path_parameter_error(a_constr);
25454         uint64_t ret_ref = tag_ptr(ret_copy, true);
25455         return ret_ref;
25456 }
25457
25458 uint64_t  __attribute__((export_name("TS_PaymentSendFailure_all_failed_retry_safe"))) TS_PaymentSendFailure_all_failed_retry_safe(uint64_tArray a) {
25459         LDKCVec_APIErrorZ a_constr;
25460         a_constr.datalen = a->arr_len;
25461         if (a_constr.datalen > 0)
25462                 a_constr.data = MALLOC(a_constr.datalen * sizeof(LDKAPIError), "LDKCVec_APIErrorZ Elements");
25463         else
25464                 a_constr.data = NULL;
25465         uint64_t* a_vals = a->elems;
25466         for (size_t k = 0; k < a_constr.datalen; k++) {
25467                 uint64_t a_conv_10 = a_vals[k];
25468                 void* a_conv_10_ptr = untag_ptr(a_conv_10);
25469                 CHECK_ACCESS(a_conv_10_ptr);
25470                 LDKAPIError a_conv_10_conv = *(LDKAPIError*)(a_conv_10_ptr);
25471                 a_conv_10_conv = APIError_clone((LDKAPIError*)untag_ptr(a_conv_10));
25472                 a_constr.data[k] = a_conv_10_conv;
25473         }
25474         FREE(a);
25475         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
25476         *ret_copy = PaymentSendFailure_all_failed_retry_safe(a_constr);
25477         uint64_t ret_ref = tag_ptr(ret_copy, true);
25478         return ret_ref;
25479 }
25480
25481 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) {
25482         LDKCVec_CResult_NoneAPIErrorZZ results_constr;
25483         results_constr.datalen = results->arr_len;
25484         if (results_constr.datalen > 0)
25485                 results_constr.data = MALLOC(results_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
25486         else
25487                 results_constr.data = NULL;
25488         uint64_t* results_vals = results->elems;
25489         for (size_t w = 0; w < results_constr.datalen; w++) {
25490                 uint64_t results_conv_22 = results_vals[w];
25491                 void* results_conv_22_ptr = untag_ptr(results_conv_22);
25492                 CHECK_ACCESS(results_conv_22_ptr);
25493                 LDKCResult_NoneAPIErrorZ results_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(results_conv_22_ptr);
25494                 results_constr.data[w] = results_conv_22_conv;
25495         }
25496         FREE(results);
25497         LDKRouteParameters failed_paths_retry_conv;
25498         failed_paths_retry_conv.inner = untag_ptr(failed_paths_retry);
25499         failed_paths_retry_conv.is_owned = ptr_is_owned(failed_paths_retry);
25500         CHECK_INNER_FIELD_ACCESS_OR_NULL(failed_paths_retry_conv);
25501         failed_paths_retry_conv = RouteParameters_clone(&failed_paths_retry_conv);
25502         LDKThirtyTwoBytes payment_id_ref;
25503         CHECK(payment_id->arr_len == 32);
25504         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
25505         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
25506         *ret_copy = PaymentSendFailure_partial_failure(results_constr, failed_paths_retry_conv, payment_id_ref);
25507         uint64_t ret_ref = tag_ptr(ret_copy, true);
25508         return ret_ref;
25509 }
25510
25511 void  __attribute__((export_name("TS_PhantomRouteHints_free"))) TS_PhantomRouteHints_free(uint64_t this_obj) {
25512         LDKPhantomRouteHints this_obj_conv;
25513         this_obj_conv.inner = untag_ptr(this_obj);
25514         this_obj_conv.is_owned = ptr_is_owned(this_obj);
25515         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
25516         PhantomRouteHints_free(this_obj_conv);
25517 }
25518
25519 uint64_tArray  __attribute__((export_name("TS_PhantomRouteHints_get_channels"))) TS_PhantomRouteHints_get_channels(uint64_t this_ptr) {
25520         LDKPhantomRouteHints this_ptr_conv;
25521         this_ptr_conv.inner = untag_ptr(this_ptr);
25522         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25523         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25524         this_ptr_conv.is_owned = false;
25525         LDKCVec_ChannelDetailsZ ret_var = PhantomRouteHints_get_channels(&this_ptr_conv);
25526         uint64_tArray ret_arr = NULL;
25527         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
25528         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
25529         for (size_t q = 0; q < ret_var.datalen; q++) {
25530                 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
25531                 uint64_t ret_conv_16_ref = 0;
25532                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
25533                 ret_conv_16_ref = tag_ptr(ret_conv_16_var.inner, ret_conv_16_var.is_owned);
25534                 ret_arr_ptr[q] = ret_conv_16_ref;
25535         }
25536         
25537         FREE(ret_var.data);
25538         return ret_arr;
25539 }
25540
25541 void  __attribute__((export_name("TS_PhantomRouteHints_set_channels"))) TS_PhantomRouteHints_set_channels(uint64_t this_ptr, uint64_tArray val) {
25542         LDKPhantomRouteHints this_ptr_conv;
25543         this_ptr_conv.inner = untag_ptr(this_ptr);
25544         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25545         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25546         this_ptr_conv.is_owned = false;
25547         LDKCVec_ChannelDetailsZ val_constr;
25548         val_constr.datalen = val->arr_len;
25549         if (val_constr.datalen > 0)
25550                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
25551         else
25552                 val_constr.data = NULL;
25553         uint64_t* val_vals = val->elems;
25554         for (size_t q = 0; q < val_constr.datalen; q++) {
25555                 uint64_t val_conv_16 = val_vals[q];
25556                 LDKChannelDetails val_conv_16_conv;
25557                 val_conv_16_conv.inner = untag_ptr(val_conv_16);
25558                 val_conv_16_conv.is_owned = ptr_is_owned(val_conv_16);
25559                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_16_conv);
25560                 val_conv_16_conv = ChannelDetails_clone(&val_conv_16_conv);
25561                 val_constr.data[q] = val_conv_16_conv;
25562         }
25563         FREE(val);
25564         PhantomRouteHints_set_channels(&this_ptr_conv, val_constr);
25565 }
25566
25567 int64_t  __attribute__((export_name("TS_PhantomRouteHints_get_phantom_scid"))) TS_PhantomRouteHints_get_phantom_scid(uint64_t this_ptr) {
25568         LDKPhantomRouteHints this_ptr_conv;
25569         this_ptr_conv.inner = untag_ptr(this_ptr);
25570         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25571         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25572         this_ptr_conv.is_owned = false;
25573         int64_t ret_conv = PhantomRouteHints_get_phantom_scid(&this_ptr_conv);
25574         return ret_conv;
25575 }
25576
25577 void  __attribute__((export_name("TS_PhantomRouteHints_set_phantom_scid"))) TS_PhantomRouteHints_set_phantom_scid(uint64_t this_ptr, int64_t val) {
25578         LDKPhantomRouteHints this_ptr_conv;
25579         this_ptr_conv.inner = untag_ptr(this_ptr);
25580         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25581         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25582         this_ptr_conv.is_owned = false;
25583         PhantomRouteHints_set_phantom_scid(&this_ptr_conv, val);
25584 }
25585
25586 int8_tArray  __attribute__((export_name("TS_PhantomRouteHints_get_real_node_pubkey"))) TS_PhantomRouteHints_get_real_node_pubkey(uint64_t this_ptr) {
25587         LDKPhantomRouteHints this_ptr_conv;
25588         this_ptr_conv.inner = untag_ptr(this_ptr);
25589         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25590         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25591         this_ptr_conv.is_owned = false;
25592         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
25593         memcpy(ret_arr->elems, PhantomRouteHints_get_real_node_pubkey(&this_ptr_conv).compressed_form, 33);
25594         return ret_arr;
25595 }
25596
25597 void  __attribute__((export_name("TS_PhantomRouteHints_set_real_node_pubkey"))) TS_PhantomRouteHints_set_real_node_pubkey(uint64_t this_ptr, int8_tArray val) {
25598         LDKPhantomRouteHints this_ptr_conv;
25599         this_ptr_conv.inner = untag_ptr(this_ptr);
25600         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25601         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25602         this_ptr_conv.is_owned = false;
25603         LDKPublicKey val_ref;
25604         CHECK(val->arr_len == 33);
25605         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
25606         PhantomRouteHints_set_real_node_pubkey(&this_ptr_conv, val_ref);
25607 }
25608
25609 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) {
25610         LDKCVec_ChannelDetailsZ channels_arg_constr;
25611         channels_arg_constr.datalen = channels_arg->arr_len;
25612         if (channels_arg_constr.datalen > 0)
25613                 channels_arg_constr.data = MALLOC(channels_arg_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
25614         else
25615                 channels_arg_constr.data = NULL;
25616         uint64_t* channels_arg_vals = channels_arg->elems;
25617         for (size_t q = 0; q < channels_arg_constr.datalen; q++) {
25618                 uint64_t channels_arg_conv_16 = channels_arg_vals[q];
25619                 LDKChannelDetails channels_arg_conv_16_conv;
25620                 channels_arg_conv_16_conv.inner = untag_ptr(channels_arg_conv_16);
25621                 channels_arg_conv_16_conv.is_owned = ptr_is_owned(channels_arg_conv_16);
25622                 CHECK_INNER_FIELD_ACCESS_OR_NULL(channels_arg_conv_16_conv);
25623                 channels_arg_conv_16_conv = ChannelDetails_clone(&channels_arg_conv_16_conv);
25624                 channels_arg_constr.data[q] = channels_arg_conv_16_conv;
25625         }
25626         FREE(channels_arg);
25627         LDKPublicKey real_node_pubkey_arg_ref;
25628         CHECK(real_node_pubkey_arg->arr_len == 33);
25629         memcpy(real_node_pubkey_arg_ref.compressed_form, real_node_pubkey_arg->elems, 33); FREE(real_node_pubkey_arg);
25630         LDKPhantomRouteHints ret_var = PhantomRouteHints_new(channels_arg_constr, phantom_scid_arg, real_node_pubkey_arg_ref);
25631         uint64_t ret_ref = 0;
25632         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25633         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
25634         return ret_ref;
25635 }
25636
25637 static inline uint64_t PhantomRouteHints_clone_ptr(LDKPhantomRouteHints *NONNULL_PTR arg) {
25638         LDKPhantomRouteHints ret_var = PhantomRouteHints_clone(arg);
25639         uint64_t ret_ref = 0;
25640         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25641         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
25642         return ret_ref;
25643 }
25644 int64_t  __attribute__((export_name("TS_PhantomRouteHints_clone_ptr"))) TS_PhantomRouteHints_clone_ptr(uint64_t arg) {
25645         LDKPhantomRouteHints arg_conv;
25646         arg_conv.inner = untag_ptr(arg);
25647         arg_conv.is_owned = ptr_is_owned(arg);
25648         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
25649         arg_conv.is_owned = false;
25650         int64_t ret_conv = PhantomRouteHints_clone_ptr(&arg_conv);
25651         return ret_conv;
25652 }
25653
25654 uint64_t  __attribute__((export_name("TS_PhantomRouteHints_clone"))) TS_PhantomRouteHints_clone(uint64_t orig) {
25655         LDKPhantomRouteHints orig_conv;
25656         orig_conv.inner = untag_ptr(orig);
25657         orig_conv.is_owned = ptr_is_owned(orig);
25658         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
25659         orig_conv.is_owned = false;
25660         LDKPhantomRouteHints ret_var = PhantomRouteHints_clone(&orig_conv);
25661         uint64_t ret_ref = 0;
25662         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25663         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
25664         return ret_ref;
25665 }
25666
25667 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) {
25668         void* fee_est_ptr = untag_ptr(fee_est);
25669         CHECK_ACCESS(fee_est_ptr);
25670         LDKFeeEstimator fee_est_conv = *(LDKFeeEstimator*)(fee_est_ptr);
25671         if (fee_est_conv.free == LDKFeeEstimator_JCalls_free) {
25672                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25673                 LDKFeeEstimator_JCalls_cloned(&fee_est_conv);
25674         }
25675         void* chain_monitor_ptr = untag_ptr(chain_monitor);
25676         CHECK_ACCESS(chain_monitor_ptr);
25677         LDKWatch chain_monitor_conv = *(LDKWatch*)(chain_monitor_ptr);
25678         if (chain_monitor_conv.free == LDKWatch_JCalls_free) {
25679                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25680                 LDKWatch_JCalls_cloned(&chain_monitor_conv);
25681         }
25682         void* tx_broadcaster_ptr = untag_ptr(tx_broadcaster);
25683         CHECK_ACCESS(tx_broadcaster_ptr);
25684         LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)(tx_broadcaster_ptr);
25685         if (tx_broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
25686                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25687                 LDKBroadcasterInterface_JCalls_cloned(&tx_broadcaster_conv);
25688         }
25689         void* logger_ptr = untag_ptr(logger);
25690         CHECK_ACCESS(logger_ptr);
25691         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
25692         if (logger_conv.free == LDKLogger_JCalls_free) {
25693                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25694                 LDKLogger_JCalls_cloned(&logger_conv);
25695         }
25696         void* keys_manager_ptr = untag_ptr(keys_manager);
25697         CHECK_ACCESS(keys_manager_ptr);
25698         LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr);
25699         if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
25700                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25701                 LDKKeysInterface_JCalls_cloned(&keys_manager_conv);
25702         }
25703         LDKUserConfig config_conv;
25704         config_conv.inner = untag_ptr(config);
25705         config_conv.is_owned = ptr_is_owned(config);
25706         CHECK_INNER_FIELD_ACCESS_OR_NULL(config_conv);
25707         config_conv = UserConfig_clone(&config_conv);
25708         LDKChainParameters params_conv;
25709         params_conv.inner = untag_ptr(params);
25710         params_conv.is_owned = ptr_is_owned(params);
25711         CHECK_INNER_FIELD_ACCESS_OR_NULL(params_conv);
25712         params_conv = ChainParameters_clone(&params_conv);
25713         LDKChannelManager ret_var = ChannelManager_new(fee_est_conv, chain_monitor_conv, tx_broadcaster_conv, logger_conv, keys_manager_conv, config_conv, params_conv);
25714         uint64_t ret_ref = 0;
25715         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25716         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
25717         return ret_ref;
25718 }
25719
25720 uint64_t  __attribute__((export_name("TS_ChannelManager_get_current_default_configuration"))) TS_ChannelManager_get_current_default_configuration(uint64_t this_arg) {
25721         LDKChannelManager this_arg_conv;
25722         this_arg_conv.inner = untag_ptr(this_arg);
25723         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25724         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25725         this_arg_conv.is_owned = false;
25726         LDKUserConfig ret_var = ChannelManager_get_current_default_configuration(&this_arg_conv);
25727         uint64_t ret_ref = 0;
25728         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25729         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
25730         return ret_ref;
25731 }
25732
25733 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) {
25734         LDKChannelManager this_arg_conv;
25735         this_arg_conv.inner = untag_ptr(this_arg);
25736         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25737         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25738         this_arg_conv.is_owned = false;
25739         LDKPublicKey their_network_key_ref;
25740         CHECK(their_network_key->arr_len == 33);
25741         memcpy(their_network_key_ref.compressed_form, their_network_key->elems, 33); FREE(their_network_key);
25742         LDKUserConfig override_config_conv;
25743         override_config_conv.inner = untag_ptr(override_config);
25744         override_config_conv.is_owned = ptr_is_owned(override_config);
25745         CHECK_INNER_FIELD_ACCESS_OR_NULL(override_config_conv);
25746         override_config_conv = UserConfig_clone(&override_config_conv);
25747         LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
25748         *ret_conv = ChannelManager_create_channel(&this_arg_conv, their_network_key_ref, channel_value_satoshis, push_msat, user_channel_id, override_config_conv);
25749         return tag_ptr(ret_conv, true);
25750 }
25751
25752 uint64_tArray  __attribute__((export_name("TS_ChannelManager_list_channels"))) TS_ChannelManager_list_channels(uint64_t this_arg) {
25753         LDKChannelManager this_arg_conv;
25754         this_arg_conv.inner = untag_ptr(this_arg);
25755         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25756         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25757         this_arg_conv.is_owned = false;
25758         LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_channels(&this_arg_conv);
25759         uint64_tArray ret_arr = NULL;
25760         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
25761         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
25762         for (size_t q = 0; q < ret_var.datalen; q++) {
25763                 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
25764                 uint64_t ret_conv_16_ref = 0;
25765                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
25766                 ret_conv_16_ref = tag_ptr(ret_conv_16_var.inner, ret_conv_16_var.is_owned);
25767                 ret_arr_ptr[q] = ret_conv_16_ref;
25768         }
25769         
25770         FREE(ret_var.data);
25771         return ret_arr;
25772 }
25773
25774 uint64_tArray  __attribute__((export_name("TS_ChannelManager_list_usable_channels"))) TS_ChannelManager_list_usable_channels(uint64_t this_arg) {
25775         LDKChannelManager this_arg_conv;
25776         this_arg_conv.inner = untag_ptr(this_arg);
25777         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25778         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25779         this_arg_conv.is_owned = false;
25780         LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_usable_channels(&this_arg_conv);
25781         uint64_tArray ret_arr = NULL;
25782         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
25783         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
25784         for (size_t q = 0; q < ret_var.datalen; q++) {
25785                 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
25786                 uint64_t ret_conv_16_ref = 0;
25787                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
25788                 ret_conv_16_ref = tag_ptr(ret_conv_16_var.inner, ret_conv_16_var.is_owned);
25789                 ret_arr_ptr[q] = ret_conv_16_ref;
25790         }
25791         
25792         FREE(ret_var.data);
25793         return ret_arr;
25794 }
25795
25796 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) {
25797         LDKChannelManager this_arg_conv;
25798         this_arg_conv.inner = untag_ptr(this_arg);
25799         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25800         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25801         this_arg_conv.is_owned = false;
25802         unsigned char channel_id_arr[32];
25803         CHECK(channel_id->arr_len == 32);
25804         memcpy(channel_id_arr, channel_id->elems, 32); FREE(channel_id);
25805         unsigned char (*channel_id_ref)[32] = &channel_id_arr;
25806         LDKPublicKey counterparty_node_id_ref;
25807         CHECK(counterparty_node_id->arr_len == 33);
25808         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
25809         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
25810         *ret_conv = ChannelManager_close_channel(&this_arg_conv, channel_id_ref, counterparty_node_id_ref);
25811         return tag_ptr(ret_conv, true);
25812 }
25813
25814 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) {
25815         LDKChannelManager this_arg_conv;
25816         this_arg_conv.inner = untag_ptr(this_arg);
25817         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25818         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25819         this_arg_conv.is_owned = false;
25820         unsigned char channel_id_arr[32];
25821         CHECK(channel_id->arr_len == 32);
25822         memcpy(channel_id_arr, channel_id->elems, 32); FREE(channel_id);
25823         unsigned char (*channel_id_ref)[32] = &channel_id_arr;
25824         LDKPublicKey counterparty_node_id_ref;
25825         CHECK(counterparty_node_id->arr_len == 33);
25826         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
25827         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
25828         *ret_conv = ChannelManager_close_channel_with_target_feerate(&this_arg_conv, channel_id_ref, counterparty_node_id_ref, target_feerate_sats_per_1000_weight);
25829         return tag_ptr(ret_conv, true);
25830 }
25831
25832 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) {
25833         LDKChannelManager this_arg_conv;
25834         this_arg_conv.inner = untag_ptr(this_arg);
25835         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25836         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25837         this_arg_conv.is_owned = false;
25838         unsigned char channel_id_arr[32];
25839         CHECK(channel_id->arr_len == 32);
25840         memcpy(channel_id_arr, channel_id->elems, 32); FREE(channel_id);
25841         unsigned char (*channel_id_ref)[32] = &channel_id_arr;
25842         LDKPublicKey counterparty_node_id_ref;
25843         CHECK(counterparty_node_id->arr_len == 33);
25844         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
25845         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
25846         *ret_conv = ChannelManager_force_close_broadcasting_latest_txn(&this_arg_conv, channel_id_ref, counterparty_node_id_ref);
25847         return tag_ptr(ret_conv, true);
25848 }
25849
25850 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) {
25851         LDKChannelManager this_arg_conv;
25852         this_arg_conv.inner = untag_ptr(this_arg);
25853         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25854         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25855         this_arg_conv.is_owned = false;
25856         unsigned char channel_id_arr[32];
25857         CHECK(channel_id->arr_len == 32);
25858         memcpy(channel_id_arr, channel_id->elems, 32); FREE(channel_id);
25859         unsigned char (*channel_id_ref)[32] = &channel_id_arr;
25860         LDKPublicKey counterparty_node_id_ref;
25861         CHECK(counterparty_node_id->arr_len == 33);
25862         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
25863         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
25864         *ret_conv = ChannelManager_force_close_without_broadcasting_txn(&this_arg_conv, channel_id_ref, counterparty_node_id_ref);
25865         return tag_ptr(ret_conv, true);
25866 }
25867
25868 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) {
25869         LDKChannelManager this_arg_conv;
25870         this_arg_conv.inner = untag_ptr(this_arg);
25871         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25872         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25873         this_arg_conv.is_owned = false;
25874         ChannelManager_force_close_all_channels_broadcasting_latest_txn(&this_arg_conv);
25875 }
25876
25877 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) {
25878         LDKChannelManager this_arg_conv;
25879         this_arg_conv.inner = untag_ptr(this_arg);
25880         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25881         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25882         this_arg_conv.is_owned = false;
25883         ChannelManager_force_close_all_channels_without_broadcasting_txn(&this_arg_conv);
25884 }
25885
25886 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) {
25887         LDKChannelManager this_arg_conv;
25888         this_arg_conv.inner = untag_ptr(this_arg);
25889         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25890         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25891         this_arg_conv.is_owned = false;
25892         LDKRoute route_conv;
25893         route_conv.inner = untag_ptr(route);
25894         route_conv.is_owned = ptr_is_owned(route);
25895         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
25896         route_conv.is_owned = false;
25897         LDKThirtyTwoBytes payment_hash_ref;
25898         CHECK(payment_hash->arr_len == 32);
25899         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
25900         LDKThirtyTwoBytes payment_secret_ref;
25901         CHECK(payment_secret->arr_len == 32);
25902         memcpy(payment_secret_ref.data, payment_secret->elems, 32); FREE(payment_secret);
25903         LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
25904         *ret_conv = ChannelManager_send_payment(&this_arg_conv, &route_conv, payment_hash_ref, payment_secret_ref);
25905         return tag_ptr(ret_conv, true);
25906 }
25907
25908 uint64_t  __attribute__((export_name("TS_ChannelManager_retry_payment"))) TS_ChannelManager_retry_payment(uint64_t this_arg, uint64_t route, int8_tArray payment_id) {
25909         LDKChannelManager this_arg_conv;
25910         this_arg_conv.inner = untag_ptr(this_arg);
25911         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25912         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25913         this_arg_conv.is_owned = false;
25914         LDKRoute route_conv;
25915         route_conv.inner = untag_ptr(route);
25916         route_conv.is_owned = ptr_is_owned(route);
25917         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
25918         route_conv.is_owned = false;
25919         LDKThirtyTwoBytes payment_id_ref;
25920         CHECK(payment_id->arr_len == 32);
25921         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
25922         LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
25923         *ret_conv = ChannelManager_retry_payment(&this_arg_conv, &route_conv, payment_id_ref);
25924         return tag_ptr(ret_conv, true);
25925 }
25926
25927 void  __attribute__((export_name("TS_ChannelManager_abandon_payment"))) TS_ChannelManager_abandon_payment(uint64_t this_arg, int8_tArray payment_id) {
25928         LDKChannelManager this_arg_conv;
25929         this_arg_conv.inner = untag_ptr(this_arg);
25930         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25931         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25932         this_arg_conv.is_owned = false;
25933         LDKThirtyTwoBytes payment_id_ref;
25934         CHECK(payment_id->arr_len == 32);
25935         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
25936         ChannelManager_abandon_payment(&this_arg_conv, payment_id_ref);
25937 }
25938
25939 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) {
25940         LDKChannelManager this_arg_conv;
25941         this_arg_conv.inner = untag_ptr(this_arg);
25942         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25943         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25944         this_arg_conv.is_owned = false;
25945         LDKRoute route_conv;
25946         route_conv.inner = untag_ptr(route);
25947         route_conv.is_owned = ptr_is_owned(route);
25948         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
25949         route_conv.is_owned = false;
25950         LDKThirtyTwoBytes payment_preimage_ref;
25951         CHECK(payment_preimage->arr_len == 32);
25952         memcpy(payment_preimage_ref.data, payment_preimage->elems, 32); FREE(payment_preimage);
25953         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
25954         *ret_conv = ChannelManager_send_spontaneous_payment(&this_arg_conv, &route_conv, payment_preimage_ref);
25955         return tag_ptr(ret_conv, true);
25956 }
25957
25958 uint64_t  __attribute__((export_name("TS_ChannelManager_send_probe"))) TS_ChannelManager_send_probe(uint64_t this_arg, uint64_tArray hops) {
25959         LDKChannelManager this_arg_conv;
25960         this_arg_conv.inner = untag_ptr(this_arg);
25961         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25962         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25963         this_arg_conv.is_owned = false;
25964         LDKCVec_RouteHopZ hops_constr;
25965         hops_constr.datalen = hops->arr_len;
25966         if (hops_constr.datalen > 0)
25967                 hops_constr.data = MALLOC(hops_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
25968         else
25969                 hops_constr.data = NULL;
25970         uint64_t* hops_vals = hops->elems;
25971         for (size_t k = 0; k < hops_constr.datalen; k++) {
25972                 uint64_t hops_conv_10 = hops_vals[k];
25973                 LDKRouteHop hops_conv_10_conv;
25974                 hops_conv_10_conv.inner = untag_ptr(hops_conv_10);
25975                 hops_conv_10_conv.is_owned = ptr_is_owned(hops_conv_10);
25976                 CHECK_INNER_FIELD_ACCESS_OR_NULL(hops_conv_10_conv);
25977                 hops_conv_10_conv = RouteHop_clone(&hops_conv_10_conv);
25978                 hops_constr.data[k] = hops_conv_10_conv;
25979         }
25980         FREE(hops);
25981         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
25982         *ret_conv = ChannelManager_send_probe(&this_arg_conv, hops_constr);
25983         return tag_ptr(ret_conv, true);
25984 }
25985
25986 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) {
25987         LDKChannelManager this_arg_conv;
25988         this_arg_conv.inner = untag_ptr(this_arg);
25989         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25990         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25991         this_arg_conv.is_owned = false;
25992         unsigned char temporary_channel_id_arr[32];
25993         CHECK(temporary_channel_id->arr_len == 32);
25994         memcpy(temporary_channel_id_arr, temporary_channel_id->elems, 32); FREE(temporary_channel_id);
25995         unsigned char (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr;
25996         LDKPublicKey counterparty_node_id_ref;
25997         CHECK(counterparty_node_id->arr_len == 33);
25998         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
25999         LDKTransaction funding_transaction_ref;
26000         funding_transaction_ref.datalen = funding_transaction->arr_len;
26001         funding_transaction_ref.data = MALLOC(funding_transaction_ref.datalen, "LDKTransaction Bytes");
26002         memcpy(funding_transaction_ref.data, funding_transaction->elems, funding_transaction_ref.datalen); FREE(funding_transaction);
26003         funding_transaction_ref.data_is_owned = true;
26004         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
26005         *ret_conv = ChannelManager_funding_transaction_generated(&this_arg_conv, temporary_channel_id_ref, counterparty_node_id_ref, funding_transaction_ref);
26006         return tag_ptr(ret_conv, true);
26007 }
26008
26009 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) {
26010         LDKChannelManager this_arg_conv;
26011         this_arg_conv.inner = untag_ptr(this_arg);
26012         this_arg_conv.is_owned = ptr_is_owned(this_arg);
26013         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26014         this_arg_conv.is_owned = false;
26015         LDKThreeBytes rgb_ref;
26016         CHECK(rgb->arr_len == 3);
26017         memcpy(rgb_ref.data, rgb->elems, 3); FREE(rgb);
26018         LDKThirtyTwoBytes alias_ref;
26019         CHECK(alias->arr_len == 32);
26020         memcpy(alias_ref.data, alias->elems, 32); FREE(alias);
26021         LDKCVec_NetAddressZ addresses_constr;
26022         addresses_constr.datalen = addresses->arr_len;
26023         if (addresses_constr.datalen > 0)
26024                 addresses_constr.data = MALLOC(addresses_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
26025         else
26026                 addresses_constr.data = NULL;
26027         uint64_t* addresses_vals = addresses->elems;
26028         for (size_t m = 0; m < addresses_constr.datalen; m++) {
26029                 uint64_t addresses_conv_12 = addresses_vals[m];
26030                 void* addresses_conv_12_ptr = untag_ptr(addresses_conv_12);
26031                 CHECK_ACCESS(addresses_conv_12_ptr);
26032                 LDKNetAddress addresses_conv_12_conv = *(LDKNetAddress*)(addresses_conv_12_ptr);
26033                 addresses_constr.data[m] = addresses_conv_12_conv;
26034         }
26035         FREE(addresses);
26036         ChannelManager_broadcast_node_announcement(&this_arg_conv, rgb_ref, alias_ref, addresses_constr);
26037 }
26038
26039 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) {
26040         LDKChannelManager this_arg_conv;
26041         this_arg_conv.inner = untag_ptr(this_arg);
26042         this_arg_conv.is_owned = ptr_is_owned(this_arg);
26043         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26044         this_arg_conv.is_owned = false;
26045         LDKPublicKey counterparty_node_id_ref;
26046         CHECK(counterparty_node_id->arr_len == 33);
26047         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
26048         LDKCVec_ThirtyTwoBytesZ channel_ids_constr;
26049         channel_ids_constr.datalen = channel_ids->arr_len;
26050         if (channel_ids_constr.datalen > 0)
26051                 channel_ids_constr.data = MALLOC(channel_ids_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_ThirtyTwoBytesZ Elements");
26052         else
26053                 channel_ids_constr.data = NULL;
26054         int8_tArray* channel_ids_vals = (void*) channel_ids->elems;
26055         for (size_t m = 0; m < channel_ids_constr.datalen; m++) {
26056                 int8_tArray channel_ids_conv_12 = channel_ids_vals[m];
26057                 LDKThirtyTwoBytes channel_ids_conv_12_ref;
26058                 CHECK(channel_ids_conv_12->arr_len == 32);
26059                 memcpy(channel_ids_conv_12_ref.data, channel_ids_conv_12->elems, 32); FREE(channel_ids_conv_12);
26060                 channel_ids_constr.data[m] = channel_ids_conv_12_ref;
26061         }
26062         FREE(channel_ids);
26063         LDKChannelConfig config_conv;
26064         config_conv.inner = untag_ptr(config);
26065         config_conv.is_owned = ptr_is_owned(config);
26066         CHECK_INNER_FIELD_ACCESS_OR_NULL(config_conv);
26067         config_conv.is_owned = false;
26068         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
26069         *ret_conv = ChannelManager_update_channel_config(&this_arg_conv, counterparty_node_id_ref, channel_ids_constr, &config_conv);
26070         return tag_ptr(ret_conv, true);
26071 }
26072
26073 void  __attribute__((export_name("TS_ChannelManager_process_pending_htlc_forwards"))) TS_ChannelManager_process_pending_htlc_forwards(uint64_t this_arg) {
26074         LDKChannelManager this_arg_conv;
26075         this_arg_conv.inner = untag_ptr(this_arg);
26076         this_arg_conv.is_owned = ptr_is_owned(this_arg);
26077         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26078         this_arg_conv.is_owned = false;
26079         ChannelManager_process_pending_htlc_forwards(&this_arg_conv);
26080 }
26081
26082 void  __attribute__((export_name("TS_ChannelManager_timer_tick_occurred"))) TS_ChannelManager_timer_tick_occurred(uint64_t this_arg) {
26083         LDKChannelManager this_arg_conv;
26084         this_arg_conv.inner = untag_ptr(this_arg);
26085         this_arg_conv.is_owned = ptr_is_owned(this_arg);
26086         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26087         this_arg_conv.is_owned = false;
26088         ChannelManager_timer_tick_occurred(&this_arg_conv);
26089 }
26090
26091 void  __attribute__((export_name("TS_ChannelManager_fail_htlc_backwards"))) TS_ChannelManager_fail_htlc_backwards(uint64_t this_arg, int8_tArray payment_hash) {
26092         LDKChannelManager this_arg_conv;
26093         this_arg_conv.inner = untag_ptr(this_arg);
26094         this_arg_conv.is_owned = ptr_is_owned(this_arg);
26095         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26096         this_arg_conv.is_owned = false;
26097         unsigned char payment_hash_arr[32];
26098         CHECK(payment_hash->arr_len == 32);
26099         memcpy(payment_hash_arr, payment_hash->elems, 32); FREE(payment_hash);
26100         unsigned char (*payment_hash_ref)[32] = &payment_hash_arr;
26101         ChannelManager_fail_htlc_backwards(&this_arg_conv, payment_hash_ref);
26102 }
26103
26104 void  __attribute__((export_name("TS_ChannelManager_claim_funds"))) TS_ChannelManager_claim_funds(uint64_t this_arg, int8_tArray payment_preimage) {
26105         LDKChannelManager this_arg_conv;
26106         this_arg_conv.inner = untag_ptr(this_arg);
26107         this_arg_conv.is_owned = ptr_is_owned(this_arg);
26108         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26109         this_arg_conv.is_owned = false;
26110         LDKThirtyTwoBytes payment_preimage_ref;
26111         CHECK(payment_preimage->arr_len == 32);
26112         memcpy(payment_preimage_ref.data, payment_preimage->elems, 32); FREE(payment_preimage);
26113         ChannelManager_claim_funds(&this_arg_conv, payment_preimage_ref);
26114 }
26115
26116 int8_tArray  __attribute__((export_name("TS_ChannelManager_get_our_node_id"))) TS_ChannelManager_get_our_node_id(uint64_t this_arg) {
26117         LDKChannelManager this_arg_conv;
26118         this_arg_conv.inner = untag_ptr(this_arg);
26119         this_arg_conv.is_owned = ptr_is_owned(this_arg);
26120         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26121         this_arg_conv.is_owned = false;
26122         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
26123         memcpy(ret_arr->elems, ChannelManager_get_our_node_id(&this_arg_conv).compressed_form, 33);
26124         return ret_arr;
26125 }
26126
26127 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) {
26128         LDKChannelManager this_arg_conv;
26129         this_arg_conv.inner = untag_ptr(this_arg);
26130         this_arg_conv.is_owned = ptr_is_owned(this_arg);
26131         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26132         this_arg_conv.is_owned = false;
26133         unsigned char temporary_channel_id_arr[32];
26134         CHECK(temporary_channel_id->arr_len == 32);
26135         memcpy(temporary_channel_id_arr, temporary_channel_id->elems, 32); FREE(temporary_channel_id);
26136         unsigned char (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr;
26137         LDKPublicKey counterparty_node_id_ref;
26138         CHECK(counterparty_node_id->arr_len == 33);
26139         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
26140         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
26141         *ret_conv = ChannelManager_accept_inbound_channel(&this_arg_conv, temporary_channel_id_ref, counterparty_node_id_ref, user_channel_id);
26142         return tag_ptr(ret_conv, true);
26143 }
26144
26145 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) {
26146         LDKChannelManager this_arg_conv;
26147         this_arg_conv.inner = untag_ptr(this_arg);
26148         this_arg_conv.is_owned = ptr_is_owned(this_arg);
26149         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26150         this_arg_conv.is_owned = false;
26151         unsigned char temporary_channel_id_arr[32];
26152         CHECK(temporary_channel_id->arr_len == 32);
26153         memcpy(temporary_channel_id_arr, temporary_channel_id->elems, 32); FREE(temporary_channel_id);
26154         unsigned char (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr;
26155         LDKPublicKey counterparty_node_id_ref;
26156         CHECK(counterparty_node_id->arr_len == 33);
26157         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
26158         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
26159         *ret_conv = ChannelManager_accept_inbound_channel_from_trusted_peer_0conf(&this_arg_conv, temporary_channel_id_ref, counterparty_node_id_ref, user_channel_id);
26160         return tag_ptr(ret_conv, true);
26161 }
26162
26163 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) {
26164         LDKChannelManager this_arg_conv;
26165         this_arg_conv.inner = untag_ptr(this_arg);
26166         this_arg_conv.is_owned = ptr_is_owned(this_arg);
26167         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26168         this_arg_conv.is_owned = false;
26169         void* min_value_msat_ptr = untag_ptr(min_value_msat);
26170         CHECK_ACCESS(min_value_msat_ptr);
26171         LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
26172         min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(min_value_msat));
26173         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
26174         *ret_conv = ChannelManager_create_inbound_payment(&this_arg_conv, min_value_msat_conv, invoice_expiry_delta_secs);
26175         return tag_ptr(ret_conv, true);
26176 }
26177
26178 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) {
26179         LDKChannelManager this_arg_conv;
26180         this_arg_conv.inner = untag_ptr(this_arg);
26181         this_arg_conv.is_owned = ptr_is_owned(this_arg);
26182         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26183         this_arg_conv.is_owned = false;
26184         void* min_value_msat_ptr = untag_ptr(min_value_msat);
26185         CHECK_ACCESS(min_value_msat_ptr);
26186         LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
26187         min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(min_value_msat));
26188         LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ");
26189         *ret_conv = ChannelManager_create_inbound_payment_legacy(&this_arg_conv, min_value_msat_conv, invoice_expiry_delta_secs);
26190         return tag_ptr(ret_conv, true);
26191 }
26192
26193 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) {
26194         LDKChannelManager this_arg_conv;
26195         this_arg_conv.inner = untag_ptr(this_arg);
26196         this_arg_conv.is_owned = ptr_is_owned(this_arg);
26197         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26198         this_arg_conv.is_owned = false;
26199         LDKThirtyTwoBytes payment_hash_ref;
26200         CHECK(payment_hash->arr_len == 32);
26201         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
26202         void* min_value_msat_ptr = untag_ptr(min_value_msat);
26203         CHECK_ACCESS(min_value_msat_ptr);
26204         LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
26205         min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(min_value_msat));
26206         LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
26207         *ret_conv = ChannelManager_create_inbound_payment_for_hash(&this_arg_conv, payment_hash_ref, min_value_msat_conv, invoice_expiry_delta_secs);
26208         return tag_ptr(ret_conv, true);
26209 }
26210
26211 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) {
26212         LDKChannelManager this_arg_conv;
26213         this_arg_conv.inner = untag_ptr(this_arg);
26214         this_arg_conv.is_owned = ptr_is_owned(this_arg);
26215         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26216         this_arg_conv.is_owned = false;
26217         LDKThirtyTwoBytes payment_hash_ref;
26218         CHECK(payment_hash->arr_len == 32);
26219         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
26220         void* min_value_msat_ptr = untag_ptr(min_value_msat);
26221         CHECK_ACCESS(min_value_msat_ptr);
26222         LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
26223         min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(min_value_msat));
26224         LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
26225         *ret_conv = ChannelManager_create_inbound_payment_for_hash_legacy(&this_arg_conv, payment_hash_ref, min_value_msat_conv, invoice_expiry_delta_secs);
26226         return tag_ptr(ret_conv, true);
26227 }
26228
26229 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) {
26230         LDKChannelManager this_arg_conv;
26231         this_arg_conv.inner = untag_ptr(this_arg);
26232         this_arg_conv.is_owned = ptr_is_owned(this_arg);
26233         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26234         this_arg_conv.is_owned = false;
26235         LDKThirtyTwoBytes payment_hash_ref;
26236         CHECK(payment_hash->arr_len == 32);
26237         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
26238         LDKThirtyTwoBytes payment_secret_ref;
26239         CHECK(payment_secret->arr_len == 32);
26240         memcpy(payment_secret_ref.data, payment_secret->elems, 32); FREE(payment_secret);
26241         LDKCResult_PaymentPreimageAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPreimageAPIErrorZ), "LDKCResult_PaymentPreimageAPIErrorZ");
26242         *ret_conv = ChannelManager_get_payment_preimage(&this_arg_conv, payment_hash_ref, payment_secret_ref);
26243         return tag_ptr(ret_conv, true);
26244 }
26245
26246 int64_t  __attribute__((export_name("TS_ChannelManager_get_phantom_scid"))) TS_ChannelManager_get_phantom_scid(uint64_t this_arg) {
26247         LDKChannelManager this_arg_conv;
26248         this_arg_conv.inner = untag_ptr(this_arg);
26249         this_arg_conv.is_owned = ptr_is_owned(this_arg);
26250         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26251         this_arg_conv.is_owned = false;
26252         int64_t ret_conv = ChannelManager_get_phantom_scid(&this_arg_conv);
26253         return ret_conv;
26254 }
26255
26256 uint64_t  __attribute__((export_name("TS_ChannelManager_get_phantom_route_hints"))) TS_ChannelManager_get_phantom_route_hints(uint64_t this_arg) {
26257         LDKChannelManager this_arg_conv;
26258         this_arg_conv.inner = untag_ptr(this_arg);
26259         this_arg_conv.is_owned = ptr_is_owned(this_arg);
26260         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26261         this_arg_conv.is_owned = false;
26262         LDKPhantomRouteHints ret_var = ChannelManager_get_phantom_route_hints(&this_arg_conv);
26263         uint64_t ret_ref = 0;
26264         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26265         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
26266         return ret_ref;
26267 }
26268
26269 uint64_t  __attribute__((export_name("TS_ChannelManager_as_MessageSendEventsProvider"))) TS_ChannelManager_as_MessageSendEventsProvider(uint64_t this_arg) {
26270         LDKChannelManager this_arg_conv;
26271         this_arg_conv.inner = untag_ptr(this_arg);
26272         this_arg_conv.is_owned = ptr_is_owned(this_arg);
26273         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26274         this_arg_conv.is_owned = false;
26275         LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
26276         *ret_ret = ChannelManager_as_MessageSendEventsProvider(&this_arg_conv);
26277         return tag_ptr(ret_ret, true);
26278 }
26279
26280 uint64_t  __attribute__((export_name("TS_ChannelManager_as_EventsProvider"))) TS_ChannelManager_as_EventsProvider(uint64_t this_arg) {
26281         LDKChannelManager this_arg_conv;
26282         this_arg_conv.inner = untag_ptr(this_arg);
26283         this_arg_conv.is_owned = ptr_is_owned(this_arg);
26284         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26285         this_arg_conv.is_owned = false;
26286         LDKEventsProvider* ret_ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
26287         *ret_ret = ChannelManager_as_EventsProvider(&this_arg_conv);
26288         return tag_ptr(ret_ret, true);
26289 }
26290
26291 uint64_t  __attribute__((export_name("TS_ChannelManager_as_Listen"))) TS_ChannelManager_as_Listen(uint64_t this_arg) {
26292         LDKChannelManager this_arg_conv;
26293         this_arg_conv.inner = untag_ptr(this_arg);
26294         this_arg_conv.is_owned = ptr_is_owned(this_arg);
26295         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26296         this_arg_conv.is_owned = false;
26297         LDKListen* ret_ret = MALLOC(sizeof(LDKListen), "LDKListen");
26298         *ret_ret = ChannelManager_as_Listen(&this_arg_conv);
26299         return tag_ptr(ret_ret, true);
26300 }
26301
26302 uint64_t  __attribute__((export_name("TS_ChannelManager_as_Confirm"))) TS_ChannelManager_as_Confirm(uint64_t this_arg) {
26303         LDKChannelManager this_arg_conv;
26304         this_arg_conv.inner = untag_ptr(this_arg);
26305         this_arg_conv.is_owned = ptr_is_owned(this_arg);
26306         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26307         this_arg_conv.is_owned = false;
26308         LDKConfirm* ret_ret = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
26309         *ret_ret = ChannelManager_as_Confirm(&this_arg_conv);
26310         return tag_ptr(ret_ret, true);
26311 }
26312
26313 void  __attribute__((export_name("TS_ChannelManager_await_persistable_update"))) TS_ChannelManager_await_persistable_update(uint64_t this_arg) {
26314         LDKChannelManager this_arg_conv;
26315         this_arg_conv.inner = untag_ptr(this_arg);
26316         this_arg_conv.is_owned = ptr_is_owned(this_arg);
26317         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26318         this_arg_conv.is_owned = false;
26319         ChannelManager_await_persistable_update(&this_arg_conv);
26320 }
26321
26322 uint64_t  __attribute__((export_name("TS_ChannelManager_current_best_block"))) TS_ChannelManager_current_best_block(uint64_t this_arg) {
26323         LDKChannelManager this_arg_conv;
26324         this_arg_conv.inner = untag_ptr(this_arg);
26325         this_arg_conv.is_owned = ptr_is_owned(this_arg);
26326         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26327         this_arg_conv.is_owned = false;
26328         LDKBestBlock ret_var = ChannelManager_current_best_block(&this_arg_conv);
26329         uint64_t ret_ref = 0;
26330         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26331         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
26332         return ret_ref;
26333 }
26334
26335 uint64_t  __attribute__((export_name("TS_ChannelManager_as_ChannelMessageHandler"))) TS_ChannelManager_as_ChannelMessageHandler(uint64_t this_arg) {
26336         LDKChannelManager this_arg_conv;
26337         this_arg_conv.inner = untag_ptr(this_arg);
26338         this_arg_conv.is_owned = ptr_is_owned(this_arg);
26339         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26340         this_arg_conv.is_owned = false;
26341         LDKChannelMessageHandler* ret_ret = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
26342         *ret_ret = ChannelManager_as_ChannelMessageHandler(&this_arg_conv);
26343         return tag_ptr(ret_ret, true);
26344 }
26345
26346 int8_tArray  __attribute__((export_name("TS_CounterpartyForwardingInfo_write"))) TS_CounterpartyForwardingInfo_write(uint64_t obj) {
26347         LDKCounterpartyForwardingInfo obj_conv;
26348         obj_conv.inner = untag_ptr(obj);
26349         obj_conv.is_owned = ptr_is_owned(obj);
26350         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
26351         obj_conv.is_owned = false;
26352         LDKCVec_u8Z ret_var = CounterpartyForwardingInfo_write(&obj_conv);
26353         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
26354         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
26355         CVec_u8Z_free(ret_var);
26356         return ret_arr;
26357 }
26358
26359 uint64_t  __attribute__((export_name("TS_CounterpartyForwardingInfo_read"))) TS_CounterpartyForwardingInfo_read(int8_tArray ser) {
26360         LDKu8slice ser_ref;
26361         ser_ref.datalen = ser->arr_len;
26362         ser_ref.data = ser->elems;
26363         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
26364         *ret_conv = CounterpartyForwardingInfo_read(ser_ref);
26365         FREE(ser);
26366         return tag_ptr(ret_conv, true);
26367 }
26368
26369 int8_tArray  __attribute__((export_name("TS_ChannelCounterparty_write"))) TS_ChannelCounterparty_write(uint64_t obj) {
26370         LDKChannelCounterparty obj_conv;
26371         obj_conv.inner = untag_ptr(obj);
26372         obj_conv.is_owned = ptr_is_owned(obj);
26373         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
26374         obj_conv.is_owned = false;
26375         LDKCVec_u8Z ret_var = ChannelCounterparty_write(&obj_conv);
26376         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
26377         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
26378         CVec_u8Z_free(ret_var);
26379         return ret_arr;
26380 }
26381
26382 uint64_t  __attribute__((export_name("TS_ChannelCounterparty_read"))) TS_ChannelCounterparty_read(int8_tArray ser) {
26383         LDKu8slice ser_ref;
26384         ser_ref.datalen = ser->arr_len;
26385         ser_ref.data = ser->elems;
26386         LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
26387         *ret_conv = ChannelCounterparty_read(ser_ref);
26388         FREE(ser);
26389         return tag_ptr(ret_conv, true);
26390 }
26391
26392 int8_tArray  __attribute__((export_name("TS_ChannelDetails_write"))) TS_ChannelDetails_write(uint64_t obj) {
26393         LDKChannelDetails obj_conv;
26394         obj_conv.inner = untag_ptr(obj);
26395         obj_conv.is_owned = ptr_is_owned(obj);
26396         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
26397         obj_conv.is_owned = false;
26398         LDKCVec_u8Z ret_var = ChannelDetails_write(&obj_conv);
26399         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
26400         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
26401         CVec_u8Z_free(ret_var);
26402         return ret_arr;
26403 }
26404
26405 uint64_t  __attribute__((export_name("TS_ChannelDetails_read"))) TS_ChannelDetails_read(int8_tArray ser) {
26406         LDKu8slice ser_ref;
26407         ser_ref.datalen = ser->arr_len;
26408         ser_ref.data = ser->elems;
26409         LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
26410         *ret_conv = ChannelDetails_read(ser_ref);
26411         FREE(ser);
26412         return tag_ptr(ret_conv, true);
26413 }
26414
26415 int8_tArray  __attribute__((export_name("TS_PhantomRouteHints_write"))) TS_PhantomRouteHints_write(uint64_t obj) {
26416         LDKPhantomRouteHints obj_conv;
26417         obj_conv.inner = untag_ptr(obj);
26418         obj_conv.is_owned = ptr_is_owned(obj);
26419         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
26420         obj_conv.is_owned = false;
26421         LDKCVec_u8Z ret_var = PhantomRouteHints_write(&obj_conv);
26422         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
26423         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
26424         CVec_u8Z_free(ret_var);
26425         return ret_arr;
26426 }
26427
26428 uint64_t  __attribute__((export_name("TS_PhantomRouteHints_read"))) TS_PhantomRouteHints_read(int8_tArray ser) {
26429         LDKu8slice ser_ref;
26430         ser_ref.datalen = ser->arr_len;
26431         ser_ref.data = ser->elems;
26432         LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
26433         *ret_conv = PhantomRouteHints_read(ser_ref);
26434         FREE(ser);
26435         return tag_ptr(ret_conv, true);
26436 }
26437
26438 int8_tArray  __attribute__((export_name("TS_ChannelManager_write"))) TS_ChannelManager_write(uint64_t obj) {
26439         LDKChannelManager obj_conv;
26440         obj_conv.inner = untag_ptr(obj);
26441         obj_conv.is_owned = ptr_is_owned(obj);
26442         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
26443         obj_conv.is_owned = false;
26444         LDKCVec_u8Z ret_var = ChannelManager_write(&obj_conv);
26445         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
26446         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
26447         CVec_u8Z_free(ret_var);
26448         return ret_arr;
26449 }
26450
26451 void  __attribute__((export_name("TS_ChannelManagerReadArgs_free"))) TS_ChannelManagerReadArgs_free(uint64_t this_obj) {
26452         LDKChannelManagerReadArgs this_obj_conv;
26453         this_obj_conv.inner = untag_ptr(this_obj);
26454         this_obj_conv.is_owned = ptr_is_owned(this_obj);
26455         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
26456         ChannelManagerReadArgs_free(this_obj_conv);
26457 }
26458
26459 uint64_t  __attribute__((export_name("TS_ChannelManagerReadArgs_get_keys_manager"))) TS_ChannelManagerReadArgs_get_keys_manager(uint64_t this_ptr) {
26460         LDKChannelManagerReadArgs this_ptr_conv;
26461         this_ptr_conv.inner = untag_ptr(this_ptr);
26462         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26463         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26464         this_ptr_conv.is_owned = false;
26465         // WARNING: This object doesn't live past this scope, needs clone!
26466         uint64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_keys_manager(&this_ptr_conv), false);
26467         return ret_ret;
26468 }
26469
26470 void  __attribute__((export_name("TS_ChannelManagerReadArgs_set_keys_manager"))) TS_ChannelManagerReadArgs_set_keys_manager(uint64_t this_ptr, uint64_t val) {
26471         LDKChannelManagerReadArgs this_ptr_conv;
26472         this_ptr_conv.inner = untag_ptr(this_ptr);
26473         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26474         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26475         this_ptr_conv.is_owned = false;
26476         void* val_ptr = untag_ptr(val);
26477         CHECK_ACCESS(val_ptr);
26478         LDKKeysInterface val_conv = *(LDKKeysInterface*)(val_ptr);
26479         if (val_conv.free == LDKKeysInterface_JCalls_free) {
26480                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
26481                 LDKKeysInterface_JCalls_cloned(&val_conv);
26482         }
26483         ChannelManagerReadArgs_set_keys_manager(&this_ptr_conv, val_conv);
26484 }
26485
26486 uint64_t  __attribute__((export_name("TS_ChannelManagerReadArgs_get_fee_estimator"))) TS_ChannelManagerReadArgs_get_fee_estimator(uint64_t this_ptr) {
26487         LDKChannelManagerReadArgs this_ptr_conv;
26488         this_ptr_conv.inner = untag_ptr(this_ptr);
26489         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26490         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26491         this_ptr_conv.is_owned = false;
26492         // WARNING: This object doesn't live past this scope, needs clone!
26493         uint64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_fee_estimator(&this_ptr_conv), false);
26494         return ret_ret;
26495 }
26496
26497 void  __attribute__((export_name("TS_ChannelManagerReadArgs_set_fee_estimator"))) TS_ChannelManagerReadArgs_set_fee_estimator(uint64_t this_ptr, uint64_t val) {
26498         LDKChannelManagerReadArgs this_ptr_conv;
26499         this_ptr_conv.inner = untag_ptr(this_ptr);
26500         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26501         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26502         this_ptr_conv.is_owned = false;
26503         void* val_ptr = untag_ptr(val);
26504         CHECK_ACCESS(val_ptr);
26505         LDKFeeEstimator val_conv = *(LDKFeeEstimator*)(val_ptr);
26506         if (val_conv.free == LDKFeeEstimator_JCalls_free) {
26507                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
26508                 LDKFeeEstimator_JCalls_cloned(&val_conv);
26509         }
26510         ChannelManagerReadArgs_set_fee_estimator(&this_ptr_conv, val_conv);
26511 }
26512
26513 uint64_t  __attribute__((export_name("TS_ChannelManagerReadArgs_get_chain_monitor"))) TS_ChannelManagerReadArgs_get_chain_monitor(uint64_t this_ptr) {
26514         LDKChannelManagerReadArgs this_ptr_conv;
26515         this_ptr_conv.inner = untag_ptr(this_ptr);
26516         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26517         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26518         this_ptr_conv.is_owned = false;
26519         // WARNING: This object doesn't live past this scope, needs clone!
26520         uint64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_chain_monitor(&this_ptr_conv), false);
26521         return ret_ret;
26522 }
26523
26524 void  __attribute__((export_name("TS_ChannelManagerReadArgs_set_chain_monitor"))) TS_ChannelManagerReadArgs_set_chain_monitor(uint64_t this_ptr, uint64_t val) {
26525         LDKChannelManagerReadArgs this_ptr_conv;
26526         this_ptr_conv.inner = untag_ptr(this_ptr);
26527         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26528         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26529         this_ptr_conv.is_owned = false;
26530         void* val_ptr = untag_ptr(val);
26531         CHECK_ACCESS(val_ptr);
26532         LDKWatch val_conv = *(LDKWatch*)(val_ptr);
26533         if (val_conv.free == LDKWatch_JCalls_free) {
26534                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
26535                 LDKWatch_JCalls_cloned(&val_conv);
26536         }
26537         ChannelManagerReadArgs_set_chain_monitor(&this_ptr_conv, val_conv);
26538 }
26539
26540 uint64_t  __attribute__((export_name("TS_ChannelManagerReadArgs_get_tx_broadcaster"))) TS_ChannelManagerReadArgs_get_tx_broadcaster(uint64_t this_ptr) {
26541         LDKChannelManagerReadArgs this_ptr_conv;
26542         this_ptr_conv.inner = untag_ptr(this_ptr);
26543         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26544         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26545         this_ptr_conv.is_owned = false;
26546         // WARNING: This object doesn't live past this scope, needs clone!
26547         uint64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_tx_broadcaster(&this_ptr_conv), false);
26548         return ret_ret;
26549 }
26550
26551 void  __attribute__((export_name("TS_ChannelManagerReadArgs_set_tx_broadcaster"))) TS_ChannelManagerReadArgs_set_tx_broadcaster(uint64_t this_ptr, uint64_t val) {
26552         LDKChannelManagerReadArgs this_ptr_conv;
26553         this_ptr_conv.inner = untag_ptr(this_ptr);
26554         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26555         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26556         this_ptr_conv.is_owned = false;
26557         void* val_ptr = untag_ptr(val);
26558         CHECK_ACCESS(val_ptr);
26559         LDKBroadcasterInterface val_conv = *(LDKBroadcasterInterface*)(val_ptr);
26560         if (val_conv.free == LDKBroadcasterInterface_JCalls_free) {
26561                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
26562                 LDKBroadcasterInterface_JCalls_cloned(&val_conv);
26563         }
26564         ChannelManagerReadArgs_set_tx_broadcaster(&this_ptr_conv, val_conv);
26565 }
26566
26567 uint64_t  __attribute__((export_name("TS_ChannelManagerReadArgs_get_logger"))) TS_ChannelManagerReadArgs_get_logger(uint64_t this_ptr) {
26568         LDKChannelManagerReadArgs this_ptr_conv;
26569         this_ptr_conv.inner = untag_ptr(this_ptr);
26570         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26571         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26572         this_ptr_conv.is_owned = false;
26573         // WARNING: This object doesn't live past this scope, needs clone!
26574         uint64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_logger(&this_ptr_conv), false);
26575         return ret_ret;
26576 }
26577
26578 void  __attribute__((export_name("TS_ChannelManagerReadArgs_set_logger"))) TS_ChannelManagerReadArgs_set_logger(uint64_t this_ptr, uint64_t val) {
26579         LDKChannelManagerReadArgs this_ptr_conv;
26580         this_ptr_conv.inner = untag_ptr(this_ptr);
26581         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26582         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26583         this_ptr_conv.is_owned = false;
26584         void* val_ptr = untag_ptr(val);
26585         CHECK_ACCESS(val_ptr);
26586         LDKLogger val_conv = *(LDKLogger*)(val_ptr);
26587         if (val_conv.free == LDKLogger_JCalls_free) {
26588                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
26589                 LDKLogger_JCalls_cloned(&val_conv);
26590         }
26591         ChannelManagerReadArgs_set_logger(&this_ptr_conv, val_conv);
26592 }
26593
26594 uint64_t  __attribute__((export_name("TS_ChannelManagerReadArgs_get_default_config"))) TS_ChannelManagerReadArgs_get_default_config(uint64_t this_ptr) {
26595         LDKChannelManagerReadArgs this_ptr_conv;
26596         this_ptr_conv.inner = untag_ptr(this_ptr);
26597         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26598         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26599         this_ptr_conv.is_owned = false;
26600         LDKUserConfig ret_var = ChannelManagerReadArgs_get_default_config(&this_ptr_conv);
26601         uint64_t ret_ref = 0;
26602         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26603         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
26604         return ret_ref;
26605 }
26606
26607 void  __attribute__((export_name("TS_ChannelManagerReadArgs_set_default_config"))) TS_ChannelManagerReadArgs_set_default_config(uint64_t this_ptr, uint64_t val) {
26608         LDKChannelManagerReadArgs this_ptr_conv;
26609         this_ptr_conv.inner = untag_ptr(this_ptr);
26610         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26611         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26612         this_ptr_conv.is_owned = false;
26613         LDKUserConfig val_conv;
26614         val_conv.inner = untag_ptr(val);
26615         val_conv.is_owned = ptr_is_owned(val);
26616         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
26617         val_conv = UserConfig_clone(&val_conv);
26618         ChannelManagerReadArgs_set_default_config(&this_ptr_conv, val_conv);
26619 }
26620
26621 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) {
26622         void* keys_manager_ptr = untag_ptr(keys_manager);
26623         CHECK_ACCESS(keys_manager_ptr);
26624         LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr);
26625         if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
26626                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
26627                 LDKKeysInterface_JCalls_cloned(&keys_manager_conv);
26628         }
26629         void* fee_estimator_ptr = untag_ptr(fee_estimator);
26630         CHECK_ACCESS(fee_estimator_ptr);
26631         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
26632         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
26633                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
26634                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
26635         }
26636         void* chain_monitor_ptr = untag_ptr(chain_monitor);
26637         CHECK_ACCESS(chain_monitor_ptr);
26638         LDKWatch chain_monitor_conv = *(LDKWatch*)(chain_monitor_ptr);
26639         if (chain_monitor_conv.free == LDKWatch_JCalls_free) {
26640                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
26641                 LDKWatch_JCalls_cloned(&chain_monitor_conv);
26642         }
26643         void* tx_broadcaster_ptr = untag_ptr(tx_broadcaster);
26644         CHECK_ACCESS(tx_broadcaster_ptr);
26645         LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)(tx_broadcaster_ptr);
26646         if (tx_broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
26647                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
26648                 LDKBroadcasterInterface_JCalls_cloned(&tx_broadcaster_conv);
26649         }
26650         void* logger_ptr = untag_ptr(logger);
26651         CHECK_ACCESS(logger_ptr);
26652         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
26653         if (logger_conv.free == LDKLogger_JCalls_free) {
26654                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
26655                 LDKLogger_JCalls_cloned(&logger_conv);
26656         }
26657         LDKUserConfig default_config_conv;
26658         default_config_conv.inner = untag_ptr(default_config);
26659         default_config_conv.is_owned = ptr_is_owned(default_config);
26660         CHECK_INNER_FIELD_ACCESS_OR_NULL(default_config_conv);
26661         default_config_conv = UserConfig_clone(&default_config_conv);
26662         LDKCVec_ChannelMonitorZ channel_monitors_constr;
26663         channel_monitors_constr.datalen = channel_monitors->arr_len;
26664         if (channel_monitors_constr.datalen > 0)
26665                 channel_monitors_constr.data = MALLOC(channel_monitors_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
26666         else
26667                 channel_monitors_constr.data = NULL;
26668         uint64_t* channel_monitors_vals = channel_monitors->elems;
26669         for (size_t q = 0; q < channel_monitors_constr.datalen; q++) {
26670                 uint64_t channel_monitors_conv_16 = channel_monitors_vals[q];
26671                 LDKChannelMonitor channel_monitors_conv_16_conv;
26672                 channel_monitors_conv_16_conv.inner = untag_ptr(channel_monitors_conv_16);
26673                 channel_monitors_conv_16_conv.is_owned = ptr_is_owned(channel_monitors_conv_16);
26674                 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_monitors_conv_16_conv);
26675                 channel_monitors_conv_16_conv.is_owned = false;
26676                 channel_monitors_constr.data[q] = channel_monitors_conv_16_conv;
26677         }
26678         FREE(channel_monitors);
26679         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);
26680         uint64_t ret_ref = 0;
26681         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26682         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
26683         return ret_ref;
26684 }
26685
26686 uint64_t  __attribute__((export_name("TS_C2Tuple_BlockHashChannelManagerZ_read"))) TS_C2Tuple_BlockHashChannelManagerZ_read(int8_tArray ser, uint64_t arg) {
26687         LDKu8slice ser_ref;
26688         ser_ref.datalen = ser->arr_len;
26689         ser_ref.data = ser->elems;
26690         LDKChannelManagerReadArgs arg_conv;
26691         arg_conv.inner = untag_ptr(arg);
26692         arg_conv.is_owned = ptr_is_owned(arg);
26693         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
26694         // WARNING: we need a move here but no clone is available for LDKChannelManagerReadArgs
26695         
26696         LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
26697         *ret_conv = C2Tuple_BlockHashChannelManagerZ_read(ser_ref, arg_conv);
26698         FREE(ser);
26699         return tag_ptr(ret_conv, true);
26700 }
26701
26702 void  __attribute__((export_name("TS_ExpandedKey_free"))) TS_ExpandedKey_free(uint64_t this_obj) {
26703         LDKExpandedKey this_obj_conv;
26704         this_obj_conv.inner = untag_ptr(this_obj);
26705         this_obj_conv.is_owned = ptr_is_owned(this_obj);
26706         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
26707         ExpandedKey_free(this_obj_conv);
26708 }
26709
26710 uint64_t  __attribute__((export_name("TS_ExpandedKey_new"))) TS_ExpandedKey_new(int8_tArray key_material) {
26711         unsigned char key_material_arr[32];
26712         CHECK(key_material->arr_len == 32);
26713         memcpy(key_material_arr, key_material->elems, 32); FREE(key_material);
26714         unsigned char (*key_material_ref)[32] = &key_material_arr;
26715         LDKExpandedKey ret_var = ExpandedKey_new(key_material_ref);
26716         uint64_t ret_ref = 0;
26717         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26718         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
26719         return ret_ref;
26720 }
26721
26722 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) {
26723         LDKExpandedKey keys_conv;
26724         keys_conv.inner = untag_ptr(keys);
26725         keys_conv.is_owned = ptr_is_owned(keys);
26726         CHECK_INNER_FIELD_ACCESS_OR_NULL(keys_conv);
26727         keys_conv.is_owned = false;
26728         void* min_value_msat_ptr = untag_ptr(min_value_msat);
26729         CHECK_ACCESS(min_value_msat_ptr);
26730         LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
26731         min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(min_value_msat));
26732         void* keys_manager_ptr = untag_ptr(keys_manager);
26733         if (ptr_is_owned(keys_manager)) { CHECK_ACCESS(keys_manager_ptr); }
26734         LDKKeysInterface* keys_manager_conv = (LDKKeysInterface*)keys_manager_ptr;
26735         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
26736         *ret_conv = create(&keys_conv, min_value_msat_conv, invoice_expiry_delta_secs, keys_manager_conv, current_time);
26737         return tag_ptr(ret_conv, true);
26738 }
26739
26740 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) {
26741         LDKExpandedKey keys_conv;
26742         keys_conv.inner = untag_ptr(keys);
26743         keys_conv.is_owned = ptr_is_owned(keys);
26744         CHECK_INNER_FIELD_ACCESS_OR_NULL(keys_conv);
26745         keys_conv.is_owned = false;
26746         void* min_value_msat_ptr = untag_ptr(min_value_msat);
26747         CHECK_ACCESS(min_value_msat_ptr);
26748         LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
26749         min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(min_value_msat));
26750         LDKThirtyTwoBytes payment_hash_ref;
26751         CHECK(payment_hash->arr_len == 32);
26752         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
26753         LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
26754         *ret_conv = create_from_hash(&keys_conv, min_value_msat_conv, payment_hash_ref, invoice_expiry_delta_secs, current_time);
26755         return tag_ptr(ret_conv, true);
26756 }
26757
26758 void  __attribute__((export_name("TS_DecodeError_free"))) TS_DecodeError_free(uint64_t this_obj) {
26759         LDKDecodeError this_obj_conv;
26760         this_obj_conv.inner = untag_ptr(this_obj);
26761         this_obj_conv.is_owned = ptr_is_owned(this_obj);
26762         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
26763         DecodeError_free(this_obj_conv);
26764 }
26765
26766 static inline uint64_t DecodeError_clone_ptr(LDKDecodeError *NONNULL_PTR arg) {
26767         LDKDecodeError ret_var = DecodeError_clone(arg);
26768         uint64_t ret_ref = 0;
26769         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26770         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
26771         return ret_ref;
26772 }
26773 int64_t  __attribute__((export_name("TS_DecodeError_clone_ptr"))) TS_DecodeError_clone_ptr(uint64_t arg) {
26774         LDKDecodeError arg_conv;
26775         arg_conv.inner = untag_ptr(arg);
26776         arg_conv.is_owned = ptr_is_owned(arg);
26777         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
26778         arg_conv.is_owned = false;
26779         int64_t ret_conv = DecodeError_clone_ptr(&arg_conv);
26780         return ret_conv;
26781 }
26782
26783 uint64_t  __attribute__((export_name("TS_DecodeError_clone"))) TS_DecodeError_clone(uint64_t orig) {
26784         LDKDecodeError orig_conv;
26785         orig_conv.inner = untag_ptr(orig);
26786         orig_conv.is_owned = ptr_is_owned(orig);
26787         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
26788         orig_conv.is_owned = false;
26789         LDKDecodeError ret_var = DecodeError_clone(&orig_conv);
26790         uint64_t ret_ref = 0;
26791         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26792         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
26793         return ret_ref;
26794 }
26795
26796 void  __attribute__((export_name("TS_Init_free"))) TS_Init_free(uint64_t this_obj) {
26797         LDKInit this_obj_conv;
26798         this_obj_conv.inner = untag_ptr(this_obj);
26799         this_obj_conv.is_owned = ptr_is_owned(this_obj);
26800         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
26801         Init_free(this_obj_conv);
26802 }
26803
26804 uint64_t  __attribute__((export_name("TS_Init_get_features"))) TS_Init_get_features(uint64_t this_ptr) {
26805         LDKInit this_ptr_conv;
26806         this_ptr_conv.inner = untag_ptr(this_ptr);
26807         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26808         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26809         this_ptr_conv.is_owned = false;
26810         LDKInitFeatures ret_var = Init_get_features(&this_ptr_conv);
26811         uint64_t ret_ref = 0;
26812         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26813         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
26814         return ret_ref;
26815 }
26816
26817 void  __attribute__((export_name("TS_Init_set_features"))) TS_Init_set_features(uint64_t this_ptr, uint64_t val) {
26818         LDKInit this_ptr_conv;
26819         this_ptr_conv.inner = untag_ptr(this_ptr);
26820         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26821         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26822         this_ptr_conv.is_owned = false;
26823         LDKInitFeatures val_conv;
26824         val_conv.inner = untag_ptr(val);
26825         val_conv.is_owned = ptr_is_owned(val);
26826         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
26827         val_conv = InitFeatures_clone(&val_conv);
26828         Init_set_features(&this_ptr_conv, val_conv);
26829 }
26830
26831 uint64_t  __attribute__((export_name("TS_Init_get_remote_network_address"))) TS_Init_get_remote_network_address(uint64_t this_ptr) {
26832         LDKInit this_ptr_conv;
26833         this_ptr_conv.inner = untag_ptr(this_ptr);
26834         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26835         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26836         this_ptr_conv.is_owned = false;
26837         LDKCOption_NetAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_NetAddressZ), "LDKCOption_NetAddressZ");
26838         *ret_copy = Init_get_remote_network_address(&this_ptr_conv);
26839         uint64_t ret_ref = tag_ptr(ret_copy, true);
26840         return ret_ref;
26841 }
26842
26843 void  __attribute__((export_name("TS_Init_set_remote_network_address"))) TS_Init_set_remote_network_address(uint64_t this_ptr, uint64_t val) {
26844         LDKInit this_ptr_conv;
26845         this_ptr_conv.inner = untag_ptr(this_ptr);
26846         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26847         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26848         this_ptr_conv.is_owned = false;
26849         void* val_ptr = untag_ptr(val);
26850         CHECK_ACCESS(val_ptr);
26851         LDKCOption_NetAddressZ val_conv = *(LDKCOption_NetAddressZ*)(val_ptr);
26852         val_conv = COption_NetAddressZ_clone((LDKCOption_NetAddressZ*)untag_ptr(val));
26853         Init_set_remote_network_address(&this_ptr_conv, val_conv);
26854 }
26855
26856 uint64_t  __attribute__((export_name("TS_Init_new"))) TS_Init_new(uint64_t features_arg, uint64_t remote_network_address_arg) {
26857         LDKInitFeatures features_arg_conv;
26858         features_arg_conv.inner = untag_ptr(features_arg);
26859         features_arg_conv.is_owned = ptr_is_owned(features_arg);
26860         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
26861         features_arg_conv = InitFeatures_clone(&features_arg_conv);
26862         void* remote_network_address_arg_ptr = untag_ptr(remote_network_address_arg);
26863         CHECK_ACCESS(remote_network_address_arg_ptr);
26864         LDKCOption_NetAddressZ remote_network_address_arg_conv = *(LDKCOption_NetAddressZ*)(remote_network_address_arg_ptr);
26865         LDKInit ret_var = Init_new(features_arg_conv, remote_network_address_arg_conv);
26866         uint64_t ret_ref = 0;
26867         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26868         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
26869         return ret_ref;
26870 }
26871
26872 static inline uint64_t Init_clone_ptr(LDKInit *NONNULL_PTR arg) {
26873         LDKInit ret_var = Init_clone(arg);
26874         uint64_t ret_ref = 0;
26875         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26876         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
26877         return ret_ref;
26878 }
26879 int64_t  __attribute__((export_name("TS_Init_clone_ptr"))) TS_Init_clone_ptr(uint64_t arg) {
26880         LDKInit arg_conv;
26881         arg_conv.inner = untag_ptr(arg);
26882         arg_conv.is_owned = ptr_is_owned(arg);
26883         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
26884         arg_conv.is_owned = false;
26885         int64_t ret_conv = Init_clone_ptr(&arg_conv);
26886         return ret_conv;
26887 }
26888
26889 uint64_t  __attribute__((export_name("TS_Init_clone"))) TS_Init_clone(uint64_t orig) {
26890         LDKInit orig_conv;
26891         orig_conv.inner = untag_ptr(orig);
26892         orig_conv.is_owned = ptr_is_owned(orig);
26893         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
26894         orig_conv.is_owned = false;
26895         LDKInit ret_var = Init_clone(&orig_conv);
26896         uint64_t ret_ref = 0;
26897         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26898         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
26899         return ret_ref;
26900 }
26901
26902 void  __attribute__((export_name("TS_ErrorMessage_free"))) TS_ErrorMessage_free(uint64_t this_obj) {
26903         LDKErrorMessage this_obj_conv;
26904         this_obj_conv.inner = untag_ptr(this_obj);
26905         this_obj_conv.is_owned = ptr_is_owned(this_obj);
26906         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
26907         ErrorMessage_free(this_obj_conv);
26908 }
26909
26910 int8_tArray  __attribute__((export_name("TS_ErrorMessage_get_channel_id"))) TS_ErrorMessage_get_channel_id(uint64_t this_ptr) {
26911         LDKErrorMessage this_ptr_conv;
26912         this_ptr_conv.inner = untag_ptr(this_ptr);
26913         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26914         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26915         this_ptr_conv.is_owned = false;
26916         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
26917         memcpy(ret_arr->elems, *ErrorMessage_get_channel_id(&this_ptr_conv), 32);
26918         return ret_arr;
26919 }
26920
26921 void  __attribute__((export_name("TS_ErrorMessage_set_channel_id"))) TS_ErrorMessage_set_channel_id(uint64_t this_ptr, int8_tArray val) {
26922         LDKErrorMessage this_ptr_conv;
26923         this_ptr_conv.inner = untag_ptr(this_ptr);
26924         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26925         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26926         this_ptr_conv.is_owned = false;
26927         LDKThirtyTwoBytes val_ref;
26928         CHECK(val->arr_len == 32);
26929         memcpy(val_ref.data, val->elems, 32); FREE(val);
26930         ErrorMessage_set_channel_id(&this_ptr_conv, val_ref);
26931 }
26932
26933 jstring  __attribute__((export_name("TS_ErrorMessage_get_data"))) TS_ErrorMessage_get_data(uint64_t this_ptr) {
26934         LDKErrorMessage this_ptr_conv;
26935         this_ptr_conv.inner = untag_ptr(this_ptr);
26936         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26937         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26938         this_ptr_conv.is_owned = false;
26939         LDKStr ret_str = ErrorMessage_get_data(&this_ptr_conv);
26940         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
26941         Str_free(ret_str);
26942         return ret_conv;
26943 }
26944
26945 void  __attribute__((export_name("TS_ErrorMessage_set_data"))) TS_ErrorMessage_set_data(uint64_t this_ptr, jstring val) {
26946         LDKErrorMessage this_ptr_conv;
26947         this_ptr_conv.inner = untag_ptr(this_ptr);
26948         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26949         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26950         this_ptr_conv.is_owned = false;
26951         LDKStr val_conv = str_ref_to_owned_c(val);
26952         ErrorMessage_set_data(&this_ptr_conv, val_conv);
26953 }
26954
26955 uint64_t  __attribute__((export_name("TS_ErrorMessage_new"))) TS_ErrorMessage_new(int8_tArray channel_id_arg, jstring data_arg) {
26956         LDKThirtyTwoBytes channel_id_arg_ref;
26957         CHECK(channel_id_arg->arr_len == 32);
26958         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
26959         LDKStr data_arg_conv = str_ref_to_owned_c(data_arg);
26960         LDKErrorMessage ret_var = ErrorMessage_new(channel_id_arg_ref, data_arg_conv);
26961         uint64_t ret_ref = 0;
26962         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26963         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
26964         return ret_ref;
26965 }
26966
26967 static inline uint64_t ErrorMessage_clone_ptr(LDKErrorMessage *NONNULL_PTR arg) {
26968         LDKErrorMessage ret_var = ErrorMessage_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_ErrorMessage_clone_ptr"))) TS_ErrorMessage_clone_ptr(uint64_t arg) {
26975         LDKErrorMessage 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 = ErrorMessage_clone_ptr(&arg_conv);
26981         return ret_conv;
26982 }
26983
26984 uint64_t  __attribute__((export_name("TS_ErrorMessage_clone"))) TS_ErrorMessage_clone(uint64_t orig) {
26985         LDKErrorMessage 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         LDKErrorMessage ret_var = ErrorMessage_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_WarningMessage_free"))) TS_WarningMessage_free(uint64_t this_obj) {
26998         LDKWarningMessage 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         WarningMessage_free(this_obj_conv);
27003 }
27004
27005 int8_tArray  __attribute__((export_name("TS_WarningMessage_get_channel_id"))) TS_WarningMessage_get_channel_id(uint64_t this_ptr) {
27006         LDKWarningMessage 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         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
27012         memcpy(ret_arr->elems, *WarningMessage_get_channel_id(&this_ptr_conv), 32);
27013         return ret_arr;
27014 }
27015
27016 void  __attribute__((export_name("TS_WarningMessage_set_channel_id"))) TS_WarningMessage_set_channel_id(uint64_t this_ptr, int8_tArray val) {
27017         LDKWarningMessage this_ptr_conv;
27018         this_ptr_conv.inner = untag_ptr(this_ptr);
27019         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27020         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27021         this_ptr_conv.is_owned = false;
27022         LDKThirtyTwoBytes val_ref;
27023         CHECK(val->arr_len == 32);
27024         memcpy(val_ref.data, val->elems, 32); FREE(val);
27025         WarningMessage_set_channel_id(&this_ptr_conv, val_ref);
27026 }
27027
27028 jstring  __attribute__((export_name("TS_WarningMessage_get_data"))) TS_WarningMessage_get_data(uint64_t this_ptr) {
27029         LDKWarningMessage this_ptr_conv;
27030         this_ptr_conv.inner = untag_ptr(this_ptr);
27031         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27032         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27033         this_ptr_conv.is_owned = false;
27034         LDKStr ret_str = WarningMessage_get_data(&this_ptr_conv);
27035         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
27036         Str_free(ret_str);
27037         return ret_conv;
27038 }
27039
27040 void  __attribute__((export_name("TS_WarningMessage_set_data"))) TS_WarningMessage_set_data(uint64_t this_ptr, jstring val) {
27041         LDKWarningMessage this_ptr_conv;
27042         this_ptr_conv.inner = untag_ptr(this_ptr);
27043         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27044         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27045         this_ptr_conv.is_owned = false;
27046         LDKStr val_conv = str_ref_to_owned_c(val);
27047         WarningMessage_set_data(&this_ptr_conv, val_conv);
27048 }
27049
27050 uint64_t  __attribute__((export_name("TS_WarningMessage_new"))) TS_WarningMessage_new(int8_tArray channel_id_arg, jstring data_arg) {
27051         LDKThirtyTwoBytes channel_id_arg_ref;
27052         CHECK(channel_id_arg->arr_len == 32);
27053         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
27054         LDKStr data_arg_conv = str_ref_to_owned_c(data_arg);
27055         LDKWarningMessage ret_var = WarningMessage_new(channel_id_arg_ref, data_arg_conv);
27056         uint64_t ret_ref = 0;
27057         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27058         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27059         return ret_ref;
27060 }
27061
27062 static inline uint64_t WarningMessage_clone_ptr(LDKWarningMessage *NONNULL_PTR arg) {
27063         LDKWarningMessage ret_var = WarningMessage_clone(arg);
27064         uint64_t ret_ref = 0;
27065         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27066         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27067         return ret_ref;
27068 }
27069 int64_t  __attribute__((export_name("TS_WarningMessage_clone_ptr"))) TS_WarningMessage_clone_ptr(uint64_t arg) {
27070         LDKWarningMessage arg_conv;
27071         arg_conv.inner = untag_ptr(arg);
27072         arg_conv.is_owned = ptr_is_owned(arg);
27073         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
27074         arg_conv.is_owned = false;
27075         int64_t ret_conv = WarningMessage_clone_ptr(&arg_conv);
27076         return ret_conv;
27077 }
27078
27079 uint64_t  __attribute__((export_name("TS_WarningMessage_clone"))) TS_WarningMessage_clone(uint64_t orig) {
27080         LDKWarningMessage orig_conv;
27081         orig_conv.inner = untag_ptr(orig);
27082         orig_conv.is_owned = ptr_is_owned(orig);
27083         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
27084         orig_conv.is_owned = false;
27085         LDKWarningMessage ret_var = WarningMessage_clone(&orig_conv);
27086         uint64_t ret_ref = 0;
27087         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27088         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27089         return ret_ref;
27090 }
27091
27092 void  __attribute__((export_name("TS_Ping_free"))) TS_Ping_free(uint64_t this_obj) {
27093         LDKPing this_obj_conv;
27094         this_obj_conv.inner = untag_ptr(this_obj);
27095         this_obj_conv.is_owned = ptr_is_owned(this_obj);
27096         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
27097         Ping_free(this_obj_conv);
27098 }
27099
27100 int16_t  __attribute__((export_name("TS_Ping_get_ponglen"))) TS_Ping_get_ponglen(uint64_t this_ptr) {
27101         LDKPing this_ptr_conv;
27102         this_ptr_conv.inner = untag_ptr(this_ptr);
27103         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27104         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27105         this_ptr_conv.is_owned = false;
27106         int16_t ret_conv = Ping_get_ponglen(&this_ptr_conv);
27107         return ret_conv;
27108 }
27109
27110 void  __attribute__((export_name("TS_Ping_set_ponglen"))) TS_Ping_set_ponglen(uint64_t this_ptr, int16_t val) {
27111         LDKPing this_ptr_conv;
27112         this_ptr_conv.inner = untag_ptr(this_ptr);
27113         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27114         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27115         this_ptr_conv.is_owned = false;
27116         Ping_set_ponglen(&this_ptr_conv, val);
27117 }
27118
27119 int16_t  __attribute__((export_name("TS_Ping_get_byteslen"))) TS_Ping_get_byteslen(uint64_t this_ptr) {
27120         LDKPing this_ptr_conv;
27121         this_ptr_conv.inner = untag_ptr(this_ptr);
27122         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27123         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27124         this_ptr_conv.is_owned = false;
27125         int16_t ret_conv = Ping_get_byteslen(&this_ptr_conv);
27126         return ret_conv;
27127 }
27128
27129 void  __attribute__((export_name("TS_Ping_set_byteslen"))) TS_Ping_set_byteslen(uint64_t this_ptr, int16_t val) {
27130         LDKPing this_ptr_conv;
27131         this_ptr_conv.inner = untag_ptr(this_ptr);
27132         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27133         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27134         this_ptr_conv.is_owned = false;
27135         Ping_set_byteslen(&this_ptr_conv, val);
27136 }
27137
27138 uint64_t  __attribute__((export_name("TS_Ping_new"))) TS_Ping_new(int16_t ponglen_arg, int16_t byteslen_arg) {
27139         LDKPing ret_var = Ping_new(ponglen_arg, byteslen_arg);
27140         uint64_t ret_ref = 0;
27141         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27142         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27143         return ret_ref;
27144 }
27145
27146 static inline uint64_t Ping_clone_ptr(LDKPing *NONNULL_PTR arg) {
27147         LDKPing ret_var = Ping_clone(arg);
27148         uint64_t ret_ref = 0;
27149         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27150         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27151         return ret_ref;
27152 }
27153 int64_t  __attribute__((export_name("TS_Ping_clone_ptr"))) TS_Ping_clone_ptr(uint64_t arg) {
27154         LDKPing arg_conv;
27155         arg_conv.inner = untag_ptr(arg);
27156         arg_conv.is_owned = ptr_is_owned(arg);
27157         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
27158         arg_conv.is_owned = false;
27159         int64_t ret_conv = Ping_clone_ptr(&arg_conv);
27160         return ret_conv;
27161 }
27162
27163 uint64_t  __attribute__((export_name("TS_Ping_clone"))) TS_Ping_clone(uint64_t orig) {
27164         LDKPing orig_conv;
27165         orig_conv.inner = untag_ptr(orig);
27166         orig_conv.is_owned = ptr_is_owned(orig);
27167         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
27168         orig_conv.is_owned = false;
27169         LDKPing ret_var = Ping_clone(&orig_conv);
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
27176 void  __attribute__((export_name("TS_Pong_free"))) TS_Pong_free(uint64_t this_obj) {
27177         LDKPong this_obj_conv;
27178         this_obj_conv.inner = untag_ptr(this_obj);
27179         this_obj_conv.is_owned = ptr_is_owned(this_obj);
27180         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
27181         Pong_free(this_obj_conv);
27182 }
27183
27184 int16_t  __attribute__((export_name("TS_Pong_get_byteslen"))) TS_Pong_get_byteslen(uint64_t this_ptr) {
27185         LDKPong this_ptr_conv;
27186         this_ptr_conv.inner = untag_ptr(this_ptr);
27187         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27188         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27189         this_ptr_conv.is_owned = false;
27190         int16_t ret_conv = Pong_get_byteslen(&this_ptr_conv);
27191         return ret_conv;
27192 }
27193
27194 void  __attribute__((export_name("TS_Pong_set_byteslen"))) TS_Pong_set_byteslen(uint64_t this_ptr, int16_t val) {
27195         LDKPong this_ptr_conv;
27196         this_ptr_conv.inner = untag_ptr(this_ptr);
27197         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27198         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27199         this_ptr_conv.is_owned = false;
27200         Pong_set_byteslen(&this_ptr_conv, val);
27201 }
27202
27203 uint64_t  __attribute__((export_name("TS_Pong_new"))) TS_Pong_new(int16_t byteslen_arg) {
27204         LDKPong ret_var = Pong_new(byteslen_arg);
27205         uint64_t ret_ref = 0;
27206         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27207         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27208         return ret_ref;
27209 }
27210
27211 static inline uint64_t Pong_clone_ptr(LDKPong *NONNULL_PTR arg) {
27212         LDKPong ret_var = Pong_clone(arg);
27213         uint64_t ret_ref = 0;
27214         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27215         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27216         return ret_ref;
27217 }
27218 int64_t  __attribute__((export_name("TS_Pong_clone_ptr"))) TS_Pong_clone_ptr(uint64_t arg) {
27219         LDKPong arg_conv;
27220         arg_conv.inner = untag_ptr(arg);
27221         arg_conv.is_owned = ptr_is_owned(arg);
27222         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
27223         arg_conv.is_owned = false;
27224         int64_t ret_conv = Pong_clone_ptr(&arg_conv);
27225         return ret_conv;
27226 }
27227
27228 uint64_t  __attribute__((export_name("TS_Pong_clone"))) TS_Pong_clone(uint64_t orig) {
27229         LDKPong orig_conv;
27230         orig_conv.inner = untag_ptr(orig);
27231         orig_conv.is_owned = ptr_is_owned(orig);
27232         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
27233         orig_conv.is_owned = false;
27234         LDKPong ret_var = Pong_clone(&orig_conv);
27235         uint64_t ret_ref = 0;
27236         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27237         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27238         return ret_ref;
27239 }
27240
27241 void  __attribute__((export_name("TS_OpenChannel_free"))) TS_OpenChannel_free(uint64_t this_obj) {
27242         LDKOpenChannel this_obj_conv;
27243         this_obj_conv.inner = untag_ptr(this_obj);
27244         this_obj_conv.is_owned = ptr_is_owned(this_obj);
27245         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
27246         OpenChannel_free(this_obj_conv);
27247 }
27248
27249 int8_tArray  __attribute__((export_name("TS_OpenChannel_get_chain_hash"))) TS_OpenChannel_get_chain_hash(uint64_t this_ptr) {
27250         LDKOpenChannel this_ptr_conv;
27251         this_ptr_conv.inner = untag_ptr(this_ptr);
27252         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27253         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27254         this_ptr_conv.is_owned = false;
27255         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
27256         memcpy(ret_arr->elems, *OpenChannel_get_chain_hash(&this_ptr_conv), 32);
27257         return ret_arr;
27258 }
27259
27260 void  __attribute__((export_name("TS_OpenChannel_set_chain_hash"))) TS_OpenChannel_set_chain_hash(uint64_t this_ptr, int8_tArray val) {
27261         LDKOpenChannel this_ptr_conv;
27262         this_ptr_conv.inner = untag_ptr(this_ptr);
27263         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27264         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27265         this_ptr_conv.is_owned = false;
27266         LDKThirtyTwoBytes val_ref;
27267         CHECK(val->arr_len == 32);
27268         memcpy(val_ref.data, val->elems, 32); FREE(val);
27269         OpenChannel_set_chain_hash(&this_ptr_conv, val_ref);
27270 }
27271
27272 int8_tArray  __attribute__((export_name("TS_OpenChannel_get_temporary_channel_id"))) TS_OpenChannel_get_temporary_channel_id(uint64_t this_ptr) {
27273         LDKOpenChannel this_ptr_conv;
27274         this_ptr_conv.inner = untag_ptr(this_ptr);
27275         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27276         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27277         this_ptr_conv.is_owned = false;
27278         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
27279         memcpy(ret_arr->elems, *OpenChannel_get_temporary_channel_id(&this_ptr_conv), 32);
27280         return ret_arr;
27281 }
27282
27283 void  __attribute__((export_name("TS_OpenChannel_set_temporary_channel_id"))) TS_OpenChannel_set_temporary_channel_id(uint64_t this_ptr, int8_tArray val) {
27284         LDKOpenChannel this_ptr_conv;
27285         this_ptr_conv.inner = untag_ptr(this_ptr);
27286         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27287         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27288         this_ptr_conv.is_owned = false;
27289         LDKThirtyTwoBytes val_ref;
27290         CHECK(val->arr_len == 32);
27291         memcpy(val_ref.data, val->elems, 32); FREE(val);
27292         OpenChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
27293 }
27294
27295 int64_t  __attribute__((export_name("TS_OpenChannel_get_funding_satoshis"))) TS_OpenChannel_get_funding_satoshis(uint64_t this_ptr) {
27296         LDKOpenChannel this_ptr_conv;
27297         this_ptr_conv.inner = untag_ptr(this_ptr);
27298         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27299         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27300         this_ptr_conv.is_owned = false;
27301         int64_t ret_conv = OpenChannel_get_funding_satoshis(&this_ptr_conv);
27302         return ret_conv;
27303 }
27304
27305 void  __attribute__((export_name("TS_OpenChannel_set_funding_satoshis"))) TS_OpenChannel_set_funding_satoshis(uint64_t this_ptr, int64_t val) {
27306         LDKOpenChannel this_ptr_conv;
27307         this_ptr_conv.inner = untag_ptr(this_ptr);
27308         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27309         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27310         this_ptr_conv.is_owned = false;
27311         OpenChannel_set_funding_satoshis(&this_ptr_conv, val);
27312 }
27313
27314 int64_t  __attribute__((export_name("TS_OpenChannel_get_push_msat"))) TS_OpenChannel_get_push_msat(uint64_t this_ptr) {
27315         LDKOpenChannel this_ptr_conv;
27316         this_ptr_conv.inner = untag_ptr(this_ptr);
27317         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27318         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27319         this_ptr_conv.is_owned = false;
27320         int64_t ret_conv = OpenChannel_get_push_msat(&this_ptr_conv);
27321         return ret_conv;
27322 }
27323
27324 void  __attribute__((export_name("TS_OpenChannel_set_push_msat"))) TS_OpenChannel_set_push_msat(uint64_t this_ptr, int64_t val) {
27325         LDKOpenChannel this_ptr_conv;
27326         this_ptr_conv.inner = untag_ptr(this_ptr);
27327         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27328         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27329         this_ptr_conv.is_owned = false;
27330         OpenChannel_set_push_msat(&this_ptr_conv, val);
27331 }
27332
27333 int64_t  __attribute__((export_name("TS_OpenChannel_get_dust_limit_satoshis"))) TS_OpenChannel_get_dust_limit_satoshis(uint64_t this_ptr) {
27334         LDKOpenChannel this_ptr_conv;
27335         this_ptr_conv.inner = untag_ptr(this_ptr);
27336         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27337         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27338         this_ptr_conv.is_owned = false;
27339         int64_t ret_conv = OpenChannel_get_dust_limit_satoshis(&this_ptr_conv);
27340         return ret_conv;
27341 }
27342
27343 void  __attribute__((export_name("TS_OpenChannel_set_dust_limit_satoshis"))) TS_OpenChannel_set_dust_limit_satoshis(uint64_t this_ptr, int64_t val) {
27344         LDKOpenChannel this_ptr_conv;
27345         this_ptr_conv.inner = untag_ptr(this_ptr);
27346         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27347         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27348         this_ptr_conv.is_owned = false;
27349         OpenChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
27350 }
27351
27352 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) {
27353         LDKOpenChannel this_ptr_conv;
27354         this_ptr_conv.inner = untag_ptr(this_ptr);
27355         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27356         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27357         this_ptr_conv.is_owned = false;
27358         int64_t ret_conv = OpenChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
27359         return ret_conv;
27360 }
27361
27362 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) {
27363         LDKOpenChannel this_ptr_conv;
27364         this_ptr_conv.inner = untag_ptr(this_ptr);
27365         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27366         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27367         this_ptr_conv.is_owned = false;
27368         OpenChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
27369 }
27370
27371 int64_t  __attribute__((export_name("TS_OpenChannel_get_channel_reserve_satoshis"))) TS_OpenChannel_get_channel_reserve_satoshis(uint64_t this_ptr) {
27372         LDKOpenChannel this_ptr_conv;
27373         this_ptr_conv.inner = untag_ptr(this_ptr);
27374         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27375         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27376         this_ptr_conv.is_owned = false;
27377         int64_t ret_conv = OpenChannel_get_channel_reserve_satoshis(&this_ptr_conv);
27378         return ret_conv;
27379 }
27380
27381 void  __attribute__((export_name("TS_OpenChannel_set_channel_reserve_satoshis"))) TS_OpenChannel_set_channel_reserve_satoshis(uint64_t this_ptr, int64_t val) {
27382         LDKOpenChannel this_ptr_conv;
27383         this_ptr_conv.inner = untag_ptr(this_ptr);
27384         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27385         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27386         this_ptr_conv.is_owned = false;
27387         OpenChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
27388 }
27389
27390 int64_t  __attribute__((export_name("TS_OpenChannel_get_htlc_minimum_msat"))) TS_OpenChannel_get_htlc_minimum_msat(uint64_t this_ptr) {
27391         LDKOpenChannel this_ptr_conv;
27392         this_ptr_conv.inner = untag_ptr(this_ptr);
27393         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27394         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27395         this_ptr_conv.is_owned = false;
27396         int64_t ret_conv = OpenChannel_get_htlc_minimum_msat(&this_ptr_conv);
27397         return ret_conv;
27398 }
27399
27400 void  __attribute__((export_name("TS_OpenChannel_set_htlc_minimum_msat"))) TS_OpenChannel_set_htlc_minimum_msat(uint64_t this_ptr, int64_t val) {
27401         LDKOpenChannel this_ptr_conv;
27402         this_ptr_conv.inner = untag_ptr(this_ptr);
27403         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27404         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27405         this_ptr_conv.is_owned = false;
27406         OpenChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
27407 }
27408
27409 int32_t  __attribute__((export_name("TS_OpenChannel_get_feerate_per_kw"))) TS_OpenChannel_get_feerate_per_kw(uint64_t this_ptr) {
27410         LDKOpenChannel this_ptr_conv;
27411         this_ptr_conv.inner = untag_ptr(this_ptr);
27412         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27413         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27414         this_ptr_conv.is_owned = false;
27415         int32_t ret_conv = OpenChannel_get_feerate_per_kw(&this_ptr_conv);
27416         return ret_conv;
27417 }
27418
27419 void  __attribute__((export_name("TS_OpenChannel_set_feerate_per_kw"))) TS_OpenChannel_set_feerate_per_kw(uint64_t this_ptr, int32_t val) {
27420         LDKOpenChannel this_ptr_conv;
27421         this_ptr_conv.inner = untag_ptr(this_ptr);
27422         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27423         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27424         this_ptr_conv.is_owned = false;
27425         OpenChannel_set_feerate_per_kw(&this_ptr_conv, val);
27426 }
27427
27428 int16_t  __attribute__((export_name("TS_OpenChannel_get_to_self_delay"))) TS_OpenChannel_get_to_self_delay(uint64_t this_ptr) {
27429         LDKOpenChannel this_ptr_conv;
27430         this_ptr_conv.inner = untag_ptr(this_ptr);
27431         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27432         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27433         this_ptr_conv.is_owned = false;
27434         int16_t ret_conv = OpenChannel_get_to_self_delay(&this_ptr_conv);
27435         return ret_conv;
27436 }
27437
27438 void  __attribute__((export_name("TS_OpenChannel_set_to_self_delay"))) TS_OpenChannel_set_to_self_delay(uint64_t this_ptr, int16_t val) {
27439         LDKOpenChannel this_ptr_conv;
27440         this_ptr_conv.inner = untag_ptr(this_ptr);
27441         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27442         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27443         this_ptr_conv.is_owned = false;
27444         OpenChannel_set_to_self_delay(&this_ptr_conv, val);
27445 }
27446
27447 int16_t  __attribute__((export_name("TS_OpenChannel_get_max_accepted_htlcs"))) TS_OpenChannel_get_max_accepted_htlcs(uint64_t this_ptr) {
27448         LDKOpenChannel this_ptr_conv;
27449         this_ptr_conv.inner = untag_ptr(this_ptr);
27450         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27451         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27452         this_ptr_conv.is_owned = false;
27453         int16_t ret_conv = OpenChannel_get_max_accepted_htlcs(&this_ptr_conv);
27454         return ret_conv;
27455 }
27456
27457 void  __attribute__((export_name("TS_OpenChannel_set_max_accepted_htlcs"))) TS_OpenChannel_set_max_accepted_htlcs(uint64_t this_ptr, int16_t val) {
27458         LDKOpenChannel this_ptr_conv;
27459         this_ptr_conv.inner = untag_ptr(this_ptr);
27460         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27461         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27462         this_ptr_conv.is_owned = false;
27463         OpenChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
27464 }
27465
27466 int8_tArray  __attribute__((export_name("TS_OpenChannel_get_funding_pubkey"))) TS_OpenChannel_get_funding_pubkey(uint64_t this_ptr) {
27467         LDKOpenChannel this_ptr_conv;
27468         this_ptr_conv.inner = untag_ptr(this_ptr);
27469         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27470         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27471         this_ptr_conv.is_owned = false;
27472         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
27473         memcpy(ret_arr->elems, OpenChannel_get_funding_pubkey(&this_ptr_conv).compressed_form, 33);
27474         return ret_arr;
27475 }
27476
27477 void  __attribute__((export_name("TS_OpenChannel_set_funding_pubkey"))) TS_OpenChannel_set_funding_pubkey(uint64_t this_ptr, int8_tArray val) {
27478         LDKOpenChannel this_ptr_conv;
27479         this_ptr_conv.inner = untag_ptr(this_ptr);
27480         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27481         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27482         this_ptr_conv.is_owned = false;
27483         LDKPublicKey val_ref;
27484         CHECK(val->arr_len == 33);
27485         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
27486         OpenChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
27487 }
27488
27489 int8_tArray  __attribute__((export_name("TS_OpenChannel_get_revocation_basepoint"))) TS_OpenChannel_get_revocation_basepoint(uint64_t this_ptr) {
27490         LDKOpenChannel this_ptr_conv;
27491         this_ptr_conv.inner = untag_ptr(this_ptr);
27492         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27493         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27494         this_ptr_conv.is_owned = false;
27495         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
27496         memcpy(ret_arr->elems, OpenChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form, 33);
27497         return ret_arr;
27498 }
27499
27500 void  __attribute__((export_name("TS_OpenChannel_set_revocation_basepoint"))) TS_OpenChannel_set_revocation_basepoint(uint64_t this_ptr, int8_tArray val) {
27501         LDKOpenChannel this_ptr_conv;
27502         this_ptr_conv.inner = untag_ptr(this_ptr);
27503         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27504         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27505         this_ptr_conv.is_owned = false;
27506         LDKPublicKey val_ref;
27507         CHECK(val->arr_len == 33);
27508         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
27509         OpenChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
27510 }
27511
27512 int8_tArray  __attribute__((export_name("TS_OpenChannel_get_payment_point"))) TS_OpenChannel_get_payment_point(uint64_t this_ptr) {
27513         LDKOpenChannel this_ptr_conv;
27514         this_ptr_conv.inner = untag_ptr(this_ptr);
27515         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27516         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27517         this_ptr_conv.is_owned = false;
27518         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
27519         memcpy(ret_arr->elems, OpenChannel_get_payment_point(&this_ptr_conv).compressed_form, 33);
27520         return ret_arr;
27521 }
27522
27523 void  __attribute__((export_name("TS_OpenChannel_set_payment_point"))) TS_OpenChannel_set_payment_point(uint64_t this_ptr, int8_tArray val) {
27524         LDKOpenChannel this_ptr_conv;
27525         this_ptr_conv.inner = untag_ptr(this_ptr);
27526         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27527         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27528         this_ptr_conv.is_owned = false;
27529         LDKPublicKey val_ref;
27530         CHECK(val->arr_len == 33);
27531         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
27532         OpenChannel_set_payment_point(&this_ptr_conv, val_ref);
27533 }
27534
27535 int8_tArray  __attribute__((export_name("TS_OpenChannel_get_delayed_payment_basepoint"))) TS_OpenChannel_get_delayed_payment_basepoint(uint64_t this_ptr) {
27536         LDKOpenChannel this_ptr_conv;
27537         this_ptr_conv.inner = untag_ptr(this_ptr);
27538         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27539         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27540         this_ptr_conv.is_owned = false;
27541         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
27542         memcpy(ret_arr->elems, OpenChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form, 33);
27543         return ret_arr;
27544 }
27545
27546 void  __attribute__((export_name("TS_OpenChannel_set_delayed_payment_basepoint"))) TS_OpenChannel_set_delayed_payment_basepoint(uint64_t this_ptr, int8_tArray val) {
27547         LDKOpenChannel this_ptr_conv;
27548         this_ptr_conv.inner = untag_ptr(this_ptr);
27549         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27550         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27551         this_ptr_conv.is_owned = false;
27552         LDKPublicKey val_ref;
27553         CHECK(val->arr_len == 33);
27554         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
27555         OpenChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
27556 }
27557
27558 int8_tArray  __attribute__((export_name("TS_OpenChannel_get_htlc_basepoint"))) TS_OpenChannel_get_htlc_basepoint(uint64_t this_ptr) {
27559         LDKOpenChannel this_ptr_conv;
27560         this_ptr_conv.inner = untag_ptr(this_ptr);
27561         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27562         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27563         this_ptr_conv.is_owned = false;
27564         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
27565         memcpy(ret_arr->elems, OpenChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form, 33);
27566         return ret_arr;
27567 }
27568
27569 void  __attribute__((export_name("TS_OpenChannel_set_htlc_basepoint"))) TS_OpenChannel_set_htlc_basepoint(uint64_t this_ptr, int8_tArray val) {
27570         LDKOpenChannel this_ptr_conv;
27571         this_ptr_conv.inner = untag_ptr(this_ptr);
27572         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27573         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27574         this_ptr_conv.is_owned = false;
27575         LDKPublicKey val_ref;
27576         CHECK(val->arr_len == 33);
27577         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
27578         OpenChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
27579 }
27580
27581 int8_tArray  __attribute__((export_name("TS_OpenChannel_get_first_per_commitment_point"))) TS_OpenChannel_get_first_per_commitment_point(uint64_t this_ptr) {
27582         LDKOpenChannel this_ptr_conv;
27583         this_ptr_conv.inner = untag_ptr(this_ptr);
27584         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27585         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27586         this_ptr_conv.is_owned = false;
27587         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
27588         memcpy(ret_arr->elems, OpenChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form, 33);
27589         return ret_arr;
27590 }
27591
27592 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) {
27593         LDKOpenChannel this_ptr_conv;
27594         this_ptr_conv.inner = untag_ptr(this_ptr);
27595         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27596         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27597         this_ptr_conv.is_owned = false;
27598         LDKPublicKey val_ref;
27599         CHECK(val->arr_len == 33);
27600         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
27601         OpenChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
27602 }
27603
27604 int8_t  __attribute__((export_name("TS_OpenChannel_get_channel_flags"))) TS_OpenChannel_get_channel_flags(uint64_t this_ptr) {
27605         LDKOpenChannel this_ptr_conv;
27606         this_ptr_conv.inner = untag_ptr(this_ptr);
27607         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27608         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27609         this_ptr_conv.is_owned = false;
27610         int8_t ret_conv = OpenChannel_get_channel_flags(&this_ptr_conv);
27611         return ret_conv;
27612 }
27613
27614 void  __attribute__((export_name("TS_OpenChannel_set_channel_flags"))) TS_OpenChannel_set_channel_flags(uint64_t this_ptr, int8_t val) {
27615         LDKOpenChannel this_ptr_conv;
27616         this_ptr_conv.inner = untag_ptr(this_ptr);
27617         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27618         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27619         this_ptr_conv.is_owned = false;
27620         OpenChannel_set_channel_flags(&this_ptr_conv, val);
27621 }
27622
27623 uint64_t  __attribute__((export_name("TS_OpenChannel_get_channel_type"))) TS_OpenChannel_get_channel_type(uint64_t this_ptr) {
27624         LDKOpenChannel this_ptr_conv;
27625         this_ptr_conv.inner = untag_ptr(this_ptr);
27626         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27627         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27628         this_ptr_conv.is_owned = false;
27629         LDKChannelTypeFeatures ret_var = OpenChannel_get_channel_type(&this_ptr_conv);
27630         uint64_t ret_ref = 0;
27631         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27632         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27633         return ret_ref;
27634 }
27635
27636 void  __attribute__((export_name("TS_OpenChannel_set_channel_type"))) TS_OpenChannel_set_channel_type(uint64_t this_ptr, uint64_t val) {
27637         LDKOpenChannel this_ptr_conv;
27638         this_ptr_conv.inner = untag_ptr(this_ptr);
27639         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27640         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27641         this_ptr_conv.is_owned = false;
27642         LDKChannelTypeFeatures val_conv;
27643         val_conv.inner = untag_ptr(val);
27644         val_conv.is_owned = ptr_is_owned(val);
27645         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
27646         val_conv = ChannelTypeFeatures_clone(&val_conv);
27647         OpenChannel_set_channel_type(&this_ptr_conv, val_conv);
27648 }
27649
27650 static inline uint64_t OpenChannel_clone_ptr(LDKOpenChannel *NONNULL_PTR arg) {
27651         LDKOpenChannel ret_var = OpenChannel_clone(arg);
27652         uint64_t ret_ref = 0;
27653         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27654         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27655         return ret_ref;
27656 }
27657 int64_t  __attribute__((export_name("TS_OpenChannel_clone_ptr"))) TS_OpenChannel_clone_ptr(uint64_t arg) {
27658         LDKOpenChannel arg_conv;
27659         arg_conv.inner = untag_ptr(arg);
27660         arg_conv.is_owned = ptr_is_owned(arg);
27661         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
27662         arg_conv.is_owned = false;
27663         int64_t ret_conv = OpenChannel_clone_ptr(&arg_conv);
27664         return ret_conv;
27665 }
27666
27667 uint64_t  __attribute__((export_name("TS_OpenChannel_clone"))) TS_OpenChannel_clone(uint64_t orig) {
27668         LDKOpenChannel orig_conv;
27669         orig_conv.inner = untag_ptr(orig);
27670         orig_conv.is_owned = ptr_is_owned(orig);
27671         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
27672         orig_conv.is_owned = false;
27673         LDKOpenChannel ret_var = OpenChannel_clone(&orig_conv);
27674         uint64_t ret_ref = 0;
27675         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27676         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27677         return ret_ref;
27678 }
27679
27680 void  __attribute__((export_name("TS_AcceptChannel_free"))) TS_AcceptChannel_free(uint64_t this_obj) {
27681         LDKAcceptChannel this_obj_conv;
27682         this_obj_conv.inner = untag_ptr(this_obj);
27683         this_obj_conv.is_owned = ptr_is_owned(this_obj);
27684         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
27685         AcceptChannel_free(this_obj_conv);
27686 }
27687
27688 int8_tArray  __attribute__((export_name("TS_AcceptChannel_get_temporary_channel_id"))) TS_AcceptChannel_get_temporary_channel_id(uint64_t this_ptr) {
27689         LDKAcceptChannel this_ptr_conv;
27690         this_ptr_conv.inner = untag_ptr(this_ptr);
27691         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27692         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27693         this_ptr_conv.is_owned = false;
27694         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
27695         memcpy(ret_arr->elems, *AcceptChannel_get_temporary_channel_id(&this_ptr_conv), 32);
27696         return ret_arr;
27697 }
27698
27699 void  __attribute__((export_name("TS_AcceptChannel_set_temporary_channel_id"))) TS_AcceptChannel_set_temporary_channel_id(uint64_t this_ptr, int8_tArray val) {
27700         LDKAcceptChannel this_ptr_conv;
27701         this_ptr_conv.inner = untag_ptr(this_ptr);
27702         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27703         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27704         this_ptr_conv.is_owned = false;
27705         LDKThirtyTwoBytes val_ref;
27706         CHECK(val->arr_len == 32);
27707         memcpy(val_ref.data, val->elems, 32); FREE(val);
27708         AcceptChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
27709 }
27710
27711 int64_t  __attribute__((export_name("TS_AcceptChannel_get_dust_limit_satoshis"))) TS_AcceptChannel_get_dust_limit_satoshis(uint64_t this_ptr) {
27712         LDKAcceptChannel this_ptr_conv;
27713         this_ptr_conv.inner = untag_ptr(this_ptr);
27714         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27715         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27716         this_ptr_conv.is_owned = false;
27717         int64_t ret_conv = AcceptChannel_get_dust_limit_satoshis(&this_ptr_conv);
27718         return ret_conv;
27719 }
27720
27721 void  __attribute__((export_name("TS_AcceptChannel_set_dust_limit_satoshis"))) TS_AcceptChannel_set_dust_limit_satoshis(uint64_t this_ptr, int64_t val) {
27722         LDKAcceptChannel this_ptr_conv;
27723         this_ptr_conv.inner = untag_ptr(this_ptr);
27724         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27725         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27726         this_ptr_conv.is_owned = false;
27727         AcceptChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
27728 }
27729
27730 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) {
27731         LDKAcceptChannel this_ptr_conv;
27732         this_ptr_conv.inner = untag_ptr(this_ptr);
27733         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27734         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27735         this_ptr_conv.is_owned = false;
27736         int64_t ret_conv = AcceptChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
27737         return ret_conv;
27738 }
27739
27740 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) {
27741         LDKAcceptChannel this_ptr_conv;
27742         this_ptr_conv.inner = untag_ptr(this_ptr);
27743         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27744         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27745         this_ptr_conv.is_owned = false;
27746         AcceptChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
27747 }
27748
27749 int64_t  __attribute__((export_name("TS_AcceptChannel_get_channel_reserve_satoshis"))) TS_AcceptChannel_get_channel_reserve_satoshis(uint64_t this_ptr) {
27750         LDKAcceptChannel this_ptr_conv;
27751         this_ptr_conv.inner = untag_ptr(this_ptr);
27752         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27753         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27754         this_ptr_conv.is_owned = false;
27755         int64_t ret_conv = AcceptChannel_get_channel_reserve_satoshis(&this_ptr_conv);
27756         return ret_conv;
27757 }
27758
27759 void  __attribute__((export_name("TS_AcceptChannel_set_channel_reserve_satoshis"))) TS_AcceptChannel_set_channel_reserve_satoshis(uint64_t this_ptr, int64_t val) {
27760         LDKAcceptChannel 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         AcceptChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
27766 }
27767
27768 int64_t  __attribute__((export_name("TS_AcceptChannel_get_htlc_minimum_msat"))) TS_AcceptChannel_get_htlc_minimum_msat(uint64_t this_ptr) {
27769         LDKAcceptChannel this_ptr_conv;
27770         this_ptr_conv.inner = untag_ptr(this_ptr);
27771         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27772         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27773         this_ptr_conv.is_owned = false;
27774         int64_t ret_conv = AcceptChannel_get_htlc_minimum_msat(&this_ptr_conv);
27775         return ret_conv;
27776 }
27777
27778 void  __attribute__((export_name("TS_AcceptChannel_set_htlc_minimum_msat"))) TS_AcceptChannel_set_htlc_minimum_msat(uint64_t this_ptr, int64_t val) {
27779         LDKAcceptChannel this_ptr_conv;
27780         this_ptr_conv.inner = untag_ptr(this_ptr);
27781         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27782         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27783         this_ptr_conv.is_owned = false;
27784         AcceptChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
27785 }
27786
27787 int32_t  __attribute__((export_name("TS_AcceptChannel_get_minimum_depth"))) TS_AcceptChannel_get_minimum_depth(uint64_t this_ptr) {
27788         LDKAcceptChannel this_ptr_conv;
27789         this_ptr_conv.inner = untag_ptr(this_ptr);
27790         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27791         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27792         this_ptr_conv.is_owned = false;
27793         int32_t ret_conv = AcceptChannel_get_minimum_depth(&this_ptr_conv);
27794         return ret_conv;
27795 }
27796
27797 void  __attribute__((export_name("TS_AcceptChannel_set_minimum_depth"))) TS_AcceptChannel_set_minimum_depth(uint64_t this_ptr, int32_t val) {
27798         LDKAcceptChannel this_ptr_conv;
27799         this_ptr_conv.inner = untag_ptr(this_ptr);
27800         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27801         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27802         this_ptr_conv.is_owned = false;
27803         AcceptChannel_set_minimum_depth(&this_ptr_conv, val);
27804 }
27805
27806 int16_t  __attribute__((export_name("TS_AcceptChannel_get_to_self_delay"))) TS_AcceptChannel_get_to_self_delay(uint64_t this_ptr) {
27807         LDKAcceptChannel this_ptr_conv;
27808         this_ptr_conv.inner = untag_ptr(this_ptr);
27809         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27810         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27811         this_ptr_conv.is_owned = false;
27812         int16_t ret_conv = AcceptChannel_get_to_self_delay(&this_ptr_conv);
27813         return ret_conv;
27814 }
27815
27816 void  __attribute__((export_name("TS_AcceptChannel_set_to_self_delay"))) TS_AcceptChannel_set_to_self_delay(uint64_t this_ptr, int16_t val) {
27817         LDKAcceptChannel this_ptr_conv;
27818         this_ptr_conv.inner = untag_ptr(this_ptr);
27819         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27820         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27821         this_ptr_conv.is_owned = false;
27822         AcceptChannel_set_to_self_delay(&this_ptr_conv, val);
27823 }
27824
27825 int16_t  __attribute__((export_name("TS_AcceptChannel_get_max_accepted_htlcs"))) TS_AcceptChannel_get_max_accepted_htlcs(uint64_t this_ptr) {
27826         LDKAcceptChannel this_ptr_conv;
27827         this_ptr_conv.inner = untag_ptr(this_ptr);
27828         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27829         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27830         this_ptr_conv.is_owned = false;
27831         int16_t ret_conv = AcceptChannel_get_max_accepted_htlcs(&this_ptr_conv);
27832         return ret_conv;
27833 }
27834
27835 void  __attribute__((export_name("TS_AcceptChannel_set_max_accepted_htlcs"))) TS_AcceptChannel_set_max_accepted_htlcs(uint64_t this_ptr, int16_t val) {
27836         LDKAcceptChannel this_ptr_conv;
27837         this_ptr_conv.inner = untag_ptr(this_ptr);
27838         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27839         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27840         this_ptr_conv.is_owned = false;
27841         AcceptChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
27842 }
27843
27844 int8_tArray  __attribute__((export_name("TS_AcceptChannel_get_funding_pubkey"))) TS_AcceptChannel_get_funding_pubkey(uint64_t this_ptr) {
27845         LDKAcceptChannel this_ptr_conv;
27846         this_ptr_conv.inner = untag_ptr(this_ptr);
27847         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27848         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27849         this_ptr_conv.is_owned = false;
27850         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
27851         memcpy(ret_arr->elems, AcceptChannel_get_funding_pubkey(&this_ptr_conv).compressed_form, 33);
27852         return ret_arr;
27853 }
27854
27855 void  __attribute__((export_name("TS_AcceptChannel_set_funding_pubkey"))) TS_AcceptChannel_set_funding_pubkey(uint64_t this_ptr, int8_tArray val) {
27856         LDKAcceptChannel this_ptr_conv;
27857         this_ptr_conv.inner = untag_ptr(this_ptr);
27858         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27859         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27860         this_ptr_conv.is_owned = false;
27861         LDKPublicKey val_ref;
27862         CHECK(val->arr_len == 33);
27863         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
27864         AcceptChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
27865 }
27866
27867 int8_tArray  __attribute__((export_name("TS_AcceptChannel_get_revocation_basepoint"))) TS_AcceptChannel_get_revocation_basepoint(uint64_t this_ptr) {
27868         LDKAcceptChannel this_ptr_conv;
27869         this_ptr_conv.inner = untag_ptr(this_ptr);
27870         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27871         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27872         this_ptr_conv.is_owned = false;
27873         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
27874         memcpy(ret_arr->elems, AcceptChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form, 33);
27875         return ret_arr;
27876 }
27877
27878 void  __attribute__((export_name("TS_AcceptChannel_set_revocation_basepoint"))) TS_AcceptChannel_set_revocation_basepoint(uint64_t this_ptr, int8_tArray val) {
27879         LDKAcceptChannel this_ptr_conv;
27880         this_ptr_conv.inner = untag_ptr(this_ptr);
27881         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27882         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27883         this_ptr_conv.is_owned = false;
27884         LDKPublicKey val_ref;
27885         CHECK(val->arr_len == 33);
27886         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
27887         AcceptChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
27888 }
27889
27890 int8_tArray  __attribute__((export_name("TS_AcceptChannel_get_payment_point"))) TS_AcceptChannel_get_payment_point(uint64_t this_ptr) {
27891         LDKAcceptChannel this_ptr_conv;
27892         this_ptr_conv.inner = untag_ptr(this_ptr);
27893         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27894         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27895         this_ptr_conv.is_owned = false;
27896         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
27897         memcpy(ret_arr->elems, AcceptChannel_get_payment_point(&this_ptr_conv).compressed_form, 33);
27898         return ret_arr;
27899 }
27900
27901 void  __attribute__((export_name("TS_AcceptChannel_set_payment_point"))) TS_AcceptChannel_set_payment_point(uint64_t this_ptr, int8_tArray val) {
27902         LDKAcceptChannel this_ptr_conv;
27903         this_ptr_conv.inner = untag_ptr(this_ptr);
27904         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27905         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27906         this_ptr_conv.is_owned = false;
27907         LDKPublicKey val_ref;
27908         CHECK(val->arr_len == 33);
27909         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
27910         AcceptChannel_set_payment_point(&this_ptr_conv, val_ref);
27911 }
27912
27913 int8_tArray  __attribute__((export_name("TS_AcceptChannel_get_delayed_payment_basepoint"))) TS_AcceptChannel_get_delayed_payment_basepoint(uint64_t this_ptr) {
27914         LDKAcceptChannel this_ptr_conv;
27915         this_ptr_conv.inner = untag_ptr(this_ptr);
27916         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27917         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27918         this_ptr_conv.is_owned = false;
27919         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
27920         memcpy(ret_arr->elems, AcceptChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form, 33);
27921         return ret_arr;
27922 }
27923
27924 void  __attribute__((export_name("TS_AcceptChannel_set_delayed_payment_basepoint"))) TS_AcceptChannel_set_delayed_payment_basepoint(uint64_t this_ptr, int8_tArray val) {
27925         LDKAcceptChannel this_ptr_conv;
27926         this_ptr_conv.inner = untag_ptr(this_ptr);
27927         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27928         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27929         this_ptr_conv.is_owned = false;
27930         LDKPublicKey val_ref;
27931         CHECK(val->arr_len == 33);
27932         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
27933         AcceptChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
27934 }
27935
27936 int8_tArray  __attribute__((export_name("TS_AcceptChannel_get_htlc_basepoint"))) TS_AcceptChannel_get_htlc_basepoint(uint64_t this_ptr) {
27937         LDKAcceptChannel this_ptr_conv;
27938         this_ptr_conv.inner = untag_ptr(this_ptr);
27939         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27940         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27941         this_ptr_conv.is_owned = false;
27942         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
27943         memcpy(ret_arr->elems, AcceptChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form, 33);
27944         return ret_arr;
27945 }
27946
27947 void  __attribute__((export_name("TS_AcceptChannel_set_htlc_basepoint"))) TS_AcceptChannel_set_htlc_basepoint(uint64_t this_ptr, int8_tArray val) {
27948         LDKAcceptChannel this_ptr_conv;
27949         this_ptr_conv.inner = untag_ptr(this_ptr);
27950         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27951         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27952         this_ptr_conv.is_owned = false;
27953         LDKPublicKey val_ref;
27954         CHECK(val->arr_len == 33);
27955         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
27956         AcceptChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
27957 }
27958
27959 int8_tArray  __attribute__((export_name("TS_AcceptChannel_get_first_per_commitment_point"))) TS_AcceptChannel_get_first_per_commitment_point(uint64_t this_ptr) {
27960         LDKAcceptChannel this_ptr_conv;
27961         this_ptr_conv.inner = untag_ptr(this_ptr);
27962         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27963         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27964         this_ptr_conv.is_owned = false;
27965         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
27966         memcpy(ret_arr->elems, AcceptChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form, 33);
27967         return ret_arr;
27968 }
27969
27970 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) {
27971         LDKAcceptChannel this_ptr_conv;
27972         this_ptr_conv.inner = untag_ptr(this_ptr);
27973         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27974         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27975         this_ptr_conv.is_owned = false;
27976         LDKPublicKey val_ref;
27977         CHECK(val->arr_len == 33);
27978         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
27979         AcceptChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
27980 }
27981
27982 uint64_t  __attribute__((export_name("TS_AcceptChannel_get_channel_type"))) TS_AcceptChannel_get_channel_type(uint64_t this_ptr) {
27983         LDKAcceptChannel this_ptr_conv;
27984         this_ptr_conv.inner = untag_ptr(this_ptr);
27985         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27986         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27987         this_ptr_conv.is_owned = false;
27988         LDKChannelTypeFeatures ret_var = AcceptChannel_get_channel_type(&this_ptr_conv);
27989         uint64_t ret_ref = 0;
27990         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27991         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27992         return ret_ref;
27993 }
27994
27995 void  __attribute__((export_name("TS_AcceptChannel_set_channel_type"))) TS_AcceptChannel_set_channel_type(uint64_t this_ptr, uint64_t val) {
27996         LDKAcceptChannel this_ptr_conv;
27997         this_ptr_conv.inner = untag_ptr(this_ptr);
27998         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27999         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28000         this_ptr_conv.is_owned = false;
28001         LDKChannelTypeFeatures val_conv;
28002         val_conv.inner = untag_ptr(val);
28003         val_conv.is_owned = ptr_is_owned(val);
28004         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
28005         val_conv = ChannelTypeFeatures_clone(&val_conv);
28006         AcceptChannel_set_channel_type(&this_ptr_conv, val_conv);
28007 }
28008
28009 static inline uint64_t AcceptChannel_clone_ptr(LDKAcceptChannel *NONNULL_PTR arg) {
28010         LDKAcceptChannel ret_var = AcceptChannel_clone(arg);
28011         uint64_t ret_ref = 0;
28012         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28013         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28014         return ret_ref;
28015 }
28016 int64_t  __attribute__((export_name("TS_AcceptChannel_clone_ptr"))) TS_AcceptChannel_clone_ptr(uint64_t arg) {
28017         LDKAcceptChannel arg_conv;
28018         arg_conv.inner = untag_ptr(arg);
28019         arg_conv.is_owned = ptr_is_owned(arg);
28020         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
28021         arg_conv.is_owned = false;
28022         int64_t ret_conv = AcceptChannel_clone_ptr(&arg_conv);
28023         return ret_conv;
28024 }
28025
28026 uint64_t  __attribute__((export_name("TS_AcceptChannel_clone"))) TS_AcceptChannel_clone(uint64_t orig) {
28027         LDKAcceptChannel orig_conv;
28028         orig_conv.inner = untag_ptr(orig);
28029         orig_conv.is_owned = ptr_is_owned(orig);
28030         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
28031         orig_conv.is_owned = false;
28032         LDKAcceptChannel ret_var = AcceptChannel_clone(&orig_conv);
28033         uint64_t ret_ref = 0;
28034         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28035         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28036         return ret_ref;
28037 }
28038
28039 void  __attribute__((export_name("TS_FundingCreated_free"))) TS_FundingCreated_free(uint64_t this_obj) {
28040         LDKFundingCreated this_obj_conv;
28041         this_obj_conv.inner = untag_ptr(this_obj);
28042         this_obj_conv.is_owned = ptr_is_owned(this_obj);
28043         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
28044         FundingCreated_free(this_obj_conv);
28045 }
28046
28047 int8_tArray  __attribute__((export_name("TS_FundingCreated_get_temporary_channel_id"))) TS_FundingCreated_get_temporary_channel_id(uint64_t this_ptr) {
28048         LDKFundingCreated this_ptr_conv;
28049         this_ptr_conv.inner = untag_ptr(this_ptr);
28050         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28051         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28052         this_ptr_conv.is_owned = false;
28053         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
28054         memcpy(ret_arr->elems, *FundingCreated_get_temporary_channel_id(&this_ptr_conv), 32);
28055         return ret_arr;
28056 }
28057
28058 void  __attribute__((export_name("TS_FundingCreated_set_temporary_channel_id"))) TS_FundingCreated_set_temporary_channel_id(uint64_t this_ptr, int8_tArray val) {
28059         LDKFundingCreated this_ptr_conv;
28060         this_ptr_conv.inner = untag_ptr(this_ptr);
28061         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28062         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28063         this_ptr_conv.is_owned = false;
28064         LDKThirtyTwoBytes val_ref;
28065         CHECK(val->arr_len == 32);
28066         memcpy(val_ref.data, val->elems, 32); FREE(val);
28067         FundingCreated_set_temporary_channel_id(&this_ptr_conv, val_ref);
28068 }
28069
28070 int8_tArray  __attribute__((export_name("TS_FundingCreated_get_funding_txid"))) TS_FundingCreated_get_funding_txid(uint64_t this_ptr) {
28071         LDKFundingCreated this_ptr_conv;
28072         this_ptr_conv.inner = untag_ptr(this_ptr);
28073         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28074         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28075         this_ptr_conv.is_owned = false;
28076         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
28077         memcpy(ret_arr->elems, *FundingCreated_get_funding_txid(&this_ptr_conv), 32);
28078         return ret_arr;
28079 }
28080
28081 void  __attribute__((export_name("TS_FundingCreated_set_funding_txid"))) TS_FundingCreated_set_funding_txid(uint64_t this_ptr, int8_tArray val) {
28082         LDKFundingCreated this_ptr_conv;
28083         this_ptr_conv.inner = untag_ptr(this_ptr);
28084         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28085         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28086         this_ptr_conv.is_owned = false;
28087         LDKThirtyTwoBytes val_ref;
28088         CHECK(val->arr_len == 32);
28089         memcpy(val_ref.data, val->elems, 32); FREE(val);
28090         FundingCreated_set_funding_txid(&this_ptr_conv, val_ref);
28091 }
28092
28093 int16_t  __attribute__((export_name("TS_FundingCreated_get_funding_output_index"))) TS_FundingCreated_get_funding_output_index(uint64_t this_ptr) {
28094         LDKFundingCreated this_ptr_conv;
28095         this_ptr_conv.inner = untag_ptr(this_ptr);
28096         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28097         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28098         this_ptr_conv.is_owned = false;
28099         int16_t ret_conv = FundingCreated_get_funding_output_index(&this_ptr_conv);
28100         return ret_conv;
28101 }
28102
28103 void  __attribute__((export_name("TS_FundingCreated_set_funding_output_index"))) TS_FundingCreated_set_funding_output_index(uint64_t this_ptr, int16_t val) {
28104         LDKFundingCreated this_ptr_conv;
28105         this_ptr_conv.inner = untag_ptr(this_ptr);
28106         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28107         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28108         this_ptr_conv.is_owned = false;
28109         FundingCreated_set_funding_output_index(&this_ptr_conv, val);
28110 }
28111
28112 int8_tArray  __attribute__((export_name("TS_FundingCreated_get_signature"))) TS_FundingCreated_get_signature(uint64_t this_ptr) {
28113         LDKFundingCreated this_ptr_conv;
28114         this_ptr_conv.inner = untag_ptr(this_ptr);
28115         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28116         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28117         this_ptr_conv.is_owned = false;
28118         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
28119         memcpy(ret_arr->elems, FundingCreated_get_signature(&this_ptr_conv).compact_form, 64);
28120         return ret_arr;
28121 }
28122
28123 void  __attribute__((export_name("TS_FundingCreated_set_signature"))) TS_FundingCreated_set_signature(uint64_t this_ptr, int8_tArray val) {
28124         LDKFundingCreated this_ptr_conv;
28125         this_ptr_conv.inner = untag_ptr(this_ptr);
28126         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28127         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28128         this_ptr_conv.is_owned = false;
28129         LDKSignature val_ref;
28130         CHECK(val->arr_len == 64);
28131         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
28132         FundingCreated_set_signature(&this_ptr_conv, val_ref);
28133 }
28134
28135 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) {
28136         LDKThirtyTwoBytes temporary_channel_id_arg_ref;
28137         CHECK(temporary_channel_id_arg->arr_len == 32);
28138         memcpy(temporary_channel_id_arg_ref.data, temporary_channel_id_arg->elems, 32); FREE(temporary_channel_id_arg);
28139         LDKThirtyTwoBytes funding_txid_arg_ref;
28140         CHECK(funding_txid_arg->arr_len == 32);
28141         memcpy(funding_txid_arg_ref.data, funding_txid_arg->elems, 32); FREE(funding_txid_arg);
28142         LDKSignature signature_arg_ref;
28143         CHECK(signature_arg->arr_len == 64);
28144         memcpy(signature_arg_ref.compact_form, signature_arg->elems, 64); FREE(signature_arg);
28145         LDKFundingCreated ret_var = FundingCreated_new(temporary_channel_id_arg_ref, funding_txid_arg_ref, funding_output_index_arg, signature_arg_ref);
28146         uint64_t ret_ref = 0;
28147         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28148         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28149         return ret_ref;
28150 }
28151
28152 static inline uint64_t FundingCreated_clone_ptr(LDKFundingCreated *NONNULL_PTR arg) {
28153         LDKFundingCreated ret_var = FundingCreated_clone(arg);
28154         uint64_t ret_ref = 0;
28155         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28156         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28157         return ret_ref;
28158 }
28159 int64_t  __attribute__((export_name("TS_FundingCreated_clone_ptr"))) TS_FundingCreated_clone_ptr(uint64_t arg) {
28160         LDKFundingCreated arg_conv;
28161         arg_conv.inner = untag_ptr(arg);
28162         arg_conv.is_owned = ptr_is_owned(arg);
28163         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
28164         arg_conv.is_owned = false;
28165         int64_t ret_conv = FundingCreated_clone_ptr(&arg_conv);
28166         return ret_conv;
28167 }
28168
28169 uint64_t  __attribute__((export_name("TS_FundingCreated_clone"))) TS_FundingCreated_clone(uint64_t orig) {
28170         LDKFundingCreated orig_conv;
28171         orig_conv.inner = untag_ptr(orig);
28172         orig_conv.is_owned = ptr_is_owned(orig);
28173         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
28174         orig_conv.is_owned = false;
28175         LDKFundingCreated ret_var = FundingCreated_clone(&orig_conv);
28176         uint64_t ret_ref = 0;
28177         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28178         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28179         return ret_ref;
28180 }
28181
28182 void  __attribute__((export_name("TS_FundingSigned_free"))) TS_FundingSigned_free(uint64_t this_obj) {
28183         LDKFundingSigned this_obj_conv;
28184         this_obj_conv.inner = untag_ptr(this_obj);
28185         this_obj_conv.is_owned = ptr_is_owned(this_obj);
28186         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
28187         FundingSigned_free(this_obj_conv);
28188 }
28189
28190 int8_tArray  __attribute__((export_name("TS_FundingSigned_get_channel_id"))) TS_FundingSigned_get_channel_id(uint64_t this_ptr) {
28191         LDKFundingSigned this_ptr_conv;
28192         this_ptr_conv.inner = untag_ptr(this_ptr);
28193         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28194         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28195         this_ptr_conv.is_owned = false;
28196         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
28197         memcpy(ret_arr->elems, *FundingSigned_get_channel_id(&this_ptr_conv), 32);
28198         return ret_arr;
28199 }
28200
28201 void  __attribute__((export_name("TS_FundingSigned_set_channel_id"))) TS_FundingSigned_set_channel_id(uint64_t this_ptr, int8_tArray val) {
28202         LDKFundingSigned this_ptr_conv;
28203         this_ptr_conv.inner = untag_ptr(this_ptr);
28204         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28205         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28206         this_ptr_conv.is_owned = false;
28207         LDKThirtyTwoBytes val_ref;
28208         CHECK(val->arr_len == 32);
28209         memcpy(val_ref.data, val->elems, 32); FREE(val);
28210         FundingSigned_set_channel_id(&this_ptr_conv, val_ref);
28211 }
28212
28213 int8_tArray  __attribute__((export_name("TS_FundingSigned_get_signature"))) TS_FundingSigned_get_signature(uint64_t this_ptr) {
28214         LDKFundingSigned this_ptr_conv;
28215         this_ptr_conv.inner = untag_ptr(this_ptr);
28216         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28217         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28218         this_ptr_conv.is_owned = false;
28219         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
28220         memcpy(ret_arr->elems, FundingSigned_get_signature(&this_ptr_conv).compact_form, 64);
28221         return ret_arr;
28222 }
28223
28224 void  __attribute__((export_name("TS_FundingSigned_set_signature"))) TS_FundingSigned_set_signature(uint64_t this_ptr, int8_tArray val) {
28225         LDKFundingSigned this_ptr_conv;
28226         this_ptr_conv.inner = untag_ptr(this_ptr);
28227         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28228         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28229         this_ptr_conv.is_owned = false;
28230         LDKSignature val_ref;
28231         CHECK(val->arr_len == 64);
28232         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
28233         FundingSigned_set_signature(&this_ptr_conv, val_ref);
28234 }
28235
28236 uint64_t  __attribute__((export_name("TS_FundingSigned_new"))) TS_FundingSigned_new(int8_tArray channel_id_arg, int8_tArray signature_arg) {
28237         LDKThirtyTwoBytes channel_id_arg_ref;
28238         CHECK(channel_id_arg->arr_len == 32);
28239         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
28240         LDKSignature signature_arg_ref;
28241         CHECK(signature_arg->arr_len == 64);
28242         memcpy(signature_arg_ref.compact_form, signature_arg->elems, 64); FREE(signature_arg);
28243         LDKFundingSigned ret_var = FundingSigned_new(channel_id_arg_ref, signature_arg_ref);
28244         uint64_t ret_ref = 0;
28245         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28246         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28247         return ret_ref;
28248 }
28249
28250 static inline uint64_t FundingSigned_clone_ptr(LDKFundingSigned *NONNULL_PTR arg) {
28251         LDKFundingSigned ret_var = FundingSigned_clone(arg);
28252         uint64_t ret_ref = 0;
28253         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28254         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28255         return ret_ref;
28256 }
28257 int64_t  __attribute__((export_name("TS_FundingSigned_clone_ptr"))) TS_FundingSigned_clone_ptr(uint64_t arg) {
28258         LDKFundingSigned arg_conv;
28259         arg_conv.inner = untag_ptr(arg);
28260         arg_conv.is_owned = ptr_is_owned(arg);
28261         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
28262         arg_conv.is_owned = false;
28263         int64_t ret_conv = FundingSigned_clone_ptr(&arg_conv);
28264         return ret_conv;
28265 }
28266
28267 uint64_t  __attribute__((export_name("TS_FundingSigned_clone"))) TS_FundingSigned_clone(uint64_t orig) {
28268         LDKFundingSigned orig_conv;
28269         orig_conv.inner = untag_ptr(orig);
28270         orig_conv.is_owned = ptr_is_owned(orig);
28271         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
28272         orig_conv.is_owned = false;
28273         LDKFundingSigned ret_var = FundingSigned_clone(&orig_conv);
28274         uint64_t ret_ref = 0;
28275         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28276         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28277         return ret_ref;
28278 }
28279
28280 void  __attribute__((export_name("TS_ChannelReady_free"))) TS_ChannelReady_free(uint64_t this_obj) {
28281         LDKChannelReady this_obj_conv;
28282         this_obj_conv.inner = untag_ptr(this_obj);
28283         this_obj_conv.is_owned = ptr_is_owned(this_obj);
28284         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
28285         ChannelReady_free(this_obj_conv);
28286 }
28287
28288 int8_tArray  __attribute__((export_name("TS_ChannelReady_get_channel_id"))) TS_ChannelReady_get_channel_id(uint64_t this_ptr) {
28289         LDKChannelReady this_ptr_conv;
28290         this_ptr_conv.inner = untag_ptr(this_ptr);
28291         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28292         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28293         this_ptr_conv.is_owned = false;
28294         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
28295         memcpy(ret_arr->elems, *ChannelReady_get_channel_id(&this_ptr_conv), 32);
28296         return ret_arr;
28297 }
28298
28299 void  __attribute__((export_name("TS_ChannelReady_set_channel_id"))) TS_ChannelReady_set_channel_id(uint64_t this_ptr, int8_tArray val) {
28300         LDKChannelReady this_ptr_conv;
28301         this_ptr_conv.inner = untag_ptr(this_ptr);
28302         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28303         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28304         this_ptr_conv.is_owned = false;
28305         LDKThirtyTwoBytes val_ref;
28306         CHECK(val->arr_len == 32);
28307         memcpy(val_ref.data, val->elems, 32); FREE(val);
28308         ChannelReady_set_channel_id(&this_ptr_conv, val_ref);
28309 }
28310
28311 int8_tArray  __attribute__((export_name("TS_ChannelReady_get_next_per_commitment_point"))) TS_ChannelReady_get_next_per_commitment_point(uint64_t this_ptr) {
28312         LDKChannelReady this_ptr_conv;
28313         this_ptr_conv.inner = untag_ptr(this_ptr);
28314         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28315         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28316         this_ptr_conv.is_owned = false;
28317         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
28318         memcpy(ret_arr->elems, ChannelReady_get_next_per_commitment_point(&this_ptr_conv).compressed_form, 33);
28319         return ret_arr;
28320 }
28321
28322 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) {
28323         LDKChannelReady this_ptr_conv;
28324         this_ptr_conv.inner = untag_ptr(this_ptr);
28325         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28326         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28327         this_ptr_conv.is_owned = false;
28328         LDKPublicKey val_ref;
28329         CHECK(val->arr_len == 33);
28330         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
28331         ChannelReady_set_next_per_commitment_point(&this_ptr_conv, val_ref);
28332 }
28333
28334 uint64_t  __attribute__((export_name("TS_ChannelReady_get_short_channel_id_alias"))) TS_ChannelReady_get_short_channel_id_alias(uint64_t this_ptr) {
28335         LDKChannelReady this_ptr_conv;
28336         this_ptr_conv.inner = untag_ptr(this_ptr);
28337         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28338         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28339         this_ptr_conv.is_owned = false;
28340         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
28341         *ret_copy = ChannelReady_get_short_channel_id_alias(&this_ptr_conv);
28342         uint64_t ret_ref = tag_ptr(ret_copy, true);
28343         return ret_ref;
28344 }
28345
28346 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) {
28347         LDKChannelReady this_ptr_conv;
28348         this_ptr_conv.inner = untag_ptr(this_ptr);
28349         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28350         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28351         this_ptr_conv.is_owned = false;
28352         void* val_ptr = untag_ptr(val);
28353         CHECK_ACCESS(val_ptr);
28354         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
28355         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
28356         ChannelReady_set_short_channel_id_alias(&this_ptr_conv, val_conv);
28357 }
28358
28359 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) {
28360         LDKThirtyTwoBytes channel_id_arg_ref;
28361         CHECK(channel_id_arg->arr_len == 32);
28362         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
28363         LDKPublicKey next_per_commitment_point_arg_ref;
28364         CHECK(next_per_commitment_point_arg->arr_len == 33);
28365         memcpy(next_per_commitment_point_arg_ref.compressed_form, next_per_commitment_point_arg->elems, 33); FREE(next_per_commitment_point_arg);
28366         void* short_channel_id_alias_arg_ptr = untag_ptr(short_channel_id_alias_arg);
28367         CHECK_ACCESS(short_channel_id_alias_arg_ptr);
28368         LDKCOption_u64Z short_channel_id_alias_arg_conv = *(LDKCOption_u64Z*)(short_channel_id_alias_arg_ptr);
28369         short_channel_id_alias_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(short_channel_id_alias_arg));
28370         LDKChannelReady ret_var = ChannelReady_new(channel_id_arg_ref, next_per_commitment_point_arg_ref, short_channel_id_alias_arg_conv);
28371         uint64_t ret_ref = 0;
28372         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28373         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28374         return ret_ref;
28375 }
28376
28377 static inline uint64_t ChannelReady_clone_ptr(LDKChannelReady *NONNULL_PTR arg) {
28378         LDKChannelReady ret_var = ChannelReady_clone(arg);
28379         uint64_t ret_ref = 0;
28380         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28381         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28382         return ret_ref;
28383 }
28384 int64_t  __attribute__((export_name("TS_ChannelReady_clone_ptr"))) TS_ChannelReady_clone_ptr(uint64_t arg) {
28385         LDKChannelReady arg_conv;
28386         arg_conv.inner = untag_ptr(arg);
28387         arg_conv.is_owned = ptr_is_owned(arg);
28388         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
28389         arg_conv.is_owned = false;
28390         int64_t ret_conv = ChannelReady_clone_ptr(&arg_conv);
28391         return ret_conv;
28392 }
28393
28394 uint64_t  __attribute__((export_name("TS_ChannelReady_clone"))) TS_ChannelReady_clone(uint64_t orig) {
28395         LDKChannelReady orig_conv;
28396         orig_conv.inner = untag_ptr(orig);
28397         orig_conv.is_owned = ptr_is_owned(orig);
28398         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
28399         orig_conv.is_owned = false;
28400         LDKChannelReady ret_var = ChannelReady_clone(&orig_conv);
28401         uint64_t ret_ref = 0;
28402         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28403         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28404         return ret_ref;
28405 }
28406
28407 void  __attribute__((export_name("TS_Shutdown_free"))) TS_Shutdown_free(uint64_t this_obj) {
28408         LDKShutdown this_obj_conv;
28409         this_obj_conv.inner = untag_ptr(this_obj);
28410         this_obj_conv.is_owned = ptr_is_owned(this_obj);
28411         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
28412         Shutdown_free(this_obj_conv);
28413 }
28414
28415 int8_tArray  __attribute__((export_name("TS_Shutdown_get_channel_id"))) TS_Shutdown_get_channel_id(uint64_t this_ptr) {
28416         LDKShutdown this_ptr_conv;
28417         this_ptr_conv.inner = untag_ptr(this_ptr);
28418         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28419         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28420         this_ptr_conv.is_owned = false;
28421         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
28422         memcpy(ret_arr->elems, *Shutdown_get_channel_id(&this_ptr_conv), 32);
28423         return ret_arr;
28424 }
28425
28426 void  __attribute__((export_name("TS_Shutdown_set_channel_id"))) TS_Shutdown_set_channel_id(uint64_t this_ptr, int8_tArray val) {
28427         LDKShutdown this_ptr_conv;
28428         this_ptr_conv.inner = untag_ptr(this_ptr);
28429         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28430         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28431         this_ptr_conv.is_owned = false;
28432         LDKThirtyTwoBytes val_ref;
28433         CHECK(val->arr_len == 32);
28434         memcpy(val_ref.data, val->elems, 32); FREE(val);
28435         Shutdown_set_channel_id(&this_ptr_conv, val_ref);
28436 }
28437
28438 int8_tArray  __attribute__((export_name("TS_Shutdown_get_scriptpubkey"))) TS_Shutdown_get_scriptpubkey(uint64_t this_ptr) {
28439         LDKShutdown this_ptr_conv;
28440         this_ptr_conv.inner = untag_ptr(this_ptr);
28441         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28442         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28443         this_ptr_conv.is_owned = false;
28444         LDKu8slice ret_var = Shutdown_get_scriptpubkey(&this_ptr_conv);
28445         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
28446         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
28447         return ret_arr;
28448 }
28449
28450 void  __attribute__((export_name("TS_Shutdown_set_scriptpubkey"))) TS_Shutdown_set_scriptpubkey(uint64_t this_ptr, int8_tArray val) {
28451         LDKShutdown this_ptr_conv;
28452         this_ptr_conv.inner = untag_ptr(this_ptr);
28453         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28454         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28455         this_ptr_conv.is_owned = false;
28456         LDKCVec_u8Z val_ref;
28457         val_ref.datalen = val->arr_len;
28458         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
28459         memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
28460         Shutdown_set_scriptpubkey(&this_ptr_conv, val_ref);
28461 }
28462
28463 uint64_t  __attribute__((export_name("TS_Shutdown_new"))) TS_Shutdown_new(int8_tArray channel_id_arg, int8_tArray scriptpubkey_arg) {
28464         LDKThirtyTwoBytes channel_id_arg_ref;
28465         CHECK(channel_id_arg->arr_len == 32);
28466         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
28467         LDKCVec_u8Z scriptpubkey_arg_ref;
28468         scriptpubkey_arg_ref.datalen = scriptpubkey_arg->arr_len;
28469         scriptpubkey_arg_ref.data = MALLOC(scriptpubkey_arg_ref.datalen, "LDKCVec_u8Z Bytes");
28470         memcpy(scriptpubkey_arg_ref.data, scriptpubkey_arg->elems, scriptpubkey_arg_ref.datalen); FREE(scriptpubkey_arg);
28471         LDKShutdown ret_var = Shutdown_new(channel_id_arg_ref, scriptpubkey_arg_ref);
28472         uint64_t ret_ref = 0;
28473         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28474         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28475         return ret_ref;
28476 }
28477
28478 static inline uint64_t Shutdown_clone_ptr(LDKShutdown *NONNULL_PTR arg) {
28479         LDKShutdown ret_var = Shutdown_clone(arg);
28480         uint64_t ret_ref = 0;
28481         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28482         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28483         return ret_ref;
28484 }
28485 int64_t  __attribute__((export_name("TS_Shutdown_clone_ptr"))) TS_Shutdown_clone_ptr(uint64_t arg) {
28486         LDKShutdown arg_conv;
28487         arg_conv.inner = untag_ptr(arg);
28488         arg_conv.is_owned = ptr_is_owned(arg);
28489         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
28490         arg_conv.is_owned = false;
28491         int64_t ret_conv = Shutdown_clone_ptr(&arg_conv);
28492         return ret_conv;
28493 }
28494
28495 uint64_t  __attribute__((export_name("TS_Shutdown_clone"))) TS_Shutdown_clone(uint64_t orig) {
28496         LDKShutdown orig_conv;
28497         orig_conv.inner = untag_ptr(orig);
28498         orig_conv.is_owned = ptr_is_owned(orig);
28499         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
28500         orig_conv.is_owned = false;
28501         LDKShutdown ret_var = Shutdown_clone(&orig_conv);
28502         uint64_t ret_ref = 0;
28503         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28504         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28505         return ret_ref;
28506 }
28507
28508 void  __attribute__((export_name("TS_ClosingSignedFeeRange_free"))) TS_ClosingSignedFeeRange_free(uint64_t this_obj) {
28509         LDKClosingSignedFeeRange this_obj_conv;
28510         this_obj_conv.inner = untag_ptr(this_obj);
28511         this_obj_conv.is_owned = ptr_is_owned(this_obj);
28512         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
28513         ClosingSignedFeeRange_free(this_obj_conv);
28514 }
28515
28516 int64_t  __attribute__((export_name("TS_ClosingSignedFeeRange_get_min_fee_satoshis"))) TS_ClosingSignedFeeRange_get_min_fee_satoshis(uint64_t this_ptr) {
28517         LDKClosingSignedFeeRange this_ptr_conv;
28518         this_ptr_conv.inner = untag_ptr(this_ptr);
28519         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28520         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28521         this_ptr_conv.is_owned = false;
28522         int64_t ret_conv = ClosingSignedFeeRange_get_min_fee_satoshis(&this_ptr_conv);
28523         return ret_conv;
28524 }
28525
28526 void  __attribute__((export_name("TS_ClosingSignedFeeRange_set_min_fee_satoshis"))) TS_ClosingSignedFeeRange_set_min_fee_satoshis(uint64_t this_ptr, int64_t val) {
28527         LDKClosingSignedFeeRange this_ptr_conv;
28528         this_ptr_conv.inner = untag_ptr(this_ptr);
28529         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28530         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28531         this_ptr_conv.is_owned = false;
28532         ClosingSignedFeeRange_set_min_fee_satoshis(&this_ptr_conv, val);
28533 }
28534
28535 int64_t  __attribute__((export_name("TS_ClosingSignedFeeRange_get_max_fee_satoshis"))) TS_ClosingSignedFeeRange_get_max_fee_satoshis(uint64_t this_ptr) {
28536         LDKClosingSignedFeeRange 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         int64_t ret_conv = ClosingSignedFeeRange_get_max_fee_satoshis(&this_ptr_conv);
28542         return ret_conv;
28543 }
28544
28545 void  __attribute__((export_name("TS_ClosingSignedFeeRange_set_max_fee_satoshis"))) TS_ClosingSignedFeeRange_set_max_fee_satoshis(uint64_t this_ptr, int64_t val) {
28546         LDKClosingSignedFeeRange this_ptr_conv;
28547         this_ptr_conv.inner = untag_ptr(this_ptr);
28548         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28549         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28550         this_ptr_conv.is_owned = false;
28551         ClosingSignedFeeRange_set_max_fee_satoshis(&this_ptr_conv, val);
28552 }
28553
28554 uint64_t  __attribute__((export_name("TS_ClosingSignedFeeRange_new"))) TS_ClosingSignedFeeRange_new(int64_t min_fee_satoshis_arg, int64_t max_fee_satoshis_arg) {
28555         LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_new(min_fee_satoshis_arg, max_fee_satoshis_arg);
28556         uint64_t ret_ref = 0;
28557         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28558         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28559         return ret_ref;
28560 }
28561
28562 static inline uint64_t ClosingSignedFeeRange_clone_ptr(LDKClosingSignedFeeRange *NONNULL_PTR arg) {
28563         LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_clone(arg);
28564         uint64_t ret_ref = 0;
28565         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28566         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28567         return ret_ref;
28568 }
28569 int64_t  __attribute__((export_name("TS_ClosingSignedFeeRange_clone_ptr"))) TS_ClosingSignedFeeRange_clone_ptr(uint64_t arg) {
28570         LDKClosingSignedFeeRange arg_conv;
28571         arg_conv.inner = untag_ptr(arg);
28572         arg_conv.is_owned = ptr_is_owned(arg);
28573         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
28574         arg_conv.is_owned = false;
28575         int64_t ret_conv = ClosingSignedFeeRange_clone_ptr(&arg_conv);
28576         return ret_conv;
28577 }
28578
28579 uint64_t  __attribute__((export_name("TS_ClosingSignedFeeRange_clone"))) TS_ClosingSignedFeeRange_clone(uint64_t orig) {
28580         LDKClosingSignedFeeRange orig_conv;
28581         orig_conv.inner = untag_ptr(orig);
28582         orig_conv.is_owned = ptr_is_owned(orig);
28583         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
28584         orig_conv.is_owned = false;
28585         LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_clone(&orig_conv);
28586         uint64_t ret_ref = 0;
28587         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28588         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28589         return ret_ref;
28590 }
28591
28592 void  __attribute__((export_name("TS_ClosingSigned_free"))) TS_ClosingSigned_free(uint64_t this_obj) {
28593         LDKClosingSigned this_obj_conv;
28594         this_obj_conv.inner = untag_ptr(this_obj);
28595         this_obj_conv.is_owned = ptr_is_owned(this_obj);
28596         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
28597         ClosingSigned_free(this_obj_conv);
28598 }
28599
28600 int8_tArray  __attribute__((export_name("TS_ClosingSigned_get_channel_id"))) TS_ClosingSigned_get_channel_id(uint64_t this_ptr) {
28601         LDKClosingSigned this_ptr_conv;
28602         this_ptr_conv.inner = untag_ptr(this_ptr);
28603         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28604         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28605         this_ptr_conv.is_owned = false;
28606         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
28607         memcpy(ret_arr->elems, *ClosingSigned_get_channel_id(&this_ptr_conv), 32);
28608         return ret_arr;
28609 }
28610
28611 void  __attribute__((export_name("TS_ClosingSigned_set_channel_id"))) TS_ClosingSigned_set_channel_id(uint64_t this_ptr, int8_tArray val) {
28612         LDKClosingSigned this_ptr_conv;
28613         this_ptr_conv.inner = untag_ptr(this_ptr);
28614         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28615         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28616         this_ptr_conv.is_owned = false;
28617         LDKThirtyTwoBytes val_ref;
28618         CHECK(val->arr_len == 32);
28619         memcpy(val_ref.data, val->elems, 32); FREE(val);
28620         ClosingSigned_set_channel_id(&this_ptr_conv, val_ref);
28621 }
28622
28623 int64_t  __attribute__((export_name("TS_ClosingSigned_get_fee_satoshis"))) TS_ClosingSigned_get_fee_satoshis(uint64_t this_ptr) {
28624         LDKClosingSigned this_ptr_conv;
28625         this_ptr_conv.inner = untag_ptr(this_ptr);
28626         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28627         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28628         this_ptr_conv.is_owned = false;
28629         int64_t ret_conv = ClosingSigned_get_fee_satoshis(&this_ptr_conv);
28630         return ret_conv;
28631 }
28632
28633 void  __attribute__((export_name("TS_ClosingSigned_set_fee_satoshis"))) TS_ClosingSigned_set_fee_satoshis(uint64_t this_ptr, int64_t val) {
28634         LDKClosingSigned this_ptr_conv;
28635         this_ptr_conv.inner = untag_ptr(this_ptr);
28636         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28637         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28638         this_ptr_conv.is_owned = false;
28639         ClosingSigned_set_fee_satoshis(&this_ptr_conv, val);
28640 }
28641
28642 int8_tArray  __attribute__((export_name("TS_ClosingSigned_get_signature"))) TS_ClosingSigned_get_signature(uint64_t this_ptr) {
28643         LDKClosingSigned this_ptr_conv;
28644         this_ptr_conv.inner = untag_ptr(this_ptr);
28645         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28646         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28647         this_ptr_conv.is_owned = false;
28648         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
28649         memcpy(ret_arr->elems, ClosingSigned_get_signature(&this_ptr_conv).compact_form, 64);
28650         return ret_arr;
28651 }
28652
28653 void  __attribute__((export_name("TS_ClosingSigned_set_signature"))) TS_ClosingSigned_set_signature(uint64_t this_ptr, int8_tArray val) {
28654         LDKClosingSigned this_ptr_conv;
28655         this_ptr_conv.inner = untag_ptr(this_ptr);
28656         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28657         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28658         this_ptr_conv.is_owned = false;
28659         LDKSignature val_ref;
28660         CHECK(val->arr_len == 64);
28661         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
28662         ClosingSigned_set_signature(&this_ptr_conv, val_ref);
28663 }
28664
28665 uint64_t  __attribute__((export_name("TS_ClosingSigned_get_fee_range"))) TS_ClosingSigned_get_fee_range(uint64_t this_ptr) {
28666         LDKClosingSigned this_ptr_conv;
28667         this_ptr_conv.inner = untag_ptr(this_ptr);
28668         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28669         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28670         this_ptr_conv.is_owned = false;
28671         LDKClosingSignedFeeRange ret_var = ClosingSigned_get_fee_range(&this_ptr_conv);
28672         uint64_t ret_ref = 0;
28673         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28674         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28675         return ret_ref;
28676 }
28677
28678 void  __attribute__((export_name("TS_ClosingSigned_set_fee_range"))) TS_ClosingSigned_set_fee_range(uint64_t this_ptr, uint64_t val) {
28679         LDKClosingSigned this_ptr_conv;
28680         this_ptr_conv.inner = untag_ptr(this_ptr);
28681         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28682         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28683         this_ptr_conv.is_owned = false;
28684         LDKClosingSignedFeeRange val_conv;
28685         val_conv.inner = untag_ptr(val);
28686         val_conv.is_owned = ptr_is_owned(val);
28687         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
28688         val_conv = ClosingSignedFeeRange_clone(&val_conv);
28689         ClosingSigned_set_fee_range(&this_ptr_conv, val_conv);
28690 }
28691
28692 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) {
28693         LDKThirtyTwoBytes channel_id_arg_ref;
28694         CHECK(channel_id_arg->arr_len == 32);
28695         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
28696         LDKSignature signature_arg_ref;
28697         CHECK(signature_arg->arr_len == 64);
28698         memcpy(signature_arg_ref.compact_form, signature_arg->elems, 64); FREE(signature_arg);
28699         LDKClosingSignedFeeRange fee_range_arg_conv;
28700         fee_range_arg_conv.inner = untag_ptr(fee_range_arg);
28701         fee_range_arg_conv.is_owned = ptr_is_owned(fee_range_arg);
28702         CHECK_INNER_FIELD_ACCESS_OR_NULL(fee_range_arg_conv);
28703         fee_range_arg_conv = ClosingSignedFeeRange_clone(&fee_range_arg_conv);
28704         LDKClosingSigned ret_var = ClosingSigned_new(channel_id_arg_ref, fee_satoshis_arg, signature_arg_ref, fee_range_arg_conv);
28705         uint64_t ret_ref = 0;
28706         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28707         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28708         return ret_ref;
28709 }
28710
28711 static inline uint64_t ClosingSigned_clone_ptr(LDKClosingSigned *NONNULL_PTR arg) {
28712         LDKClosingSigned ret_var = ClosingSigned_clone(arg);
28713         uint64_t ret_ref = 0;
28714         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28715         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28716         return ret_ref;
28717 }
28718 int64_t  __attribute__((export_name("TS_ClosingSigned_clone_ptr"))) TS_ClosingSigned_clone_ptr(uint64_t arg) {
28719         LDKClosingSigned arg_conv;
28720         arg_conv.inner = untag_ptr(arg);
28721         arg_conv.is_owned = ptr_is_owned(arg);
28722         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
28723         arg_conv.is_owned = false;
28724         int64_t ret_conv = ClosingSigned_clone_ptr(&arg_conv);
28725         return ret_conv;
28726 }
28727
28728 uint64_t  __attribute__((export_name("TS_ClosingSigned_clone"))) TS_ClosingSigned_clone(uint64_t orig) {
28729         LDKClosingSigned orig_conv;
28730         orig_conv.inner = untag_ptr(orig);
28731         orig_conv.is_owned = ptr_is_owned(orig);
28732         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
28733         orig_conv.is_owned = false;
28734         LDKClosingSigned ret_var = ClosingSigned_clone(&orig_conv);
28735         uint64_t ret_ref = 0;
28736         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28737         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28738         return ret_ref;
28739 }
28740
28741 void  __attribute__((export_name("TS_UpdateAddHTLC_free"))) TS_UpdateAddHTLC_free(uint64_t this_obj) {
28742         LDKUpdateAddHTLC this_obj_conv;
28743         this_obj_conv.inner = untag_ptr(this_obj);
28744         this_obj_conv.is_owned = ptr_is_owned(this_obj);
28745         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
28746         UpdateAddHTLC_free(this_obj_conv);
28747 }
28748
28749 int8_tArray  __attribute__((export_name("TS_UpdateAddHTLC_get_channel_id"))) TS_UpdateAddHTLC_get_channel_id(uint64_t this_ptr) {
28750         LDKUpdateAddHTLC this_ptr_conv;
28751         this_ptr_conv.inner = untag_ptr(this_ptr);
28752         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28753         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28754         this_ptr_conv.is_owned = false;
28755         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
28756         memcpy(ret_arr->elems, *UpdateAddHTLC_get_channel_id(&this_ptr_conv), 32);
28757         return ret_arr;
28758 }
28759
28760 void  __attribute__((export_name("TS_UpdateAddHTLC_set_channel_id"))) TS_UpdateAddHTLC_set_channel_id(uint64_t this_ptr, int8_tArray val) {
28761         LDKUpdateAddHTLC this_ptr_conv;
28762         this_ptr_conv.inner = untag_ptr(this_ptr);
28763         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28764         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28765         this_ptr_conv.is_owned = false;
28766         LDKThirtyTwoBytes val_ref;
28767         CHECK(val->arr_len == 32);
28768         memcpy(val_ref.data, val->elems, 32); FREE(val);
28769         UpdateAddHTLC_set_channel_id(&this_ptr_conv, val_ref);
28770 }
28771
28772 int64_t  __attribute__((export_name("TS_UpdateAddHTLC_get_htlc_id"))) TS_UpdateAddHTLC_get_htlc_id(uint64_t this_ptr) {
28773         LDKUpdateAddHTLC this_ptr_conv;
28774         this_ptr_conv.inner = untag_ptr(this_ptr);
28775         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28776         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28777         this_ptr_conv.is_owned = false;
28778         int64_t ret_conv = UpdateAddHTLC_get_htlc_id(&this_ptr_conv);
28779         return ret_conv;
28780 }
28781
28782 void  __attribute__((export_name("TS_UpdateAddHTLC_set_htlc_id"))) TS_UpdateAddHTLC_set_htlc_id(uint64_t this_ptr, int64_t val) {
28783         LDKUpdateAddHTLC this_ptr_conv;
28784         this_ptr_conv.inner = untag_ptr(this_ptr);
28785         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28786         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28787         this_ptr_conv.is_owned = false;
28788         UpdateAddHTLC_set_htlc_id(&this_ptr_conv, val);
28789 }
28790
28791 int64_t  __attribute__((export_name("TS_UpdateAddHTLC_get_amount_msat"))) TS_UpdateAddHTLC_get_amount_msat(uint64_t this_ptr) {
28792         LDKUpdateAddHTLC this_ptr_conv;
28793         this_ptr_conv.inner = untag_ptr(this_ptr);
28794         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28795         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28796         this_ptr_conv.is_owned = false;
28797         int64_t ret_conv = UpdateAddHTLC_get_amount_msat(&this_ptr_conv);
28798         return ret_conv;
28799 }
28800
28801 void  __attribute__((export_name("TS_UpdateAddHTLC_set_amount_msat"))) TS_UpdateAddHTLC_set_amount_msat(uint64_t this_ptr, int64_t val) {
28802         LDKUpdateAddHTLC 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         UpdateAddHTLC_set_amount_msat(&this_ptr_conv, val);
28808 }
28809
28810 int8_tArray  __attribute__((export_name("TS_UpdateAddHTLC_get_payment_hash"))) TS_UpdateAddHTLC_get_payment_hash(uint64_t this_ptr) {
28811         LDKUpdateAddHTLC this_ptr_conv;
28812         this_ptr_conv.inner = untag_ptr(this_ptr);
28813         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28814         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28815         this_ptr_conv.is_owned = false;
28816         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
28817         memcpy(ret_arr->elems, *UpdateAddHTLC_get_payment_hash(&this_ptr_conv), 32);
28818         return ret_arr;
28819 }
28820
28821 void  __attribute__((export_name("TS_UpdateAddHTLC_set_payment_hash"))) TS_UpdateAddHTLC_set_payment_hash(uint64_t this_ptr, int8_tArray val) {
28822         LDKUpdateAddHTLC this_ptr_conv;
28823         this_ptr_conv.inner = untag_ptr(this_ptr);
28824         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28825         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28826         this_ptr_conv.is_owned = false;
28827         LDKThirtyTwoBytes val_ref;
28828         CHECK(val->arr_len == 32);
28829         memcpy(val_ref.data, val->elems, 32); FREE(val);
28830         UpdateAddHTLC_set_payment_hash(&this_ptr_conv, val_ref);
28831 }
28832
28833 int32_t  __attribute__((export_name("TS_UpdateAddHTLC_get_cltv_expiry"))) TS_UpdateAddHTLC_get_cltv_expiry(uint64_t this_ptr) {
28834         LDKUpdateAddHTLC this_ptr_conv;
28835         this_ptr_conv.inner = untag_ptr(this_ptr);
28836         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28837         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28838         this_ptr_conv.is_owned = false;
28839         int32_t ret_conv = UpdateAddHTLC_get_cltv_expiry(&this_ptr_conv);
28840         return ret_conv;
28841 }
28842
28843 void  __attribute__((export_name("TS_UpdateAddHTLC_set_cltv_expiry"))) TS_UpdateAddHTLC_set_cltv_expiry(uint64_t this_ptr, int32_t val) {
28844         LDKUpdateAddHTLC 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         UpdateAddHTLC_set_cltv_expiry(&this_ptr_conv, val);
28850 }
28851
28852 static inline uint64_t UpdateAddHTLC_clone_ptr(LDKUpdateAddHTLC *NONNULL_PTR arg) {
28853         LDKUpdateAddHTLC ret_var = UpdateAddHTLC_clone(arg);
28854         uint64_t ret_ref = 0;
28855         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28856         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28857         return ret_ref;
28858 }
28859 int64_t  __attribute__((export_name("TS_UpdateAddHTLC_clone_ptr"))) TS_UpdateAddHTLC_clone_ptr(uint64_t arg) {
28860         LDKUpdateAddHTLC arg_conv;
28861         arg_conv.inner = untag_ptr(arg);
28862         arg_conv.is_owned = ptr_is_owned(arg);
28863         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
28864         arg_conv.is_owned = false;
28865         int64_t ret_conv = UpdateAddHTLC_clone_ptr(&arg_conv);
28866         return ret_conv;
28867 }
28868
28869 uint64_t  __attribute__((export_name("TS_UpdateAddHTLC_clone"))) TS_UpdateAddHTLC_clone(uint64_t orig) {
28870         LDKUpdateAddHTLC orig_conv;
28871         orig_conv.inner = untag_ptr(orig);
28872         orig_conv.is_owned = ptr_is_owned(orig);
28873         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
28874         orig_conv.is_owned = false;
28875         LDKUpdateAddHTLC ret_var = UpdateAddHTLC_clone(&orig_conv);
28876         uint64_t ret_ref = 0;
28877         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28878         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28879         return ret_ref;
28880 }
28881
28882 void  __attribute__((export_name("TS_UpdateFulfillHTLC_free"))) TS_UpdateFulfillHTLC_free(uint64_t this_obj) {
28883         LDKUpdateFulfillHTLC this_obj_conv;
28884         this_obj_conv.inner = untag_ptr(this_obj);
28885         this_obj_conv.is_owned = ptr_is_owned(this_obj);
28886         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
28887         UpdateFulfillHTLC_free(this_obj_conv);
28888 }
28889
28890 int8_tArray  __attribute__((export_name("TS_UpdateFulfillHTLC_get_channel_id"))) TS_UpdateFulfillHTLC_get_channel_id(uint64_t this_ptr) {
28891         LDKUpdateFulfillHTLC this_ptr_conv;
28892         this_ptr_conv.inner = untag_ptr(this_ptr);
28893         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28894         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28895         this_ptr_conv.is_owned = false;
28896         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
28897         memcpy(ret_arr->elems, *UpdateFulfillHTLC_get_channel_id(&this_ptr_conv), 32);
28898         return ret_arr;
28899 }
28900
28901 void  __attribute__((export_name("TS_UpdateFulfillHTLC_set_channel_id"))) TS_UpdateFulfillHTLC_set_channel_id(uint64_t this_ptr, int8_tArray val) {
28902         LDKUpdateFulfillHTLC this_ptr_conv;
28903         this_ptr_conv.inner = untag_ptr(this_ptr);
28904         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28905         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28906         this_ptr_conv.is_owned = false;
28907         LDKThirtyTwoBytes val_ref;
28908         CHECK(val->arr_len == 32);
28909         memcpy(val_ref.data, val->elems, 32); FREE(val);
28910         UpdateFulfillHTLC_set_channel_id(&this_ptr_conv, val_ref);
28911 }
28912
28913 int64_t  __attribute__((export_name("TS_UpdateFulfillHTLC_get_htlc_id"))) TS_UpdateFulfillHTLC_get_htlc_id(uint64_t this_ptr) {
28914         LDKUpdateFulfillHTLC this_ptr_conv;
28915         this_ptr_conv.inner = untag_ptr(this_ptr);
28916         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28917         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28918         this_ptr_conv.is_owned = false;
28919         int64_t ret_conv = UpdateFulfillHTLC_get_htlc_id(&this_ptr_conv);
28920         return ret_conv;
28921 }
28922
28923 void  __attribute__((export_name("TS_UpdateFulfillHTLC_set_htlc_id"))) TS_UpdateFulfillHTLC_set_htlc_id(uint64_t this_ptr, int64_t val) {
28924         LDKUpdateFulfillHTLC this_ptr_conv;
28925         this_ptr_conv.inner = untag_ptr(this_ptr);
28926         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28927         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28928         this_ptr_conv.is_owned = false;
28929         UpdateFulfillHTLC_set_htlc_id(&this_ptr_conv, val);
28930 }
28931
28932 int8_tArray  __attribute__((export_name("TS_UpdateFulfillHTLC_get_payment_preimage"))) TS_UpdateFulfillHTLC_get_payment_preimage(uint64_t this_ptr) {
28933         LDKUpdateFulfillHTLC this_ptr_conv;
28934         this_ptr_conv.inner = untag_ptr(this_ptr);
28935         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28936         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28937         this_ptr_conv.is_owned = false;
28938         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
28939         memcpy(ret_arr->elems, *UpdateFulfillHTLC_get_payment_preimage(&this_ptr_conv), 32);
28940         return ret_arr;
28941 }
28942
28943 void  __attribute__((export_name("TS_UpdateFulfillHTLC_set_payment_preimage"))) TS_UpdateFulfillHTLC_set_payment_preimage(uint64_t this_ptr, int8_tArray val) {
28944         LDKUpdateFulfillHTLC this_ptr_conv;
28945         this_ptr_conv.inner = untag_ptr(this_ptr);
28946         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28947         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28948         this_ptr_conv.is_owned = false;
28949         LDKThirtyTwoBytes val_ref;
28950         CHECK(val->arr_len == 32);
28951         memcpy(val_ref.data, val->elems, 32); FREE(val);
28952         UpdateFulfillHTLC_set_payment_preimage(&this_ptr_conv, val_ref);
28953 }
28954
28955 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) {
28956         LDKThirtyTwoBytes channel_id_arg_ref;
28957         CHECK(channel_id_arg->arr_len == 32);
28958         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
28959         LDKThirtyTwoBytes payment_preimage_arg_ref;
28960         CHECK(payment_preimage_arg->arr_len == 32);
28961         memcpy(payment_preimage_arg_ref.data, payment_preimage_arg->elems, 32); FREE(payment_preimage_arg);
28962         LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_new(channel_id_arg_ref, htlc_id_arg, payment_preimage_arg_ref);
28963         uint64_t ret_ref = 0;
28964         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28965         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28966         return ret_ref;
28967 }
28968
28969 static inline uint64_t UpdateFulfillHTLC_clone_ptr(LDKUpdateFulfillHTLC *NONNULL_PTR arg) {
28970         LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_clone(arg);
28971         uint64_t ret_ref = 0;
28972         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28973         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28974         return ret_ref;
28975 }
28976 int64_t  __attribute__((export_name("TS_UpdateFulfillHTLC_clone_ptr"))) TS_UpdateFulfillHTLC_clone_ptr(uint64_t arg) {
28977         LDKUpdateFulfillHTLC arg_conv;
28978         arg_conv.inner = untag_ptr(arg);
28979         arg_conv.is_owned = ptr_is_owned(arg);
28980         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
28981         arg_conv.is_owned = false;
28982         int64_t ret_conv = UpdateFulfillHTLC_clone_ptr(&arg_conv);
28983         return ret_conv;
28984 }
28985
28986 uint64_t  __attribute__((export_name("TS_UpdateFulfillHTLC_clone"))) TS_UpdateFulfillHTLC_clone(uint64_t orig) {
28987         LDKUpdateFulfillHTLC orig_conv;
28988         orig_conv.inner = untag_ptr(orig);
28989         orig_conv.is_owned = ptr_is_owned(orig);
28990         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
28991         orig_conv.is_owned = false;
28992         LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_clone(&orig_conv);
28993         uint64_t ret_ref = 0;
28994         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28995         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28996         return ret_ref;
28997 }
28998
28999 void  __attribute__((export_name("TS_UpdateFailHTLC_free"))) TS_UpdateFailHTLC_free(uint64_t this_obj) {
29000         LDKUpdateFailHTLC this_obj_conv;
29001         this_obj_conv.inner = untag_ptr(this_obj);
29002         this_obj_conv.is_owned = ptr_is_owned(this_obj);
29003         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
29004         UpdateFailHTLC_free(this_obj_conv);
29005 }
29006
29007 int8_tArray  __attribute__((export_name("TS_UpdateFailHTLC_get_channel_id"))) TS_UpdateFailHTLC_get_channel_id(uint64_t this_ptr) {
29008         LDKUpdateFailHTLC this_ptr_conv;
29009         this_ptr_conv.inner = untag_ptr(this_ptr);
29010         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29011         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29012         this_ptr_conv.is_owned = false;
29013         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
29014         memcpy(ret_arr->elems, *UpdateFailHTLC_get_channel_id(&this_ptr_conv), 32);
29015         return ret_arr;
29016 }
29017
29018 void  __attribute__((export_name("TS_UpdateFailHTLC_set_channel_id"))) TS_UpdateFailHTLC_set_channel_id(uint64_t this_ptr, int8_tArray val) {
29019         LDKUpdateFailHTLC this_ptr_conv;
29020         this_ptr_conv.inner = untag_ptr(this_ptr);
29021         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29022         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29023         this_ptr_conv.is_owned = false;
29024         LDKThirtyTwoBytes val_ref;
29025         CHECK(val->arr_len == 32);
29026         memcpy(val_ref.data, val->elems, 32); FREE(val);
29027         UpdateFailHTLC_set_channel_id(&this_ptr_conv, val_ref);
29028 }
29029
29030 int64_t  __attribute__((export_name("TS_UpdateFailHTLC_get_htlc_id"))) TS_UpdateFailHTLC_get_htlc_id(uint64_t this_ptr) {
29031         LDKUpdateFailHTLC this_ptr_conv;
29032         this_ptr_conv.inner = untag_ptr(this_ptr);
29033         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29034         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29035         this_ptr_conv.is_owned = false;
29036         int64_t ret_conv = UpdateFailHTLC_get_htlc_id(&this_ptr_conv);
29037         return ret_conv;
29038 }
29039
29040 void  __attribute__((export_name("TS_UpdateFailHTLC_set_htlc_id"))) TS_UpdateFailHTLC_set_htlc_id(uint64_t this_ptr, int64_t val) {
29041         LDKUpdateFailHTLC this_ptr_conv;
29042         this_ptr_conv.inner = untag_ptr(this_ptr);
29043         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29044         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29045         this_ptr_conv.is_owned = false;
29046         UpdateFailHTLC_set_htlc_id(&this_ptr_conv, val);
29047 }
29048
29049 static inline uint64_t UpdateFailHTLC_clone_ptr(LDKUpdateFailHTLC *NONNULL_PTR arg) {
29050         LDKUpdateFailHTLC ret_var = UpdateFailHTLC_clone(arg);
29051         uint64_t ret_ref = 0;
29052         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29053         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29054         return ret_ref;
29055 }
29056 int64_t  __attribute__((export_name("TS_UpdateFailHTLC_clone_ptr"))) TS_UpdateFailHTLC_clone_ptr(uint64_t arg) {
29057         LDKUpdateFailHTLC arg_conv;
29058         arg_conv.inner = untag_ptr(arg);
29059         arg_conv.is_owned = ptr_is_owned(arg);
29060         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
29061         arg_conv.is_owned = false;
29062         int64_t ret_conv = UpdateFailHTLC_clone_ptr(&arg_conv);
29063         return ret_conv;
29064 }
29065
29066 uint64_t  __attribute__((export_name("TS_UpdateFailHTLC_clone"))) TS_UpdateFailHTLC_clone(uint64_t orig) {
29067         LDKUpdateFailHTLC orig_conv;
29068         orig_conv.inner = untag_ptr(orig);
29069         orig_conv.is_owned = ptr_is_owned(orig);
29070         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
29071         orig_conv.is_owned = false;
29072         LDKUpdateFailHTLC ret_var = UpdateFailHTLC_clone(&orig_conv);
29073         uint64_t ret_ref = 0;
29074         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29075         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29076         return ret_ref;
29077 }
29078
29079 void  __attribute__((export_name("TS_UpdateFailMalformedHTLC_free"))) TS_UpdateFailMalformedHTLC_free(uint64_t this_obj) {
29080         LDKUpdateFailMalformedHTLC this_obj_conv;
29081         this_obj_conv.inner = untag_ptr(this_obj);
29082         this_obj_conv.is_owned = ptr_is_owned(this_obj);
29083         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
29084         UpdateFailMalformedHTLC_free(this_obj_conv);
29085 }
29086
29087 int8_tArray  __attribute__((export_name("TS_UpdateFailMalformedHTLC_get_channel_id"))) TS_UpdateFailMalformedHTLC_get_channel_id(uint64_t this_ptr) {
29088         LDKUpdateFailMalformedHTLC this_ptr_conv;
29089         this_ptr_conv.inner = untag_ptr(this_ptr);
29090         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29091         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29092         this_ptr_conv.is_owned = false;
29093         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
29094         memcpy(ret_arr->elems, *UpdateFailMalformedHTLC_get_channel_id(&this_ptr_conv), 32);
29095         return ret_arr;
29096 }
29097
29098 void  __attribute__((export_name("TS_UpdateFailMalformedHTLC_set_channel_id"))) TS_UpdateFailMalformedHTLC_set_channel_id(uint64_t this_ptr, int8_tArray val) {
29099         LDKUpdateFailMalformedHTLC this_ptr_conv;
29100         this_ptr_conv.inner = untag_ptr(this_ptr);
29101         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29102         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29103         this_ptr_conv.is_owned = false;
29104         LDKThirtyTwoBytes val_ref;
29105         CHECK(val->arr_len == 32);
29106         memcpy(val_ref.data, val->elems, 32); FREE(val);
29107         UpdateFailMalformedHTLC_set_channel_id(&this_ptr_conv, val_ref);
29108 }
29109
29110 int64_t  __attribute__((export_name("TS_UpdateFailMalformedHTLC_get_htlc_id"))) TS_UpdateFailMalformedHTLC_get_htlc_id(uint64_t this_ptr) {
29111         LDKUpdateFailMalformedHTLC this_ptr_conv;
29112         this_ptr_conv.inner = untag_ptr(this_ptr);
29113         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29114         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29115         this_ptr_conv.is_owned = false;
29116         int64_t ret_conv = UpdateFailMalformedHTLC_get_htlc_id(&this_ptr_conv);
29117         return ret_conv;
29118 }
29119
29120 void  __attribute__((export_name("TS_UpdateFailMalformedHTLC_set_htlc_id"))) TS_UpdateFailMalformedHTLC_set_htlc_id(uint64_t this_ptr, int64_t val) {
29121         LDKUpdateFailMalformedHTLC this_ptr_conv;
29122         this_ptr_conv.inner = untag_ptr(this_ptr);
29123         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29124         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29125         this_ptr_conv.is_owned = false;
29126         UpdateFailMalformedHTLC_set_htlc_id(&this_ptr_conv, val);
29127 }
29128
29129 int16_t  __attribute__((export_name("TS_UpdateFailMalformedHTLC_get_failure_code"))) TS_UpdateFailMalformedHTLC_get_failure_code(uint64_t this_ptr) {
29130         LDKUpdateFailMalformedHTLC this_ptr_conv;
29131         this_ptr_conv.inner = untag_ptr(this_ptr);
29132         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29133         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29134         this_ptr_conv.is_owned = false;
29135         int16_t ret_conv = UpdateFailMalformedHTLC_get_failure_code(&this_ptr_conv);
29136         return ret_conv;
29137 }
29138
29139 void  __attribute__((export_name("TS_UpdateFailMalformedHTLC_set_failure_code"))) TS_UpdateFailMalformedHTLC_set_failure_code(uint64_t this_ptr, int16_t val) {
29140         LDKUpdateFailMalformedHTLC this_ptr_conv;
29141         this_ptr_conv.inner = untag_ptr(this_ptr);
29142         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29143         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29144         this_ptr_conv.is_owned = false;
29145         UpdateFailMalformedHTLC_set_failure_code(&this_ptr_conv, val);
29146 }
29147
29148 static inline uint64_t UpdateFailMalformedHTLC_clone_ptr(LDKUpdateFailMalformedHTLC *NONNULL_PTR arg) {
29149         LDKUpdateFailMalformedHTLC ret_var = UpdateFailMalformedHTLC_clone(arg);
29150         uint64_t ret_ref = 0;
29151         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29152         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29153         return ret_ref;
29154 }
29155 int64_t  __attribute__((export_name("TS_UpdateFailMalformedHTLC_clone_ptr"))) TS_UpdateFailMalformedHTLC_clone_ptr(uint64_t arg) {
29156         LDKUpdateFailMalformedHTLC arg_conv;
29157         arg_conv.inner = untag_ptr(arg);
29158         arg_conv.is_owned = ptr_is_owned(arg);
29159         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
29160         arg_conv.is_owned = false;
29161         int64_t ret_conv = UpdateFailMalformedHTLC_clone_ptr(&arg_conv);
29162         return ret_conv;
29163 }
29164
29165 uint64_t  __attribute__((export_name("TS_UpdateFailMalformedHTLC_clone"))) TS_UpdateFailMalformedHTLC_clone(uint64_t orig) {
29166         LDKUpdateFailMalformedHTLC orig_conv;
29167         orig_conv.inner = untag_ptr(orig);
29168         orig_conv.is_owned = ptr_is_owned(orig);
29169         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
29170         orig_conv.is_owned = false;
29171         LDKUpdateFailMalformedHTLC ret_var = UpdateFailMalformedHTLC_clone(&orig_conv);
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
29178 void  __attribute__((export_name("TS_CommitmentSigned_free"))) TS_CommitmentSigned_free(uint64_t this_obj) {
29179         LDKCommitmentSigned this_obj_conv;
29180         this_obj_conv.inner = untag_ptr(this_obj);
29181         this_obj_conv.is_owned = ptr_is_owned(this_obj);
29182         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
29183         CommitmentSigned_free(this_obj_conv);
29184 }
29185
29186 int8_tArray  __attribute__((export_name("TS_CommitmentSigned_get_channel_id"))) TS_CommitmentSigned_get_channel_id(uint64_t this_ptr) {
29187         LDKCommitmentSigned this_ptr_conv;
29188         this_ptr_conv.inner = untag_ptr(this_ptr);
29189         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29190         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29191         this_ptr_conv.is_owned = false;
29192         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
29193         memcpy(ret_arr->elems, *CommitmentSigned_get_channel_id(&this_ptr_conv), 32);
29194         return ret_arr;
29195 }
29196
29197 void  __attribute__((export_name("TS_CommitmentSigned_set_channel_id"))) TS_CommitmentSigned_set_channel_id(uint64_t this_ptr, int8_tArray val) {
29198         LDKCommitmentSigned this_ptr_conv;
29199         this_ptr_conv.inner = untag_ptr(this_ptr);
29200         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29201         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29202         this_ptr_conv.is_owned = false;
29203         LDKThirtyTwoBytes val_ref;
29204         CHECK(val->arr_len == 32);
29205         memcpy(val_ref.data, val->elems, 32); FREE(val);
29206         CommitmentSigned_set_channel_id(&this_ptr_conv, val_ref);
29207 }
29208
29209 int8_tArray  __attribute__((export_name("TS_CommitmentSigned_get_signature"))) TS_CommitmentSigned_get_signature(uint64_t this_ptr) {
29210         LDKCommitmentSigned this_ptr_conv;
29211         this_ptr_conv.inner = untag_ptr(this_ptr);
29212         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29213         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29214         this_ptr_conv.is_owned = false;
29215         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
29216         memcpy(ret_arr->elems, CommitmentSigned_get_signature(&this_ptr_conv).compact_form, 64);
29217         return ret_arr;
29218 }
29219
29220 void  __attribute__((export_name("TS_CommitmentSigned_set_signature"))) TS_CommitmentSigned_set_signature(uint64_t this_ptr, int8_tArray val) {
29221         LDKCommitmentSigned this_ptr_conv;
29222         this_ptr_conv.inner = untag_ptr(this_ptr);
29223         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29224         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29225         this_ptr_conv.is_owned = false;
29226         LDKSignature val_ref;
29227         CHECK(val->arr_len == 64);
29228         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
29229         CommitmentSigned_set_signature(&this_ptr_conv, val_ref);
29230 }
29231
29232 ptrArray  __attribute__((export_name("TS_CommitmentSigned_get_htlc_signatures"))) TS_CommitmentSigned_get_htlc_signatures(uint64_t this_ptr) {
29233         LDKCommitmentSigned this_ptr_conv;
29234         this_ptr_conv.inner = untag_ptr(this_ptr);
29235         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29236         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29237         this_ptr_conv.is_owned = false;
29238         LDKCVec_SignatureZ ret_var = CommitmentSigned_get_htlc_signatures(&this_ptr_conv);
29239         ptrArray ret_arr = NULL;
29240         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
29241         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
29242         for (size_t m = 0; m < ret_var.datalen; m++) {
29243                 int8_tArray ret_conv_12_arr = init_int8_tArray(64, __LINE__);
29244                 memcpy(ret_conv_12_arr->elems, ret_var.data[m].compact_form, 64);
29245                 ret_arr_ptr[m] = ret_conv_12_arr;
29246         }
29247         
29248         FREE(ret_var.data);
29249         return ret_arr;
29250 }
29251
29252 void  __attribute__((export_name("TS_CommitmentSigned_set_htlc_signatures"))) TS_CommitmentSigned_set_htlc_signatures(uint64_t this_ptr, ptrArray val) {
29253         LDKCommitmentSigned this_ptr_conv;
29254         this_ptr_conv.inner = untag_ptr(this_ptr);
29255         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29256         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29257         this_ptr_conv.is_owned = false;
29258         LDKCVec_SignatureZ val_constr;
29259         val_constr.datalen = val->arr_len;
29260         if (val_constr.datalen > 0)
29261                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
29262         else
29263                 val_constr.data = NULL;
29264         int8_tArray* val_vals = (void*) val->elems;
29265         for (size_t m = 0; m < val_constr.datalen; m++) {
29266                 int8_tArray val_conv_12 = val_vals[m];
29267                 LDKSignature val_conv_12_ref;
29268                 CHECK(val_conv_12->arr_len == 64);
29269                 memcpy(val_conv_12_ref.compact_form, val_conv_12->elems, 64); FREE(val_conv_12);
29270                 val_constr.data[m] = val_conv_12_ref;
29271         }
29272         FREE(val);
29273         CommitmentSigned_set_htlc_signatures(&this_ptr_conv, val_constr);
29274 }
29275
29276 uint64_t  __attribute__((export_name("TS_CommitmentSigned_new"))) TS_CommitmentSigned_new(int8_tArray channel_id_arg, int8_tArray signature_arg, ptrArray htlc_signatures_arg) {
29277         LDKThirtyTwoBytes channel_id_arg_ref;
29278         CHECK(channel_id_arg->arr_len == 32);
29279         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
29280         LDKSignature signature_arg_ref;
29281         CHECK(signature_arg->arr_len == 64);
29282         memcpy(signature_arg_ref.compact_form, signature_arg->elems, 64); FREE(signature_arg);
29283         LDKCVec_SignatureZ htlc_signatures_arg_constr;
29284         htlc_signatures_arg_constr.datalen = htlc_signatures_arg->arr_len;
29285         if (htlc_signatures_arg_constr.datalen > 0)
29286                 htlc_signatures_arg_constr.data = MALLOC(htlc_signatures_arg_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
29287         else
29288                 htlc_signatures_arg_constr.data = NULL;
29289         int8_tArray* htlc_signatures_arg_vals = (void*) htlc_signatures_arg->elems;
29290         for (size_t m = 0; m < htlc_signatures_arg_constr.datalen; m++) {
29291                 int8_tArray htlc_signatures_arg_conv_12 = htlc_signatures_arg_vals[m];
29292                 LDKSignature htlc_signatures_arg_conv_12_ref;
29293                 CHECK(htlc_signatures_arg_conv_12->arr_len == 64);
29294                 memcpy(htlc_signatures_arg_conv_12_ref.compact_form, htlc_signatures_arg_conv_12->elems, 64); FREE(htlc_signatures_arg_conv_12);
29295                 htlc_signatures_arg_constr.data[m] = htlc_signatures_arg_conv_12_ref;
29296         }
29297         FREE(htlc_signatures_arg);
29298         LDKCommitmentSigned ret_var = CommitmentSigned_new(channel_id_arg_ref, signature_arg_ref, htlc_signatures_arg_constr);
29299         uint64_t ret_ref = 0;
29300         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29301         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29302         return ret_ref;
29303 }
29304
29305 static inline uint64_t CommitmentSigned_clone_ptr(LDKCommitmentSigned *NONNULL_PTR arg) {
29306         LDKCommitmentSigned ret_var = CommitmentSigned_clone(arg);
29307         uint64_t ret_ref = 0;
29308         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29309         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29310         return ret_ref;
29311 }
29312 int64_t  __attribute__((export_name("TS_CommitmentSigned_clone_ptr"))) TS_CommitmentSigned_clone_ptr(uint64_t arg) {
29313         LDKCommitmentSigned arg_conv;
29314         arg_conv.inner = untag_ptr(arg);
29315         arg_conv.is_owned = ptr_is_owned(arg);
29316         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
29317         arg_conv.is_owned = false;
29318         int64_t ret_conv = CommitmentSigned_clone_ptr(&arg_conv);
29319         return ret_conv;
29320 }
29321
29322 uint64_t  __attribute__((export_name("TS_CommitmentSigned_clone"))) TS_CommitmentSigned_clone(uint64_t orig) {
29323         LDKCommitmentSigned orig_conv;
29324         orig_conv.inner = untag_ptr(orig);
29325         orig_conv.is_owned = ptr_is_owned(orig);
29326         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
29327         orig_conv.is_owned = false;
29328         LDKCommitmentSigned ret_var = CommitmentSigned_clone(&orig_conv);
29329         uint64_t ret_ref = 0;
29330         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29331         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29332         return ret_ref;
29333 }
29334
29335 void  __attribute__((export_name("TS_RevokeAndACK_free"))) TS_RevokeAndACK_free(uint64_t this_obj) {
29336         LDKRevokeAndACK this_obj_conv;
29337         this_obj_conv.inner = untag_ptr(this_obj);
29338         this_obj_conv.is_owned = ptr_is_owned(this_obj);
29339         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
29340         RevokeAndACK_free(this_obj_conv);
29341 }
29342
29343 int8_tArray  __attribute__((export_name("TS_RevokeAndACK_get_channel_id"))) TS_RevokeAndACK_get_channel_id(uint64_t this_ptr) {
29344         LDKRevokeAndACK this_ptr_conv;
29345         this_ptr_conv.inner = untag_ptr(this_ptr);
29346         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29347         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29348         this_ptr_conv.is_owned = false;
29349         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
29350         memcpy(ret_arr->elems, *RevokeAndACK_get_channel_id(&this_ptr_conv), 32);
29351         return ret_arr;
29352 }
29353
29354 void  __attribute__((export_name("TS_RevokeAndACK_set_channel_id"))) TS_RevokeAndACK_set_channel_id(uint64_t this_ptr, int8_tArray val) {
29355         LDKRevokeAndACK this_ptr_conv;
29356         this_ptr_conv.inner = untag_ptr(this_ptr);
29357         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29358         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29359         this_ptr_conv.is_owned = false;
29360         LDKThirtyTwoBytes val_ref;
29361         CHECK(val->arr_len == 32);
29362         memcpy(val_ref.data, val->elems, 32); FREE(val);
29363         RevokeAndACK_set_channel_id(&this_ptr_conv, val_ref);
29364 }
29365
29366 int8_tArray  __attribute__((export_name("TS_RevokeAndACK_get_per_commitment_secret"))) TS_RevokeAndACK_get_per_commitment_secret(uint64_t this_ptr) {
29367         LDKRevokeAndACK this_ptr_conv;
29368         this_ptr_conv.inner = untag_ptr(this_ptr);
29369         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29370         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29371         this_ptr_conv.is_owned = false;
29372         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
29373         memcpy(ret_arr->elems, *RevokeAndACK_get_per_commitment_secret(&this_ptr_conv), 32);
29374         return ret_arr;
29375 }
29376
29377 void  __attribute__((export_name("TS_RevokeAndACK_set_per_commitment_secret"))) TS_RevokeAndACK_set_per_commitment_secret(uint64_t this_ptr, int8_tArray val) {
29378         LDKRevokeAndACK this_ptr_conv;
29379         this_ptr_conv.inner = untag_ptr(this_ptr);
29380         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29381         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29382         this_ptr_conv.is_owned = false;
29383         LDKThirtyTwoBytes val_ref;
29384         CHECK(val->arr_len == 32);
29385         memcpy(val_ref.data, val->elems, 32); FREE(val);
29386         RevokeAndACK_set_per_commitment_secret(&this_ptr_conv, val_ref);
29387 }
29388
29389 int8_tArray  __attribute__((export_name("TS_RevokeAndACK_get_next_per_commitment_point"))) TS_RevokeAndACK_get_next_per_commitment_point(uint64_t this_ptr) {
29390         LDKRevokeAndACK this_ptr_conv;
29391         this_ptr_conv.inner = untag_ptr(this_ptr);
29392         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29393         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29394         this_ptr_conv.is_owned = false;
29395         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
29396         memcpy(ret_arr->elems, RevokeAndACK_get_next_per_commitment_point(&this_ptr_conv).compressed_form, 33);
29397         return ret_arr;
29398 }
29399
29400 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) {
29401         LDKRevokeAndACK this_ptr_conv;
29402         this_ptr_conv.inner = untag_ptr(this_ptr);
29403         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29404         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29405         this_ptr_conv.is_owned = false;
29406         LDKPublicKey val_ref;
29407         CHECK(val->arr_len == 33);
29408         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
29409         RevokeAndACK_set_next_per_commitment_point(&this_ptr_conv, val_ref);
29410 }
29411
29412 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) {
29413         LDKThirtyTwoBytes channel_id_arg_ref;
29414         CHECK(channel_id_arg->arr_len == 32);
29415         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
29416         LDKThirtyTwoBytes per_commitment_secret_arg_ref;
29417         CHECK(per_commitment_secret_arg->arr_len == 32);
29418         memcpy(per_commitment_secret_arg_ref.data, per_commitment_secret_arg->elems, 32); FREE(per_commitment_secret_arg);
29419         LDKPublicKey next_per_commitment_point_arg_ref;
29420         CHECK(next_per_commitment_point_arg->arr_len == 33);
29421         memcpy(next_per_commitment_point_arg_ref.compressed_form, next_per_commitment_point_arg->elems, 33); FREE(next_per_commitment_point_arg);
29422         LDKRevokeAndACK ret_var = RevokeAndACK_new(channel_id_arg_ref, per_commitment_secret_arg_ref, next_per_commitment_point_arg_ref);
29423         uint64_t ret_ref = 0;
29424         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29425         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29426         return ret_ref;
29427 }
29428
29429 static inline uint64_t RevokeAndACK_clone_ptr(LDKRevokeAndACK *NONNULL_PTR arg) {
29430         LDKRevokeAndACK ret_var = RevokeAndACK_clone(arg);
29431         uint64_t ret_ref = 0;
29432         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29433         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29434         return ret_ref;
29435 }
29436 int64_t  __attribute__((export_name("TS_RevokeAndACK_clone_ptr"))) TS_RevokeAndACK_clone_ptr(uint64_t arg) {
29437         LDKRevokeAndACK arg_conv;
29438         arg_conv.inner = untag_ptr(arg);
29439         arg_conv.is_owned = ptr_is_owned(arg);
29440         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
29441         arg_conv.is_owned = false;
29442         int64_t ret_conv = RevokeAndACK_clone_ptr(&arg_conv);
29443         return ret_conv;
29444 }
29445
29446 uint64_t  __attribute__((export_name("TS_RevokeAndACK_clone"))) TS_RevokeAndACK_clone(uint64_t orig) {
29447         LDKRevokeAndACK orig_conv;
29448         orig_conv.inner = untag_ptr(orig);
29449         orig_conv.is_owned = ptr_is_owned(orig);
29450         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
29451         orig_conv.is_owned = false;
29452         LDKRevokeAndACK ret_var = RevokeAndACK_clone(&orig_conv);
29453         uint64_t ret_ref = 0;
29454         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29455         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29456         return ret_ref;
29457 }
29458
29459 void  __attribute__((export_name("TS_UpdateFee_free"))) TS_UpdateFee_free(uint64_t this_obj) {
29460         LDKUpdateFee this_obj_conv;
29461         this_obj_conv.inner = untag_ptr(this_obj);
29462         this_obj_conv.is_owned = ptr_is_owned(this_obj);
29463         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
29464         UpdateFee_free(this_obj_conv);
29465 }
29466
29467 int8_tArray  __attribute__((export_name("TS_UpdateFee_get_channel_id"))) TS_UpdateFee_get_channel_id(uint64_t this_ptr) {
29468         LDKUpdateFee this_ptr_conv;
29469         this_ptr_conv.inner = untag_ptr(this_ptr);
29470         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29471         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29472         this_ptr_conv.is_owned = false;
29473         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
29474         memcpy(ret_arr->elems, *UpdateFee_get_channel_id(&this_ptr_conv), 32);
29475         return ret_arr;
29476 }
29477
29478 void  __attribute__((export_name("TS_UpdateFee_set_channel_id"))) TS_UpdateFee_set_channel_id(uint64_t this_ptr, int8_tArray val) {
29479         LDKUpdateFee this_ptr_conv;
29480         this_ptr_conv.inner = untag_ptr(this_ptr);
29481         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29482         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29483         this_ptr_conv.is_owned = false;
29484         LDKThirtyTwoBytes val_ref;
29485         CHECK(val->arr_len == 32);
29486         memcpy(val_ref.data, val->elems, 32); FREE(val);
29487         UpdateFee_set_channel_id(&this_ptr_conv, val_ref);
29488 }
29489
29490 int32_t  __attribute__((export_name("TS_UpdateFee_get_feerate_per_kw"))) TS_UpdateFee_get_feerate_per_kw(uint64_t this_ptr) {
29491         LDKUpdateFee this_ptr_conv;
29492         this_ptr_conv.inner = untag_ptr(this_ptr);
29493         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29494         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29495         this_ptr_conv.is_owned = false;
29496         int32_t ret_conv = UpdateFee_get_feerate_per_kw(&this_ptr_conv);
29497         return ret_conv;
29498 }
29499
29500 void  __attribute__((export_name("TS_UpdateFee_set_feerate_per_kw"))) TS_UpdateFee_set_feerate_per_kw(uint64_t this_ptr, int32_t val) {
29501         LDKUpdateFee this_ptr_conv;
29502         this_ptr_conv.inner = untag_ptr(this_ptr);
29503         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29504         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29505         this_ptr_conv.is_owned = false;
29506         UpdateFee_set_feerate_per_kw(&this_ptr_conv, val);
29507 }
29508
29509 uint64_t  __attribute__((export_name("TS_UpdateFee_new"))) TS_UpdateFee_new(int8_tArray channel_id_arg, int32_t feerate_per_kw_arg) {
29510         LDKThirtyTwoBytes channel_id_arg_ref;
29511         CHECK(channel_id_arg->arr_len == 32);
29512         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
29513         LDKUpdateFee ret_var = UpdateFee_new(channel_id_arg_ref, feerate_per_kw_arg);
29514         uint64_t ret_ref = 0;
29515         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29516         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29517         return ret_ref;
29518 }
29519
29520 static inline uint64_t UpdateFee_clone_ptr(LDKUpdateFee *NONNULL_PTR arg) {
29521         LDKUpdateFee ret_var = UpdateFee_clone(arg);
29522         uint64_t ret_ref = 0;
29523         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29524         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29525         return ret_ref;
29526 }
29527 int64_t  __attribute__((export_name("TS_UpdateFee_clone_ptr"))) TS_UpdateFee_clone_ptr(uint64_t arg) {
29528         LDKUpdateFee arg_conv;
29529         arg_conv.inner = untag_ptr(arg);
29530         arg_conv.is_owned = ptr_is_owned(arg);
29531         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
29532         arg_conv.is_owned = false;
29533         int64_t ret_conv = UpdateFee_clone_ptr(&arg_conv);
29534         return ret_conv;
29535 }
29536
29537 uint64_t  __attribute__((export_name("TS_UpdateFee_clone"))) TS_UpdateFee_clone(uint64_t orig) {
29538         LDKUpdateFee orig_conv;
29539         orig_conv.inner = untag_ptr(orig);
29540         orig_conv.is_owned = ptr_is_owned(orig);
29541         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
29542         orig_conv.is_owned = false;
29543         LDKUpdateFee ret_var = UpdateFee_clone(&orig_conv);
29544         uint64_t ret_ref = 0;
29545         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29546         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29547         return ret_ref;
29548 }
29549
29550 void  __attribute__((export_name("TS_DataLossProtect_free"))) TS_DataLossProtect_free(uint64_t this_obj) {
29551         LDKDataLossProtect this_obj_conv;
29552         this_obj_conv.inner = untag_ptr(this_obj);
29553         this_obj_conv.is_owned = ptr_is_owned(this_obj);
29554         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
29555         DataLossProtect_free(this_obj_conv);
29556 }
29557
29558 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) {
29559         LDKDataLossProtect this_ptr_conv;
29560         this_ptr_conv.inner = untag_ptr(this_ptr);
29561         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29562         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29563         this_ptr_conv.is_owned = false;
29564         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
29565         memcpy(ret_arr->elems, *DataLossProtect_get_your_last_per_commitment_secret(&this_ptr_conv), 32);
29566         return ret_arr;
29567 }
29568
29569 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) {
29570         LDKDataLossProtect this_ptr_conv;
29571         this_ptr_conv.inner = untag_ptr(this_ptr);
29572         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29573         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29574         this_ptr_conv.is_owned = false;
29575         LDKThirtyTwoBytes val_ref;
29576         CHECK(val->arr_len == 32);
29577         memcpy(val_ref.data, val->elems, 32); FREE(val);
29578         DataLossProtect_set_your_last_per_commitment_secret(&this_ptr_conv, val_ref);
29579 }
29580
29581 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) {
29582         LDKDataLossProtect this_ptr_conv;
29583         this_ptr_conv.inner = untag_ptr(this_ptr);
29584         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29585         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29586         this_ptr_conv.is_owned = false;
29587         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
29588         memcpy(ret_arr->elems, DataLossProtect_get_my_current_per_commitment_point(&this_ptr_conv).compressed_form, 33);
29589         return ret_arr;
29590 }
29591
29592 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) {
29593         LDKDataLossProtect this_ptr_conv;
29594         this_ptr_conv.inner = untag_ptr(this_ptr);
29595         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29596         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29597         this_ptr_conv.is_owned = false;
29598         LDKPublicKey val_ref;
29599         CHECK(val->arr_len == 33);
29600         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
29601         DataLossProtect_set_my_current_per_commitment_point(&this_ptr_conv, val_ref);
29602 }
29603
29604 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) {
29605         LDKThirtyTwoBytes your_last_per_commitment_secret_arg_ref;
29606         CHECK(your_last_per_commitment_secret_arg->arr_len == 32);
29607         memcpy(your_last_per_commitment_secret_arg_ref.data, your_last_per_commitment_secret_arg->elems, 32); FREE(your_last_per_commitment_secret_arg);
29608         LDKPublicKey my_current_per_commitment_point_arg_ref;
29609         CHECK(my_current_per_commitment_point_arg->arr_len == 33);
29610         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);
29611         LDKDataLossProtect ret_var = DataLossProtect_new(your_last_per_commitment_secret_arg_ref, my_current_per_commitment_point_arg_ref);
29612         uint64_t ret_ref = 0;
29613         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29614         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29615         return ret_ref;
29616 }
29617
29618 static inline uint64_t DataLossProtect_clone_ptr(LDKDataLossProtect *NONNULL_PTR arg) {
29619         LDKDataLossProtect ret_var = DataLossProtect_clone(arg);
29620         uint64_t ret_ref = 0;
29621         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29622         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29623         return ret_ref;
29624 }
29625 int64_t  __attribute__((export_name("TS_DataLossProtect_clone_ptr"))) TS_DataLossProtect_clone_ptr(uint64_t arg) {
29626         LDKDataLossProtect arg_conv;
29627         arg_conv.inner = untag_ptr(arg);
29628         arg_conv.is_owned = ptr_is_owned(arg);
29629         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
29630         arg_conv.is_owned = false;
29631         int64_t ret_conv = DataLossProtect_clone_ptr(&arg_conv);
29632         return ret_conv;
29633 }
29634
29635 uint64_t  __attribute__((export_name("TS_DataLossProtect_clone"))) TS_DataLossProtect_clone(uint64_t orig) {
29636         LDKDataLossProtect orig_conv;
29637         orig_conv.inner = untag_ptr(orig);
29638         orig_conv.is_owned = ptr_is_owned(orig);
29639         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
29640         orig_conv.is_owned = false;
29641         LDKDataLossProtect ret_var = DataLossProtect_clone(&orig_conv);
29642         uint64_t ret_ref = 0;
29643         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29644         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29645         return ret_ref;
29646 }
29647
29648 void  __attribute__((export_name("TS_ChannelReestablish_free"))) TS_ChannelReestablish_free(uint64_t this_obj) {
29649         LDKChannelReestablish this_obj_conv;
29650         this_obj_conv.inner = untag_ptr(this_obj);
29651         this_obj_conv.is_owned = ptr_is_owned(this_obj);
29652         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
29653         ChannelReestablish_free(this_obj_conv);
29654 }
29655
29656 int8_tArray  __attribute__((export_name("TS_ChannelReestablish_get_channel_id"))) TS_ChannelReestablish_get_channel_id(uint64_t this_ptr) {
29657         LDKChannelReestablish this_ptr_conv;
29658         this_ptr_conv.inner = untag_ptr(this_ptr);
29659         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29660         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29661         this_ptr_conv.is_owned = false;
29662         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
29663         memcpy(ret_arr->elems, *ChannelReestablish_get_channel_id(&this_ptr_conv), 32);
29664         return ret_arr;
29665 }
29666
29667 void  __attribute__((export_name("TS_ChannelReestablish_set_channel_id"))) TS_ChannelReestablish_set_channel_id(uint64_t this_ptr, int8_tArray val) {
29668         LDKChannelReestablish this_ptr_conv;
29669         this_ptr_conv.inner = untag_ptr(this_ptr);
29670         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29671         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29672         this_ptr_conv.is_owned = false;
29673         LDKThirtyTwoBytes val_ref;
29674         CHECK(val->arr_len == 32);
29675         memcpy(val_ref.data, val->elems, 32); FREE(val);
29676         ChannelReestablish_set_channel_id(&this_ptr_conv, val_ref);
29677 }
29678
29679 int64_t  __attribute__((export_name("TS_ChannelReestablish_get_next_local_commitment_number"))) TS_ChannelReestablish_get_next_local_commitment_number(uint64_t this_ptr) {
29680         LDKChannelReestablish 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         int64_t ret_conv = ChannelReestablish_get_next_local_commitment_number(&this_ptr_conv);
29686         return ret_conv;
29687 }
29688
29689 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) {
29690         LDKChannelReestablish this_ptr_conv;
29691         this_ptr_conv.inner = untag_ptr(this_ptr);
29692         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29693         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29694         this_ptr_conv.is_owned = false;
29695         ChannelReestablish_set_next_local_commitment_number(&this_ptr_conv, val);
29696 }
29697
29698 int64_t  __attribute__((export_name("TS_ChannelReestablish_get_next_remote_commitment_number"))) TS_ChannelReestablish_get_next_remote_commitment_number(uint64_t this_ptr) {
29699         LDKChannelReestablish this_ptr_conv;
29700         this_ptr_conv.inner = untag_ptr(this_ptr);
29701         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29702         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29703         this_ptr_conv.is_owned = false;
29704         int64_t ret_conv = ChannelReestablish_get_next_remote_commitment_number(&this_ptr_conv);
29705         return ret_conv;
29706 }
29707
29708 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) {
29709         LDKChannelReestablish this_ptr_conv;
29710         this_ptr_conv.inner = untag_ptr(this_ptr);
29711         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29712         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29713         this_ptr_conv.is_owned = false;
29714         ChannelReestablish_set_next_remote_commitment_number(&this_ptr_conv, val);
29715 }
29716
29717 static inline uint64_t ChannelReestablish_clone_ptr(LDKChannelReestablish *NONNULL_PTR arg) {
29718         LDKChannelReestablish ret_var = ChannelReestablish_clone(arg);
29719         uint64_t ret_ref = 0;
29720         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29721         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29722         return ret_ref;
29723 }
29724 int64_t  __attribute__((export_name("TS_ChannelReestablish_clone_ptr"))) TS_ChannelReestablish_clone_ptr(uint64_t arg) {
29725         LDKChannelReestablish arg_conv;
29726         arg_conv.inner = untag_ptr(arg);
29727         arg_conv.is_owned = ptr_is_owned(arg);
29728         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
29729         arg_conv.is_owned = false;
29730         int64_t ret_conv = ChannelReestablish_clone_ptr(&arg_conv);
29731         return ret_conv;
29732 }
29733
29734 uint64_t  __attribute__((export_name("TS_ChannelReestablish_clone"))) TS_ChannelReestablish_clone(uint64_t orig) {
29735         LDKChannelReestablish orig_conv;
29736         orig_conv.inner = untag_ptr(orig);
29737         orig_conv.is_owned = ptr_is_owned(orig);
29738         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
29739         orig_conv.is_owned = false;
29740         LDKChannelReestablish ret_var = ChannelReestablish_clone(&orig_conv);
29741         uint64_t ret_ref = 0;
29742         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29743         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29744         return ret_ref;
29745 }
29746
29747 void  __attribute__((export_name("TS_AnnouncementSignatures_free"))) TS_AnnouncementSignatures_free(uint64_t this_obj) {
29748         LDKAnnouncementSignatures this_obj_conv;
29749         this_obj_conv.inner = untag_ptr(this_obj);
29750         this_obj_conv.is_owned = ptr_is_owned(this_obj);
29751         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
29752         AnnouncementSignatures_free(this_obj_conv);
29753 }
29754
29755 int8_tArray  __attribute__((export_name("TS_AnnouncementSignatures_get_channel_id"))) TS_AnnouncementSignatures_get_channel_id(uint64_t this_ptr) {
29756         LDKAnnouncementSignatures this_ptr_conv;
29757         this_ptr_conv.inner = untag_ptr(this_ptr);
29758         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29759         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29760         this_ptr_conv.is_owned = false;
29761         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
29762         memcpy(ret_arr->elems, *AnnouncementSignatures_get_channel_id(&this_ptr_conv), 32);
29763         return ret_arr;
29764 }
29765
29766 void  __attribute__((export_name("TS_AnnouncementSignatures_set_channel_id"))) TS_AnnouncementSignatures_set_channel_id(uint64_t this_ptr, int8_tArray val) {
29767         LDKAnnouncementSignatures this_ptr_conv;
29768         this_ptr_conv.inner = untag_ptr(this_ptr);
29769         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29770         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29771         this_ptr_conv.is_owned = false;
29772         LDKThirtyTwoBytes val_ref;
29773         CHECK(val->arr_len == 32);
29774         memcpy(val_ref.data, val->elems, 32); FREE(val);
29775         AnnouncementSignatures_set_channel_id(&this_ptr_conv, val_ref);
29776 }
29777
29778 int64_t  __attribute__((export_name("TS_AnnouncementSignatures_get_short_channel_id"))) TS_AnnouncementSignatures_get_short_channel_id(uint64_t this_ptr) {
29779         LDKAnnouncementSignatures this_ptr_conv;
29780         this_ptr_conv.inner = untag_ptr(this_ptr);
29781         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29782         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29783         this_ptr_conv.is_owned = false;
29784         int64_t ret_conv = AnnouncementSignatures_get_short_channel_id(&this_ptr_conv);
29785         return ret_conv;
29786 }
29787
29788 void  __attribute__((export_name("TS_AnnouncementSignatures_set_short_channel_id"))) TS_AnnouncementSignatures_set_short_channel_id(uint64_t this_ptr, int64_t val) {
29789         LDKAnnouncementSignatures this_ptr_conv;
29790         this_ptr_conv.inner = untag_ptr(this_ptr);
29791         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29792         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29793         this_ptr_conv.is_owned = false;
29794         AnnouncementSignatures_set_short_channel_id(&this_ptr_conv, val);
29795 }
29796
29797 int8_tArray  __attribute__((export_name("TS_AnnouncementSignatures_get_node_signature"))) TS_AnnouncementSignatures_get_node_signature(uint64_t this_ptr) {
29798         LDKAnnouncementSignatures this_ptr_conv;
29799         this_ptr_conv.inner = untag_ptr(this_ptr);
29800         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29801         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29802         this_ptr_conv.is_owned = false;
29803         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
29804         memcpy(ret_arr->elems, AnnouncementSignatures_get_node_signature(&this_ptr_conv).compact_form, 64);
29805         return ret_arr;
29806 }
29807
29808 void  __attribute__((export_name("TS_AnnouncementSignatures_set_node_signature"))) TS_AnnouncementSignatures_set_node_signature(uint64_t this_ptr, int8_tArray val) {
29809         LDKAnnouncementSignatures this_ptr_conv;
29810         this_ptr_conv.inner = untag_ptr(this_ptr);
29811         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29812         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29813         this_ptr_conv.is_owned = false;
29814         LDKSignature val_ref;
29815         CHECK(val->arr_len == 64);
29816         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
29817         AnnouncementSignatures_set_node_signature(&this_ptr_conv, val_ref);
29818 }
29819
29820 int8_tArray  __attribute__((export_name("TS_AnnouncementSignatures_get_bitcoin_signature"))) TS_AnnouncementSignatures_get_bitcoin_signature(uint64_t this_ptr) {
29821         LDKAnnouncementSignatures this_ptr_conv;
29822         this_ptr_conv.inner = untag_ptr(this_ptr);
29823         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29824         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29825         this_ptr_conv.is_owned = false;
29826         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
29827         memcpy(ret_arr->elems, AnnouncementSignatures_get_bitcoin_signature(&this_ptr_conv).compact_form, 64);
29828         return ret_arr;
29829 }
29830
29831 void  __attribute__((export_name("TS_AnnouncementSignatures_set_bitcoin_signature"))) TS_AnnouncementSignatures_set_bitcoin_signature(uint64_t this_ptr, int8_tArray val) {
29832         LDKAnnouncementSignatures this_ptr_conv;
29833         this_ptr_conv.inner = untag_ptr(this_ptr);
29834         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29835         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29836         this_ptr_conv.is_owned = false;
29837         LDKSignature val_ref;
29838         CHECK(val->arr_len == 64);
29839         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
29840         AnnouncementSignatures_set_bitcoin_signature(&this_ptr_conv, val_ref);
29841 }
29842
29843 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) {
29844         LDKThirtyTwoBytes channel_id_arg_ref;
29845         CHECK(channel_id_arg->arr_len == 32);
29846         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
29847         LDKSignature node_signature_arg_ref;
29848         CHECK(node_signature_arg->arr_len == 64);
29849         memcpy(node_signature_arg_ref.compact_form, node_signature_arg->elems, 64); FREE(node_signature_arg);
29850         LDKSignature bitcoin_signature_arg_ref;
29851         CHECK(bitcoin_signature_arg->arr_len == 64);
29852         memcpy(bitcoin_signature_arg_ref.compact_form, bitcoin_signature_arg->elems, 64); FREE(bitcoin_signature_arg);
29853         LDKAnnouncementSignatures ret_var = AnnouncementSignatures_new(channel_id_arg_ref, short_channel_id_arg, node_signature_arg_ref, bitcoin_signature_arg_ref);
29854         uint64_t ret_ref = 0;
29855         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29856         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29857         return ret_ref;
29858 }
29859
29860 static inline uint64_t AnnouncementSignatures_clone_ptr(LDKAnnouncementSignatures *NONNULL_PTR arg) {
29861         LDKAnnouncementSignatures ret_var = AnnouncementSignatures_clone(arg);
29862         uint64_t ret_ref = 0;
29863         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29864         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29865         return ret_ref;
29866 }
29867 int64_t  __attribute__((export_name("TS_AnnouncementSignatures_clone_ptr"))) TS_AnnouncementSignatures_clone_ptr(uint64_t arg) {
29868         LDKAnnouncementSignatures arg_conv;
29869         arg_conv.inner = untag_ptr(arg);
29870         arg_conv.is_owned = ptr_is_owned(arg);
29871         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
29872         arg_conv.is_owned = false;
29873         int64_t ret_conv = AnnouncementSignatures_clone_ptr(&arg_conv);
29874         return ret_conv;
29875 }
29876
29877 uint64_t  __attribute__((export_name("TS_AnnouncementSignatures_clone"))) TS_AnnouncementSignatures_clone(uint64_t orig) {
29878         LDKAnnouncementSignatures orig_conv;
29879         orig_conv.inner = untag_ptr(orig);
29880         orig_conv.is_owned = ptr_is_owned(orig);
29881         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
29882         orig_conv.is_owned = false;
29883         LDKAnnouncementSignatures ret_var = AnnouncementSignatures_clone(&orig_conv);
29884         uint64_t ret_ref = 0;
29885         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29886         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29887         return ret_ref;
29888 }
29889
29890 void  __attribute__((export_name("TS_NetAddress_free"))) TS_NetAddress_free(uint64_t this_ptr) {
29891         if (!ptr_is_owned(this_ptr)) return;
29892         void* this_ptr_ptr = untag_ptr(this_ptr);
29893         CHECK_ACCESS(this_ptr_ptr);
29894         LDKNetAddress this_ptr_conv = *(LDKNetAddress*)(this_ptr_ptr);
29895         FREE(untag_ptr(this_ptr));
29896         NetAddress_free(this_ptr_conv);
29897 }
29898
29899 static inline uint64_t NetAddress_clone_ptr(LDKNetAddress *NONNULL_PTR arg) {
29900         LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
29901         *ret_copy = NetAddress_clone(arg);
29902         uint64_t ret_ref = tag_ptr(ret_copy, true);
29903         return ret_ref;
29904 }
29905 int64_t  __attribute__((export_name("TS_NetAddress_clone_ptr"))) TS_NetAddress_clone_ptr(uint64_t arg) {
29906         LDKNetAddress* arg_conv = (LDKNetAddress*)untag_ptr(arg);
29907         int64_t ret_conv = NetAddress_clone_ptr(arg_conv);
29908         return ret_conv;
29909 }
29910
29911 uint64_t  __attribute__((export_name("TS_NetAddress_clone"))) TS_NetAddress_clone(uint64_t orig) {
29912         LDKNetAddress* orig_conv = (LDKNetAddress*)untag_ptr(orig);
29913         LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
29914         *ret_copy = NetAddress_clone(orig_conv);
29915         uint64_t ret_ref = tag_ptr(ret_copy, true);
29916         return ret_ref;
29917 }
29918
29919 uint64_t  __attribute__((export_name("TS_NetAddress_ipv4"))) TS_NetAddress_ipv4(int8_tArray addr, int16_t port) {
29920         LDKFourBytes addr_ref;
29921         CHECK(addr->arr_len == 4);
29922         memcpy(addr_ref.data, addr->elems, 4); FREE(addr);
29923         LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
29924         *ret_copy = NetAddress_ipv4(addr_ref, port);
29925         uint64_t ret_ref = tag_ptr(ret_copy, true);
29926         return ret_ref;
29927 }
29928
29929 uint64_t  __attribute__((export_name("TS_NetAddress_ipv6"))) TS_NetAddress_ipv6(int8_tArray addr, int16_t port) {
29930         LDKSixteenBytes addr_ref;
29931         CHECK(addr->arr_len == 16);
29932         memcpy(addr_ref.data, addr->elems, 16); FREE(addr);
29933         LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
29934         *ret_copy = NetAddress_ipv6(addr_ref, port);
29935         uint64_t ret_ref = tag_ptr(ret_copy, true);
29936         return ret_ref;
29937 }
29938
29939 uint64_t  __attribute__((export_name("TS_NetAddress_onion_v2"))) TS_NetAddress_onion_v2(int8_tArray a) {
29940         LDKTwelveBytes a_ref;
29941         CHECK(a->arr_len == 12);
29942         memcpy(a_ref.data, a->elems, 12); FREE(a);
29943         LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
29944         *ret_copy = NetAddress_onion_v2(a_ref);
29945         uint64_t ret_ref = tag_ptr(ret_copy, true);
29946         return ret_ref;
29947 }
29948
29949 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) {
29950         LDKThirtyTwoBytes ed25519_pubkey_ref;
29951         CHECK(ed25519_pubkey->arr_len == 32);
29952         memcpy(ed25519_pubkey_ref.data, ed25519_pubkey->elems, 32); FREE(ed25519_pubkey);
29953         LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
29954         *ret_copy = NetAddress_onion_v3(ed25519_pubkey_ref, checksum, version, port);
29955         uint64_t ret_ref = tag_ptr(ret_copy, true);
29956         return ret_ref;
29957 }
29958
29959 uint64_t  __attribute__((export_name("TS_NetAddress_hostname"))) TS_NetAddress_hostname(uint64_t hostname, int16_t port) {
29960         LDKHostname hostname_conv;
29961         hostname_conv.inner = untag_ptr(hostname);
29962         hostname_conv.is_owned = ptr_is_owned(hostname);
29963         CHECK_INNER_FIELD_ACCESS_OR_NULL(hostname_conv);
29964         hostname_conv = Hostname_clone(&hostname_conv);
29965         LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
29966         *ret_copy = NetAddress_hostname(hostname_conv, port);
29967         uint64_t ret_ref = tag_ptr(ret_copy, true);
29968         return ret_ref;
29969 }
29970
29971 int8_tArray  __attribute__((export_name("TS_NetAddress_write"))) TS_NetAddress_write(uint64_t obj) {
29972         LDKNetAddress* obj_conv = (LDKNetAddress*)untag_ptr(obj);
29973         LDKCVec_u8Z ret_var = NetAddress_write(obj_conv);
29974         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
29975         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
29976         CVec_u8Z_free(ret_var);
29977         return ret_arr;
29978 }
29979
29980 uint64_t  __attribute__((export_name("TS_NetAddress_read"))) TS_NetAddress_read(int8_tArray ser) {
29981         LDKu8slice ser_ref;
29982         ser_ref.datalen = ser->arr_len;
29983         ser_ref.data = ser->elems;
29984         LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
29985         *ret_conv = NetAddress_read(ser_ref);
29986         FREE(ser);
29987         return tag_ptr(ret_conv, true);
29988 }
29989
29990 void  __attribute__((export_name("TS_UnsignedNodeAnnouncement_free"))) TS_UnsignedNodeAnnouncement_free(uint64_t this_obj) {
29991         LDKUnsignedNodeAnnouncement this_obj_conv;
29992         this_obj_conv.inner = untag_ptr(this_obj);
29993         this_obj_conv.is_owned = ptr_is_owned(this_obj);
29994         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
29995         UnsignedNodeAnnouncement_free(this_obj_conv);
29996 }
29997
29998 uint64_t  __attribute__((export_name("TS_UnsignedNodeAnnouncement_get_features"))) TS_UnsignedNodeAnnouncement_get_features(uint64_t this_ptr) {
29999         LDKUnsignedNodeAnnouncement 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         LDKNodeFeatures ret_var = UnsignedNodeAnnouncement_get_features(&this_ptr_conv);
30005         uint64_t ret_ref = 0;
30006         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30007         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30008         return ret_ref;
30009 }
30010
30011 void  __attribute__((export_name("TS_UnsignedNodeAnnouncement_set_features"))) TS_UnsignedNodeAnnouncement_set_features(uint64_t this_ptr, uint64_t val) {
30012         LDKUnsignedNodeAnnouncement this_ptr_conv;
30013         this_ptr_conv.inner = untag_ptr(this_ptr);
30014         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30015         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30016         this_ptr_conv.is_owned = false;
30017         LDKNodeFeatures val_conv;
30018         val_conv.inner = untag_ptr(val);
30019         val_conv.is_owned = ptr_is_owned(val);
30020         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
30021         val_conv = NodeFeatures_clone(&val_conv);
30022         UnsignedNodeAnnouncement_set_features(&this_ptr_conv, val_conv);
30023 }
30024
30025 int32_t  __attribute__((export_name("TS_UnsignedNodeAnnouncement_get_timestamp"))) TS_UnsignedNodeAnnouncement_get_timestamp(uint64_t this_ptr) {
30026         LDKUnsignedNodeAnnouncement this_ptr_conv;
30027         this_ptr_conv.inner = untag_ptr(this_ptr);
30028         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30029         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30030         this_ptr_conv.is_owned = false;
30031         int32_t ret_conv = UnsignedNodeAnnouncement_get_timestamp(&this_ptr_conv);
30032         return ret_conv;
30033 }
30034
30035 void  __attribute__((export_name("TS_UnsignedNodeAnnouncement_set_timestamp"))) TS_UnsignedNodeAnnouncement_set_timestamp(uint64_t this_ptr, int32_t val) {
30036         LDKUnsignedNodeAnnouncement this_ptr_conv;
30037         this_ptr_conv.inner = untag_ptr(this_ptr);
30038         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30039         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30040         this_ptr_conv.is_owned = false;
30041         UnsignedNodeAnnouncement_set_timestamp(&this_ptr_conv, val);
30042 }
30043
30044 int8_tArray  __attribute__((export_name("TS_UnsignedNodeAnnouncement_get_node_id"))) TS_UnsignedNodeAnnouncement_get_node_id(uint64_t this_ptr) {
30045         LDKUnsignedNodeAnnouncement this_ptr_conv;
30046         this_ptr_conv.inner = untag_ptr(this_ptr);
30047         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30048         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30049         this_ptr_conv.is_owned = false;
30050         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
30051         memcpy(ret_arr->elems, UnsignedNodeAnnouncement_get_node_id(&this_ptr_conv).compressed_form, 33);
30052         return ret_arr;
30053 }
30054
30055 void  __attribute__((export_name("TS_UnsignedNodeAnnouncement_set_node_id"))) TS_UnsignedNodeAnnouncement_set_node_id(uint64_t this_ptr, int8_tArray val) {
30056         LDKUnsignedNodeAnnouncement this_ptr_conv;
30057         this_ptr_conv.inner = untag_ptr(this_ptr);
30058         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30059         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30060         this_ptr_conv.is_owned = false;
30061         LDKPublicKey val_ref;
30062         CHECK(val->arr_len == 33);
30063         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
30064         UnsignedNodeAnnouncement_set_node_id(&this_ptr_conv, val_ref);
30065 }
30066
30067 int8_tArray  __attribute__((export_name("TS_UnsignedNodeAnnouncement_get_rgb"))) TS_UnsignedNodeAnnouncement_get_rgb(uint64_t this_ptr) {
30068         LDKUnsignedNodeAnnouncement this_ptr_conv;
30069         this_ptr_conv.inner = untag_ptr(this_ptr);
30070         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30071         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30072         this_ptr_conv.is_owned = false;
30073         int8_tArray ret_arr = init_int8_tArray(3, __LINE__);
30074         memcpy(ret_arr->elems, *UnsignedNodeAnnouncement_get_rgb(&this_ptr_conv), 3);
30075         return ret_arr;
30076 }
30077
30078 void  __attribute__((export_name("TS_UnsignedNodeAnnouncement_set_rgb"))) TS_UnsignedNodeAnnouncement_set_rgb(uint64_t this_ptr, int8_tArray val) {
30079         LDKUnsignedNodeAnnouncement this_ptr_conv;
30080         this_ptr_conv.inner = untag_ptr(this_ptr);
30081         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30082         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30083         this_ptr_conv.is_owned = false;
30084         LDKThreeBytes val_ref;
30085         CHECK(val->arr_len == 3);
30086         memcpy(val_ref.data, val->elems, 3); FREE(val);
30087         UnsignedNodeAnnouncement_set_rgb(&this_ptr_conv, val_ref);
30088 }
30089
30090 int8_tArray  __attribute__((export_name("TS_UnsignedNodeAnnouncement_get_alias"))) TS_UnsignedNodeAnnouncement_get_alias(uint64_t this_ptr) {
30091         LDKUnsignedNodeAnnouncement this_ptr_conv;
30092         this_ptr_conv.inner = untag_ptr(this_ptr);
30093         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30094         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30095         this_ptr_conv.is_owned = false;
30096         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
30097         memcpy(ret_arr->elems, *UnsignedNodeAnnouncement_get_alias(&this_ptr_conv), 32);
30098         return ret_arr;
30099 }
30100
30101 void  __attribute__((export_name("TS_UnsignedNodeAnnouncement_set_alias"))) TS_UnsignedNodeAnnouncement_set_alias(uint64_t this_ptr, int8_tArray val) {
30102         LDKUnsignedNodeAnnouncement this_ptr_conv;
30103         this_ptr_conv.inner = untag_ptr(this_ptr);
30104         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30105         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30106         this_ptr_conv.is_owned = false;
30107         LDKThirtyTwoBytes val_ref;
30108         CHECK(val->arr_len == 32);
30109         memcpy(val_ref.data, val->elems, 32); FREE(val);
30110         UnsignedNodeAnnouncement_set_alias(&this_ptr_conv, val_ref);
30111 }
30112
30113 uint64_tArray  __attribute__((export_name("TS_UnsignedNodeAnnouncement_get_addresses"))) TS_UnsignedNodeAnnouncement_get_addresses(uint64_t this_ptr) {
30114         LDKUnsignedNodeAnnouncement this_ptr_conv;
30115         this_ptr_conv.inner = untag_ptr(this_ptr);
30116         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30117         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30118         this_ptr_conv.is_owned = false;
30119         LDKCVec_NetAddressZ ret_var = UnsignedNodeAnnouncement_get_addresses(&this_ptr_conv);
30120         uint64_tArray ret_arr = NULL;
30121         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
30122         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
30123         for (size_t m = 0; m < ret_var.datalen; m++) {
30124                 LDKNetAddress *ret_conv_12_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
30125                 *ret_conv_12_copy = ret_var.data[m];
30126                 uint64_t ret_conv_12_ref = tag_ptr(ret_conv_12_copy, true);
30127                 ret_arr_ptr[m] = ret_conv_12_ref;
30128         }
30129         
30130         FREE(ret_var.data);
30131         return ret_arr;
30132 }
30133
30134 void  __attribute__((export_name("TS_UnsignedNodeAnnouncement_set_addresses"))) TS_UnsignedNodeAnnouncement_set_addresses(uint64_t this_ptr, uint64_tArray val) {
30135         LDKUnsignedNodeAnnouncement this_ptr_conv;
30136         this_ptr_conv.inner = untag_ptr(this_ptr);
30137         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30138         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30139         this_ptr_conv.is_owned = false;
30140         LDKCVec_NetAddressZ val_constr;
30141         val_constr.datalen = val->arr_len;
30142         if (val_constr.datalen > 0)
30143                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
30144         else
30145                 val_constr.data = NULL;
30146         uint64_t* val_vals = val->elems;
30147         for (size_t m = 0; m < val_constr.datalen; m++) {
30148                 uint64_t val_conv_12 = val_vals[m];
30149                 void* val_conv_12_ptr = untag_ptr(val_conv_12);
30150                 CHECK_ACCESS(val_conv_12_ptr);
30151                 LDKNetAddress val_conv_12_conv = *(LDKNetAddress*)(val_conv_12_ptr);
30152                 val_conv_12_conv = NetAddress_clone((LDKNetAddress*)untag_ptr(val_conv_12));
30153                 val_constr.data[m] = val_conv_12_conv;
30154         }
30155         FREE(val);
30156         UnsignedNodeAnnouncement_set_addresses(&this_ptr_conv, val_constr);
30157 }
30158
30159 static inline uint64_t UnsignedNodeAnnouncement_clone_ptr(LDKUnsignedNodeAnnouncement *NONNULL_PTR arg) {
30160         LDKUnsignedNodeAnnouncement ret_var = UnsignedNodeAnnouncement_clone(arg);
30161         uint64_t ret_ref = 0;
30162         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30163         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30164         return ret_ref;
30165 }
30166 int64_t  __attribute__((export_name("TS_UnsignedNodeAnnouncement_clone_ptr"))) TS_UnsignedNodeAnnouncement_clone_ptr(uint64_t arg) {
30167         LDKUnsignedNodeAnnouncement arg_conv;
30168         arg_conv.inner = untag_ptr(arg);
30169         arg_conv.is_owned = ptr_is_owned(arg);
30170         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30171         arg_conv.is_owned = false;
30172         int64_t ret_conv = UnsignedNodeAnnouncement_clone_ptr(&arg_conv);
30173         return ret_conv;
30174 }
30175
30176 uint64_t  __attribute__((export_name("TS_UnsignedNodeAnnouncement_clone"))) TS_UnsignedNodeAnnouncement_clone(uint64_t orig) {
30177         LDKUnsignedNodeAnnouncement orig_conv;
30178         orig_conv.inner = untag_ptr(orig);
30179         orig_conv.is_owned = ptr_is_owned(orig);
30180         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30181         orig_conv.is_owned = false;
30182         LDKUnsignedNodeAnnouncement ret_var = UnsignedNodeAnnouncement_clone(&orig_conv);
30183         uint64_t ret_ref = 0;
30184         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30185         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30186         return ret_ref;
30187 }
30188
30189 void  __attribute__((export_name("TS_NodeAnnouncement_free"))) TS_NodeAnnouncement_free(uint64_t this_obj) {
30190         LDKNodeAnnouncement this_obj_conv;
30191         this_obj_conv.inner = untag_ptr(this_obj);
30192         this_obj_conv.is_owned = ptr_is_owned(this_obj);
30193         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30194         NodeAnnouncement_free(this_obj_conv);
30195 }
30196
30197 int8_tArray  __attribute__((export_name("TS_NodeAnnouncement_get_signature"))) TS_NodeAnnouncement_get_signature(uint64_t this_ptr) {
30198         LDKNodeAnnouncement this_ptr_conv;
30199         this_ptr_conv.inner = untag_ptr(this_ptr);
30200         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30201         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30202         this_ptr_conv.is_owned = false;
30203         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
30204         memcpy(ret_arr->elems, NodeAnnouncement_get_signature(&this_ptr_conv).compact_form, 64);
30205         return ret_arr;
30206 }
30207
30208 void  __attribute__((export_name("TS_NodeAnnouncement_set_signature"))) TS_NodeAnnouncement_set_signature(uint64_t this_ptr, int8_tArray val) {
30209         LDKNodeAnnouncement this_ptr_conv;
30210         this_ptr_conv.inner = untag_ptr(this_ptr);
30211         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30212         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30213         this_ptr_conv.is_owned = false;
30214         LDKSignature val_ref;
30215         CHECK(val->arr_len == 64);
30216         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
30217         NodeAnnouncement_set_signature(&this_ptr_conv, val_ref);
30218 }
30219
30220 uint64_t  __attribute__((export_name("TS_NodeAnnouncement_get_contents"))) TS_NodeAnnouncement_get_contents(uint64_t this_ptr) {
30221         LDKNodeAnnouncement this_ptr_conv;
30222         this_ptr_conv.inner = untag_ptr(this_ptr);
30223         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30224         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30225         this_ptr_conv.is_owned = false;
30226         LDKUnsignedNodeAnnouncement ret_var = NodeAnnouncement_get_contents(&this_ptr_conv);
30227         uint64_t ret_ref = 0;
30228         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30229         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30230         return ret_ref;
30231 }
30232
30233 void  __attribute__((export_name("TS_NodeAnnouncement_set_contents"))) TS_NodeAnnouncement_set_contents(uint64_t this_ptr, uint64_t val) {
30234         LDKNodeAnnouncement this_ptr_conv;
30235         this_ptr_conv.inner = untag_ptr(this_ptr);
30236         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30237         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30238         this_ptr_conv.is_owned = false;
30239         LDKUnsignedNodeAnnouncement val_conv;
30240         val_conv.inner = untag_ptr(val);
30241         val_conv.is_owned = ptr_is_owned(val);
30242         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
30243         val_conv = UnsignedNodeAnnouncement_clone(&val_conv);
30244         NodeAnnouncement_set_contents(&this_ptr_conv, val_conv);
30245 }
30246
30247 uint64_t  __attribute__((export_name("TS_NodeAnnouncement_new"))) TS_NodeAnnouncement_new(int8_tArray signature_arg, uint64_t contents_arg) {
30248         LDKSignature signature_arg_ref;
30249         CHECK(signature_arg->arr_len == 64);
30250         memcpy(signature_arg_ref.compact_form, signature_arg->elems, 64); FREE(signature_arg);
30251         LDKUnsignedNodeAnnouncement contents_arg_conv;
30252         contents_arg_conv.inner = untag_ptr(contents_arg);
30253         contents_arg_conv.is_owned = ptr_is_owned(contents_arg);
30254         CHECK_INNER_FIELD_ACCESS_OR_NULL(contents_arg_conv);
30255         contents_arg_conv = UnsignedNodeAnnouncement_clone(&contents_arg_conv);
30256         LDKNodeAnnouncement ret_var = NodeAnnouncement_new(signature_arg_ref, contents_arg_conv);
30257         uint64_t ret_ref = 0;
30258         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30259         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30260         return ret_ref;
30261 }
30262
30263 static inline uint64_t NodeAnnouncement_clone_ptr(LDKNodeAnnouncement *NONNULL_PTR arg) {
30264         LDKNodeAnnouncement ret_var = NodeAnnouncement_clone(arg);
30265         uint64_t ret_ref = 0;
30266         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30267         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30268         return ret_ref;
30269 }
30270 int64_t  __attribute__((export_name("TS_NodeAnnouncement_clone_ptr"))) TS_NodeAnnouncement_clone_ptr(uint64_t arg) {
30271         LDKNodeAnnouncement arg_conv;
30272         arg_conv.inner = untag_ptr(arg);
30273         arg_conv.is_owned = ptr_is_owned(arg);
30274         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30275         arg_conv.is_owned = false;
30276         int64_t ret_conv = NodeAnnouncement_clone_ptr(&arg_conv);
30277         return ret_conv;
30278 }
30279
30280 uint64_t  __attribute__((export_name("TS_NodeAnnouncement_clone"))) TS_NodeAnnouncement_clone(uint64_t orig) {
30281         LDKNodeAnnouncement orig_conv;
30282         orig_conv.inner = untag_ptr(orig);
30283         orig_conv.is_owned = ptr_is_owned(orig);
30284         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30285         orig_conv.is_owned = false;
30286         LDKNodeAnnouncement ret_var = NodeAnnouncement_clone(&orig_conv);
30287         uint64_t ret_ref = 0;
30288         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30289         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30290         return ret_ref;
30291 }
30292
30293 void  __attribute__((export_name("TS_UnsignedChannelAnnouncement_free"))) TS_UnsignedChannelAnnouncement_free(uint64_t this_obj) {
30294         LDKUnsignedChannelAnnouncement this_obj_conv;
30295         this_obj_conv.inner = untag_ptr(this_obj);
30296         this_obj_conv.is_owned = ptr_is_owned(this_obj);
30297         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30298         UnsignedChannelAnnouncement_free(this_obj_conv);
30299 }
30300
30301 uint64_t  __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_features"))) TS_UnsignedChannelAnnouncement_get_features(uint64_t this_ptr) {
30302         LDKUnsignedChannelAnnouncement this_ptr_conv;
30303         this_ptr_conv.inner = untag_ptr(this_ptr);
30304         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30305         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30306         this_ptr_conv.is_owned = false;
30307         LDKChannelFeatures ret_var = UnsignedChannelAnnouncement_get_features(&this_ptr_conv);
30308         uint64_t ret_ref = 0;
30309         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30310         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30311         return ret_ref;
30312 }
30313
30314 void  __attribute__((export_name("TS_UnsignedChannelAnnouncement_set_features"))) TS_UnsignedChannelAnnouncement_set_features(uint64_t this_ptr, uint64_t val) {
30315         LDKUnsignedChannelAnnouncement 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         LDKChannelFeatures val_conv;
30321         val_conv.inner = untag_ptr(val);
30322         val_conv.is_owned = ptr_is_owned(val);
30323         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
30324         val_conv = ChannelFeatures_clone(&val_conv);
30325         UnsignedChannelAnnouncement_set_features(&this_ptr_conv, val_conv);
30326 }
30327
30328 int8_tArray  __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_chain_hash"))) TS_UnsignedChannelAnnouncement_get_chain_hash(uint64_t this_ptr) {
30329         LDKUnsignedChannelAnnouncement this_ptr_conv;
30330         this_ptr_conv.inner = untag_ptr(this_ptr);
30331         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30332         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30333         this_ptr_conv.is_owned = false;
30334         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
30335         memcpy(ret_arr->elems, *UnsignedChannelAnnouncement_get_chain_hash(&this_ptr_conv), 32);
30336         return ret_arr;
30337 }
30338
30339 void  __attribute__((export_name("TS_UnsignedChannelAnnouncement_set_chain_hash"))) TS_UnsignedChannelAnnouncement_set_chain_hash(uint64_t this_ptr, int8_tArray val) {
30340         LDKUnsignedChannelAnnouncement this_ptr_conv;
30341         this_ptr_conv.inner = untag_ptr(this_ptr);
30342         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30343         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30344         this_ptr_conv.is_owned = false;
30345         LDKThirtyTwoBytes val_ref;
30346         CHECK(val->arr_len == 32);
30347         memcpy(val_ref.data, val->elems, 32); FREE(val);
30348         UnsignedChannelAnnouncement_set_chain_hash(&this_ptr_conv, val_ref);
30349 }
30350
30351 int64_t  __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_short_channel_id"))) TS_UnsignedChannelAnnouncement_get_short_channel_id(uint64_t this_ptr) {
30352         LDKUnsignedChannelAnnouncement this_ptr_conv;
30353         this_ptr_conv.inner = untag_ptr(this_ptr);
30354         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30355         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30356         this_ptr_conv.is_owned = false;
30357         int64_t ret_conv = UnsignedChannelAnnouncement_get_short_channel_id(&this_ptr_conv);
30358         return ret_conv;
30359 }
30360
30361 void  __attribute__((export_name("TS_UnsignedChannelAnnouncement_set_short_channel_id"))) TS_UnsignedChannelAnnouncement_set_short_channel_id(uint64_t this_ptr, int64_t val) {
30362         LDKUnsignedChannelAnnouncement this_ptr_conv;
30363         this_ptr_conv.inner = untag_ptr(this_ptr);
30364         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30365         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30366         this_ptr_conv.is_owned = false;
30367         UnsignedChannelAnnouncement_set_short_channel_id(&this_ptr_conv, val);
30368 }
30369
30370 int8_tArray  __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_node_id_1"))) TS_UnsignedChannelAnnouncement_get_node_id_1(uint64_t this_ptr) {
30371         LDKUnsignedChannelAnnouncement this_ptr_conv;
30372         this_ptr_conv.inner = untag_ptr(this_ptr);
30373         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30374         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30375         this_ptr_conv.is_owned = false;
30376         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
30377         memcpy(ret_arr->elems, UnsignedChannelAnnouncement_get_node_id_1(&this_ptr_conv).compressed_form, 33);
30378         return ret_arr;
30379 }
30380
30381 void  __attribute__((export_name("TS_UnsignedChannelAnnouncement_set_node_id_1"))) TS_UnsignedChannelAnnouncement_set_node_id_1(uint64_t this_ptr, int8_tArray val) {
30382         LDKUnsignedChannelAnnouncement this_ptr_conv;
30383         this_ptr_conv.inner = untag_ptr(this_ptr);
30384         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30385         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30386         this_ptr_conv.is_owned = false;
30387         LDKPublicKey val_ref;
30388         CHECK(val->arr_len == 33);
30389         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
30390         UnsignedChannelAnnouncement_set_node_id_1(&this_ptr_conv, val_ref);
30391 }
30392
30393 int8_tArray  __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_node_id_2"))) TS_UnsignedChannelAnnouncement_get_node_id_2(uint64_t this_ptr) {
30394         LDKUnsignedChannelAnnouncement this_ptr_conv;
30395         this_ptr_conv.inner = untag_ptr(this_ptr);
30396         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30397         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30398         this_ptr_conv.is_owned = false;
30399         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
30400         memcpy(ret_arr->elems, UnsignedChannelAnnouncement_get_node_id_2(&this_ptr_conv).compressed_form, 33);
30401         return ret_arr;
30402 }
30403
30404 void  __attribute__((export_name("TS_UnsignedChannelAnnouncement_set_node_id_2"))) TS_UnsignedChannelAnnouncement_set_node_id_2(uint64_t this_ptr, int8_tArray val) {
30405         LDKUnsignedChannelAnnouncement this_ptr_conv;
30406         this_ptr_conv.inner = untag_ptr(this_ptr);
30407         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30408         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30409         this_ptr_conv.is_owned = false;
30410         LDKPublicKey val_ref;
30411         CHECK(val->arr_len == 33);
30412         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
30413         UnsignedChannelAnnouncement_set_node_id_2(&this_ptr_conv, val_ref);
30414 }
30415
30416 int8_tArray  __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_bitcoin_key_1"))) TS_UnsignedChannelAnnouncement_get_bitcoin_key_1(uint64_t this_ptr) {
30417         LDKUnsignedChannelAnnouncement this_ptr_conv;
30418         this_ptr_conv.inner = untag_ptr(this_ptr);
30419         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30420         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30421         this_ptr_conv.is_owned = false;
30422         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
30423         memcpy(ret_arr->elems, UnsignedChannelAnnouncement_get_bitcoin_key_1(&this_ptr_conv).compressed_form, 33);
30424         return ret_arr;
30425 }
30426
30427 void  __attribute__((export_name("TS_UnsignedChannelAnnouncement_set_bitcoin_key_1"))) TS_UnsignedChannelAnnouncement_set_bitcoin_key_1(uint64_t this_ptr, int8_tArray val) {
30428         LDKUnsignedChannelAnnouncement this_ptr_conv;
30429         this_ptr_conv.inner = untag_ptr(this_ptr);
30430         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30431         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30432         this_ptr_conv.is_owned = false;
30433         LDKPublicKey val_ref;
30434         CHECK(val->arr_len == 33);
30435         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
30436         UnsignedChannelAnnouncement_set_bitcoin_key_1(&this_ptr_conv, val_ref);
30437 }
30438
30439 int8_tArray  __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_bitcoin_key_2"))) TS_UnsignedChannelAnnouncement_get_bitcoin_key_2(uint64_t this_ptr) {
30440         LDKUnsignedChannelAnnouncement this_ptr_conv;
30441         this_ptr_conv.inner = untag_ptr(this_ptr);
30442         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30443         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30444         this_ptr_conv.is_owned = false;
30445         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
30446         memcpy(ret_arr->elems, UnsignedChannelAnnouncement_get_bitcoin_key_2(&this_ptr_conv).compressed_form, 33);
30447         return ret_arr;
30448 }
30449
30450 void  __attribute__((export_name("TS_UnsignedChannelAnnouncement_set_bitcoin_key_2"))) TS_UnsignedChannelAnnouncement_set_bitcoin_key_2(uint64_t this_ptr, int8_tArray val) {
30451         LDKUnsignedChannelAnnouncement this_ptr_conv;
30452         this_ptr_conv.inner = untag_ptr(this_ptr);
30453         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30454         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30455         this_ptr_conv.is_owned = false;
30456         LDKPublicKey val_ref;
30457         CHECK(val->arr_len == 33);
30458         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
30459         UnsignedChannelAnnouncement_set_bitcoin_key_2(&this_ptr_conv, val_ref);
30460 }
30461
30462 static inline uint64_t UnsignedChannelAnnouncement_clone_ptr(LDKUnsignedChannelAnnouncement *NONNULL_PTR arg) {
30463         LDKUnsignedChannelAnnouncement ret_var = UnsignedChannelAnnouncement_clone(arg);
30464         uint64_t ret_ref = 0;
30465         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30466         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30467         return ret_ref;
30468 }
30469 int64_t  __attribute__((export_name("TS_UnsignedChannelAnnouncement_clone_ptr"))) TS_UnsignedChannelAnnouncement_clone_ptr(uint64_t arg) {
30470         LDKUnsignedChannelAnnouncement arg_conv;
30471         arg_conv.inner = untag_ptr(arg);
30472         arg_conv.is_owned = ptr_is_owned(arg);
30473         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30474         arg_conv.is_owned = false;
30475         int64_t ret_conv = UnsignedChannelAnnouncement_clone_ptr(&arg_conv);
30476         return ret_conv;
30477 }
30478
30479 uint64_t  __attribute__((export_name("TS_UnsignedChannelAnnouncement_clone"))) TS_UnsignedChannelAnnouncement_clone(uint64_t orig) {
30480         LDKUnsignedChannelAnnouncement orig_conv;
30481         orig_conv.inner = untag_ptr(orig);
30482         orig_conv.is_owned = ptr_is_owned(orig);
30483         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30484         orig_conv.is_owned = false;
30485         LDKUnsignedChannelAnnouncement ret_var = UnsignedChannelAnnouncement_clone(&orig_conv);
30486         uint64_t ret_ref = 0;
30487         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30488         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30489         return ret_ref;
30490 }
30491
30492 void  __attribute__((export_name("TS_ChannelAnnouncement_free"))) TS_ChannelAnnouncement_free(uint64_t this_obj) {
30493         LDKChannelAnnouncement this_obj_conv;
30494         this_obj_conv.inner = untag_ptr(this_obj);
30495         this_obj_conv.is_owned = ptr_is_owned(this_obj);
30496         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30497         ChannelAnnouncement_free(this_obj_conv);
30498 }
30499
30500 int8_tArray  __attribute__((export_name("TS_ChannelAnnouncement_get_node_signature_1"))) TS_ChannelAnnouncement_get_node_signature_1(uint64_t this_ptr) {
30501         LDKChannelAnnouncement this_ptr_conv;
30502         this_ptr_conv.inner = untag_ptr(this_ptr);
30503         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30504         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30505         this_ptr_conv.is_owned = false;
30506         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
30507         memcpy(ret_arr->elems, ChannelAnnouncement_get_node_signature_1(&this_ptr_conv).compact_form, 64);
30508         return ret_arr;
30509 }
30510
30511 void  __attribute__((export_name("TS_ChannelAnnouncement_set_node_signature_1"))) TS_ChannelAnnouncement_set_node_signature_1(uint64_t this_ptr, int8_tArray val) {
30512         LDKChannelAnnouncement this_ptr_conv;
30513         this_ptr_conv.inner = untag_ptr(this_ptr);
30514         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30515         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30516         this_ptr_conv.is_owned = false;
30517         LDKSignature val_ref;
30518         CHECK(val->arr_len == 64);
30519         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
30520         ChannelAnnouncement_set_node_signature_1(&this_ptr_conv, val_ref);
30521 }
30522
30523 int8_tArray  __attribute__((export_name("TS_ChannelAnnouncement_get_node_signature_2"))) TS_ChannelAnnouncement_get_node_signature_2(uint64_t this_ptr) {
30524         LDKChannelAnnouncement this_ptr_conv;
30525         this_ptr_conv.inner = untag_ptr(this_ptr);
30526         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30527         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30528         this_ptr_conv.is_owned = false;
30529         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
30530         memcpy(ret_arr->elems, ChannelAnnouncement_get_node_signature_2(&this_ptr_conv).compact_form, 64);
30531         return ret_arr;
30532 }
30533
30534 void  __attribute__((export_name("TS_ChannelAnnouncement_set_node_signature_2"))) TS_ChannelAnnouncement_set_node_signature_2(uint64_t this_ptr, int8_tArray val) {
30535         LDKChannelAnnouncement this_ptr_conv;
30536         this_ptr_conv.inner = untag_ptr(this_ptr);
30537         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30538         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30539         this_ptr_conv.is_owned = false;
30540         LDKSignature val_ref;
30541         CHECK(val->arr_len == 64);
30542         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
30543         ChannelAnnouncement_set_node_signature_2(&this_ptr_conv, val_ref);
30544 }
30545
30546 int8_tArray  __attribute__((export_name("TS_ChannelAnnouncement_get_bitcoin_signature_1"))) TS_ChannelAnnouncement_get_bitcoin_signature_1(uint64_t this_ptr) {
30547         LDKChannelAnnouncement this_ptr_conv;
30548         this_ptr_conv.inner = untag_ptr(this_ptr);
30549         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30550         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30551         this_ptr_conv.is_owned = false;
30552         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
30553         memcpy(ret_arr->elems, ChannelAnnouncement_get_bitcoin_signature_1(&this_ptr_conv).compact_form, 64);
30554         return ret_arr;
30555 }
30556
30557 void  __attribute__((export_name("TS_ChannelAnnouncement_set_bitcoin_signature_1"))) TS_ChannelAnnouncement_set_bitcoin_signature_1(uint64_t this_ptr, int8_tArray val) {
30558         LDKChannelAnnouncement this_ptr_conv;
30559         this_ptr_conv.inner = untag_ptr(this_ptr);
30560         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30561         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30562         this_ptr_conv.is_owned = false;
30563         LDKSignature val_ref;
30564         CHECK(val->arr_len == 64);
30565         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
30566         ChannelAnnouncement_set_bitcoin_signature_1(&this_ptr_conv, val_ref);
30567 }
30568
30569 int8_tArray  __attribute__((export_name("TS_ChannelAnnouncement_get_bitcoin_signature_2"))) TS_ChannelAnnouncement_get_bitcoin_signature_2(uint64_t this_ptr) {
30570         LDKChannelAnnouncement this_ptr_conv;
30571         this_ptr_conv.inner = untag_ptr(this_ptr);
30572         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30573         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30574         this_ptr_conv.is_owned = false;
30575         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
30576         memcpy(ret_arr->elems, ChannelAnnouncement_get_bitcoin_signature_2(&this_ptr_conv).compact_form, 64);
30577         return ret_arr;
30578 }
30579
30580 void  __attribute__((export_name("TS_ChannelAnnouncement_set_bitcoin_signature_2"))) TS_ChannelAnnouncement_set_bitcoin_signature_2(uint64_t this_ptr, int8_tArray val) {
30581         LDKChannelAnnouncement this_ptr_conv;
30582         this_ptr_conv.inner = untag_ptr(this_ptr);
30583         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30584         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30585         this_ptr_conv.is_owned = false;
30586         LDKSignature val_ref;
30587         CHECK(val->arr_len == 64);
30588         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
30589         ChannelAnnouncement_set_bitcoin_signature_2(&this_ptr_conv, val_ref);
30590 }
30591
30592 uint64_t  __attribute__((export_name("TS_ChannelAnnouncement_get_contents"))) TS_ChannelAnnouncement_get_contents(uint64_t this_ptr) {
30593         LDKChannelAnnouncement this_ptr_conv;
30594         this_ptr_conv.inner = untag_ptr(this_ptr);
30595         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30596         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30597         this_ptr_conv.is_owned = false;
30598         LDKUnsignedChannelAnnouncement ret_var = ChannelAnnouncement_get_contents(&this_ptr_conv);
30599         uint64_t ret_ref = 0;
30600         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30601         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30602         return ret_ref;
30603 }
30604
30605 void  __attribute__((export_name("TS_ChannelAnnouncement_set_contents"))) TS_ChannelAnnouncement_set_contents(uint64_t this_ptr, uint64_t val) {
30606         LDKChannelAnnouncement 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         LDKUnsignedChannelAnnouncement val_conv;
30612         val_conv.inner = untag_ptr(val);
30613         val_conv.is_owned = ptr_is_owned(val);
30614         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
30615         val_conv = UnsignedChannelAnnouncement_clone(&val_conv);
30616         ChannelAnnouncement_set_contents(&this_ptr_conv, val_conv);
30617 }
30618
30619 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) {
30620         LDKSignature node_signature_1_arg_ref;
30621         CHECK(node_signature_1_arg->arr_len == 64);
30622         memcpy(node_signature_1_arg_ref.compact_form, node_signature_1_arg->elems, 64); FREE(node_signature_1_arg);
30623         LDKSignature node_signature_2_arg_ref;
30624         CHECK(node_signature_2_arg->arr_len == 64);
30625         memcpy(node_signature_2_arg_ref.compact_form, node_signature_2_arg->elems, 64); FREE(node_signature_2_arg);
30626         LDKSignature bitcoin_signature_1_arg_ref;
30627         CHECK(bitcoin_signature_1_arg->arr_len == 64);
30628         memcpy(bitcoin_signature_1_arg_ref.compact_form, bitcoin_signature_1_arg->elems, 64); FREE(bitcoin_signature_1_arg);
30629         LDKSignature bitcoin_signature_2_arg_ref;
30630         CHECK(bitcoin_signature_2_arg->arr_len == 64);
30631         memcpy(bitcoin_signature_2_arg_ref.compact_form, bitcoin_signature_2_arg->elems, 64); FREE(bitcoin_signature_2_arg);
30632         LDKUnsignedChannelAnnouncement contents_arg_conv;
30633         contents_arg_conv.inner = untag_ptr(contents_arg);
30634         contents_arg_conv.is_owned = ptr_is_owned(contents_arg);
30635         CHECK_INNER_FIELD_ACCESS_OR_NULL(contents_arg_conv);
30636         contents_arg_conv = UnsignedChannelAnnouncement_clone(&contents_arg_conv);
30637         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);
30638         uint64_t ret_ref = 0;
30639         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30640         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30641         return ret_ref;
30642 }
30643
30644 static inline uint64_t ChannelAnnouncement_clone_ptr(LDKChannelAnnouncement *NONNULL_PTR arg) {
30645         LDKChannelAnnouncement ret_var = ChannelAnnouncement_clone(arg);
30646         uint64_t ret_ref = 0;
30647         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30648         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30649         return ret_ref;
30650 }
30651 int64_t  __attribute__((export_name("TS_ChannelAnnouncement_clone_ptr"))) TS_ChannelAnnouncement_clone_ptr(uint64_t arg) {
30652         LDKChannelAnnouncement arg_conv;
30653         arg_conv.inner = untag_ptr(arg);
30654         arg_conv.is_owned = ptr_is_owned(arg);
30655         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30656         arg_conv.is_owned = false;
30657         int64_t ret_conv = ChannelAnnouncement_clone_ptr(&arg_conv);
30658         return ret_conv;
30659 }
30660
30661 uint64_t  __attribute__((export_name("TS_ChannelAnnouncement_clone"))) TS_ChannelAnnouncement_clone(uint64_t orig) {
30662         LDKChannelAnnouncement orig_conv;
30663         orig_conv.inner = untag_ptr(orig);
30664         orig_conv.is_owned = ptr_is_owned(orig);
30665         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30666         orig_conv.is_owned = false;
30667         LDKChannelAnnouncement ret_var = ChannelAnnouncement_clone(&orig_conv);
30668         uint64_t ret_ref = 0;
30669         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30670         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30671         return ret_ref;
30672 }
30673
30674 void  __attribute__((export_name("TS_UnsignedChannelUpdate_free"))) TS_UnsignedChannelUpdate_free(uint64_t this_obj) {
30675         LDKUnsignedChannelUpdate this_obj_conv;
30676         this_obj_conv.inner = untag_ptr(this_obj);
30677         this_obj_conv.is_owned = ptr_is_owned(this_obj);
30678         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30679         UnsignedChannelUpdate_free(this_obj_conv);
30680 }
30681
30682 int8_tArray  __attribute__((export_name("TS_UnsignedChannelUpdate_get_chain_hash"))) TS_UnsignedChannelUpdate_get_chain_hash(uint64_t this_ptr) {
30683         LDKUnsignedChannelUpdate this_ptr_conv;
30684         this_ptr_conv.inner = untag_ptr(this_ptr);
30685         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30686         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30687         this_ptr_conv.is_owned = false;
30688         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
30689         memcpy(ret_arr->elems, *UnsignedChannelUpdate_get_chain_hash(&this_ptr_conv), 32);
30690         return ret_arr;
30691 }
30692
30693 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_chain_hash"))) TS_UnsignedChannelUpdate_set_chain_hash(uint64_t this_ptr, int8_tArray val) {
30694         LDKUnsignedChannelUpdate this_ptr_conv;
30695         this_ptr_conv.inner = untag_ptr(this_ptr);
30696         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30697         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30698         this_ptr_conv.is_owned = false;
30699         LDKThirtyTwoBytes val_ref;
30700         CHECK(val->arr_len == 32);
30701         memcpy(val_ref.data, val->elems, 32); FREE(val);
30702         UnsignedChannelUpdate_set_chain_hash(&this_ptr_conv, val_ref);
30703 }
30704
30705 int64_t  __attribute__((export_name("TS_UnsignedChannelUpdate_get_short_channel_id"))) TS_UnsignedChannelUpdate_get_short_channel_id(uint64_t this_ptr) {
30706         LDKUnsignedChannelUpdate this_ptr_conv;
30707         this_ptr_conv.inner = untag_ptr(this_ptr);
30708         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30709         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30710         this_ptr_conv.is_owned = false;
30711         int64_t ret_conv = UnsignedChannelUpdate_get_short_channel_id(&this_ptr_conv);
30712         return ret_conv;
30713 }
30714
30715 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_short_channel_id"))) TS_UnsignedChannelUpdate_set_short_channel_id(uint64_t this_ptr, int64_t val) {
30716         LDKUnsignedChannelUpdate this_ptr_conv;
30717         this_ptr_conv.inner = untag_ptr(this_ptr);
30718         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30719         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30720         this_ptr_conv.is_owned = false;
30721         UnsignedChannelUpdate_set_short_channel_id(&this_ptr_conv, val);
30722 }
30723
30724 int32_t  __attribute__((export_name("TS_UnsignedChannelUpdate_get_timestamp"))) TS_UnsignedChannelUpdate_get_timestamp(uint64_t this_ptr) {
30725         LDKUnsignedChannelUpdate 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         int32_t ret_conv = UnsignedChannelUpdate_get_timestamp(&this_ptr_conv);
30731         return ret_conv;
30732 }
30733
30734 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_timestamp"))) TS_UnsignedChannelUpdate_set_timestamp(uint64_t this_ptr, int32_t val) {
30735         LDKUnsignedChannelUpdate this_ptr_conv;
30736         this_ptr_conv.inner = untag_ptr(this_ptr);
30737         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30738         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30739         this_ptr_conv.is_owned = false;
30740         UnsignedChannelUpdate_set_timestamp(&this_ptr_conv, val);
30741 }
30742
30743 int8_t  __attribute__((export_name("TS_UnsignedChannelUpdate_get_flags"))) TS_UnsignedChannelUpdate_get_flags(uint64_t this_ptr) {
30744         LDKUnsignedChannelUpdate this_ptr_conv;
30745         this_ptr_conv.inner = untag_ptr(this_ptr);
30746         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30747         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30748         this_ptr_conv.is_owned = false;
30749         int8_t ret_conv = UnsignedChannelUpdate_get_flags(&this_ptr_conv);
30750         return ret_conv;
30751 }
30752
30753 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_flags"))) TS_UnsignedChannelUpdate_set_flags(uint64_t this_ptr, int8_t val) {
30754         LDKUnsignedChannelUpdate this_ptr_conv;
30755         this_ptr_conv.inner = untag_ptr(this_ptr);
30756         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30757         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30758         this_ptr_conv.is_owned = false;
30759         UnsignedChannelUpdate_set_flags(&this_ptr_conv, val);
30760 }
30761
30762 int16_t  __attribute__((export_name("TS_UnsignedChannelUpdate_get_cltv_expiry_delta"))) TS_UnsignedChannelUpdate_get_cltv_expiry_delta(uint64_t this_ptr) {
30763         LDKUnsignedChannelUpdate this_ptr_conv;
30764         this_ptr_conv.inner = untag_ptr(this_ptr);
30765         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30766         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30767         this_ptr_conv.is_owned = false;
30768         int16_t ret_conv = UnsignedChannelUpdate_get_cltv_expiry_delta(&this_ptr_conv);
30769         return ret_conv;
30770 }
30771
30772 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_cltv_expiry_delta"))) TS_UnsignedChannelUpdate_set_cltv_expiry_delta(uint64_t this_ptr, int16_t val) {
30773         LDKUnsignedChannelUpdate this_ptr_conv;
30774         this_ptr_conv.inner = untag_ptr(this_ptr);
30775         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30776         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30777         this_ptr_conv.is_owned = false;
30778         UnsignedChannelUpdate_set_cltv_expiry_delta(&this_ptr_conv, val);
30779 }
30780
30781 int64_t  __attribute__((export_name("TS_UnsignedChannelUpdate_get_htlc_minimum_msat"))) TS_UnsignedChannelUpdate_get_htlc_minimum_msat(uint64_t this_ptr) {
30782         LDKUnsignedChannelUpdate 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         int64_t ret_conv = UnsignedChannelUpdate_get_htlc_minimum_msat(&this_ptr_conv);
30788         return ret_conv;
30789 }
30790
30791 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_htlc_minimum_msat"))) TS_UnsignedChannelUpdate_set_htlc_minimum_msat(uint64_t this_ptr, int64_t val) {
30792         LDKUnsignedChannelUpdate this_ptr_conv;
30793         this_ptr_conv.inner = untag_ptr(this_ptr);
30794         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30795         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30796         this_ptr_conv.is_owned = false;
30797         UnsignedChannelUpdate_set_htlc_minimum_msat(&this_ptr_conv, val);
30798 }
30799
30800 int64_t  __attribute__((export_name("TS_UnsignedChannelUpdate_get_htlc_maximum_msat"))) TS_UnsignedChannelUpdate_get_htlc_maximum_msat(uint64_t this_ptr) {
30801         LDKUnsignedChannelUpdate this_ptr_conv;
30802         this_ptr_conv.inner = untag_ptr(this_ptr);
30803         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30804         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30805         this_ptr_conv.is_owned = false;
30806         int64_t ret_conv = UnsignedChannelUpdate_get_htlc_maximum_msat(&this_ptr_conv);
30807         return ret_conv;
30808 }
30809
30810 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_htlc_maximum_msat"))) TS_UnsignedChannelUpdate_set_htlc_maximum_msat(uint64_t this_ptr, int64_t val) {
30811         LDKUnsignedChannelUpdate this_ptr_conv;
30812         this_ptr_conv.inner = untag_ptr(this_ptr);
30813         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30814         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30815         this_ptr_conv.is_owned = false;
30816         UnsignedChannelUpdate_set_htlc_maximum_msat(&this_ptr_conv, val);
30817 }
30818
30819 int32_t  __attribute__((export_name("TS_UnsignedChannelUpdate_get_fee_base_msat"))) TS_UnsignedChannelUpdate_get_fee_base_msat(uint64_t this_ptr) {
30820         LDKUnsignedChannelUpdate this_ptr_conv;
30821         this_ptr_conv.inner = untag_ptr(this_ptr);
30822         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30823         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30824         this_ptr_conv.is_owned = false;
30825         int32_t ret_conv = UnsignedChannelUpdate_get_fee_base_msat(&this_ptr_conv);
30826         return ret_conv;
30827 }
30828
30829 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_fee_base_msat"))) TS_UnsignedChannelUpdate_set_fee_base_msat(uint64_t this_ptr, int32_t val) {
30830         LDKUnsignedChannelUpdate this_ptr_conv;
30831         this_ptr_conv.inner = untag_ptr(this_ptr);
30832         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30833         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30834         this_ptr_conv.is_owned = false;
30835         UnsignedChannelUpdate_set_fee_base_msat(&this_ptr_conv, val);
30836 }
30837
30838 int32_t  __attribute__((export_name("TS_UnsignedChannelUpdate_get_fee_proportional_millionths"))) TS_UnsignedChannelUpdate_get_fee_proportional_millionths(uint64_t this_ptr) {
30839         LDKUnsignedChannelUpdate this_ptr_conv;
30840         this_ptr_conv.inner = untag_ptr(this_ptr);
30841         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30842         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30843         this_ptr_conv.is_owned = false;
30844         int32_t ret_conv = UnsignedChannelUpdate_get_fee_proportional_millionths(&this_ptr_conv);
30845         return ret_conv;
30846 }
30847
30848 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_fee_proportional_millionths"))) TS_UnsignedChannelUpdate_set_fee_proportional_millionths(uint64_t this_ptr, int32_t val) {
30849         LDKUnsignedChannelUpdate this_ptr_conv;
30850         this_ptr_conv.inner = untag_ptr(this_ptr);
30851         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30852         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30853         this_ptr_conv.is_owned = false;
30854         UnsignedChannelUpdate_set_fee_proportional_millionths(&this_ptr_conv, val);
30855 }
30856
30857 int8_tArray  __attribute__((export_name("TS_UnsignedChannelUpdate_get_excess_data"))) TS_UnsignedChannelUpdate_get_excess_data(uint64_t this_ptr) {
30858         LDKUnsignedChannelUpdate this_ptr_conv;
30859         this_ptr_conv.inner = untag_ptr(this_ptr);
30860         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30861         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30862         this_ptr_conv.is_owned = false;
30863         LDKCVec_u8Z ret_var = UnsignedChannelUpdate_get_excess_data(&this_ptr_conv);
30864         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
30865         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
30866         CVec_u8Z_free(ret_var);
30867         return ret_arr;
30868 }
30869
30870 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_excess_data"))) TS_UnsignedChannelUpdate_set_excess_data(uint64_t this_ptr, int8_tArray val) {
30871         LDKUnsignedChannelUpdate this_ptr_conv;
30872         this_ptr_conv.inner = untag_ptr(this_ptr);
30873         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30874         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30875         this_ptr_conv.is_owned = false;
30876         LDKCVec_u8Z val_ref;
30877         val_ref.datalen = val->arr_len;
30878         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
30879         memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
30880         UnsignedChannelUpdate_set_excess_data(&this_ptr_conv, val_ref);
30881 }
30882
30883 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) {
30884         LDKThirtyTwoBytes chain_hash_arg_ref;
30885         CHECK(chain_hash_arg->arr_len == 32);
30886         memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
30887         LDKCVec_u8Z excess_data_arg_ref;
30888         excess_data_arg_ref.datalen = excess_data_arg->arr_len;
30889         excess_data_arg_ref.data = MALLOC(excess_data_arg_ref.datalen, "LDKCVec_u8Z Bytes");
30890         memcpy(excess_data_arg_ref.data, excess_data_arg->elems, excess_data_arg_ref.datalen); FREE(excess_data_arg);
30891         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);
30892         uint64_t ret_ref = 0;
30893         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30894         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30895         return ret_ref;
30896 }
30897
30898 static inline uint64_t UnsignedChannelUpdate_clone_ptr(LDKUnsignedChannelUpdate *NONNULL_PTR arg) {
30899         LDKUnsignedChannelUpdate ret_var = UnsignedChannelUpdate_clone(arg);
30900         uint64_t ret_ref = 0;
30901         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30902         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30903         return ret_ref;
30904 }
30905 int64_t  __attribute__((export_name("TS_UnsignedChannelUpdate_clone_ptr"))) TS_UnsignedChannelUpdate_clone_ptr(uint64_t arg) {
30906         LDKUnsignedChannelUpdate arg_conv;
30907         arg_conv.inner = untag_ptr(arg);
30908         arg_conv.is_owned = ptr_is_owned(arg);
30909         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30910         arg_conv.is_owned = false;
30911         int64_t ret_conv = UnsignedChannelUpdate_clone_ptr(&arg_conv);
30912         return ret_conv;
30913 }
30914
30915 uint64_t  __attribute__((export_name("TS_UnsignedChannelUpdate_clone"))) TS_UnsignedChannelUpdate_clone(uint64_t orig) {
30916         LDKUnsignedChannelUpdate orig_conv;
30917         orig_conv.inner = untag_ptr(orig);
30918         orig_conv.is_owned = ptr_is_owned(orig);
30919         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30920         orig_conv.is_owned = false;
30921         LDKUnsignedChannelUpdate ret_var = UnsignedChannelUpdate_clone(&orig_conv);
30922         uint64_t ret_ref = 0;
30923         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30924         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30925         return ret_ref;
30926 }
30927
30928 void  __attribute__((export_name("TS_ChannelUpdate_free"))) TS_ChannelUpdate_free(uint64_t this_obj) {
30929         LDKChannelUpdate this_obj_conv;
30930         this_obj_conv.inner = untag_ptr(this_obj);
30931         this_obj_conv.is_owned = ptr_is_owned(this_obj);
30932         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30933         ChannelUpdate_free(this_obj_conv);
30934 }
30935
30936 int8_tArray  __attribute__((export_name("TS_ChannelUpdate_get_signature"))) TS_ChannelUpdate_get_signature(uint64_t this_ptr) {
30937         LDKChannelUpdate this_ptr_conv;
30938         this_ptr_conv.inner = untag_ptr(this_ptr);
30939         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30940         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30941         this_ptr_conv.is_owned = false;
30942         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
30943         memcpy(ret_arr->elems, ChannelUpdate_get_signature(&this_ptr_conv).compact_form, 64);
30944         return ret_arr;
30945 }
30946
30947 void  __attribute__((export_name("TS_ChannelUpdate_set_signature"))) TS_ChannelUpdate_set_signature(uint64_t this_ptr, int8_tArray val) {
30948         LDKChannelUpdate this_ptr_conv;
30949         this_ptr_conv.inner = untag_ptr(this_ptr);
30950         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30951         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30952         this_ptr_conv.is_owned = false;
30953         LDKSignature val_ref;
30954         CHECK(val->arr_len == 64);
30955         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
30956         ChannelUpdate_set_signature(&this_ptr_conv, val_ref);
30957 }
30958
30959 uint64_t  __attribute__((export_name("TS_ChannelUpdate_get_contents"))) TS_ChannelUpdate_get_contents(uint64_t this_ptr) {
30960         LDKChannelUpdate this_ptr_conv;
30961         this_ptr_conv.inner = untag_ptr(this_ptr);
30962         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30963         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30964         this_ptr_conv.is_owned = false;
30965         LDKUnsignedChannelUpdate ret_var = ChannelUpdate_get_contents(&this_ptr_conv);
30966         uint64_t ret_ref = 0;
30967         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30968         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30969         return ret_ref;
30970 }
30971
30972 void  __attribute__((export_name("TS_ChannelUpdate_set_contents"))) TS_ChannelUpdate_set_contents(uint64_t this_ptr, uint64_t val) {
30973         LDKChannelUpdate this_ptr_conv;
30974         this_ptr_conv.inner = untag_ptr(this_ptr);
30975         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30976         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30977         this_ptr_conv.is_owned = false;
30978         LDKUnsignedChannelUpdate val_conv;
30979         val_conv.inner = untag_ptr(val);
30980         val_conv.is_owned = ptr_is_owned(val);
30981         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
30982         val_conv = UnsignedChannelUpdate_clone(&val_conv);
30983         ChannelUpdate_set_contents(&this_ptr_conv, val_conv);
30984 }
30985
30986 uint64_t  __attribute__((export_name("TS_ChannelUpdate_new"))) TS_ChannelUpdate_new(int8_tArray signature_arg, uint64_t contents_arg) {
30987         LDKSignature signature_arg_ref;
30988         CHECK(signature_arg->arr_len == 64);
30989         memcpy(signature_arg_ref.compact_form, signature_arg->elems, 64); FREE(signature_arg);
30990         LDKUnsignedChannelUpdate contents_arg_conv;
30991         contents_arg_conv.inner = untag_ptr(contents_arg);
30992         contents_arg_conv.is_owned = ptr_is_owned(contents_arg);
30993         CHECK_INNER_FIELD_ACCESS_OR_NULL(contents_arg_conv);
30994         contents_arg_conv = UnsignedChannelUpdate_clone(&contents_arg_conv);
30995         LDKChannelUpdate ret_var = ChannelUpdate_new(signature_arg_ref, contents_arg_conv);
30996         uint64_t ret_ref = 0;
30997         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30998         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30999         return ret_ref;
31000 }
31001
31002 static inline uint64_t ChannelUpdate_clone_ptr(LDKChannelUpdate *NONNULL_PTR arg) {
31003         LDKChannelUpdate ret_var = ChannelUpdate_clone(arg);
31004         uint64_t ret_ref = 0;
31005         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31006         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31007         return ret_ref;
31008 }
31009 int64_t  __attribute__((export_name("TS_ChannelUpdate_clone_ptr"))) TS_ChannelUpdate_clone_ptr(uint64_t arg) {
31010         LDKChannelUpdate arg_conv;
31011         arg_conv.inner = untag_ptr(arg);
31012         arg_conv.is_owned = ptr_is_owned(arg);
31013         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31014         arg_conv.is_owned = false;
31015         int64_t ret_conv = ChannelUpdate_clone_ptr(&arg_conv);
31016         return ret_conv;
31017 }
31018
31019 uint64_t  __attribute__((export_name("TS_ChannelUpdate_clone"))) TS_ChannelUpdate_clone(uint64_t orig) {
31020         LDKChannelUpdate orig_conv;
31021         orig_conv.inner = untag_ptr(orig);
31022         orig_conv.is_owned = ptr_is_owned(orig);
31023         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31024         orig_conv.is_owned = false;
31025         LDKChannelUpdate ret_var = ChannelUpdate_clone(&orig_conv);
31026         uint64_t ret_ref = 0;
31027         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31028         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31029         return ret_ref;
31030 }
31031
31032 void  __attribute__((export_name("TS_QueryChannelRange_free"))) TS_QueryChannelRange_free(uint64_t this_obj) {
31033         LDKQueryChannelRange this_obj_conv;
31034         this_obj_conv.inner = untag_ptr(this_obj);
31035         this_obj_conv.is_owned = ptr_is_owned(this_obj);
31036         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31037         QueryChannelRange_free(this_obj_conv);
31038 }
31039
31040 int8_tArray  __attribute__((export_name("TS_QueryChannelRange_get_chain_hash"))) TS_QueryChannelRange_get_chain_hash(uint64_t this_ptr) {
31041         LDKQueryChannelRange this_ptr_conv;
31042         this_ptr_conv.inner = untag_ptr(this_ptr);
31043         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31044         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31045         this_ptr_conv.is_owned = false;
31046         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
31047         memcpy(ret_arr->elems, *QueryChannelRange_get_chain_hash(&this_ptr_conv), 32);
31048         return ret_arr;
31049 }
31050
31051 void  __attribute__((export_name("TS_QueryChannelRange_set_chain_hash"))) TS_QueryChannelRange_set_chain_hash(uint64_t this_ptr, int8_tArray val) {
31052         LDKQueryChannelRange this_ptr_conv;
31053         this_ptr_conv.inner = untag_ptr(this_ptr);
31054         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31055         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31056         this_ptr_conv.is_owned = false;
31057         LDKThirtyTwoBytes val_ref;
31058         CHECK(val->arr_len == 32);
31059         memcpy(val_ref.data, val->elems, 32); FREE(val);
31060         QueryChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
31061 }
31062
31063 int32_t  __attribute__((export_name("TS_QueryChannelRange_get_first_blocknum"))) TS_QueryChannelRange_get_first_blocknum(uint64_t this_ptr) {
31064         LDKQueryChannelRange this_ptr_conv;
31065         this_ptr_conv.inner = untag_ptr(this_ptr);
31066         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31067         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31068         this_ptr_conv.is_owned = false;
31069         int32_t ret_conv = QueryChannelRange_get_first_blocknum(&this_ptr_conv);
31070         return ret_conv;
31071 }
31072
31073 void  __attribute__((export_name("TS_QueryChannelRange_set_first_blocknum"))) TS_QueryChannelRange_set_first_blocknum(uint64_t this_ptr, int32_t val) {
31074         LDKQueryChannelRange this_ptr_conv;
31075         this_ptr_conv.inner = untag_ptr(this_ptr);
31076         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31077         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31078         this_ptr_conv.is_owned = false;
31079         QueryChannelRange_set_first_blocknum(&this_ptr_conv, val);
31080 }
31081
31082 int32_t  __attribute__((export_name("TS_QueryChannelRange_get_number_of_blocks"))) TS_QueryChannelRange_get_number_of_blocks(uint64_t this_ptr) {
31083         LDKQueryChannelRange this_ptr_conv;
31084         this_ptr_conv.inner = untag_ptr(this_ptr);
31085         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31086         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31087         this_ptr_conv.is_owned = false;
31088         int32_t ret_conv = QueryChannelRange_get_number_of_blocks(&this_ptr_conv);
31089         return ret_conv;
31090 }
31091
31092 void  __attribute__((export_name("TS_QueryChannelRange_set_number_of_blocks"))) TS_QueryChannelRange_set_number_of_blocks(uint64_t this_ptr, int32_t val) {
31093         LDKQueryChannelRange this_ptr_conv;
31094         this_ptr_conv.inner = untag_ptr(this_ptr);
31095         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31096         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31097         this_ptr_conv.is_owned = false;
31098         QueryChannelRange_set_number_of_blocks(&this_ptr_conv, val);
31099 }
31100
31101 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) {
31102         LDKThirtyTwoBytes chain_hash_arg_ref;
31103         CHECK(chain_hash_arg->arr_len == 32);
31104         memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
31105         LDKQueryChannelRange ret_var = QueryChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg);
31106         uint64_t ret_ref = 0;
31107         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31108         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31109         return ret_ref;
31110 }
31111
31112 static inline uint64_t QueryChannelRange_clone_ptr(LDKQueryChannelRange *NONNULL_PTR arg) {
31113         LDKQueryChannelRange ret_var = QueryChannelRange_clone(arg);
31114         uint64_t ret_ref = 0;
31115         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31116         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31117         return ret_ref;
31118 }
31119 int64_t  __attribute__((export_name("TS_QueryChannelRange_clone_ptr"))) TS_QueryChannelRange_clone_ptr(uint64_t arg) {
31120         LDKQueryChannelRange arg_conv;
31121         arg_conv.inner = untag_ptr(arg);
31122         arg_conv.is_owned = ptr_is_owned(arg);
31123         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31124         arg_conv.is_owned = false;
31125         int64_t ret_conv = QueryChannelRange_clone_ptr(&arg_conv);
31126         return ret_conv;
31127 }
31128
31129 uint64_t  __attribute__((export_name("TS_QueryChannelRange_clone"))) TS_QueryChannelRange_clone(uint64_t orig) {
31130         LDKQueryChannelRange orig_conv;
31131         orig_conv.inner = untag_ptr(orig);
31132         orig_conv.is_owned = ptr_is_owned(orig);
31133         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31134         orig_conv.is_owned = false;
31135         LDKQueryChannelRange ret_var = QueryChannelRange_clone(&orig_conv);
31136         uint64_t ret_ref = 0;
31137         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31138         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31139         return ret_ref;
31140 }
31141
31142 void  __attribute__((export_name("TS_ReplyChannelRange_free"))) TS_ReplyChannelRange_free(uint64_t this_obj) {
31143         LDKReplyChannelRange this_obj_conv;
31144         this_obj_conv.inner = untag_ptr(this_obj);
31145         this_obj_conv.is_owned = ptr_is_owned(this_obj);
31146         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31147         ReplyChannelRange_free(this_obj_conv);
31148 }
31149
31150 int8_tArray  __attribute__((export_name("TS_ReplyChannelRange_get_chain_hash"))) TS_ReplyChannelRange_get_chain_hash(uint64_t this_ptr) {
31151         LDKReplyChannelRange this_ptr_conv;
31152         this_ptr_conv.inner = untag_ptr(this_ptr);
31153         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31154         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31155         this_ptr_conv.is_owned = false;
31156         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
31157         memcpy(ret_arr->elems, *ReplyChannelRange_get_chain_hash(&this_ptr_conv), 32);
31158         return ret_arr;
31159 }
31160
31161 void  __attribute__((export_name("TS_ReplyChannelRange_set_chain_hash"))) TS_ReplyChannelRange_set_chain_hash(uint64_t this_ptr, int8_tArray val) {
31162         LDKReplyChannelRange this_ptr_conv;
31163         this_ptr_conv.inner = untag_ptr(this_ptr);
31164         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31165         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31166         this_ptr_conv.is_owned = false;
31167         LDKThirtyTwoBytes val_ref;
31168         CHECK(val->arr_len == 32);
31169         memcpy(val_ref.data, val->elems, 32); FREE(val);
31170         ReplyChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
31171 }
31172
31173 int32_t  __attribute__((export_name("TS_ReplyChannelRange_get_first_blocknum"))) TS_ReplyChannelRange_get_first_blocknum(uint64_t this_ptr) {
31174         LDKReplyChannelRange 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         int32_t ret_conv = ReplyChannelRange_get_first_blocknum(&this_ptr_conv);
31180         return ret_conv;
31181 }
31182
31183 void  __attribute__((export_name("TS_ReplyChannelRange_set_first_blocknum"))) TS_ReplyChannelRange_set_first_blocknum(uint64_t this_ptr, int32_t val) {
31184         LDKReplyChannelRange this_ptr_conv;
31185         this_ptr_conv.inner = untag_ptr(this_ptr);
31186         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31187         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31188         this_ptr_conv.is_owned = false;
31189         ReplyChannelRange_set_first_blocknum(&this_ptr_conv, val);
31190 }
31191
31192 int32_t  __attribute__((export_name("TS_ReplyChannelRange_get_number_of_blocks"))) TS_ReplyChannelRange_get_number_of_blocks(uint64_t this_ptr) {
31193         LDKReplyChannelRange this_ptr_conv;
31194         this_ptr_conv.inner = untag_ptr(this_ptr);
31195         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31196         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31197         this_ptr_conv.is_owned = false;
31198         int32_t ret_conv = ReplyChannelRange_get_number_of_blocks(&this_ptr_conv);
31199         return ret_conv;
31200 }
31201
31202 void  __attribute__((export_name("TS_ReplyChannelRange_set_number_of_blocks"))) TS_ReplyChannelRange_set_number_of_blocks(uint64_t this_ptr, int32_t val) {
31203         LDKReplyChannelRange this_ptr_conv;
31204         this_ptr_conv.inner = untag_ptr(this_ptr);
31205         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31206         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31207         this_ptr_conv.is_owned = false;
31208         ReplyChannelRange_set_number_of_blocks(&this_ptr_conv, val);
31209 }
31210
31211 jboolean  __attribute__((export_name("TS_ReplyChannelRange_get_sync_complete"))) TS_ReplyChannelRange_get_sync_complete(uint64_t this_ptr) {
31212         LDKReplyChannelRange this_ptr_conv;
31213         this_ptr_conv.inner = untag_ptr(this_ptr);
31214         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31215         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31216         this_ptr_conv.is_owned = false;
31217         jboolean ret_conv = ReplyChannelRange_get_sync_complete(&this_ptr_conv);
31218         return ret_conv;
31219 }
31220
31221 void  __attribute__((export_name("TS_ReplyChannelRange_set_sync_complete"))) TS_ReplyChannelRange_set_sync_complete(uint64_t this_ptr, jboolean val) {
31222         LDKReplyChannelRange this_ptr_conv;
31223         this_ptr_conv.inner = untag_ptr(this_ptr);
31224         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31225         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31226         this_ptr_conv.is_owned = false;
31227         ReplyChannelRange_set_sync_complete(&this_ptr_conv, val);
31228 }
31229
31230 int64_tArray  __attribute__((export_name("TS_ReplyChannelRange_get_short_channel_ids"))) TS_ReplyChannelRange_get_short_channel_ids(uint64_t this_ptr) {
31231         LDKReplyChannelRange this_ptr_conv;
31232         this_ptr_conv.inner = untag_ptr(this_ptr);
31233         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31234         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31235         this_ptr_conv.is_owned = false;
31236         LDKCVec_u64Z ret_var = ReplyChannelRange_get_short_channel_ids(&this_ptr_conv);
31237         int64_tArray ret_arr = NULL;
31238         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
31239         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
31240         for (size_t i = 0; i < ret_var.datalen; i++) {
31241                 int64_t ret_conv_8_conv = ret_var.data[i];
31242                 ret_arr_ptr[i] = ret_conv_8_conv;
31243         }
31244         
31245         FREE(ret_var.data);
31246         return ret_arr;
31247 }
31248
31249 void  __attribute__((export_name("TS_ReplyChannelRange_set_short_channel_ids"))) TS_ReplyChannelRange_set_short_channel_ids(uint64_t this_ptr, int64_tArray val) {
31250         LDKReplyChannelRange this_ptr_conv;
31251         this_ptr_conv.inner = untag_ptr(this_ptr);
31252         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31253         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31254         this_ptr_conv.is_owned = false;
31255         LDKCVec_u64Z val_constr;
31256         val_constr.datalen = val->arr_len;
31257         if (val_constr.datalen > 0)
31258                 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
31259         else
31260                 val_constr.data = NULL;
31261         int64_t* val_vals = val->elems;
31262         for (size_t i = 0; i < val_constr.datalen; i++) {
31263                 int64_t val_conv_8 = val_vals[i];
31264                 val_constr.data[i] = val_conv_8;
31265         }
31266         FREE(val);
31267         ReplyChannelRange_set_short_channel_ids(&this_ptr_conv, val_constr);
31268 }
31269
31270 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) {
31271         LDKThirtyTwoBytes chain_hash_arg_ref;
31272         CHECK(chain_hash_arg->arr_len == 32);
31273         memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
31274         LDKCVec_u64Z short_channel_ids_arg_constr;
31275         short_channel_ids_arg_constr.datalen = short_channel_ids_arg->arr_len;
31276         if (short_channel_ids_arg_constr.datalen > 0)
31277                 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
31278         else
31279                 short_channel_ids_arg_constr.data = NULL;
31280         int64_t* short_channel_ids_arg_vals = short_channel_ids_arg->elems;
31281         for (size_t i = 0; i < short_channel_ids_arg_constr.datalen; i++) {
31282                 int64_t short_channel_ids_arg_conv_8 = short_channel_ids_arg_vals[i];
31283                 short_channel_ids_arg_constr.data[i] = short_channel_ids_arg_conv_8;
31284         }
31285         FREE(short_channel_ids_arg);
31286         LDKReplyChannelRange ret_var = ReplyChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg, sync_complete_arg, short_channel_ids_arg_constr);
31287         uint64_t ret_ref = 0;
31288         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31289         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31290         return ret_ref;
31291 }
31292
31293 static inline uint64_t ReplyChannelRange_clone_ptr(LDKReplyChannelRange *NONNULL_PTR arg) {
31294         LDKReplyChannelRange ret_var = ReplyChannelRange_clone(arg);
31295         uint64_t ret_ref = 0;
31296         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31297         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31298         return ret_ref;
31299 }
31300 int64_t  __attribute__((export_name("TS_ReplyChannelRange_clone_ptr"))) TS_ReplyChannelRange_clone_ptr(uint64_t arg) {
31301         LDKReplyChannelRange arg_conv;
31302         arg_conv.inner = untag_ptr(arg);
31303         arg_conv.is_owned = ptr_is_owned(arg);
31304         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31305         arg_conv.is_owned = false;
31306         int64_t ret_conv = ReplyChannelRange_clone_ptr(&arg_conv);
31307         return ret_conv;
31308 }
31309
31310 uint64_t  __attribute__((export_name("TS_ReplyChannelRange_clone"))) TS_ReplyChannelRange_clone(uint64_t orig) {
31311         LDKReplyChannelRange orig_conv;
31312         orig_conv.inner = untag_ptr(orig);
31313         orig_conv.is_owned = ptr_is_owned(orig);
31314         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31315         orig_conv.is_owned = false;
31316         LDKReplyChannelRange ret_var = ReplyChannelRange_clone(&orig_conv);
31317         uint64_t ret_ref = 0;
31318         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31319         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31320         return ret_ref;
31321 }
31322
31323 void  __attribute__((export_name("TS_QueryShortChannelIds_free"))) TS_QueryShortChannelIds_free(uint64_t this_obj) {
31324         LDKQueryShortChannelIds this_obj_conv;
31325         this_obj_conv.inner = untag_ptr(this_obj);
31326         this_obj_conv.is_owned = ptr_is_owned(this_obj);
31327         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31328         QueryShortChannelIds_free(this_obj_conv);
31329 }
31330
31331 int8_tArray  __attribute__((export_name("TS_QueryShortChannelIds_get_chain_hash"))) TS_QueryShortChannelIds_get_chain_hash(uint64_t this_ptr) {
31332         LDKQueryShortChannelIds this_ptr_conv;
31333         this_ptr_conv.inner = untag_ptr(this_ptr);
31334         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31335         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31336         this_ptr_conv.is_owned = false;
31337         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
31338         memcpy(ret_arr->elems, *QueryShortChannelIds_get_chain_hash(&this_ptr_conv), 32);
31339         return ret_arr;
31340 }
31341
31342 void  __attribute__((export_name("TS_QueryShortChannelIds_set_chain_hash"))) TS_QueryShortChannelIds_set_chain_hash(uint64_t this_ptr, int8_tArray val) {
31343         LDKQueryShortChannelIds this_ptr_conv;
31344         this_ptr_conv.inner = untag_ptr(this_ptr);
31345         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31346         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31347         this_ptr_conv.is_owned = false;
31348         LDKThirtyTwoBytes val_ref;
31349         CHECK(val->arr_len == 32);
31350         memcpy(val_ref.data, val->elems, 32); FREE(val);
31351         QueryShortChannelIds_set_chain_hash(&this_ptr_conv, val_ref);
31352 }
31353
31354 int64_tArray  __attribute__((export_name("TS_QueryShortChannelIds_get_short_channel_ids"))) TS_QueryShortChannelIds_get_short_channel_ids(uint64_t this_ptr) {
31355         LDKQueryShortChannelIds this_ptr_conv;
31356         this_ptr_conv.inner = untag_ptr(this_ptr);
31357         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31358         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31359         this_ptr_conv.is_owned = false;
31360         LDKCVec_u64Z ret_var = QueryShortChannelIds_get_short_channel_ids(&this_ptr_conv);
31361         int64_tArray ret_arr = NULL;
31362         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
31363         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
31364         for (size_t i = 0; i < ret_var.datalen; i++) {
31365                 int64_t ret_conv_8_conv = ret_var.data[i];
31366                 ret_arr_ptr[i] = ret_conv_8_conv;
31367         }
31368         
31369         FREE(ret_var.data);
31370         return ret_arr;
31371 }
31372
31373 void  __attribute__((export_name("TS_QueryShortChannelIds_set_short_channel_ids"))) TS_QueryShortChannelIds_set_short_channel_ids(uint64_t this_ptr, int64_tArray val) {
31374         LDKQueryShortChannelIds this_ptr_conv;
31375         this_ptr_conv.inner = untag_ptr(this_ptr);
31376         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31377         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31378         this_ptr_conv.is_owned = false;
31379         LDKCVec_u64Z val_constr;
31380         val_constr.datalen = val->arr_len;
31381         if (val_constr.datalen > 0)
31382                 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
31383         else
31384                 val_constr.data = NULL;
31385         int64_t* val_vals = val->elems;
31386         for (size_t i = 0; i < val_constr.datalen; i++) {
31387                 int64_t val_conv_8 = val_vals[i];
31388                 val_constr.data[i] = val_conv_8;
31389         }
31390         FREE(val);
31391         QueryShortChannelIds_set_short_channel_ids(&this_ptr_conv, val_constr);
31392 }
31393
31394 uint64_t  __attribute__((export_name("TS_QueryShortChannelIds_new"))) TS_QueryShortChannelIds_new(int8_tArray chain_hash_arg, int64_tArray short_channel_ids_arg) {
31395         LDKThirtyTwoBytes chain_hash_arg_ref;
31396         CHECK(chain_hash_arg->arr_len == 32);
31397         memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
31398         LDKCVec_u64Z short_channel_ids_arg_constr;
31399         short_channel_ids_arg_constr.datalen = short_channel_ids_arg->arr_len;
31400         if (short_channel_ids_arg_constr.datalen > 0)
31401                 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
31402         else
31403                 short_channel_ids_arg_constr.data = NULL;
31404         int64_t* short_channel_ids_arg_vals = short_channel_ids_arg->elems;
31405         for (size_t i = 0; i < short_channel_ids_arg_constr.datalen; i++) {
31406                 int64_t short_channel_ids_arg_conv_8 = short_channel_ids_arg_vals[i];
31407                 short_channel_ids_arg_constr.data[i] = short_channel_ids_arg_conv_8;
31408         }
31409         FREE(short_channel_ids_arg);
31410         LDKQueryShortChannelIds ret_var = QueryShortChannelIds_new(chain_hash_arg_ref, short_channel_ids_arg_constr);
31411         uint64_t ret_ref = 0;
31412         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31413         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31414         return ret_ref;
31415 }
31416
31417 static inline uint64_t QueryShortChannelIds_clone_ptr(LDKQueryShortChannelIds *NONNULL_PTR arg) {
31418         LDKQueryShortChannelIds ret_var = QueryShortChannelIds_clone(arg);
31419         uint64_t ret_ref = 0;
31420         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31421         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31422         return ret_ref;
31423 }
31424 int64_t  __attribute__((export_name("TS_QueryShortChannelIds_clone_ptr"))) TS_QueryShortChannelIds_clone_ptr(uint64_t arg) {
31425         LDKQueryShortChannelIds arg_conv;
31426         arg_conv.inner = untag_ptr(arg);
31427         arg_conv.is_owned = ptr_is_owned(arg);
31428         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31429         arg_conv.is_owned = false;
31430         int64_t ret_conv = QueryShortChannelIds_clone_ptr(&arg_conv);
31431         return ret_conv;
31432 }
31433
31434 uint64_t  __attribute__((export_name("TS_QueryShortChannelIds_clone"))) TS_QueryShortChannelIds_clone(uint64_t orig) {
31435         LDKQueryShortChannelIds orig_conv;
31436         orig_conv.inner = untag_ptr(orig);
31437         orig_conv.is_owned = ptr_is_owned(orig);
31438         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31439         orig_conv.is_owned = false;
31440         LDKQueryShortChannelIds ret_var = QueryShortChannelIds_clone(&orig_conv);
31441         uint64_t ret_ref = 0;
31442         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31443         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31444         return ret_ref;
31445 }
31446
31447 void  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_free"))) TS_ReplyShortChannelIdsEnd_free(uint64_t this_obj) {
31448         LDKReplyShortChannelIdsEnd this_obj_conv;
31449         this_obj_conv.inner = untag_ptr(this_obj);
31450         this_obj_conv.is_owned = ptr_is_owned(this_obj);
31451         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31452         ReplyShortChannelIdsEnd_free(this_obj_conv);
31453 }
31454
31455 int8_tArray  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_get_chain_hash"))) TS_ReplyShortChannelIdsEnd_get_chain_hash(uint64_t this_ptr) {
31456         LDKReplyShortChannelIdsEnd this_ptr_conv;
31457         this_ptr_conv.inner = untag_ptr(this_ptr);
31458         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31459         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31460         this_ptr_conv.is_owned = false;
31461         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
31462         memcpy(ret_arr->elems, *ReplyShortChannelIdsEnd_get_chain_hash(&this_ptr_conv), 32);
31463         return ret_arr;
31464 }
31465
31466 void  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_set_chain_hash"))) TS_ReplyShortChannelIdsEnd_set_chain_hash(uint64_t this_ptr, int8_tArray val) {
31467         LDKReplyShortChannelIdsEnd this_ptr_conv;
31468         this_ptr_conv.inner = untag_ptr(this_ptr);
31469         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31470         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31471         this_ptr_conv.is_owned = false;
31472         LDKThirtyTwoBytes val_ref;
31473         CHECK(val->arr_len == 32);
31474         memcpy(val_ref.data, val->elems, 32); FREE(val);
31475         ReplyShortChannelIdsEnd_set_chain_hash(&this_ptr_conv, val_ref);
31476 }
31477
31478 jboolean  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_get_full_information"))) TS_ReplyShortChannelIdsEnd_get_full_information(uint64_t this_ptr) {
31479         LDKReplyShortChannelIdsEnd this_ptr_conv;
31480         this_ptr_conv.inner = untag_ptr(this_ptr);
31481         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31482         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31483         this_ptr_conv.is_owned = false;
31484         jboolean ret_conv = ReplyShortChannelIdsEnd_get_full_information(&this_ptr_conv);
31485         return ret_conv;
31486 }
31487
31488 void  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_set_full_information"))) TS_ReplyShortChannelIdsEnd_set_full_information(uint64_t this_ptr, jboolean val) {
31489         LDKReplyShortChannelIdsEnd this_ptr_conv;
31490         this_ptr_conv.inner = untag_ptr(this_ptr);
31491         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31492         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31493         this_ptr_conv.is_owned = false;
31494         ReplyShortChannelIdsEnd_set_full_information(&this_ptr_conv, val);
31495 }
31496
31497 uint64_t  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_new"))) TS_ReplyShortChannelIdsEnd_new(int8_tArray chain_hash_arg, jboolean full_information_arg) {
31498         LDKThirtyTwoBytes chain_hash_arg_ref;
31499         CHECK(chain_hash_arg->arr_len == 32);
31500         memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
31501         LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_new(chain_hash_arg_ref, full_information_arg);
31502         uint64_t ret_ref = 0;
31503         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31504         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31505         return ret_ref;
31506 }
31507
31508 static inline uint64_t ReplyShortChannelIdsEnd_clone_ptr(LDKReplyShortChannelIdsEnd *NONNULL_PTR arg) {
31509         LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_clone(arg);
31510         uint64_t ret_ref = 0;
31511         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31512         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31513         return ret_ref;
31514 }
31515 int64_t  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_clone_ptr"))) TS_ReplyShortChannelIdsEnd_clone_ptr(uint64_t arg) {
31516         LDKReplyShortChannelIdsEnd arg_conv;
31517         arg_conv.inner = untag_ptr(arg);
31518         arg_conv.is_owned = ptr_is_owned(arg);
31519         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31520         arg_conv.is_owned = false;
31521         int64_t ret_conv = ReplyShortChannelIdsEnd_clone_ptr(&arg_conv);
31522         return ret_conv;
31523 }
31524
31525 uint64_t  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_clone"))) TS_ReplyShortChannelIdsEnd_clone(uint64_t orig) {
31526         LDKReplyShortChannelIdsEnd orig_conv;
31527         orig_conv.inner = untag_ptr(orig);
31528         orig_conv.is_owned = ptr_is_owned(orig);
31529         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31530         orig_conv.is_owned = false;
31531         LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_clone(&orig_conv);
31532         uint64_t ret_ref = 0;
31533         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31534         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31535         return ret_ref;
31536 }
31537
31538 void  __attribute__((export_name("TS_GossipTimestampFilter_free"))) TS_GossipTimestampFilter_free(uint64_t this_obj) {
31539         LDKGossipTimestampFilter this_obj_conv;
31540         this_obj_conv.inner = untag_ptr(this_obj);
31541         this_obj_conv.is_owned = ptr_is_owned(this_obj);
31542         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31543         GossipTimestampFilter_free(this_obj_conv);
31544 }
31545
31546 int8_tArray  __attribute__((export_name("TS_GossipTimestampFilter_get_chain_hash"))) TS_GossipTimestampFilter_get_chain_hash(uint64_t this_ptr) {
31547         LDKGossipTimestampFilter this_ptr_conv;
31548         this_ptr_conv.inner = untag_ptr(this_ptr);
31549         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31550         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31551         this_ptr_conv.is_owned = false;
31552         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
31553         memcpy(ret_arr->elems, *GossipTimestampFilter_get_chain_hash(&this_ptr_conv), 32);
31554         return ret_arr;
31555 }
31556
31557 void  __attribute__((export_name("TS_GossipTimestampFilter_set_chain_hash"))) TS_GossipTimestampFilter_set_chain_hash(uint64_t this_ptr, int8_tArray val) {
31558         LDKGossipTimestampFilter this_ptr_conv;
31559         this_ptr_conv.inner = untag_ptr(this_ptr);
31560         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31561         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31562         this_ptr_conv.is_owned = false;
31563         LDKThirtyTwoBytes val_ref;
31564         CHECK(val->arr_len == 32);
31565         memcpy(val_ref.data, val->elems, 32); FREE(val);
31566         GossipTimestampFilter_set_chain_hash(&this_ptr_conv, val_ref);
31567 }
31568
31569 int32_t  __attribute__((export_name("TS_GossipTimestampFilter_get_first_timestamp"))) TS_GossipTimestampFilter_get_first_timestamp(uint64_t this_ptr) {
31570         LDKGossipTimestampFilter this_ptr_conv;
31571         this_ptr_conv.inner = untag_ptr(this_ptr);
31572         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31573         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31574         this_ptr_conv.is_owned = false;
31575         int32_t ret_conv = GossipTimestampFilter_get_first_timestamp(&this_ptr_conv);
31576         return ret_conv;
31577 }
31578
31579 void  __attribute__((export_name("TS_GossipTimestampFilter_set_first_timestamp"))) TS_GossipTimestampFilter_set_first_timestamp(uint64_t this_ptr, int32_t val) {
31580         LDKGossipTimestampFilter this_ptr_conv;
31581         this_ptr_conv.inner = untag_ptr(this_ptr);
31582         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31583         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31584         this_ptr_conv.is_owned = false;
31585         GossipTimestampFilter_set_first_timestamp(&this_ptr_conv, val);
31586 }
31587
31588 int32_t  __attribute__((export_name("TS_GossipTimestampFilter_get_timestamp_range"))) TS_GossipTimestampFilter_get_timestamp_range(uint64_t this_ptr) {
31589         LDKGossipTimestampFilter this_ptr_conv;
31590         this_ptr_conv.inner = untag_ptr(this_ptr);
31591         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31592         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31593         this_ptr_conv.is_owned = false;
31594         int32_t ret_conv = GossipTimestampFilter_get_timestamp_range(&this_ptr_conv);
31595         return ret_conv;
31596 }
31597
31598 void  __attribute__((export_name("TS_GossipTimestampFilter_set_timestamp_range"))) TS_GossipTimestampFilter_set_timestamp_range(uint64_t this_ptr, int32_t val) {
31599         LDKGossipTimestampFilter this_ptr_conv;
31600         this_ptr_conv.inner = untag_ptr(this_ptr);
31601         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31602         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31603         this_ptr_conv.is_owned = false;
31604         GossipTimestampFilter_set_timestamp_range(&this_ptr_conv, val);
31605 }
31606
31607 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) {
31608         LDKThirtyTwoBytes chain_hash_arg_ref;
31609         CHECK(chain_hash_arg->arr_len == 32);
31610         memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
31611         LDKGossipTimestampFilter ret_var = GossipTimestampFilter_new(chain_hash_arg_ref, first_timestamp_arg, timestamp_range_arg);
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 GossipTimestampFilter_clone_ptr(LDKGossipTimestampFilter *NONNULL_PTR arg) {
31619         LDKGossipTimestampFilter ret_var = GossipTimestampFilter_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_GossipTimestampFilter_clone_ptr"))) TS_GossipTimestampFilter_clone_ptr(uint64_t arg) {
31626         LDKGossipTimestampFilter 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 = GossipTimestampFilter_clone_ptr(&arg_conv);
31632         return ret_conv;
31633 }
31634
31635 uint64_t  __attribute__((export_name("TS_GossipTimestampFilter_clone"))) TS_GossipTimestampFilter_clone(uint64_t orig) {
31636         LDKGossipTimestampFilter 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         LDKGossipTimestampFilter ret_var = GossipTimestampFilter_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_ErrorAction_free"))) TS_ErrorAction_free(uint64_t this_ptr) {
31649         if (!ptr_is_owned(this_ptr)) return;
31650         void* this_ptr_ptr = untag_ptr(this_ptr);
31651         CHECK_ACCESS(this_ptr_ptr);
31652         LDKErrorAction this_ptr_conv = *(LDKErrorAction*)(this_ptr_ptr);
31653         FREE(untag_ptr(this_ptr));
31654         ErrorAction_free(this_ptr_conv);
31655 }
31656
31657 static inline uint64_t ErrorAction_clone_ptr(LDKErrorAction *NONNULL_PTR arg) {
31658         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
31659         *ret_copy = ErrorAction_clone(arg);
31660         uint64_t ret_ref = tag_ptr(ret_copy, true);
31661         return ret_ref;
31662 }
31663 int64_t  __attribute__((export_name("TS_ErrorAction_clone_ptr"))) TS_ErrorAction_clone_ptr(uint64_t arg) {
31664         LDKErrorAction* arg_conv = (LDKErrorAction*)untag_ptr(arg);
31665         int64_t ret_conv = ErrorAction_clone_ptr(arg_conv);
31666         return ret_conv;
31667 }
31668
31669 uint64_t  __attribute__((export_name("TS_ErrorAction_clone"))) TS_ErrorAction_clone(uint64_t orig) {
31670         LDKErrorAction* orig_conv = (LDKErrorAction*)untag_ptr(orig);
31671         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
31672         *ret_copy = ErrorAction_clone(orig_conv);
31673         uint64_t ret_ref = tag_ptr(ret_copy, true);
31674         return ret_ref;
31675 }
31676
31677 uint64_t  __attribute__((export_name("TS_ErrorAction_disconnect_peer"))) TS_ErrorAction_disconnect_peer(uint64_t msg) {
31678         LDKErrorMessage msg_conv;
31679         msg_conv.inner = untag_ptr(msg);
31680         msg_conv.is_owned = ptr_is_owned(msg);
31681         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
31682         msg_conv = ErrorMessage_clone(&msg_conv);
31683         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
31684         *ret_copy = ErrorAction_disconnect_peer(msg_conv);
31685         uint64_t ret_ref = tag_ptr(ret_copy, true);
31686         return ret_ref;
31687 }
31688
31689 uint64_t  __attribute__((export_name("TS_ErrorAction_ignore_error"))) TS_ErrorAction_ignore_error() {
31690         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
31691         *ret_copy = ErrorAction_ignore_error();
31692         uint64_t ret_ref = tag_ptr(ret_copy, true);
31693         return ret_ref;
31694 }
31695
31696 uint64_t  __attribute__((export_name("TS_ErrorAction_ignore_and_log"))) TS_ErrorAction_ignore_and_log(uint32_t a) {
31697         LDKLevel a_conv = LDKLevel_from_js(a);
31698         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
31699         *ret_copy = ErrorAction_ignore_and_log(a_conv);
31700         uint64_t ret_ref = tag_ptr(ret_copy, true);
31701         return ret_ref;
31702 }
31703
31704 uint64_t  __attribute__((export_name("TS_ErrorAction_ignore_duplicate_gossip"))) TS_ErrorAction_ignore_duplicate_gossip() {
31705         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
31706         *ret_copy = ErrorAction_ignore_duplicate_gossip();
31707         uint64_t ret_ref = tag_ptr(ret_copy, true);
31708         return ret_ref;
31709 }
31710
31711 uint64_t  __attribute__((export_name("TS_ErrorAction_send_error_message"))) TS_ErrorAction_send_error_message(uint64_t msg) {
31712         LDKErrorMessage msg_conv;
31713         msg_conv.inner = untag_ptr(msg);
31714         msg_conv.is_owned = ptr_is_owned(msg);
31715         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
31716         msg_conv = ErrorMessage_clone(&msg_conv);
31717         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
31718         *ret_copy = ErrorAction_send_error_message(msg_conv);
31719         uint64_t ret_ref = tag_ptr(ret_copy, true);
31720         return ret_ref;
31721 }
31722
31723 uint64_t  __attribute__((export_name("TS_ErrorAction_send_warning_message"))) TS_ErrorAction_send_warning_message(uint64_t msg, uint32_t log_level) {
31724         LDKWarningMessage msg_conv;
31725         msg_conv.inner = untag_ptr(msg);
31726         msg_conv.is_owned = ptr_is_owned(msg);
31727         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
31728         msg_conv = WarningMessage_clone(&msg_conv);
31729         LDKLevel log_level_conv = LDKLevel_from_js(log_level);
31730         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
31731         *ret_copy = ErrorAction_send_warning_message(msg_conv, log_level_conv);
31732         uint64_t ret_ref = tag_ptr(ret_copy, true);
31733         return ret_ref;
31734 }
31735
31736 void  __attribute__((export_name("TS_LightningError_free"))) TS_LightningError_free(uint64_t this_obj) {
31737         LDKLightningError this_obj_conv;
31738         this_obj_conv.inner = untag_ptr(this_obj);
31739         this_obj_conv.is_owned = ptr_is_owned(this_obj);
31740         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31741         LightningError_free(this_obj_conv);
31742 }
31743
31744 jstring  __attribute__((export_name("TS_LightningError_get_err"))) TS_LightningError_get_err(uint64_t this_ptr) {
31745         LDKLightningError this_ptr_conv;
31746         this_ptr_conv.inner = untag_ptr(this_ptr);
31747         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31748         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31749         this_ptr_conv.is_owned = false;
31750         LDKStr ret_str = LightningError_get_err(&this_ptr_conv);
31751         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
31752         Str_free(ret_str);
31753         return ret_conv;
31754 }
31755
31756 void  __attribute__((export_name("TS_LightningError_set_err"))) TS_LightningError_set_err(uint64_t this_ptr, jstring val) {
31757         LDKLightningError this_ptr_conv;
31758         this_ptr_conv.inner = untag_ptr(this_ptr);
31759         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31760         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31761         this_ptr_conv.is_owned = false;
31762         LDKStr val_conv = str_ref_to_owned_c(val);
31763         LightningError_set_err(&this_ptr_conv, val_conv);
31764 }
31765
31766 uint64_t  __attribute__((export_name("TS_LightningError_get_action"))) TS_LightningError_get_action(uint64_t this_ptr) {
31767         LDKLightningError this_ptr_conv;
31768         this_ptr_conv.inner = untag_ptr(this_ptr);
31769         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31770         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31771         this_ptr_conv.is_owned = false;
31772         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
31773         *ret_copy = LightningError_get_action(&this_ptr_conv);
31774         uint64_t ret_ref = tag_ptr(ret_copy, true);
31775         return ret_ref;
31776 }
31777
31778 void  __attribute__((export_name("TS_LightningError_set_action"))) TS_LightningError_set_action(uint64_t this_ptr, uint64_t val) {
31779         LDKLightningError this_ptr_conv;
31780         this_ptr_conv.inner = untag_ptr(this_ptr);
31781         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31782         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31783         this_ptr_conv.is_owned = false;
31784         void* val_ptr = untag_ptr(val);
31785         CHECK_ACCESS(val_ptr);
31786         LDKErrorAction val_conv = *(LDKErrorAction*)(val_ptr);
31787         val_conv = ErrorAction_clone((LDKErrorAction*)untag_ptr(val));
31788         LightningError_set_action(&this_ptr_conv, val_conv);
31789 }
31790
31791 uint64_t  __attribute__((export_name("TS_LightningError_new"))) TS_LightningError_new(jstring err_arg, uint64_t action_arg) {
31792         LDKStr err_arg_conv = str_ref_to_owned_c(err_arg);
31793         void* action_arg_ptr = untag_ptr(action_arg);
31794         CHECK_ACCESS(action_arg_ptr);
31795         LDKErrorAction action_arg_conv = *(LDKErrorAction*)(action_arg_ptr);
31796         action_arg_conv = ErrorAction_clone((LDKErrorAction*)untag_ptr(action_arg));
31797         LDKLightningError ret_var = LightningError_new(err_arg_conv, action_arg_conv);
31798         uint64_t ret_ref = 0;
31799         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31800         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31801         return ret_ref;
31802 }
31803
31804 static inline uint64_t LightningError_clone_ptr(LDKLightningError *NONNULL_PTR arg) {
31805         LDKLightningError ret_var = LightningError_clone(arg);
31806         uint64_t ret_ref = 0;
31807         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31808         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31809         return ret_ref;
31810 }
31811 int64_t  __attribute__((export_name("TS_LightningError_clone_ptr"))) TS_LightningError_clone_ptr(uint64_t arg) {
31812         LDKLightningError arg_conv;
31813         arg_conv.inner = untag_ptr(arg);
31814         arg_conv.is_owned = ptr_is_owned(arg);
31815         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31816         arg_conv.is_owned = false;
31817         int64_t ret_conv = LightningError_clone_ptr(&arg_conv);
31818         return ret_conv;
31819 }
31820
31821 uint64_t  __attribute__((export_name("TS_LightningError_clone"))) TS_LightningError_clone(uint64_t orig) {
31822         LDKLightningError orig_conv;
31823         orig_conv.inner = untag_ptr(orig);
31824         orig_conv.is_owned = ptr_is_owned(orig);
31825         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31826         orig_conv.is_owned = false;
31827         LDKLightningError ret_var = LightningError_clone(&orig_conv);
31828         uint64_t ret_ref = 0;
31829         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31830         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31831         return ret_ref;
31832 }
31833
31834 void  __attribute__((export_name("TS_CommitmentUpdate_free"))) TS_CommitmentUpdate_free(uint64_t this_obj) {
31835         LDKCommitmentUpdate this_obj_conv;
31836         this_obj_conv.inner = untag_ptr(this_obj);
31837         this_obj_conv.is_owned = ptr_is_owned(this_obj);
31838         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31839         CommitmentUpdate_free(this_obj_conv);
31840 }
31841
31842 uint64_tArray  __attribute__((export_name("TS_CommitmentUpdate_get_update_add_htlcs"))) TS_CommitmentUpdate_get_update_add_htlcs(uint64_t this_ptr) {
31843         LDKCommitmentUpdate this_ptr_conv;
31844         this_ptr_conv.inner = untag_ptr(this_ptr);
31845         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31846         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31847         this_ptr_conv.is_owned = false;
31848         LDKCVec_UpdateAddHTLCZ ret_var = CommitmentUpdate_get_update_add_htlcs(&this_ptr_conv);
31849         uint64_tArray ret_arr = NULL;
31850         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
31851         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
31852         for (size_t p = 0; p < ret_var.datalen; p++) {
31853                 LDKUpdateAddHTLC ret_conv_15_var = ret_var.data[p];
31854                 uint64_t ret_conv_15_ref = 0;
31855                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_15_var);
31856                 ret_conv_15_ref = tag_ptr(ret_conv_15_var.inner, ret_conv_15_var.is_owned);
31857                 ret_arr_ptr[p] = ret_conv_15_ref;
31858         }
31859         
31860         FREE(ret_var.data);
31861         return ret_arr;
31862 }
31863
31864 void  __attribute__((export_name("TS_CommitmentUpdate_set_update_add_htlcs"))) TS_CommitmentUpdate_set_update_add_htlcs(uint64_t this_ptr, uint64_tArray val) {
31865         LDKCommitmentUpdate this_ptr_conv;
31866         this_ptr_conv.inner = untag_ptr(this_ptr);
31867         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31868         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31869         this_ptr_conv.is_owned = false;
31870         LDKCVec_UpdateAddHTLCZ val_constr;
31871         val_constr.datalen = val->arr_len;
31872         if (val_constr.datalen > 0)
31873                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
31874         else
31875                 val_constr.data = NULL;
31876         uint64_t* val_vals = val->elems;
31877         for (size_t p = 0; p < val_constr.datalen; p++) {
31878                 uint64_t val_conv_15 = val_vals[p];
31879                 LDKUpdateAddHTLC val_conv_15_conv;
31880                 val_conv_15_conv.inner = untag_ptr(val_conv_15);
31881                 val_conv_15_conv.is_owned = ptr_is_owned(val_conv_15);
31882                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_15_conv);
31883                 val_conv_15_conv = UpdateAddHTLC_clone(&val_conv_15_conv);
31884                 val_constr.data[p] = val_conv_15_conv;
31885         }
31886         FREE(val);
31887         CommitmentUpdate_set_update_add_htlcs(&this_ptr_conv, val_constr);
31888 }
31889
31890 uint64_tArray  __attribute__((export_name("TS_CommitmentUpdate_get_update_fulfill_htlcs"))) TS_CommitmentUpdate_get_update_fulfill_htlcs(uint64_t this_ptr) {
31891         LDKCommitmentUpdate this_ptr_conv;
31892         this_ptr_conv.inner = untag_ptr(this_ptr);
31893         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31894         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31895         this_ptr_conv.is_owned = false;
31896         LDKCVec_UpdateFulfillHTLCZ ret_var = CommitmentUpdate_get_update_fulfill_htlcs(&this_ptr_conv);
31897         uint64_tArray ret_arr = NULL;
31898         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
31899         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
31900         for (size_t t = 0; t < ret_var.datalen; t++) {
31901                 LDKUpdateFulfillHTLC ret_conv_19_var = ret_var.data[t];
31902                 uint64_t ret_conv_19_ref = 0;
31903                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_19_var);
31904                 ret_conv_19_ref = tag_ptr(ret_conv_19_var.inner, ret_conv_19_var.is_owned);
31905                 ret_arr_ptr[t] = ret_conv_19_ref;
31906         }
31907         
31908         FREE(ret_var.data);
31909         return ret_arr;
31910 }
31911
31912 void  __attribute__((export_name("TS_CommitmentUpdate_set_update_fulfill_htlcs"))) TS_CommitmentUpdate_set_update_fulfill_htlcs(uint64_t this_ptr, uint64_tArray val) {
31913         LDKCommitmentUpdate this_ptr_conv;
31914         this_ptr_conv.inner = untag_ptr(this_ptr);
31915         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31916         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31917         this_ptr_conv.is_owned = false;
31918         LDKCVec_UpdateFulfillHTLCZ val_constr;
31919         val_constr.datalen = val->arr_len;
31920         if (val_constr.datalen > 0)
31921                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
31922         else
31923                 val_constr.data = NULL;
31924         uint64_t* val_vals = val->elems;
31925         for (size_t t = 0; t < val_constr.datalen; t++) {
31926                 uint64_t val_conv_19 = val_vals[t];
31927                 LDKUpdateFulfillHTLC val_conv_19_conv;
31928                 val_conv_19_conv.inner = untag_ptr(val_conv_19);
31929                 val_conv_19_conv.is_owned = ptr_is_owned(val_conv_19);
31930                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_19_conv);
31931                 val_conv_19_conv = UpdateFulfillHTLC_clone(&val_conv_19_conv);
31932                 val_constr.data[t] = val_conv_19_conv;
31933         }
31934         FREE(val);
31935         CommitmentUpdate_set_update_fulfill_htlcs(&this_ptr_conv, val_constr);
31936 }
31937
31938 uint64_tArray  __attribute__((export_name("TS_CommitmentUpdate_get_update_fail_htlcs"))) TS_CommitmentUpdate_get_update_fail_htlcs(uint64_t this_ptr) {
31939         LDKCommitmentUpdate this_ptr_conv;
31940         this_ptr_conv.inner = untag_ptr(this_ptr);
31941         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31942         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31943         this_ptr_conv.is_owned = false;
31944         LDKCVec_UpdateFailHTLCZ ret_var = CommitmentUpdate_get_update_fail_htlcs(&this_ptr_conv);
31945         uint64_tArray ret_arr = NULL;
31946         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
31947         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
31948         for (size_t q = 0; q < ret_var.datalen; q++) {
31949                 LDKUpdateFailHTLC ret_conv_16_var = ret_var.data[q];
31950                 uint64_t ret_conv_16_ref = 0;
31951                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
31952                 ret_conv_16_ref = tag_ptr(ret_conv_16_var.inner, ret_conv_16_var.is_owned);
31953                 ret_arr_ptr[q] = ret_conv_16_ref;
31954         }
31955         
31956         FREE(ret_var.data);
31957         return ret_arr;
31958 }
31959
31960 void  __attribute__((export_name("TS_CommitmentUpdate_set_update_fail_htlcs"))) TS_CommitmentUpdate_set_update_fail_htlcs(uint64_t this_ptr, uint64_tArray val) {
31961         LDKCommitmentUpdate this_ptr_conv;
31962         this_ptr_conv.inner = untag_ptr(this_ptr);
31963         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31964         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31965         this_ptr_conv.is_owned = false;
31966         LDKCVec_UpdateFailHTLCZ val_constr;
31967         val_constr.datalen = val->arr_len;
31968         if (val_constr.datalen > 0)
31969                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
31970         else
31971                 val_constr.data = NULL;
31972         uint64_t* val_vals = val->elems;
31973         for (size_t q = 0; q < val_constr.datalen; q++) {
31974                 uint64_t val_conv_16 = val_vals[q];
31975                 LDKUpdateFailHTLC val_conv_16_conv;
31976                 val_conv_16_conv.inner = untag_ptr(val_conv_16);
31977                 val_conv_16_conv.is_owned = ptr_is_owned(val_conv_16);
31978                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_16_conv);
31979                 val_conv_16_conv = UpdateFailHTLC_clone(&val_conv_16_conv);
31980                 val_constr.data[q] = val_conv_16_conv;
31981         }
31982         FREE(val);
31983         CommitmentUpdate_set_update_fail_htlcs(&this_ptr_conv, val_constr);
31984 }
31985
31986 uint64_tArray  __attribute__((export_name("TS_CommitmentUpdate_get_update_fail_malformed_htlcs"))) TS_CommitmentUpdate_get_update_fail_malformed_htlcs(uint64_t this_ptr) {
31987         LDKCommitmentUpdate this_ptr_conv;
31988         this_ptr_conv.inner = untag_ptr(this_ptr);
31989         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31990         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31991         this_ptr_conv.is_owned = false;
31992         LDKCVec_UpdateFailMalformedHTLCZ ret_var = CommitmentUpdate_get_update_fail_malformed_htlcs(&this_ptr_conv);
31993         uint64_tArray ret_arr = NULL;
31994         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
31995         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
31996         for (size_t z = 0; z < ret_var.datalen; z++) {
31997                 LDKUpdateFailMalformedHTLC ret_conv_25_var = ret_var.data[z];
31998                 uint64_t ret_conv_25_ref = 0;
31999                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_25_var);
32000                 ret_conv_25_ref = tag_ptr(ret_conv_25_var.inner, ret_conv_25_var.is_owned);
32001                 ret_arr_ptr[z] = ret_conv_25_ref;
32002         }
32003         
32004         FREE(ret_var.data);
32005         return ret_arr;
32006 }
32007
32008 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) {
32009         LDKCommitmentUpdate this_ptr_conv;
32010         this_ptr_conv.inner = untag_ptr(this_ptr);
32011         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32012         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32013         this_ptr_conv.is_owned = false;
32014         LDKCVec_UpdateFailMalformedHTLCZ val_constr;
32015         val_constr.datalen = val->arr_len;
32016         if (val_constr.datalen > 0)
32017                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
32018         else
32019                 val_constr.data = NULL;
32020         uint64_t* val_vals = val->elems;
32021         for (size_t z = 0; z < val_constr.datalen; z++) {
32022                 uint64_t val_conv_25 = val_vals[z];
32023                 LDKUpdateFailMalformedHTLC val_conv_25_conv;
32024                 val_conv_25_conv.inner = untag_ptr(val_conv_25);
32025                 val_conv_25_conv.is_owned = ptr_is_owned(val_conv_25);
32026                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_25_conv);
32027                 val_conv_25_conv = UpdateFailMalformedHTLC_clone(&val_conv_25_conv);
32028                 val_constr.data[z] = val_conv_25_conv;
32029         }
32030         FREE(val);
32031         CommitmentUpdate_set_update_fail_malformed_htlcs(&this_ptr_conv, val_constr);
32032 }
32033
32034 uint64_t  __attribute__((export_name("TS_CommitmentUpdate_get_update_fee"))) TS_CommitmentUpdate_get_update_fee(uint64_t this_ptr) {
32035         LDKCommitmentUpdate this_ptr_conv;
32036         this_ptr_conv.inner = untag_ptr(this_ptr);
32037         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32038         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32039         this_ptr_conv.is_owned = false;
32040         LDKUpdateFee ret_var = CommitmentUpdate_get_update_fee(&this_ptr_conv);
32041         uint64_t ret_ref = 0;
32042         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32043         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32044         return ret_ref;
32045 }
32046
32047 void  __attribute__((export_name("TS_CommitmentUpdate_set_update_fee"))) TS_CommitmentUpdate_set_update_fee(uint64_t this_ptr, uint64_t val) {
32048         LDKCommitmentUpdate this_ptr_conv;
32049         this_ptr_conv.inner = untag_ptr(this_ptr);
32050         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32051         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32052         this_ptr_conv.is_owned = false;
32053         LDKUpdateFee val_conv;
32054         val_conv.inner = untag_ptr(val);
32055         val_conv.is_owned = ptr_is_owned(val);
32056         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
32057         val_conv = UpdateFee_clone(&val_conv);
32058         CommitmentUpdate_set_update_fee(&this_ptr_conv, val_conv);
32059 }
32060
32061 uint64_t  __attribute__((export_name("TS_CommitmentUpdate_get_commitment_signed"))) TS_CommitmentUpdate_get_commitment_signed(uint64_t this_ptr) {
32062         LDKCommitmentUpdate this_ptr_conv;
32063         this_ptr_conv.inner = untag_ptr(this_ptr);
32064         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32065         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32066         this_ptr_conv.is_owned = false;
32067         LDKCommitmentSigned ret_var = CommitmentUpdate_get_commitment_signed(&this_ptr_conv);
32068         uint64_t ret_ref = 0;
32069         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32070         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32071         return ret_ref;
32072 }
32073
32074 void  __attribute__((export_name("TS_CommitmentUpdate_set_commitment_signed"))) TS_CommitmentUpdate_set_commitment_signed(uint64_t this_ptr, uint64_t val) {
32075         LDKCommitmentUpdate this_ptr_conv;
32076         this_ptr_conv.inner = untag_ptr(this_ptr);
32077         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32078         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32079         this_ptr_conv.is_owned = false;
32080         LDKCommitmentSigned val_conv;
32081         val_conv.inner = untag_ptr(val);
32082         val_conv.is_owned = ptr_is_owned(val);
32083         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
32084         val_conv = CommitmentSigned_clone(&val_conv);
32085         CommitmentUpdate_set_commitment_signed(&this_ptr_conv, val_conv);
32086 }
32087
32088 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) {
32089         LDKCVec_UpdateAddHTLCZ update_add_htlcs_arg_constr;
32090         update_add_htlcs_arg_constr.datalen = update_add_htlcs_arg->arr_len;
32091         if (update_add_htlcs_arg_constr.datalen > 0)
32092                 update_add_htlcs_arg_constr.data = MALLOC(update_add_htlcs_arg_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
32093         else
32094                 update_add_htlcs_arg_constr.data = NULL;
32095         uint64_t* update_add_htlcs_arg_vals = update_add_htlcs_arg->elems;
32096         for (size_t p = 0; p < update_add_htlcs_arg_constr.datalen; p++) {
32097                 uint64_t update_add_htlcs_arg_conv_15 = update_add_htlcs_arg_vals[p];
32098                 LDKUpdateAddHTLC update_add_htlcs_arg_conv_15_conv;
32099                 update_add_htlcs_arg_conv_15_conv.inner = untag_ptr(update_add_htlcs_arg_conv_15);
32100                 update_add_htlcs_arg_conv_15_conv.is_owned = ptr_is_owned(update_add_htlcs_arg_conv_15);
32101                 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_add_htlcs_arg_conv_15_conv);
32102                 update_add_htlcs_arg_conv_15_conv = UpdateAddHTLC_clone(&update_add_htlcs_arg_conv_15_conv);
32103                 update_add_htlcs_arg_constr.data[p] = update_add_htlcs_arg_conv_15_conv;
32104         }
32105         FREE(update_add_htlcs_arg);
32106         LDKCVec_UpdateFulfillHTLCZ update_fulfill_htlcs_arg_constr;
32107         update_fulfill_htlcs_arg_constr.datalen = update_fulfill_htlcs_arg->arr_len;
32108         if (update_fulfill_htlcs_arg_constr.datalen > 0)
32109                 update_fulfill_htlcs_arg_constr.data = MALLOC(update_fulfill_htlcs_arg_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
32110         else
32111                 update_fulfill_htlcs_arg_constr.data = NULL;
32112         uint64_t* update_fulfill_htlcs_arg_vals = update_fulfill_htlcs_arg->elems;
32113         for (size_t t = 0; t < update_fulfill_htlcs_arg_constr.datalen; t++) {
32114                 uint64_t update_fulfill_htlcs_arg_conv_19 = update_fulfill_htlcs_arg_vals[t];
32115                 LDKUpdateFulfillHTLC update_fulfill_htlcs_arg_conv_19_conv;
32116                 update_fulfill_htlcs_arg_conv_19_conv.inner = untag_ptr(update_fulfill_htlcs_arg_conv_19);
32117                 update_fulfill_htlcs_arg_conv_19_conv.is_owned = ptr_is_owned(update_fulfill_htlcs_arg_conv_19);
32118                 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fulfill_htlcs_arg_conv_19_conv);
32119                 update_fulfill_htlcs_arg_conv_19_conv = UpdateFulfillHTLC_clone(&update_fulfill_htlcs_arg_conv_19_conv);
32120                 update_fulfill_htlcs_arg_constr.data[t] = update_fulfill_htlcs_arg_conv_19_conv;
32121         }
32122         FREE(update_fulfill_htlcs_arg);
32123         LDKCVec_UpdateFailHTLCZ update_fail_htlcs_arg_constr;
32124         update_fail_htlcs_arg_constr.datalen = update_fail_htlcs_arg->arr_len;
32125         if (update_fail_htlcs_arg_constr.datalen > 0)
32126                 update_fail_htlcs_arg_constr.data = MALLOC(update_fail_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
32127         else
32128                 update_fail_htlcs_arg_constr.data = NULL;
32129         uint64_t* update_fail_htlcs_arg_vals = update_fail_htlcs_arg->elems;
32130         for (size_t q = 0; q < update_fail_htlcs_arg_constr.datalen; q++) {
32131                 uint64_t update_fail_htlcs_arg_conv_16 = update_fail_htlcs_arg_vals[q];
32132                 LDKUpdateFailHTLC update_fail_htlcs_arg_conv_16_conv;
32133                 update_fail_htlcs_arg_conv_16_conv.inner = untag_ptr(update_fail_htlcs_arg_conv_16);
32134                 update_fail_htlcs_arg_conv_16_conv.is_owned = ptr_is_owned(update_fail_htlcs_arg_conv_16);
32135                 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fail_htlcs_arg_conv_16_conv);
32136                 update_fail_htlcs_arg_conv_16_conv = UpdateFailHTLC_clone(&update_fail_htlcs_arg_conv_16_conv);
32137                 update_fail_htlcs_arg_constr.data[q] = update_fail_htlcs_arg_conv_16_conv;
32138         }
32139         FREE(update_fail_htlcs_arg);
32140         LDKCVec_UpdateFailMalformedHTLCZ update_fail_malformed_htlcs_arg_constr;
32141         update_fail_malformed_htlcs_arg_constr.datalen = update_fail_malformed_htlcs_arg->arr_len;
32142         if (update_fail_malformed_htlcs_arg_constr.datalen > 0)
32143                 update_fail_malformed_htlcs_arg_constr.data = MALLOC(update_fail_malformed_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
32144         else
32145                 update_fail_malformed_htlcs_arg_constr.data = NULL;
32146         uint64_t* update_fail_malformed_htlcs_arg_vals = update_fail_malformed_htlcs_arg->elems;
32147         for (size_t z = 0; z < update_fail_malformed_htlcs_arg_constr.datalen; z++) {
32148                 uint64_t update_fail_malformed_htlcs_arg_conv_25 = update_fail_malformed_htlcs_arg_vals[z];
32149                 LDKUpdateFailMalformedHTLC update_fail_malformed_htlcs_arg_conv_25_conv;
32150                 update_fail_malformed_htlcs_arg_conv_25_conv.inner = untag_ptr(update_fail_malformed_htlcs_arg_conv_25);
32151                 update_fail_malformed_htlcs_arg_conv_25_conv.is_owned = ptr_is_owned(update_fail_malformed_htlcs_arg_conv_25);
32152                 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fail_malformed_htlcs_arg_conv_25_conv);
32153                 update_fail_malformed_htlcs_arg_conv_25_conv = UpdateFailMalformedHTLC_clone(&update_fail_malformed_htlcs_arg_conv_25_conv);
32154                 update_fail_malformed_htlcs_arg_constr.data[z] = update_fail_malformed_htlcs_arg_conv_25_conv;
32155         }
32156         FREE(update_fail_malformed_htlcs_arg);
32157         LDKUpdateFee update_fee_arg_conv;
32158         update_fee_arg_conv.inner = untag_ptr(update_fee_arg);
32159         update_fee_arg_conv.is_owned = ptr_is_owned(update_fee_arg);
32160         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fee_arg_conv);
32161         update_fee_arg_conv = UpdateFee_clone(&update_fee_arg_conv);
32162         LDKCommitmentSigned commitment_signed_arg_conv;
32163         commitment_signed_arg_conv.inner = untag_ptr(commitment_signed_arg);
32164         commitment_signed_arg_conv.is_owned = ptr_is_owned(commitment_signed_arg);
32165         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_signed_arg_conv);
32166         commitment_signed_arg_conv = CommitmentSigned_clone(&commitment_signed_arg_conv);
32167         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);
32168         uint64_t ret_ref = 0;
32169         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32170         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32171         return ret_ref;
32172 }
32173
32174 static inline uint64_t CommitmentUpdate_clone_ptr(LDKCommitmentUpdate *NONNULL_PTR arg) {
32175         LDKCommitmentUpdate ret_var = CommitmentUpdate_clone(arg);
32176         uint64_t ret_ref = 0;
32177         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32178         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32179         return ret_ref;
32180 }
32181 int64_t  __attribute__((export_name("TS_CommitmentUpdate_clone_ptr"))) TS_CommitmentUpdate_clone_ptr(uint64_t arg) {
32182         LDKCommitmentUpdate arg_conv;
32183         arg_conv.inner = untag_ptr(arg);
32184         arg_conv.is_owned = ptr_is_owned(arg);
32185         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32186         arg_conv.is_owned = false;
32187         int64_t ret_conv = CommitmentUpdate_clone_ptr(&arg_conv);
32188         return ret_conv;
32189 }
32190
32191 uint64_t  __attribute__((export_name("TS_CommitmentUpdate_clone"))) TS_CommitmentUpdate_clone(uint64_t orig) {
32192         LDKCommitmentUpdate orig_conv;
32193         orig_conv.inner = untag_ptr(orig);
32194         orig_conv.is_owned = ptr_is_owned(orig);
32195         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32196         orig_conv.is_owned = false;
32197         LDKCommitmentUpdate ret_var = CommitmentUpdate_clone(&orig_conv);
32198         uint64_t ret_ref = 0;
32199         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32200         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32201         return ret_ref;
32202 }
32203
32204 void  __attribute__((export_name("TS_ChannelMessageHandler_free"))) TS_ChannelMessageHandler_free(uint64_t this_ptr) {
32205         if (!ptr_is_owned(this_ptr)) return;
32206         void* this_ptr_ptr = untag_ptr(this_ptr);
32207         CHECK_ACCESS(this_ptr_ptr);
32208         LDKChannelMessageHandler this_ptr_conv = *(LDKChannelMessageHandler*)(this_ptr_ptr);
32209         FREE(untag_ptr(this_ptr));
32210         ChannelMessageHandler_free(this_ptr_conv);
32211 }
32212
32213 void  __attribute__((export_name("TS_RoutingMessageHandler_free"))) TS_RoutingMessageHandler_free(uint64_t this_ptr) {
32214         if (!ptr_is_owned(this_ptr)) return;
32215         void* this_ptr_ptr = untag_ptr(this_ptr);
32216         CHECK_ACCESS(this_ptr_ptr);
32217         LDKRoutingMessageHandler this_ptr_conv = *(LDKRoutingMessageHandler*)(this_ptr_ptr);
32218         FREE(untag_ptr(this_ptr));
32219         RoutingMessageHandler_free(this_ptr_conv);
32220 }
32221
32222 int8_tArray  __attribute__((export_name("TS_AcceptChannel_write"))) TS_AcceptChannel_write(uint64_t obj) {
32223         LDKAcceptChannel obj_conv;
32224         obj_conv.inner = untag_ptr(obj);
32225         obj_conv.is_owned = ptr_is_owned(obj);
32226         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
32227         obj_conv.is_owned = false;
32228         LDKCVec_u8Z ret_var = AcceptChannel_write(&obj_conv);
32229         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
32230         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
32231         CVec_u8Z_free(ret_var);
32232         return ret_arr;
32233 }
32234
32235 uint64_t  __attribute__((export_name("TS_AcceptChannel_read"))) TS_AcceptChannel_read(int8_tArray ser) {
32236         LDKu8slice ser_ref;
32237         ser_ref.datalen = ser->arr_len;
32238         ser_ref.data = ser->elems;
32239         LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
32240         *ret_conv = AcceptChannel_read(ser_ref);
32241         FREE(ser);
32242         return tag_ptr(ret_conv, true);
32243 }
32244
32245 int8_tArray  __attribute__((export_name("TS_AnnouncementSignatures_write"))) TS_AnnouncementSignatures_write(uint64_t obj) {
32246         LDKAnnouncementSignatures obj_conv;
32247         obj_conv.inner = untag_ptr(obj);
32248         obj_conv.is_owned = ptr_is_owned(obj);
32249         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
32250         obj_conv.is_owned = false;
32251         LDKCVec_u8Z ret_var = AnnouncementSignatures_write(&obj_conv);
32252         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
32253         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
32254         CVec_u8Z_free(ret_var);
32255         return ret_arr;
32256 }
32257
32258 uint64_t  __attribute__((export_name("TS_AnnouncementSignatures_read"))) TS_AnnouncementSignatures_read(int8_tArray ser) {
32259         LDKu8slice ser_ref;
32260         ser_ref.datalen = ser->arr_len;
32261         ser_ref.data = ser->elems;
32262         LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
32263         *ret_conv = AnnouncementSignatures_read(ser_ref);
32264         FREE(ser);
32265         return tag_ptr(ret_conv, true);
32266 }
32267
32268 int8_tArray  __attribute__((export_name("TS_ChannelReestablish_write"))) TS_ChannelReestablish_write(uint64_t obj) {
32269         LDKChannelReestablish obj_conv;
32270         obj_conv.inner = untag_ptr(obj);
32271         obj_conv.is_owned = ptr_is_owned(obj);
32272         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
32273         obj_conv.is_owned = false;
32274         LDKCVec_u8Z ret_var = ChannelReestablish_write(&obj_conv);
32275         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
32276         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
32277         CVec_u8Z_free(ret_var);
32278         return ret_arr;
32279 }
32280
32281 uint64_t  __attribute__((export_name("TS_ChannelReestablish_read"))) TS_ChannelReestablish_read(int8_tArray ser) {
32282         LDKu8slice ser_ref;
32283         ser_ref.datalen = ser->arr_len;
32284         ser_ref.data = ser->elems;
32285         LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
32286         *ret_conv = ChannelReestablish_read(ser_ref);
32287         FREE(ser);
32288         return tag_ptr(ret_conv, true);
32289 }
32290
32291 int8_tArray  __attribute__((export_name("TS_ClosingSigned_write"))) TS_ClosingSigned_write(uint64_t obj) {
32292         LDKClosingSigned obj_conv;
32293         obj_conv.inner = untag_ptr(obj);
32294         obj_conv.is_owned = ptr_is_owned(obj);
32295         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
32296         obj_conv.is_owned = false;
32297         LDKCVec_u8Z ret_var = ClosingSigned_write(&obj_conv);
32298         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
32299         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
32300         CVec_u8Z_free(ret_var);
32301         return ret_arr;
32302 }
32303
32304 uint64_t  __attribute__((export_name("TS_ClosingSigned_read"))) TS_ClosingSigned_read(int8_tArray ser) {
32305         LDKu8slice ser_ref;
32306         ser_ref.datalen = ser->arr_len;
32307         ser_ref.data = ser->elems;
32308         LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
32309         *ret_conv = ClosingSigned_read(ser_ref);
32310         FREE(ser);
32311         return tag_ptr(ret_conv, true);
32312 }
32313
32314 int8_tArray  __attribute__((export_name("TS_ClosingSignedFeeRange_write"))) TS_ClosingSignedFeeRange_write(uint64_t obj) {
32315         LDKClosingSignedFeeRange obj_conv;
32316         obj_conv.inner = untag_ptr(obj);
32317         obj_conv.is_owned = ptr_is_owned(obj);
32318         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
32319         obj_conv.is_owned = false;
32320         LDKCVec_u8Z ret_var = ClosingSignedFeeRange_write(&obj_conv);
32321         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
32322         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
32323         CVec_u8Z_free(ret_var);
32324         return ret_arr;
32325 }
32326
32327 uint64_t  __attribute__((export_name("TS_ClosingSignedFeeRange_read"))) TS_ClosingSignedFeeRange_read(int8_tArray ser) {
32328         LDKu8slice ser_ref;
32329         ser_ref.datalen = ser->arr_len;
32330         ser_ref.data = ser->elems;
32331         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
32332         *ret_conv = ClosingSignedFeeRange_read(ser_ref);
32333         FREE(ser);
32334         return tag_ptr(ret_conv, true);
32335 }
32336
32337 int8_tArray  __attribute__((export_name("TS_CommitmentSigned_write"))) TS_CommitmentSigned_write(uint64_t obj) {
32338         LDKCommitmentSigned obj_conv;
32339         obj_conv.inner = untag_ptr(obj);
32340         obj_conv.is_owned = ptr_is_owned(obj);
32341         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
32342         obj_conv.is_owned = false;
32343         LDKCVec_u8Z ret_var = CommitmentSigned_write(&obj_conv);
32344         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
32345         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
32346         CVec_u8Z_free(ret_var);
32347         return ret_arr;
32348 }
32349
32350 uint64_t  __attribute__((export_name("TS_CommitmentSigned_read"))) TS_CommitmentSigned_read(int8_tArray ser) {
32351         LDKu8slice ser_ref;
32352         ser_ref.datalen = ser->arr_len;
32353         ser_ref.data = ser->elems;
32354         LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
32355         *ret_conv = CommitmentSigned_read(ser_ref);
32356         FREE(ser);
32357         return tag_ptr(ret_conv, true);
32358 }
32359
32360 int8_tArray  __attribute__((export_name("TS_FundingCreated_write"))) TS_FundingCreated_write(uint64_t obj) {
32361         LDKFundingCreated obj_conv;
32362         obj_conv.inner = untag_ptr(obj);
32363         obj_conv.is_owned = ptr_is_owned(obj);
32364         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
32365         obj_conv.is_owned = false;
32366         LDKCVec_u8Z ret_var = FundingCreated_write(&obj_conv);
32367         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
32368         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
32369         CVec_u8Z_free(ret_var);
32370         return ret_arr;
32371 }
32372
32373 uint64_t  __attribute__((export_name("TS_FundingCreated_read"))) TS_FundingCreated_read(int8_tArray ser) {
32374         LDKu8slice ser_ref;
32375         ser_ref.datalen = ser->arr_len;
32376         ser_ref.data = ser->elems;
32377         LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
32378         *ret_conv = FundingCreated_read(ser_ref);
32379         FREE(ser);
32380         return tag_ptr(ret_conv, true);
32381 }
32382
32383 int8_tArray  __attribute__((export_name("TS_FundingSigned_write"))) TS_FundingSigned_write(uint64_t obj) {
32384         LDKFundingSigned obj_conv;
32385         obj_conv.inner = untag_ptr(obj);
32386         obj_conv.is_owned = ptr_is_owned(obj);
32387         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
32388         obj_conv.is_owned = false;
32389         LDKCVec_u8Z ret_var = FundingSigned_write(&obj_conv);
32390         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
32391         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
32392         CVec_u8Z_free(ret_var);
32393         return ret_arr;
32394 }
32395
32396 uint64_t  __attribute__((export_name("TS_FundingSigned_read"))) TS_FundingSigned_read(int8_tArray ser) {
32397         LDKu8slice ser_ref;
32398         ser_ref.datalen = ser->arr_len;
32399         ser_ref.data = ser->elems;
32400         LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
32401         *ret_conv = FundingSigned_read(ser_ref);
32402         FREE(ser);
32403         return tag_ptr(ret_conv, true);
32404 }
32405
32406 int8_tArray  __attribute__((export_name("TS_ChannelReady_write"))) TS_ChannelReady_write(uint64_t obj) {
32407         LDKChannelReady obj_conv;
32408         obj_conv.inner = untag_ptr(obj);
32409         obj_conv.is_owned = ptr_is_owned(obj);
32410         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
32411         obj_conv.is_owned = false;
32412         LDKCVec_u8Z ret_var = ChannelReady_write(&obj_conv);
32413         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
32414         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
32415         CVec_u8Z_free(ret_var);
32416         return ret_arr;
32417 }
32418
32419 uint64_t  __attribute__((export_name("TS_ChannelReady_read"))) TS_ChannelReady_read(int8_tArray ser) {
32420         LDKu8slice ser_ref;
32421         ser_ref.datalen = ser->arr_len;
32422         ser_ref.data = ser->elems;
32423         LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
32424         *ret_conv = ChannelReady_read(ser_ref);
32425         FREE(ser);
32426         return tag_ptr(ret_conv, true);
32427 }
32428
32429 int8_tArray  __attribute__((export_name("TS_Init_write"))) TS_Init_write(uint64_t obj) {
32430         LDKInit obj_conv;
32431         obj_conv.inner = untag_ptr(obj);
32432         obj_conv.is_owned = ptr_is_owned(obj);
32433         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
32434         obj_conv.is_owned = false;
32435         LDKCVec_u8Z ret_var = Init_write(&obj_conv);
32436         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
32437         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
32438         CVec_u8Z_free(ret_var);
32439         return ret_arr;
32440 }
32441
32442 uint64_t  __attribute__((export_name("TS_Init_read"))) TS_Init_read(int8_tArray ser) {
32443         LDKu8slice ser_ref;
32444         ser_ref.datalen = ser->arr_len;
32445         ser_ref.data = ser->elems;
32446         LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
32447         *ret_conv = Init_read(ser_ref);
32448         FREE(ser);
32449         return tag_ptr(ret_conv, true);
32450 }
32451
32452 int8_tArray  __attribute__((export_name("TS_OpenChannel_write"))) TS_OpenChannel_write(uint64_t obj) {
32453         LDKOpenChannel obj_conv;
32454         obj_conv.inner = untag_ptr(obj);
32455         obj_conv.is_owned = ptr_is_owned(obj);
32456         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
32457         obj_conv.is_owned = false;
32458         LDKCVec_u8Z ret_var = OpenChannel_write(&obj_conv);
32459         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
32460         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
32461         CVec_u8Z_free(ret_var);
32462         return ret_arr;
32463 }
32464
32465 uint64_t  __attribute__((export_name("TS_OpenChannel_read"))) TS_OpenChannel_read(int8_tArray ser) {
32466         LDKu8slice ser_ref;
32467         ser_ref.datalen = ser->arr_len;
32468         ser_ref.data = ser->elems;
32469         LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
32470         *ret_conv = OpenChannel_read(ser_ref);
32471         FREE(ser);
32472         return tag_ptr(ret_conv, true);
32473 }
32474
32475 int8_tArray  __attribute__((export_name("TS_RevokeAndACK_write"))) TS_RevokeAndACK_write(uint64_t obj) {
32476         LDKRevokeAndACK obj_conv;
32477         obj_conv.inner = untag_ptr(obj);
32478         obj_conv.is_owned = ptr_is_owned(obj);
32479         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
32480         obj_conv.is_owned = false;
32481         LDKCVec_u8Z ret_var = RevokeAndACK_write(&obj_conv);
32482         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
32483         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
32484         CVec_u8Z_free(ret_var);
32485         return ret_arr;
32486 }
32487
32488 uint64_t  __attribute__((export_name("TS_RevokeAndACK_read"))) TS_RevokeAndACK_read(int8_tArray ser) {
32489         LDKu8slice ser_ref;
32490         ser_ref.datalen = ser->arr_len;
32491         ser_ref.data = ser->elems;
32492         LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
32493         *ret_conv = RevokeAndACK_read(ser_ref);
32494         FREE(ser);
32495         return tag_ptr(ret_conv, true);
32496 }
32497
32498 int8_tArray  __attribute__((export_name("TS_Shutdown_write"))) TS_Shutdown_write(uint64_t obj) {
32499         LDKShutdown obj_conv;
32500         obj_conv.inner = untag_ptr(obj);
32501         obj_conv.is_owned = ptr_is_owned(obj);
32502         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
32503         obj_conv.is_owned = false;
32504         LDKCVec_u8Z ret_var = Shutdown_write(&obj_conv);
32505         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
32506         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
32507         CVec_u8Z_free(ret_var);
32508         return ret_arr;
32509 }
32510
32511 uint64_t  __attribute__((export_name("TS_Shutdown_read"))) TS_Shutdown_read(int8_tArray ser) {
32512         LDKu8slice ser_ref;
32513         ser_ref.datalen = ser->arr_len;
32514         ser_ref.data = ser->elems;
32515         LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
32516         *ret_conv = Shutdown_read(ser_ref);
32517         FREE(ser);
32518         return tag_ptr(ret_conv, true);
32519 }
32520
32521 int8_tArray  __attribute__((export_name("TS_UpdateFailHTLC_write"))) TS_UpdateFailHTLC_write(uint64_t obj) {
32522         LDKUpdateFailHTLC obj_conv;
32523         obj_conv.inner = untag_ptr(obj);
32524         obj_conv.is_owned = ptr_is_owned(obj);
32525         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
32526         obj_conv.is_owned = false;
32527         LDKCVec_u8Z ret_var = UpdateFailHTLC_write(&obj_conv);
32528         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
32529         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
32530         CVec_u8Z_free(ret_var);
32531         return ret_arr;
32532 }
32533
32534 uint64_t  __attribute__((export_name("TS_UpdateFailHTLC_read"))) TS_UpdateFailHTLC_read(int8_tArray ser) {
32535         LDKu8slice ser_ref;
32536         ser_ref.datalen = ser->arr_len;
32537         ser_ref.data = ser->elems;
32538         LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
32539         *ret_conv = UpdateFailHTLC_read(ser_ref);
32540         FREE(ser);
32541         return tag_ptr(ret_conv, true);
32542 }
32543
32544 int8_tArray  __attribute__((export_name("TS_UpdateFailMalformedHTLC_write"))) TS_UpdateFailMalformedHTLC_write(uint64_t obj) {
32545         LDKUpdateFailMalformedHTLC obj_conv;
32546         obj_conv.inner = untag_ptr(obj);
32547         obj_conv.is_owned = ptr_is_owned(obj);
32548         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
32549         obj_conv.is_owned = false;
32550         LDKCVec_u8Z ret_var = UpdateFailMalformedHTLC_write(&obj_conv);
32551         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
32552         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
32553         CVec_u8Z_free(ret_var);
32554         return ret_arr;
32555 }
32556
32557 uint64_t  __attribute__((export_name("TS_UpdateFailMalformedHTLC_read"))) TS_UpdateFailMalformedHTLC_read(int8_tArray ser) {
32558         LDKu8slice ser_ref;
32559         ser_ref.datalen = ser->arr_len;
32560         ser_ref.data = ser->elems;
32561         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
32562         *ret_conv = UpdateFailMalformedHTLC_read(ser_ref);
32563         FREE(ser);
32564         return tag_ptr(ret_conv, true);
32565 }
32566
32567 int8_tArray  __attribute__((export_name("TS_UpdateFee_write"))) TS_UpdateFee_write(uint64_t obj) {
32568         LDKUpdateFee obj_conv;
32569         obj_conv.inner = untag_ptr(obj);
32570         obj_conv.is_owned = ptr_is_owned(obj);
32571         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
32572         obj_conv.is_owned = false;
32573         LDKCVec_u8Z ret_var = UpdateFee_write(&obj_conv);
32574         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
32575         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
32576         CVec_u8Z_free(ret_var);
32577         return ret_arr;
32578 }
32579
32580 uint64_t  __attribute__((export_name("TS_UpdateFee_read"))) TS_UpdateFee_read(int8_tArray ser) {
32581         LDKu8slice ser_ref;
32582         ser_ref.datalen = ser->arr_len;
32583         ser_ref.data = ser->elems;
32584         LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
32585         *ret_conv = UpdateFee_read(ser_ref);
32586         FREE(ser);
32587         return tag_ptr(ret_conv, true);
32588 }
32589
32590 int8_tArray  __attribute__((export_name("TS_UpdateFulfillHTLC_write"))) TS_UpdateFulfillHTLC_write(uint64_t obj) {
32591         LDKUpdateFulfillHTLC obj_conv;
32592         obj_conv.inner = untag_ptr(obj);
32593         obj_conv.is_owned = ptr_is_owned(obj);
32594         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
32595         obj_conv.is_owned = false;
32596         LDKCVec_u8Z ret_var = UpdateFulfillHTLC_write(&obj_conv);
32597         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
32598         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
32599         CVec_u8Z_free(ret_var);
32600         return ret_arr;
32601 }
32602
32603 uint64_t  __attribute__((export_name("TS_UpdateFulfillHTLC_read"))) TS_UpdateFulfillHTLC_read(int8_tArray ser) {
32604         LDKu8slice ser_ref;
32605         ser_ref.datalen = ser->arr_len;
32606         ser_ref.data = ser->elems;
32607         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
32608         *ret_conv = UpdateFulfillHTLC_read(ser_ref);
32609         FREE(ser);
32610         return tag_ptr(ret_conv, true);
32611 }
32612
32613 int8_tArray  __attribute__((export_name("TS_UpdateAddHTLC_write"))) TS_UpdateAddHTLC_write(uint64_t obj) {
32614         LDKUpdateAddHTLC obj_conv;
32615         obj_conv.inner = untag_ptr(obj);
32616         obj_conv.is_owned = ptr_is_owned(obj);
32617         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
32618         obj_conv.is_owned = false;
32619         LDKCVec_u8Z ret_var = UpdateAddHTLC_write(&obj_conv);
32620         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
32621         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
32622         CVec_u8Z_free(ret_var);
32623         return ret_arr;
32624 }
32625
32626 uint64_t  __attribute__((export_name("TS_UpdateAddHTLC_read"))) TS_UpdateAddHTLC_read(int8_tArray ser) {
32627         LDKu8slice ser_ref;
32628         ser_ref.datalen = ser->arr_len;
32629         ser_ref.data = ser->elems;
32630         LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
32631         *ret_conv = UpdateAddHTLC_read(ser_ref);
32632         FREE(ser);
32633         return tag_ptr(ret_conv, true);
32634 }
32635
32636 int8_tArray  __attribute__((export_name("TS_Ping_write"))) TS_Ping_write(uint64_t obj) {
32637         LDKPing obj_conv;
32638         obj_conv.inner = untag_ptr(obj);
32639         obj_conv.is_owned = ptr_is_owned(obj);
32640         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
32641         obj_conv.is_owned = false;
32642         LDKCVec_u8Z ret_var = Ping_write(&obj_conv);
32643         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
32644         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
32645         CVec_u8Z_free(ret_var);
32646         return ret_arr;
32647 }
32648
32649 uint64_t  __attribute__((export_name("TS_Ping_read"))) TS_Ping_read(int8_tArray ser) {
32650         LDKu8slice ser_ref;
32651         ser_ref.datalen = ser->arr_len;
32652         ser_ref.data = ser->elems;
32653         LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
32654         *ret_conv = Ping_read(ser_ref);
32655         FREE(ser);
32656         return tag_ptr(ret_conv, true);
32657 }
32658
32659 int8_tArray  __attribute__((export_name("TS_Pong_write"))) TS_Pong_write(uint64_t obj) {
32660         LDKPong obj_conv;
32661         obj_conv.inner = untag_ptr(obj);
32662         obj_conv.is_owned = ptr_is_owned(obj);
32663         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
32664         obj_conv.is_owned = false;
32665         LDKCVec_u8Z ret_var = Pong_write(&obj_conv);
32666         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
32667         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
32668         CVec_u8Z_free(ret_var);
32669         return ret_arr;
32670 }
32671
32672 uint64_t  __attribute__((export_name("TS_Pong_read"))) TS_Pong_read(int8_tArray ser) {
32673         LDKu8slice ser_ref;
32674         ser_ref.datalen = ser->arr_len;
32675         ser_ref.data = ser->elems;
32676         LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
32677         *ret_conv = Pong_read(ser_ref);
32678         FREE(ser);
32679         return tag_ptr(ret_conv, true);
32680 }
32681
32682 int8_tArray  __attribute__((export_name("TS_UnsignedChannelAnnouncement_write"))) TS_UnsignedChannelAnnouncement_write(uint64_t obj) {
32683         LDKUnsignedChannelAnnouncement obj_conv;
32684         obj_conv.inner = untag_ptr(obj);
32685         obj_conv.is_owned = ptr_is_owned(obj);
32686         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
32687         obj_conv.is_owned = false;
32688         LDKCVec_u8Z ret_var = UnsignedChannelAnnouncement_write(&obj_conv);
32689         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
32690         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
32691         CVec_u8Z_free(ret_var);
32692         return ret_arr;
32693 }
32694
32695 uint64_t  __attribute__((export_name("TS_UnsignedChannelAnnouncement_read"))) TS_UnsignedChannelAnnouncement_read(int8_tArray ser) {
32696         LDKu8slice ser_ref;
32697         ser_ref.datalen = ser->arr_len;
32698         ser_ref.data = ser->elems;
32699         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
32700         *ret_conv = UnsignedChannelAnnouncement_read(ser_ref);
32701         FREE(ser);
32702         return tag_ptr(ret_conv, true);
32703 }
32704
32705 int8_tArray  __attribute__((export_name("TS_ChannelAnnouncement_write"))) TS_ChannelAnnouncement_write(uint64_t obj) {
32706         LDKChannelAnnouncement obj_conv;
32707         obj_conv.inner = untag_ptr(obj);
32708         obj_conv.is_owned = ptr_is_owned(obj);
32709         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
32710         obj_conv.is_owned = false;
32711         LDKCVec_u8Z ret_var = ChannelAnnouncement_write(&obj_conv);
32712         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
32713         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
32714         CVec_u8Z_free(ret_var);
32715         return ret_arr;
32716 }
32717
32718 uint64_t  __attribute__((export_name("TS_ChannelAnnouncement_read"))) TS_ChannelAnnouncement_read(int8_tArray ser) {
32719         LDKu8slice ser_ref;
32720         ser_ref.datalen = ser->arr_len;
32721         ser_ref.data = ser->elems;
32722         LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
32723         *ret_conv = ChannelAnnouncement_read(ser_ref);
32724         FREE(ser);
32725         return tag_ptr(ret_conv, true);
32726 }
32727
32728 int8_tArray  __attribute__((export_name("TS_UnsignedChannelUpdate_write"))) TS_UnsignedChannelUpdate_write(uint64_t obj) {
32729         LDKUnsignedChannelUpdate obj_conv;
32730         obj_conv.inner = untag_ptr(obj);
32731         obj_conv.is_owned = ptr_is_owned(obj);
32732         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
32733         obj_conv.is_owned = false;
32734         LDKCVec_u8Z ret_var = UnsignedChannelUpdate_write(&obj_conv);
32735         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
32736         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
32737         CVec_u8Z_free(ret_var);
32738         return ret_arr;
32739 }
32740
32741 uint64_t  __attribute__((export_name("TS_UnsignedChannelUpdate_read"))) TS_UnsignedChannelUpdate_read(int8_tArray ser) {
32742         LDKu8slice ser_ref;
32743         ser_ref.datalen = ser->arr_len;
32744         ser_ref.data = ser->elems;
32745         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
32746         *ret_conv = UnsignedChannelUpdate_read(ser_ref);
32747         FREE(ser);
32748         return tag_ptr(ret_conv, true);
32749 }
32750
32751 int8_tArray  __attribute__((export_name("TS_ChannelUpdate_write"))) TS_ChannelUpdate_write(uint64_t obj) {
32752         LDKChannelUpdate obj_conv;
32753         obj_conv.inner = untag_ptr(obj);
32754         obj_conv.is_owned = ptr_is_owned(obj);
32755         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
32756         obj_conv.is_owned = false;
32757         LDKCVec_u8Z ret_var = ChannelUpdate_write(&obj_conv);
32758         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
32759         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
32760         CVec_u8Z_free(ret_var);
32761         return ret_arr;
32762 }
32763
32764 uint64_t  __attribute__((export_name("TS_ChannelUpdate_read"))) TS_ChannelUpdate_read(int8_tArray ser) {
32765         LDKu8slice ser_ref;
32766         ser_ref.datalen = ser->arr_len;
32767         ser_ref.data = ser->elems;
32768         LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
32769         *ret_conv = ChannelUpdate_read(ser_ref);
32770         FREE(ser);
32771         return tag_ptr(ret_conv, true);
32772 }
32773
32774 int8_tArray  __attribute__((export_name("TS_ErrorMessage_write"))) TS_ErrorMessage_write(uint64_t obj) {
32775         LDKErrorMessage obj_conv;
32776         obj_conv.inner = untag_ptr(obj);
32777         obj_conv.is_owned = ptr_is_owned(obj);
32778         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
32779         obj_conv.is_owned = false;
32780         LDKCVec_u8Z ret_var = ErrorMessage_write(&obj_conv);
32781         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
32782         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
32783         CVec_u8Z_free(ret_var);
32784         return ret_arr;
32785 }
32786
32787 uint64_t  __attribute__((export_name("TS_ErrorMessage_read"))) TS_ErrorMessage_read(int8_tArray ser) {
32788         LDKu8slice ser_ref;
32789         ser_ref.datalen = ser->arr_len;
32790         ser_ref.data = ser->elems;
32791         LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
32792         *ret_conv = ErrorMessage_read(ser_ref);
32793         FREE(ser);
32794         return tag_ptr(ret_conv, true);
32795 }
32796
32797 int8_tArray  __attribute__((export_name("TS_WarningMessage_write"))) TS_WarningMessage_write(uint64_t obj) {
32798         LDKWarningMessage obj_conv;
32799         obj_conv.inner = untag_ptr(obj);
32800         obj_conv.is_owned = ptr_is_owned(obj);
32801         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
32802         obj_conv.is_owned = false;
32803         LDKCVec_u8Z ret_var = WarningMessage_write(&obj_conv);
32804         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
32805         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
32806         CVec_u8Z_free(ret_var);
32807         return ret_arr;
32808 }
32809
32810 uint64_t  __attribute__((export_name("TS_WarningMessage_read"))) TS_WarningMessage_read(int8_tArray ser) {
32811         LDKu8slice ser_ref;
32812         ser_ref.datalen = ser->arr_len;
32813         ser_ref.data = ser->elems;
32814         LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
32815         *ret_conv = WarningMessage_read(ser_ref);
32816         FREE(ser);
32817         return tag_ptr(ret_conv, true);
32818 }
32819
32820 int8_tArray  __attribute__((export_name("TS_UnsignedNodeAnnouncement_write"))) TS_UnsignedNodeAnnouncement_write(uint64_t obj) {
32821         LDKUnsignedNodeAnnouncement obj_conv;
32822         obj_conv.inner = untag_ptr(obj);
32823         obj_conv.is_owned = ptr_is_owned(obj);
32824         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
32825         obj_conv.is_owned = false;
32826         LDKCVec_u8Z ret_var = UnsignedNodeAnnouncement_write(&obj_conv);
32827         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
32828         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
32829         CVec_u8Z_free(ret_var);
32830         return ret_arr;
32831 }
32832
32833 uint64_t  __attribute__((export_name("TS_UnsignedNodeAnnouncement_read"))) TS_UnsignedNodeAnnouncement_read(int8_tArray ser) {
32834         LDKu8slice ser_ref;
32835         ser_ref.datalen = ser->arr_len;
32836         ser_ref.data = ser->elems;
32837         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
32838         *ret_conv = UnsignedNodeAnnouncement_read(ser_ref);
32839         FREE(ser);
32840         return tag_ptr(ret_conv, true);
32841 }
32842
32843 int8_tArray  __attribute__((export_name("TS_NodeAnnouncement_write"))) TS_NodeAnnouncement_write(uint64_t obj) {
32844         LDKNodeAnnouncement obj_conv;
32845         obj_conv.inner = untag_ptr(obj);
32846         obj_conv.is_owned = ptr_is_owned(obj);
32847         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
32848         obj_conv.is_owned = false;
32849         LDKCVec_u8Z ret_var = NodeAnnouncement_write(&obj_conv);
32850         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
32851         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
32852         CVec_u8Z_free(ret_var);
32853         return ret_arr;
32854 }
32855
32856 uint64_t  __attribute__((export_name("TS_NodeAnnouncement_read"))) TS_NodeAnnouncement_read(int8_tArray ser) {
32857         LDKu8slice ser_ref;
32858         ser_ref.datalen = ser->arr_len;
32859         ser_ref.data = ser->elems;
32860         LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
32861         *ret_conv = NodeAnnouncement_read(ser_ref);
32862         FREE(ser);
32863         return tag_ptr(ret_conv, true);
32864 }
32865
32866 uint64_t  __attribute__((export_name("TS_QueryShortChannelIds_read"))) TS_QueryShortChannelIds_read(int8_tArray ser) {
32867         LDKu8slice ser_ref;
32868         ser_ref.datalen = ser->arr_len;
32869         ser_ref.data = ser->elems;
32870         LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
32871         *ret_conv = QueryShortChannelIds_read(ser_ref);
32872         FREE(ser);
32873         return tag_ptr(ret_conv, true);
32874 }
32875
32876 int8_tArray  __attribute__((export_name("TS_QueryShortChannelIds_write"))) TS_QueryShortChannelIds_write(uint64_t obj) {
32877         LDKQueryShortChannelIds obj_conv;
32878         obj_conv.inner = untag_ptr(obj);
32879         obj_conv.is_owned = ptr_is_owned(obj);
32880         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
32881         obj_conv.is_owned = false;
32882         LDKCVec_u8Z ret_var = QueryShortChannelIds_write(&obj_conv);
32883         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
32884         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
32885         CVec_u8Z_free(ret_var);
32886         return ret_arr;
32887 }
32888
32889 int8_tArray  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_write"))) TS_ReplyShortChannelIdsEnd_write(uint64_t obj) {
32890         LDKReplyShortChannelIdsEnd obj_conv;
32891         obj_conv.inner = untag_ptr(obj);
32892         obj_conv.is_owned = ptr_is_owned(obj);
32893         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
32894         obj_conv.is_owned = false;
32895         LDKCVec_u8Z ret_var = ReplyShortChannelIdsEnd_write(&obj_conv);
32896         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
32897         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
32898         CVec_u8Z_free(ret_var);
32899         return ret_arr;
32900 }
32901
32902 uint64_t  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_read"))) TS_ReplyShortChannelIdsEnd_read(int8_tArray ser) {
32903         LDKu8slice ser_ref;
32904         ser_ref.datalen = ser->arr_len;
32905         ser_ref.data = ser->elems;
32906         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
32907         *ret_conv = ReplyShortChannelIdsEnd_read(ser_ref);
32908         FREE(ser);
32909         return tag_ptr(ret_conv, true);
32910 }
32911
32912 int32_t  __attribute__((export_name("TS_QueryChannelRange_end_blocknum"))) TS_QueryChannelRange_end_blocknum(uint64_t this_arg) {
32913         LDKQueryChannelRange this_arg_conv;
32914         this_arg_conv.inner = untag_ptr(this_arg);
32915         this_arg_conv.is_owned = ptr_is_owned(this_arg);
32916         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
32917         this_arg_conv.is_owned = false;
32918         int32_t ret_conv = QueryChannelRange_end_blocknum(&this_arg_conv);
32919         return ret_conv;
32920 }
32921
32922 int8_tArray  __attribute__((export_name("TS_QueryChannelRange_write"))) TS_QueryChannelRange_write(uint64_t obj) {
32923         LDKQueryChannelRange obj_conv;
32924         obj_conv.inner = untag_ptr(obj);
32925         obj_conv.is_owned = ptr_is_owned(obj);
32926         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
32927         obj_conv.is_owned = false;
32928         LDKCVec_u8Z ret_var = QueryChannelRange_write(&obj_conv);
32929         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
32930         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
32931         CVec_u8Z_free(ret_var);
32932         return ret_arr;
32933 }
32934
32935 uint64_t  __attribute__((export_name("TS_QueryChannelRange_read"))) TS_QueryChannelRange_read(int8_tArray ser) {
32936         LDKu8slice ser_ref;
32937         ser_ref.datalen = ser->arr_len;
32938         ser_ref.data = ser->elems;
32939         LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
32940         *ret_conv = QueryChannelRange_read(ser_ref);
32941         FREE(ser);
32942         return tag_ptr(ret_conv, true);
32943 }
32944
32945 uint64_t  __attribute__((export_name("TS_ReplyChannelRange_read"))) TS_ReplyChannelRange_read(int8_tArray ser) {
32946         LDKu8slice ser_ref;
32947         ser_ref.datalen = ser->arr_len;
32948         ser_ref.data = ser->elems;
32949         LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
32950         *ret_conv = ReplyChannelRange_read(ser_ref);
32951         FREE(ser);
32952         return tag_ptr(ret_conv, true);
32953 }
32954
32955 int8_tArray  __attribute__((export_name("TS_ReplyChannelRange_write"))) TS_ReplyChannelRange_write(uint64_t obj) {
32956         LDKReplyChannelRange obj_conv;
32957         obj_conv.inner = untag_ptr(obj);
32958         obj_conv.is_owned = ptr_is_owned(obj);
32959         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
32960         obj_conv.is_owned = false;
32961         LDKCVec_u8Z ret_var = ReplyChannelRange_write(&obj_conv);
32962         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
32963         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
32964         CVec_u8Z_free(ret_var);
32965         return ret_arr;
32966 }
32967
32968 int8_tArray  __attribute__((export_name("TS_GossipTimestampFilter_write"))) TS_GossipTimestampFilter_write(uint64_t obj) {
32969         LDKGossipTimestampFilter obj_conv;
32970         obj_conv.inner = untag_ptr(obj);
32971         obj_conv.is_owned = ptr_is_owned(obj);
32972         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
32973         obj_conv.is_owned = false;
32974         LDKCVec_u8Z ret_var = GossipTimestampFilter_write(&obj_conv);
32975         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
32976         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
32977         CVec_u8Z_free(ret_var);
32978         return ret_arr;
32979 }
32980
32981 uint64_t  __attribute__((export_name("TS_GossipTimestampFilter_read"))) TS_GossipTimestampFilter_read(int8_tArray ser) {
32982         LDKu8slice ser_ref;
32983         ser_ref.datalen = ser->arr_len;
32984         ser_ref.data = ser->elems;
32985         LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
32986         *ret_conv = GossipTimestampFilter_read(ser_ref);
32987         FREE(ser);
32988         return tag_ptr(ret_conv, true);
32989 }
32990
32991 void  __attribute__((export_name("TS_CustomMessageHandler_free"))) TS_CustomMessageHandler_free(uint64_t this_ptr) {
32992         if (!ptr_is_owned(this_ptr)) return;
32993         void* this_ptr_ptr = untag_ptr(this_ptr);
32994         CHECK_ACCESS(this_ptr_ptr);
32995         LDKCustomMessageHandler this_ptr_conv = *(LDKCustomMessageHandler*)(this_ptr_ptr);
32996         FREE(untag_ptr(this_ptr));
32997         CustomMessageHandler_free(this_ptr_conv);
32998 }
32999
33000 void  __attribute__((export_name("TS_IgnoringMessageHandler_free"))) TS_IgnoringMessageHandler_free(uint64_t this_obj) {
33001         LDKIgnoringMessageHandler this_obj_conv;
33002         this_obj_conv.inner = untag_ptr(this_obj);
33003         this_obj_conv.is_owned = ptr_is_owned(this_obj);
33004         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33005         IgnoringMessageHandler_free(this_obj_conv);
33006 }
33007
33008 uint64_t  __attribute__((export_name("TS_IgnoringMessageHandler_new"))) TS_IgnoringMessageHandler_new() {
33009         LDKIgnoringMessageHandler ret_var = IgnoringMessageHandler_new();
33010         uint64_t ret_ref = 0;
33011         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33012         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33013         return ret_ref;
33014 }
33015
33016 uint64_t  __attribute__((export_name("TS_IgnoringMessageHandler_as_MessageSendEventsProvider"))) TS_IgnoringMessageHandler_as_MessageSendEventsProvider(uint64_t this_arg) {
33017         LDKIgnoringMessageHandler this_arg_conv;
33018         this_arg_conv.inner = untag_ptr(this_arg);
33019         this_arg_conv.is_owned = ptr_is_owned(this_arg);
33020         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33021         this_arg_conv.is_owned = false;
33022         LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
33023         *ret_ret = IgnoringMessageHandler_as_MessageSendEventsProvider(&this_arg_conv);
33024         return tag_ptr(ret_ret, true);
33025 }
33026
33027 uint64_t  __attribute__((export_name("TS_IgnoringMessageHandler_as_RoutingMessageHandler"))) TS_IgnoringMessageHandler_as_RoutingMessageHandler(uint64_t this_arg) {
33028         LDKIgnoringMessageHandler this_arg_conv;
33029         this_arg_conv.inner = untag_ptr(this_arg);
33030         this_arg_conv.is_owned = ptr_is_owned(this_arg);
33031         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33032         this_arg_conv.is_owned = false;
33033         LDKRoutingMessageHandler* ret_ret = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
33034         *ret_ret = IgnoringMessageHandler_as_RoutingMessageHandler(&this_arg_conv);
33035         return tag_ptr(ret_ret, true);
33036 }
33037
33038 uint64_t  __attribute__((export_name("TS_IgnoringMessageHandler_as_CustomMessageReader"))) TS_IgnoringMessageHandler_as_CustomMessageReader(uint64_t this_arg) {
33039         LDKIgnoringMessageHandler this_arg_conv;
33040         this_arg_conv.inner = untag_ptr(this_arg);
33041         this_arg_conv.is_owned = ptr_is_owned(this_arg);
33042         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33043         this_arg_conv.is_owned = false;
33044         LDKCustomMessageReader* ret_ret = MALLOC(sizeof(LDKCustomMessageReader), "LDKCustomMessageReader");
33045         *ret_ret = IgnoringMessageHandler_as_CustomMessageReader(&this_arg_conv);
33046         return tag_ptr(ret_ret, true);
33047 }
33048
33049 uint64_t  __attribute__((export_name("TS_IgnoringMessageHandler_as_CustomMessageHandler"))) TS_IgnoringMessageHandler_as_CustomMessageHandler(uint64_t this_arg) {
33050         LDKIgnoringMessageHandler this_arg_conv;
33051         this_arg_conv.inner = untag_ptr(this_arg);
33052         this_arg_conv.is_owned = ptr_is_owned(this_arg);
33053         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33054         this_arg_conv.is_owned = false;
33055         LDKCustomMessageHandler* ret_ret = MALLOC(sizeof(LDKCustomMessageHandler), "LDKCustomMessageHandler");
33056         *ret_ret = IgnoringMessageHandler_as_CustomMessageHandler(&this_arg_conv);
33057         return tag_ptr(ret_ret, true);
33058 }
33059
33060 void  __attribute__((export_name("TS_ErroringMessageHandler_free"))) TS_ErroringMessageHandler_free(uint64_t this_obj) {
33061         LDKErroringMessageHandler this_obj_conv;
33062         this_obj_conv.inner = untag_ptr(this_obj);
33063         this_obj_conv.is_owned = ptr_is_owned(this_obj);
33064         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33065         ErroringMessageHandler_free(this_obj_conv);
33066 }
33067
33068 uint64_t  __attribute__((export_name("TS_ErroringMessageHandler_new"))) TS_ErroringMessageHandler_new() {
33069         LDKErroringMessageHandler ret_var = ErroringMessageHandler_new();
33070         uint64_t ret_ref = 0;
33071         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33072         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33073         return ret_ref;
33074 }
33075
33076 uint64_t  __attribute__((export_name("TS_ErroringMessageHandler_as_MessageSendEventsProvider"))) TS_ErroringMessageHandler_as_MessageSendEventsProvider(uint64_t this_arg) {
33077         LDKErroringMessageHandler this_arg_conv;
33078         this_arg_conv.inner = untag_ptr(this_arg);
33079         this_arg_conv.is_owned = ptr_is_owned(this_arg);
33080         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33081         this_arg_conv.is_owned = false;
33082         LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
33083         *ret_ret = ErroringMessageHandler_as_MessageSendEventsProvider(&this_arg_conv);
33084         return tag_ptr(ret_ret, true);
33085 }
33086
33087 uint64_t  __attribute__((export_name("TS_ErroringMessageHandler_as_ChannelMessageHandler"))) TS_ErroringMessageHandler_as_ChannelMessageHandler(uint64_t this_arg) {
33088         LDKErroringMessageHandler this_arg_conv;
33089         this_arg_conv.inner = untag_ptr(this_arg);
33090         this_arg_conv.is_owned = ptr_is_owned(this_arg);
33091         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33092         this_arg_conv.is_owned = false;
33093         LDKChannelMessageHandler* ret_ret = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
33094         *ret_ret = ErroringMessageHandler_as_ChannelMessageHandler(&this_arg_conv);
33095         return tag_ptr(ret_ret, true);
33096 }
33097
33098 void  __attribute__((export_name("TS_MessageHandler_free"))) TS_MessageHandler_free(uint64_t this_obj) {
33099         LDKMessageHandler this_obj_conv;
33100         this_obj_conv.inner = untag_ptr(this_obj);
33101         this_obj_conv.is_owned = ptr_is_owned(this_obj);
33102         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33103         MessageHandler_free(this_obj_conv);
33104 }
33105
33106 uint64_t  __attribute__((export_name("TS_MessageHandler_get_chan_handler"))) TS_MessageHandler_get_chan_handler(uint64_t this_ptr) {
33107         LDKMessageHandler this_ptr_conv;
33108         this_ptr_conv.inner = untag_ptr(this_ptr);
33109         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33110         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33111         this_ptr_conv.is_owned = false;
33112         // WARNING: This object doesn't live past this scope, needs clone!
33113         uint64_t ret_ret = tag_ptr(MessageHandler_get_chan_handler(&this_ptr_conv), false);
33114         return ret_ret;
33115 }
33116
33117 void  __attribute__((export_name("TS_MessageHandler_set_chan_handler"))) TS_MessageHandler_set_chan_handler(uint64_t this_ptr, uint64_t val) {
33118         LDKMessageHandler this_ptr_conv;
33119         this_ptr_conv.inner = untag_ptr(this_ptr);
33120         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33121         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33122         this_ptr_conv.is_owned = false;
33123         void* val_ptr = untag_ptr(val);
33124         CHECK_ACCESS(val_ptr);
33125         LDKChannelMessageHandler val_conv = *(LDKChannelMessageHandler*)(val_ptr);
33126         if (val_conv.free == LDKChannelMessageHandler_JCalls_free) {
33127                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
33128                 LDKChannelMessageHandler_JCalls_cloned(&val_conv);
33129         }
33130         MessageHandler_set_chan_handler(&this_ptr_conv, val_conv);
33131 }
33132
33133 uint64_t  __attribute__((export_name("TS_MessageHandler_get_route_handler"))) TS_MessageHandler_get_route_handler(uint64_t this_ptr) {
33134         LDKMessageHandler this_ptr_conv;
33135         this_ptr_conv.inner = untag_ptr(this_ptr);
33136         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33137         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33138         this_ptr_conv.is_owned = false;
33139         // WARNING: This object doesn't live past this scope, needs clone!
33140         uint64_t ret_ret = tag_ptr(MessageHandler_get_route_handler(&this_ptr_conv), false);
33141         return ret_ret;
33142 }
33143
33144 void  __attribute__((export_name("TS_MessageHandler_set_route_handler"))) TS_MessageHandler_set_route_handler(uint64_t this_ptr, uint64_t val) {
33145         LDKMessageHandler this_ptr_conv;
33146         this_ptr_conv.inner = untag_ptr(this_ptr);
33147         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33148         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33149         this_ptr_conv.is_owned = false;
33150         void* val_ptr = untag_ptr(val);
33151         CHECK_ACCESS(val_ptr);
33152         LDKRoutingMessageHandler val_conv = *(LDKRoutingMessageHandler*)(val_ptr);
33153         if (val_conv.free == LDKRoutingMessageHandler_JCalls_free) {
33154                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
33155                 LDKRoutingMessageHandler_JCalls_cloned(&val_conv);
33156         }
33157         MessageHandler_set_route_handler(&this_ptr_conv, val_conv);
33158 }
33159
33160 uint64_t  __attribute__((export_name("TS_MessageHandler_new"))) TS_MessageHandler_new(uint64_t chan_handler_arg, uint64_t route_handler_arg) {
33161         void* chan_handler_arg_ptr = untag_ptr(chan_handler_arg);
33162         CHECK_ACCESS(chan_handler_arg_ptr);
33163         LDKChannelMessageHandler chan_handler_arg_conv = *(LDKChannelMessageHandler*)(chan_handler_arg_ptr);
33164         if (chan_handler_arg_conv.free == LDKChannelMessageHandler_JCalls_free) {
33165                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
33166                 LDKChannelMessageHandler_JCalls_cloned(&chan_handler_arg_conv);
33167         }
33168         void* route_handler_arg_ptr = untag_ptr(route_handler_arg);
33169         CHECK_ACCESS(route_handler_arg_ptr);
33170         LDKRoutingMessageHandler route_handler_arg_conv = *(LDKRoutingMessageHandler*)(route_handler_arg_ptr);
33171         if (route_handler_arg_conv.free == LDKRoutingMessageHandler_JCalls_free) {
33172                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
33173                 LDKRoutingMessageHandler_JCalls_cloned(&route_handler_arg_conv);
33174         }
33175         LDKMessageHandler ret_var = MessageHandler_new(chan_handler_arg_conv, route_handler_arg_conv);
33176         uint64_t ret_ref = 0;
33177         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33178         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33179         return ret_ref;
33180 }
33181
33182 static inline uint64_t SocketDescriptor_clone_ptr(LDKSocketDescriptor *NONNULL_PTR arg) {
33183         LDKSocketDescriptor* ret_ret = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
33184         *ret_ret = SocketDescriptor_clone(arg);
33185         return tag_ptr(ret_ret, true);
33186 }
33187 int64_t  __attribute__((export_name("TS_SocketDescriptor_clone_ptr"))) TS_SocketDescriptor_clone_ptr(uint64_t arg) {
33188         void* arg_ptr = untag_ptr(arg);
33189         if (ptr_is_owned(arg)) { CHECK_ACCESS(arg_ptr); }
33190         LDKSocketDescriptor* arg_conv = (LDKSocketDescriptor*)arg_ptr;
33191         int64_t ret_conv = SocketDescriptor_clone_ptr(arg_conv);
33192         return ret_conv;
33193 }
33194
33195 uint64_t  __attribute__((export_name("TS_SocketDescriptor_clone"))) TS_SocketDescriptor_clone(uint64_t orig) {
33196         void* orig_ptr = untag_ptr(orig);
33197         if (ptr_is_owned(orig)) { CHECK_ACCESS(orig_ptr); }
33198         LDKSocketDescriptor* orig_conv = (LDKSocketDescriptor*)orig_ptr;
33199         LDKSocketDescriptor* ret_ret = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
33200         *ret_ret = SocketDescriptor_clone(orig_conv);
33201         return tag_ptr(ret_ret, true);
33202 }
33203
33204 void  __attribute__((export_name("TS_SocketDescriptor_free"))) TS_SocketDescriptor_free(uint64_t this_ptr) {
33205         if (!ptr_is_owned(this_ptr)) return;
33206         void* this_ptr_ptr = untag_ptr(this_ptr);
33207         CHECK_ACCESS(this_ptr_ptr);
33208         LDKSocketDescriptor this_ptr_conv = *(LDKSocketDescriptor*)(this_ptr_ptr);
33209         FREE(untag_ptr(this_ptr));
33210         SocketDescriptor_free(this_ptr_conv);
33211 }
33212
33213 void  __attribute__((export_name("TS_PeerHandleError_free"))) TS_PeerHandleError_free(uint64_t this_obj) {
33214         LDKPeerHandleError this_obj_conv;
33215         this_obj_conv.inner = untag_ptr(this_obj);
33216         this_obj_conv.is_owned = ptr_is_owned(this_obj);
33217         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33218         PeerHandleError_free(this_obj_conv);
33219 }
33220
33221 jboolean  __attribute__((export_name("TS_PeerHandleError_get_no_connection_possible"))) TS_PeerHandleError_get_no_connection_possible(uint64_t this_ptr) {
33222         LDKPeerHandleError this_ptr_conv;
33223         this_ptr_conv.inner = untag_ptr(this_ptr);
33224         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33225         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33226         this_ptr_conv.is_owned = false;
33227         jboolean ret_conv = PeerHandleError_get_no_connection_possible(&this_ptr_conv);
33228         return ret_conv;
33229 }
33230
33231 void  __attribute__((export_name("TS_PeerHandleError_set_no_connection_possible"))) TS_PeerHandleError_set_no_connection_possible(uint64_t this_ptr, jboolean val) {
33232         LDKPeerHandleError this_ptr_conv;
33233         this_ptr_conv.inner = untag_ptr(this_ptr);
33234         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33235         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33236         this_ptr_conv.is_owned = false;
33237         PeerHandleError_set_no_connection_possible(&this_ptr_conv, val);
33238 }
33239
33240 uint64_t  __attribute__((export_name("TS_PeerHandleError_new"))) TS_PeerHandleError_new(jboolean no_connection_possible_arg) {
33241         LDKPeerHandleError ret_var = PeerHandleError_new(no_connection_possible_arg);
33242         uint64_t ret_ref = 0;
33243         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33244         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33245         return ret_ref;
33246 }
33247
33248 static inline uint64_t PeerHandleError_clone_ptr(LDKPeerHandleError *NONNULL_PTR arg) {
33249         LDKPeerHandleError ret_var = PeerHandleError_clone(arg);
33250         uint64_t ret_ref = 0;
33251         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33252         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33253         return ret_ref;
33254 }
33255 int64_t  __attribute__((export_name("TS_PeerHandleError_clone_ptr"))) TS_PeerHandleError_clone_ptr(uint64_t arg) {
33256         LDKPeerHandleError arg_conv;
33257         arg_conv.inner = untag_ptr(arg);
33258         arg_conv.is_owned = ptr_is_owned(arg);
33259         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
33260         arg_conv.is_owned = false;
33261         int64_t ret_conv = PeerHandleError_clone_ptr(&arg_conv);
33262         return ret_conv;
33263 }
33264
33265 uint64_t  __attribute__((export_name("TS_PeerHandleError_clone"))) TS_PeerHandleError_clone(uint64_t orig) {
33266         LDKPeerHandleError orig_conv;
33267         orig_conv.inner = untag_ptr(orig);
33268         orig_conv.is_owned = ptr_is_owned(orig);
33269         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33270         orig_conv.is_owned = false;
33271         LDKPeerHandleError ret_var = PeerHandleError_clone(&orig_conv);
33272         uint64_t ret_ref = 0;
33273         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33274         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33275         return ret_ref;
33276 }
33277
33278 void  __attribute__((export_name("TS_PeerManager_free"))) TS_PeerManager_free(uint64_t this_obj) {
33279         LDKPeerManager this_obj_conv;
33280         this_obj_conv.inner = untag_ptr(this_obj);
33281         this_obj_conv.is_owned = ptr_is_owned(this_obj);
33282         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33283         PeerManager_free(this_obj_conv);
33284 }
33285
33286 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) {
33287         LDKMessageHandler message_handler_conv;
33288         message_handler_conv.inner = untag_ptr(message_handler);
33289         message_handler_conv.is_owned = ptr_is_owned(message_handler);
33290         CHECK_INNER_FIELD_ACCESS_OR_NULL(message_handler_conv);
33291         // WARNING: we need a move here but no clone is available for LDKMessageHandler
33292         
33293         LDKSecretKey our_node_secret_ref;
33294         CHECK(our_node_secret->arr_len == 32);
33295         memcpy(our_node_secret_ref.bytes, our_node_secret->elems, 32); FREE(our_node_secret);
33296         unsigned char ephemeral_random_data_arr[32];
33297         CHECK(ephemeral_random_data->arr_len == 32);
33298         memcpy(ephemeral_random_data_arr, ephemeral_random_data->elems, 32); FREE(ephemeral_random_data);
33299         unsigned char (*ephemeral_random_data_ref)[32] = &ephemeral_random_data_arr;
33300         void* logger_ptr = untag_ptr(logger);
33301         CHECK_ACCESS(logger_ptr);
33302         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
33303         if (logger_conv.free == LDKLogger_JCalls_free) {
33304                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
33305                 LDKLogger_JCalls_cloned(&logger_conv);
33306         }
33307         void* custom_message_handler_ptr = untag_ptr(custom_message_handler);
33308         CHECK_ACCESS(custom_message_handler_ptr);
33309         LDKCustomMessageHandler custom_message_handler_conv = *(LDKCustomMessageHandler*)(custom_message_handler_ptr);
33310         if (custom_message_handler_conv.free == LDKCustomMessageHandler_JCalls_free) {
33311                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
33312                 LDKCustomMessageHandler_JCalls_cloned(&custom_message_handler_conv);
33313         }
33314         LDKPeerManager ret_var = PeerManager_new(message_handler_conv, our_node_secret_ref, ephemeral_random_data_ref, logger_conv, custom_message_handler_conv);
33315         uint64_t ret_ref = 0;
33316         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33317         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33318         return ret_ref;
33319 }
33320
33321 ptrArray  __attribute__((export_name("TS_PeerManager_get_peer_node_ids"))) TS_PeerManager_get_peer_node_ids(uint64_t this_arg) {
33322         LDKPeerManager this_arg_conv;
33323         this_arg_conv.inner = untag_ptr(this_arg);
33324         this_arg_conv.is_owned = ptr_is_owned(this_arg);
33325         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33326         this_arg_conv.is_owned = false;
33327         LDKCVec_PublicKeyZ ret_var = PeerManager_get_peer_node_ids(&this_arg_conv);
33328         ptrArray ret_arr = NULL;
33329         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
33330         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
33331         for (size_t m = 0; m < ret_var.datalen; m++) {
33332                 int8_tArray ret_conv_12_arr = init_int8_tArray(33, __LINE__);
33333                 memcpy(ret_conv_12_arr->elems, ret_var.data[m].compressed_form, 33);
33334                 ret_arr_ptr[m] = ret_conv_12_arr;
33335         }
33336         
33337         FREE(ret_var.data);
33338         return ret_arr;
33339 }
33340
33341 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) {
33342         LDKPeerManager this_arg_conv;
33343         this_arg_conv.inner = untag_ptr(this_arg);
33344         this_arg_conv.is_owned = ptr_is_owned(this_arg);
33345         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33346         this_arg_conv.is_owned = false;
33347         LDKPublicKey their_node_id_ref;
33348         CHECK(their_node_id->arr_len == 33);
33349         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
33350         void* descriptor_ptr = untag_ptr(descriptor);
33351         CHECK_ACCESS(descriptor_ptr);
33352         LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)(descriptor_ptr);
33353         if (descriptor_conv.free == LDKSocketDescriptor_JCalls_free) {
33354                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
33355                 LDKSocketDescriptor_JCalls_cloned(&descriptor_conv);
33356         }
33357         void* remote_network_address_ptr = untag_ptr(remote_network_address);
33358         CHECK_ACCESS(remote_network_address_ptr);
33359         LDKCOption_NetAddressZ remote_network_address_conv = *(LDKCOption_NetAddressZ*)(remote_network_address_ptr);
33360         LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
33361         *ret_conv = PeerManager_new_outbound_connection(&this_arg_conv, their_node_id_ref, descriptor_conv, remote_network_address_conv);
33362         return tag_ptr(ret_conv, true);
33363 }
33364
33365 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) {
33366         LDKPeerManager this_arg_conv;
33367         this_arg_conv.inner = untag_ptr(this_arg);
33368         this_arg_conv.is_owned = ptr_is_owned(this_arg);
33369         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33370         this_arg_conv.is_owned = false;
33371         void* descriptor_ptr = untag_ptr(descriptor);
33372         CHECK_ACCESS(descriptor_ptr);
33373         LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)(descriptor_ptr);
33374         if (descriptor_conv.free == LDKSocketDescriptor_JCalls_free) {
33375                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
33376                 LDKSocketDescriptor_JCalls_cloned(&descriptor_conv);
33377         }
33378         void* remote_network_address_ptr = untag_ptr(remote_network_address);
33379         CHECK_ACCESS(remote_network_address_ptr);
33380         LDKCOption_NetAddressZ remote_network_address_conv = *(LDKCOption_NetAddressZ*)(remote_network_address_ptr);
33381         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
33382         *ret_conv = PeerManager_new_inbound_connection(&this_arg_conv, descriptor_conv, remote_network_address_conv);
33383         return tag_ptr(ret_conv, true);
33384 }
33385
33386 uint64_t  __attribute__((export_name("TS_PeerManager_write_buffer_space_avail"))) TS_PeerManager_write_buffer_space_avail(uint64_t this_arg, uint64_t descriptor) {
33387         LDKPeerManager this_arg_conv;
33388         this_arg_conv.inner = untag_ptr(this_arg);
33389         this_arg_conv.is_owned = ptr_is_owned(this_arg);
33390         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33391         this_arg_conv.is_owned = false;
33392         void* descriptor_ptr = untag_ptr(descriptor);
33393         if (ptr_is_owned(descriptor)) { CHECK_ACCESS(descriptor_ptr); }
33394         LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)descriptor_ptr;
33395         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
33396         *ret_conv = PeerManager_write_buffer_space_avail(&this_arg_conv, descriptor_conv);
33397         return tag_ptr(ret_conv, true);
33398 }
33399
33400 uint64_t  __attribute__((export_name("TS_PeerManager_read_event"))) TS_PeerManager_read_event(uint64_t this_arg, uint64_t peer_descriptor, int8_tArray data) {
33401         LDKPeerManager this_arg_conv;
33402         this_arg_conv.inner = untag_ptr(this_arg);
33403         this_arg_conv.is_owned = ptr_is_owned(this_arg);
33404         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33405         this_arg_conv.is_owned = false;
33406         void* peer_descriptor_ptr = untag_ptr(peer_descriptor);
33407         if (ptr_is_owned(peer_descriptor)) { CHECK_ACCESS(peer_descriptor_ptr); }
33408         LDKSocketDescriptor* peer_descriptor_conv = (LDKSocketDescriptor*)peer_descriptor_ptr;
33409         LDKu8slice data_ref;
33410         data_ref.datalen = data->arr_len;
33411         data_ref.data = data->elems;
33412         LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
33413         *ret_conv = PeerManager_read_event(&this_arg_conv, peer_descriptor_conv, data_ref);
33414         FREE(data);
33415         return tag_ptr(ret_conv, true);
33416 }
33417
33418 void  __attribute__((export_name("TS_PeerManager_process_events"))) TS_PeerManager_process_events(uint64_t this_arg) {
33419         LDKPeerManager this_arg_conv;
33420         this_arg_conv.inner = untag_ptr(this_arg);
33421         this_arg_conv.is_owned = ptr_is_owned(this_arg);
33422         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33423         this_arg_conv.is_owned = false;
33424         PeerManager_process_events(&this_arg_conv);
33425 }
33426
33427 void  __attribute__((export_name("TS_PeerManager_socket_disconnected"))) TS_PeerManager_socket_disconnected(uint64_t this_arg, uint64_t descriptor) {
33428         LDKPeerManager this_arg_conv;
33429         this_arg_conv.inner = untag_ptr(this_arg);
33430         this_arg_conv.is_owned = ptr_is_owned(this_arg);
33431         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33432         this_arg_conv.is_owned = false;
33433         void* descriptor_ptr = untag_ptr(descriptor);
33434         if (ptr_is_owned(descriptor)) { CHECK_ACCESS(descriptor_ptr); }
33435         LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)descriptor_ptr;
33436         PeerManager_socket_disconnected(&this_arg_conv, descriptor_conv);
33437 }
33438
33439 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) {
33440         LDKPeerManager this_arg_conv;
33441         this_arg_conv.inner = untag_ptr(this_arg);
33442         this_arg_conv.is_owned = ptr_is_owned(this_arg);
33443         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33444         this_arg_conv.is_owned = false;
33445         LDKPublicKey node_id_ref;
33446         CHECK(node_id->arr_len == 33);
33447         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
33448         PeerManager_disconnect_by_node_id(&this_arg_conv, node_id_ref, no_connection_possible);
33449 }
33450
33451 void  __attribute__((export_name("TS_PeerManager_disconnect_all_peers"))) TS_PeerManager_disconnect_all_peers(uint64_t this_arg) {
33452         LDKPeerManager this_arg_conv;
33453         this_arg_conv.inner = untag_ptr(this_arg);
33454         this_arg_conv.is_owned = ptr_is_owned(this_arg);
33455         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33456         this_arg_conv.is_owned = false;
33457         PeerManager_disconnect_all_peers(&this_arg_conv);
33458 }
33459
33460 void  __attribute__((export_name("TS_PeerManager_timer_tick_occurred"))) TS_PeerManager_timer_tick_occurred(uint64_t this_arg) {
33461         LDKPeerManager this_arg_conv;
33462         this_arg_conv.inner = untag_ptr(this_arg);
33463         this_arg_conv.is_owned = ptr_is_owned(this_arg);
33464         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33465         this_arg_conv.is_owned = false;
33466         PeerManager_timer_tick_occurred(&this_arg_conv);
33467 }
33468
33469 int64_t  __attribute__((export_name("TS_htlc_success_tx_weight"))) TS_htlc_success_tx_weight(jboolean opt_anchors) {
33470         int64_t ret_conv = htlc_success_tx_weight(opt_anchors);
33471         return ret_conv;
33472 }
33473
33474 int64_t  __attribute__((export_name("TS_htlc_timeout_tx_weight"))) TS_htlc_timeout_tx_weight(jboolean opt_anchors) {
33475         int64_t ret_conv = htlc_timeout_tx_weight(opt_anchors);
33476         return ret_conv;
33477 }
33478
33479 int8_tArray  __attribute__((export_name("TS_build_commitment_secret"))) TS_build_commitment_secret(int8_tArray commitment_seed, int64_t idx) {
33480         unsigned char commitment_seed_arr[32];
33481         CHECK(commitment_seed->arr_len == 32);
33482         memcpy(commitment_seed_arr, commitment_seed->elems, 32); FREE(commitment_seed);
33483         unsigned char (*commitment_seed_ref)[32] = &commitment_seed_arr;
33484         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
33485         memcpy(ret_arr->elems, build_commitment_secret(commitment_seed_ref, idx).data, 32);
33486         return ret_arr;
33487 }
33488
33489 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) {
33490         LDKCVec_u8Z to_holder_script_ref;
33491         to_holder_script_ref.datalen = to_holder_script->arr_len;
33492         to_holder_script_ref.data = MALLOC(to_holder_script_ref.datalen, "LDKCVec_u8Z Bytes");
33493         memcpy(to_holder_script_ref.data, to_holder_script->elems, to_holder_script_ref.datalen); FREE(to_holder_script);
33494         LDKCVec_u8Z to_counterparty_script_ref;
33495         to_counterparty_script_ref.datalen = to_counterparty_script->arr_len;
33496         to_counterparty_script_ref.data = MALLOC(to_counterparty_script_ref.datalen, "LDKCVec_u8Z Bytes");
33497         memcpy(to_counterparty_script_ref.data, to_counterparty_script->elems, to_counterparty_script_ref.datalen); FREE(to_counterparty_script);
33498         LDKOutPoint funding_outpoint_conv;
33499         funding_outpoint_conv.inner = untag_ptr(funding_outpoint);
33500         funding_outpoint_conv.is_owned = ptr_is_owned(funding_outpoint);
33501         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_conv);
33502         funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
33503         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);
33504         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
33505         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
33506         Transaction_free(ret_var);
33507         return ret_arr;
33508 }
33509
33510 void  __attribute__((export_name("TS_CounterpartyCommitmentSecrets_free"))) TS_CounterpartyCommitmentSecrets_free(uint64_t this_obj) {
33511         LDKCounterpartyCommitmentSecrets this_obj_conv;
33512         this_obj_conv.inner = untag_ptr(this_obj);
33513         this_obj_conv.is_owned = ptr_is_owned(this_obj);
33514         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33515         CounterpartyCommitmentSecrets_free(this_obj_conv);
33516 }
33517
33518 static inline uint64_t CounterpartyCommitmentSecrets_clone_ptr(LDKCounterpartyCommitmentSecrets *NONNULL_PTR arg) {
33519         LDKCounterpartyCommitmentSecrets ret_var = CounterpartyCommitmentSecrets_clone(arg);
33520         uint64_t ret_ref = 0;
33521         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33522         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33523         return ret_ref;
33524 }
33525 int64_t  __attribute__((export_name("TS_CounterpartyCommitmentSecrets_clone_ptr"))) TS_CounterpartyCommitmentSecrets_clone_ptr(uint64_t arg) {
33526         LDKCounterpartyCommitmentSecrets arg_conv;
33527         arg_conv.inner = untag_ptr(arg);
33528         arg_conv.is_owned = ptr_is_owned(arg);
33529         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
33530         arg_conv.is_owned = false;
33531         int64_t ret_conv = CounterpartyCommitmentSecrets_clone_ptr(&arg_conv);
33532         return ret_conv;
33533 }
33534
33535 uint64_t  __attribute__((export_name("TS_CounterpartyCommitmentSecrets_clone"))) TS_CounterpartyCommitmentSecrets_clone(uint64_t orig) {
33536         LDKCounterpartyCommitmentSecrets orig_conv;
33537         orig_conv.inner = untag_ptr(orig);
33538         orig_conv.is_owned = ptr_is_owned(orig);
33539         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33540         orig_conv.is_owned = false;
33541         LDKCounterpartyCommitmentSecrets ret_var = CounterpartyCommitmentSecrets_clone(&orig_conv);
33542         uint64_t ret_ref = 0;
33543         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33544         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33545         return ret_ref;
33546 }
33547
33548 uint64_t  __attribute__((export_name("TS_CounterpartyCommitmentSecrets_new"))) TS_CounterpartyCommitmentSecrets_new() {
33549         LDKCounterpartyCommitmentSecrets ret_var = CounterpartyCommitmentSecrets_new();
33550         uint64_t ret_ref = 0;
33551         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33552         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33553         return ret_ref;
33554 }
33555
33556 int64_t  __attribute__((export_name("TS_CounterpartyCommitmentSecrets_get_min_seen_secret"))) TS_CounterpartyCommitmentSecrets_get_min_seen_secret(uint64_t this_arg) {
33557         LDKCounterpartyCommitmentSecrets this_arg_conv;
33558         this_arg_conv.inner = untag_ptr(this_arg);
33559         this_arg_conv.is_owned = ptr_is_owned(this_arg);
33560         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33561         this_arg_conv.is_owned = false;
33562         int64_t ret_conv = CounterpartyCommitmentSecrets_get_min_seen_secret(&this_arg_conv);
33563         return ret_conv;
33564 }
33565
33566 uint64_t  __attribute__((export_name("TS_CounterpartyCommitmentSecrets_provide_secret"))) TS_CounterpartyCommitmentSecrets_provide_secret(uint64_t this_arg, int64_t idx, int8_tArray secret) {
33567         LDKCounterpartyCommitmentSecrets 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         LDKThirtyTwoBytes secret_ref;
33573         CHECK(secret->arr_len == 32);
33574         memcpy(secret_ref.data, secret->elems, 32); FREE(secret);
33575         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
33576         *ret_conv = CounterpartyCommitmentSecrets_provide_secret(&this_arg_conv, idx, secret_ref);
33577         return tag_ptr(ret_conv, true);
33578 }
33579
33580 int8_tArray  __attribute__((export_name("TS_CounterpartyCommitmentSecrets_get_secret"))) TS_CounterpartyCommitmentSecrets_get_secret(uint64_t this_arg, int64_t idx) {
33581         LDKCounterpartyCommitmentSecrets this_arg_conv;
33582         this_arg_conv.inner = untag_ptr(this_arg);
33583         this_arg_conv.is_owned = ptr_is_owned(this_arg);
33584         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33585         this_arg_conv.is_owned = false;
33586         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
33587         memcpy(ret_arr->elems, CounterpartyCommitmentSecrets_get_secret(&this_arg_conv, idx).data, 32);
33588         return ret_arr;
33589 }
33590
33591 int8_tArray  __attribute__((export_name("TS_CounterpartyCommitmentSecrets_write"))) TS_CounterpartyCommitmentSecrets_write(uint64_t obj) {
33592         LDKCounterpartyCommitmentSecrets obj_conv;
33593         obj_conv.inner = untag_ptr(obj);
33594         obj_conv.is_owned = ptr_is_owned(obj);
33595         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
33596         obj_conv.is_owned = false;
33597         LDKCVec_u8Z ret_var = CounterpartyCommitmentSecrets_write(&obj_conv);
33598         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
33599         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
33600         CVec_u8Z_free(ret_var);
33601         return ret_arr;
33602 }
33603
33604 uint64_t  __attribute__((export_name("TS_CounterpartyCommitmentSecrets_read"))) TS_CounterpartyCommitmentSecrets_read(int8_tArray ser) {
33605         LDKu8slice ser_ref;
33606         ser_ref.datalen = ser->arr_len;
33607         ser_ref.data = ser->elems;
33608         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
33609         *ret_conv = CounterpartyCommitmentSecrets_read(ser_ref);
33610         FREE(ser);
33611         return tag_ptr(ret_conv, true);
33612 }
33613
33614 uint64_t  __attribute__((export_name("TS_derive_private_key"))) TS_derive_private_key(int8_tArray per_commitment_point, int8_tArray base_secret) {
33615         LDKPublicKey per_commitment_point_ref;
33616         CHECK(per_commitment_point->arr_len == 33);
33617         memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33); FREE(per_commitment_point);
33618         unsigned char base_secret_arr[32];
33619         CHECK(base_secret->arr_len == 32);
33620         memcpy(base_secret_arr, base_secret->elems, 32); FREE(base_secret);
33621         unsigned char (*base_secret_ref)[32] = &base_secret_arr;
33622         LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
33623         *ret_conv = derive_private_key(per_commitment_point_ref, base_secret_ref);
33624         return tag_ptr(ret_conv, true);
33625 }
33626
33627 uint64_t  __attribute__((export_name("TS_derive_public_key"))) TS_derive_public_key(int8_tArray per_commitment_point, int8_tArray base_point) {
33628         LDKPublicKey per_commitment_point_ref;
33629         CHECK(per_commitment_point->arr_len == 33);
33630         memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33); FREE(per_commitment_point);
33631         LDKPublicKey base_point_ref;
33632         CHECK(base_point->arr_len == 33);
33633         memcpy(base_point_ref.compressed_form, base_point->elems, 33); FREE(base_point);
33634         LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
33635         *ret_conv = derive_public_key(per_commitment_point_ref, base_point_ref);
33636         return tag_ptr(ret_conv, true);
33637 }
33638
33639 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) {
33640         unsigned char per_commitment_secret_arr[32];
33641         CHECK(per_commitment_secret->arr_len == 32);
33642         memcpy(per_commitment_secret_arr, per_commitment_secret->elems, 32); FREE(per_commitment_secret);
33643         unsigned char (*per_commitment_secret_ref)[32] = &per_commitment_secret_arr;
33644         unsigned char countersignatory_revocation_base_secret_arr[32];
33645         CHECK(countersignatory_revocation_base_secret->arr_len == 32);
33646         memcpy(countersignatory_revocation_base_secret_arr, countersignatory_revocation_base_secret->elems, 32); FREE(countersignatory_revocation_base_secret);
33647         unsigned char (*countersignatory_revocation_base_secret_ref)[32] = &countersignatory_revocation_base_secret_arr;
33648         LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
33649         *ret_conv = derive_private_revocation_key(per_commitment_secret_ref, countersignatory_revocation_base_secret_ref);
33650         return tag_ptr(ret_conv, true);
33651 }
33652
33653 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) {
33654         LDKPublicKey per_commitment_point_ref;
33655         CHECK(per_commitment_point->arr_len == 33);
33656         memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33); FREE(per_commitment_point);
33657         LDKPublicKey countersignatory_revocation_base_point_ref;
33658         CHECK(countersignatory_revocation_base_point->arr_len == 33);
33659         memcpy(countersignatory_revocation_base_point_ref.compressed_form, countersignatory_revocation_base_point->elems, 33); FREE(countersignatory_revocation_base_point);
33660         LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
33661         *ret_conv = derive_public_revocation_key(per_commitment_point_ref, countersignatory_revocation_base_point_ref);
33662         return tag_ptr(ret_conv, true);
33663 }
33664
33665 void  __attribute__((export_name("TS_TxCreationKeys_free"))) TS_TxCreationKeys_free(uint64_t this_obj) {
33666         LDKTxCreationKeys this_obj_conv;
33667         this_obj_conv.inner = untag_ptr(this_obj);
33668         this_obj_conv.is_owned = ptr_is_owned(this_obj);
33669         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33670         TxCreationKeys_free(this_obj_conv);
33671 }
33672
33673 int8_tArray  __attribute__((export_name("TS_TxCreationKeys_get_per_commitment_point"))) TS_TxCreationKeys_get_per_commitment_point(uint64_t this_ptr) {
33674         LDKTxCreationKeys this_ptr_conv;
33675         this_ptr_conv.inner = untag_ptr(this_ptr);
33676         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33677         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33678         this_ptr_conv.is_owned = false;
33679         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
33680         memcpy(ret_arr->elems, TxCreationKeys_get_per_commitment_point(&this_ptr_conv).compressed_form, 33);
33681         return ret_arr;
33682 }
33683
33684 void  __attribute__((export_name("TS_TxCreationKeys_set_per_commitment_point"))) TS_TxCreationKeys_set_per_commitment_point(uint64_t this_ptr, int8_tArray val) {
33685         LDKTxCreationKeys this_ptr_conv;
33686         this_ptr_conv.inner = untag_ptr(this_ptr);
33687         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33688         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33689         this_ptr_conv.is_owned = false;
33690         LDKPublicKey val_ref;
33691         CHECK(val->arr_len == 33);
33692         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
33693         TxCreationKeys_set_per_commitment_point(&this_ptr_conv, val_ref);
33694 }
33695
33696 int8_tArray  __attribute__((export_name("TS_TxCreationKeys_get_revocation_key"))) TS_TxCreationKeys_get_revocation_key(uint64_t this_ptr) {
33697         LDKTxCreationKeys this_ptr_conv;
33698         this_ptr_conv.inner = untag_ptr(this_ptr);
33699         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33700         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33701         this_ptr_conv.is_owned = false;
33702         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
33703         memcpy(ret_arr->elems, TxCreationKeys_get_revocation_key(&this_ptr_conv).compressed_form, 33);
33704         return ret_arr;
33705 }
33706
33707 void  __attribute__((export_name("TS_TxCreationKeys_set_revocation_key"))) TS_TxCreationKeys_set_revocation_key(uint64_t this_ptr, int8_tArray val) {
33708         LDKTxCreationKeys this_ptr_conv;
33709         this_ptr_conv.inner = untag_ptr(this_ptr);
33710         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33711         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33712         this_ptr_conv.is_owned = false;
33713         LDKPublicKey val_ref;
33714         CHECK(val->arr_len == 33);
33715         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
33716         TxCreationKeys_set_revocation_key(&this_ptr_conv, val_ref);
33717 }
33718
33719 int8_tArray  __attribute__((export_name("TS_TxCreationKeys_get_broadcaster_htlc_key"))) TS_TxCreationKeys_get_broadcaster_htlc_key(uint64_t this_ptr) {
33720         LDKTxCreationKeys this_ptr_conv;
33721         this_ptr_conv.inner = untag_ptr(this_ptr);
33722         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33723         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33724         this_ptr_conv.is_owned = false;
33725         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
33726         memcpy(ret_arr->elems, TxCreationKeys_get_broadcaster_htlc_key(&this_ptr_conv).compressed_form, 33);
33727         return ret_arr;
33728 }
33729
33730 void  __attribute__((export_name("TS_TxCreationKeys_set_broadcaster_htlc_key"))) TS_TxCreationKeys_set_broadcaster_htlc_key(uint64_t this_ptr, int8_tArray val) {
33731         LDKTxCreationKeys this_ptr_conv;
33732         this_ptr_conv.inner = untag_ptr(this_ptr);
33733         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33734         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33735         this_ptr_conv.is_owned = false;
33736         LDKPublicKey val_ref;
33737         CHECK(val->arr_len == 33);
33738         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
33739         TxCreationKeys_set_broadcaster_htlc_key(&this_ptr_conv, val_ref);
33740 }
33741
33742 int8_tArray  __attribute__((export_name("TS_TxCreationKeys_get_countersignatory_htlc_key"))) TS_TxCreationKeys_get_countersignatory_htlc_key(uint64_t this_ptr) {
33743         LDKTxCreationKeys this_ptr_conv;
33744         this_ptr_conv.inner = untag_ptr(this_ptr);
33745         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33746         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33747         this_ptr_conv.is_owned = false;
33748         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
33749         memcpy(ret_arr->elems, TxCreationKeys_get_countersignatory_htlc_key(&this_ptr_conv).compressed_form, 33);
33750         return ret_arr;
33751 }
33752
33753 void  __attribute__((export_name("TS_TxCreationKeys_set_countersignatory_htlc_key"))) TS_TxCreationKeys_set_countersignatory_htlc_key(uint64_t this_ptr, int8_tArray val) {
33754         LDKTxCreationKeys this_ptr_conv;
33755         this_ptr_conv.inner = untag_ptr(this_ptr);
33756         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33757         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33758         this_ptr_conv.is_owned = false;
33759         LDKPublicKey val_ref;
33760         CHECK(val->arr_len == 33);
33761         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
33762         TxCreationKeys_set_countersignatory_htlc_key(&this_ptr_conv, val_ref);
33763 }
33764
33765 int8_tArray  __attribute__((export_name("TS_TxCreationKeys_get_broadcaster_delayed_payment_key"))) TS_TxCreationKeys_get_broadcaster_delayed_payment_key(uint64_t this_ptr) {
33766         LDKTxCreationKeys this_ptr_conv;
33767         this_ptr_conv.inner = untag_ptr(this_ptr);
33768         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33769         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33770         this_ptr_conv.is_owned = false;
33771         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
33772         memcpy(ret_arr->elems, TxCreationKeys_get_broadcaster_delayed_payment_key(&this_ptr_conv).compressed_form, 33);
33773         return ret_arr;
33774 }
33775
33776 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) {
33777         LDKTxCreationKeys this_ptr_conv;
33778         this_ptr_conv.inner = untag_ptr(this_ptr);
33779         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33780         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33781         this_ptr_conv.is_owned = false;
33782         LDKPublicKey val_ref;
33783         CHECK(val->arr_len == 33);
33784         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
33785         TxCreationKeys_set_broadcaster_delayed_payment_key(&this_ptr_conv, val_ref);
33786 }
33787
33788 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) {
33789         LDKPublicKey per_commitment_point_arg_ref;
33790         CHECK(per_commitment_point_arg->arr_len == 33);
33791         memcpy(per_commitment_point_arg_ref.compressed_form, per_commitment_point_arg->elems, 33); FREE(per_commitment_point_arg);
33792         LDKPublicKey revocation_key_arg_ref;
33793         CHECK(revocation_key_arg->arr_len == 33);
33794         memcpy(revocation_key_arg_ref.compressed_form, revocation_key_arg->elems, 33); FREE(revocation_key_arg);
33795         LDKPublicKey broadcaster_htlc_key_arg_ref;
33796         CHECK(broadcaster_htlc_key_arg->arr_len == 33);
33797         memcpy(broadcaster_htlc_key_arg_ref.compressed_form, broadcaster_htlc_key_arg->elems, 33); FREE(broadcaster_htlc_key_arg);
33798         LDKPublicKey countersignatory_htlc_key_arg_ref;
33799         CHECK(countersignatory_htlc_key_arg->arr_len == 33);
33800         memcpy(countersignatory_htlc_key_arg_ref.compressed_form, countersignatory_htlc_key_arg->elems, 33); FREE(countersignatory_htlc_key_arg);
33801         LDKPublicKey broadcaster_delayed_payment_key_arg_ref;
33802         CHECK(broadcaster_delayed_payment_key_arg->arr_len == 33);
33803         memcpy(broadcaster_delayed_payment_key_arg_ref.compressed_form, broadcaster_delayed_payment_key_arg->elems, 33); FREE(broadcaster_delayed_payment_key_arg);
33804         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);
33805         uint64_t ret_ref = 0;
33806         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33807         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33808         return ret_ref;
33809 }
33810
33811 static inline uint64_t TxCreationKeys_clone_ptr(LDKTxCreationKeys *NONNULL_PTR arg) {
33812         LDKTxCreationKeys ret_var = TxCreationKeys_clone(arg);
33813         uint64_t ret_ref = 0;
33814         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33815         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33816         return ret_ref;
33817 }
33818 int64_t  __attribute__((export_name("TS_TxCreationKeys_clone_ptr"))) TS_TxCreationKeys_clone_ptr(uint64_t arg) {
33819         LDKTxCreationKeys arg_conv;
33820         arg_conv.inner = untag_ptr(arg);
33821         arg_conv.is_owned = ptr_is_owned(arg);
33822         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
33823         arg_conv.is_owned = false;
33824         int64_t ret_conv = TxCreationKeys_clone_ptr(&arg_conv);
33825         return ret_conv;
33826 }
33827
33828 uint64_t  __attribute__((export_name("TS_TxCreationKeys_clone"))) TS_TxCreationKeys_clone(uint64_t orig) {
33829         LDKTxCreationKeys orig_conv;
33830         orig_conv.inner = untag_ptr(orig);
33831         orig_conv.is_owned = ptr_is_owned(orig);
33832         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33833         orig_conv.is_owned = false;
33834         LDKTxCreationKeys ret_var = TxCreationKeys_clone(&orig_conv);
33835         uint64_t ret_ref = 0;
33836         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33837         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33838         return ret_ref;
33839 }
33840
33841 int8_tArray  __attribute__((export_name("TS_TxCreationKeys_write"))) TS_TxCreationKeys_write(uint64_t obj) {
33842         LDKTxCreationKeys obj_conv;
33843         obj_conv.inner = untag_ptr(obj);
33844         obj_conv.is_owned = ptr_is_owned(obj);
33845         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
33846         obj_conv.is_owned = false;
33847         LDKCVec_u8Z ret_var = TxCreationKeys_write(&obj_conv);
33848         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
33849         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
33850         CVec_u8Z_free(ret_var);
33851         return ret_arr;
33852 }
33853
33854 uint64_t  __attribute__((export_name("TS_TxCreationKeys_read"))) TS_TxCreationKeys_read(int8_tArray ser) {
33855         LDKu8slice ser_ref;
33856         ser_ref.datalen = ser->arr_len;
33857         ser_ref.data = ser->elems;
33858         LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
33859         *ret_conv = TxCreationKeys_read(ser_ref);
33860         FREE(ser);
33861         return tag_ptr(ret_conv, true);
33862 }
33863
33864 void  __attribute__((export_name("TS_ChannelPublicKeys_free"))) TS_ChannelPublicKeys_free(uint64_t this_obj) {
33865         LDKChannelPublicKeys this_obj_conv;
33866         this_obj_conv.inner = untag_ptr(this_obj);
33867         this_obj_conv.is_owned = ptr_is_owned(this_obj);
33868         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33869         ChannelPublicKeys_free(this_obj_conv);
33870 }
33871
33872 int8_tArray  __attribute__((export_name("TS_ChannelPublicKeys_get_funding_pubkey"))) TS_ChannelPublicKeys_get_funding_pubkey(uint64_t this_ptr) {
33873         LDKChannelPublicKeys this_ptr_conv;
33874         this_ptr_conv.inner = untag_ptr(this_ptr);
33875         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33876         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33877         this_ptr_conv.is_owned = false;
33878         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
33879         memcpy(ret_arr->elems, ChannelPublicKeys_get_funding_pubkey(&this_ptr_conv).compressed_form, 33);
33880         return ret_arr;
33881 }
33882
33883 void  __attribute__((export_name("TS_ChannelPublicKeys_set_funding_pubkey"))) TS_ChannelPublicKeys_set_funding_pubkey(uint64_t this_ptr, int8_tArray val) {
33884         LDKChannelPublicKeys this_ptr_conv;
33885         this_ptr_conv.inner = untag_ptr(this_ptr);
33886         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33887         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33888         this_ptr_conv.is_owned = false;
33889         LDKPublicKey val_ref;
33890         CHECK(val->arr_len == 33);
33891         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
33892         ChannelPublicKeys_set_funding_pubkey(&this_ptr_conv, val_ref);
33893 }
33894
33895 int8_tArray  __attribute__((export_name("TS_ChannelPublicKeys_get_revocation_basepoint"))) TS_ChannelPublicKeys_get_revocation_basepoint(uint64_t this_ptr) {
33896         LDKChannelPublicKeys this_ptr_conv;
33897         this_ptr_conv.inner = untag_ptr(this_ptr);
33898         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33899         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33900         this_ptr_conv.is_owned = false;
33901         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
33902         memcpy(ret_arr->elems, ChannelPublicKeys_get_revocation_basepoint(&this_ptr_conv).compressed_form, 33);
33903         return ret_arr;
33904 }
33905
33906 void  __attribute__((export_name("TS_ChannelPublicKeys_set_revocation_basepoint"))) TS_ChannelPublicKeys_set_revocation_basepoint(uint64_t this_ptr, int8_tArray val) {
33907         LDKChannelPublicKeys this_ptr_conv;
33908         this_ptr_conv.inner = untag_ptr(this_ptr);
33909         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33910         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33911         this_ptr_conv.is_owned = false;
33912         LDKPublicKey val_ref;
33913         CHECK(val->arr_len == 33);
33914         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
33915         ChannelPublicKeys_set_revocation_basepoint(&this_ptr_conv, val_ref);
33916 }
33917
33918 int8_tArray  __attribute__((export_name("TS_ChannelPublicKeys_get_payment_point"))) TS_ChannelPublicKeys_get_payment_point(uint64_t this_ptr) {
33919         LDKChannelPublicKeys this_ptr_conv;
33920         this_ptr_conv.inner = untag_ptr(this_ptr);
33921         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33922         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33923         this_ptr_conv.is_owned = false;
33924         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
33925         memcpy(ret_arr->elems, ChannelPublicKeys_get_payment_point(&this_ptr_conv).compressed_form, 33);
33926         return ret_arr;
33927 }
33928
33929 void  __attribute__((export_name("TS_ChannelPublicKeys_set_payment_point"))) TS_ChannelPublicKeys_set_payment_point(uint64_t this_ptr, int8_tArray val) {
33930         LDKChannelPublicKeys this_ptr_conv;
33931         this_ptr_conv.inner = untag_ptr(this_ptr);
33932         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33933         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33934         this_ptr_conv.is_owned = false;
33935         LDKPublicKey val_ref;
33936         CHECK(val->arr_len == 33);
33937         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
33938         ChannelPublicKeys_set_payment_point(&this_ptr_conv, val_ref);
33939 }
33940
33941 int8_tArray  __attribute__((export_name("TS_ChannelPublicKeys_get_delayed_payment_basepoint"))) TS_ChannelPublicKeys_get_delayed_payment_basepoint(uint64_t this_ptr) {
33942         LDKChannelPublicKeys this_ptr_conv;
33943         this_ptr_conv.inner = untag_ptr(this_ptr);
33944         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33945         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33946         this_ptr_conv.is_owned = false;
33947         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
33948         memcpy(ret_arr->elems, ChannelPublicKeys_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form, 33);
33949         return ret_arr;
33950 }
33951
33952 void  __attribute__((export_name("TS_ChannelPublicKeys_set_delayed_payment_basepoint"))) TS_ChannelPublicKeys_set_delayed_payment_basepoint(uint64_t this_ptr, int8_tArray val) {
33953         LDKChannelPublicKeys this_ptr_conv;
33954         this_ptr_conv.inner = untag_ptr(this_ptr);
33955         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33956         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33957         this_ptr_conv.is_owned = false;
33958         LDKPublicKey val_ref;
33959         CHECK(val->arr_len == 33);
33960         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
33961         ChannelPublicKeys_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
33962 }
33963
33964 int8_tArray  __attribute__((export_name("TS_ChannelPublicKeys_get_htlc_basepoint"))) TS_ChannelPublicKeys_get_htlc_basepoint(uint64_t this_ptr) {
33965         LDKChannelPublicKeys this_ptr_conv;
33966         this_ptr_conv.inner = untag_ptr(this_ptr);
33967         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33968         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33969         this_ptr_conv.is_owned = false;
33970         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
33971         memcpy(ret_arr->elems, ChannelPublicKeys_get_htlc_basepoint(&this_ptr_conv).compressed_form, 33);
33972         return ret_arr;
33973 }
33974
33975 void  __attribute__((export_name("TS_ChannelPublicKeys_set_htlc_basepoint"))) TS_ChannelPublicKeys_set_htlc_basepoint(uint64_t this_ptr, int8_tArray val) {
33976         LDKChannelPublicKeys this_ptr_conv;
33977         this_ptr_conv.inner = untag_ptr(this_ptr);
33978         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33979         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33980         this_ptr_conv.is_owned = false;
33981         LDKPublicKey val_ref;
33982         CHECK(val->arr_len == 33);
33983         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
33984         ChannelPublicKeys_set_htlc_basepoint(&this_ptr_conv, val_ref);
33985 }
33986
33987 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) {
33988         LDKPublicKey funding_pubkey_arg_ref;
33989         CHECK(funding_pubkey_arg->arr_len == 33);
33990         memcpy(funding_pubkey_arg_ref.compressed_form, funding_pubkey_arg->elems, 33); FREE(funding_pubkey_arg);
33991         LDKPublicKey revocation_basepoint_arg_ref;
33992         CHECK(revocation_basepoint_arg->arr_len == 33);
33993         memcpy(revocation_basepoint_arg_ref.compressed_form, revocation_basepoint_arg->elems, 33); FREE(revocation_basepoint_arg);
33994         LDKPublicKey payment_point_arg_ref;
33995         CHECK(payment_point_arg->arr_len == 33);
33996         memcpy(payment_point_arg_ref.compressed_form, payment_point_arg->elems, 33); FREE(payment_point_arg);
33997         LDKPublicKey delayed_payment_basepoint_arg_ref;
33998         CHECK(delayed_payment_basepoint_arg->arr_len == 33);
33999         memcpy(delayed_payment_basepoint_arg_ref.compressed_form, delayed_payment_basepoint_arg->elems, 33); FREE(delayed_payment_basepoint_arg);
34000         LDKPublicKey htlc_basepoint_arg_ref;
34001         CHECK(htlc_basepoint_arg->arr_len == 33);
34002         memcpy(htlc_basepoint_arg_ref.compressed_form, htlc_basepoint_arg->elems, 33); FREE(htlc_basepoint_arg);
34003         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);
34004         uint64_t ret_ref = 0;
34005         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34006         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34007         return ret_ref;
34008 }
34009
34010 static inline uint64_t ChannelPublicKeys_clone_ptr(LDKChannelPublicKeys *NONNULL_PTR arg) {
34011         LDKChannelPublicKeys ret_var = ChannelPublicKeys_clone(arg);
34012         uint64_t ret_ref = 0;
34013         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34014         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34015         return ret_ref;
34016 }
34017 int64_t  __attribute__((export_name("TS_ChannelPublicKeys_clone_ptr"))) TS_ChannelPublicKeys_clone_ptr(uint64_t arg) {
34018         LDKChannelPublicKeys arg_conv;
34019         arg_conv.inner = untag_ptr(arg);
34020         arg_conv.is_owned = ptr_is_owned(arg);
34021         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34022         arg_conv.is_owned = false;
34023         int64_t ret_conv = ChannelPublicKeys_clone_ptr(&arg_conv);
34024         return ret_conv;
34025 }
34026
34027 uint64_t  __attribute__((export_name("TS_ChannelPublicKeys_clone"))) TS_ChannelPublicKeys_clone(uint64_t orig) {
34028         LDKChannelPublicKeys orig_conv;
34029         orig_conv.inner = untag_ptr(orig);
34030         orig_conv.is_owned = ptr_is_owned(orig);
34031         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34032         orig_conv.is_owned = false;
34033         LDKChannelPublicKeys ret_var = ChannelPublicKeys_clone(&orig_conv);
34034         uint64_t ret_ref = 0;
34035         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34036         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34037         return ret_ref;
34038 }
34039
34040 int8_tArray  __attribute__((export_name("TS_ChannelPublicKeys_write"))) TS_ChannelPublicKeys_write(uint64_t obj) {
34041         LDKChannelPublicKeys obj_conv;
34042         obj_conv.inner = untag_ptr(obj);
34043         obj_conv.is_owned = ptr_is_owned(obj);
34044         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
34045         obj_conv.is_owned = false;
34046         LDKCVec_u8Z ret_var = ChannelPublicKeys_write(&obj_conv);
34047         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
34048         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
34049         CVec_u8Z_free(ret_var);
34050         return ret_arr;
34051 }
34052
34053 uint64_t  __attribute__((export_name("TS_ChannelPublicKeys_read"))) TS_ChannelPublicKeys_read(int8_tArray ser) {
34054         LDKu8slice ser_ref;
34055         ser_ref.datalen = ser->arr_len;
34056         ser_ref.data = ser->elems;
34057         LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
34058         *ret_conv = ChannelPublicKeys_read(ser_ref);
34059         FREE(ser);
34060         return tag_ptr(ret_conv, true);
34061 }
34062
34063 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) {
34064         LDKPublicKey per_commitment_point_ref;
34065         CHECK(per_commitment_point->arr_len == 33);
34066         memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33); FREE(per_commitment_point);
34067         LDKPublicKey broadcaster_delayed_payment_base_ref;
34068         CHECK(broadcaster_delayed_payment_base->arr_len == 33);
34069         memcpy(broadcaster_delayed_payment_base_ref.compressed_form, broadcaster_delayed_payment_base->elems, 33); FREE(broadcaster_delayed_payment_base);
34070         LDKPublicKey broadcaster_htlc_base_ref;
34071         CHECK(broadcaster_htlc_base->arr_len == 33);
34072         memcpy(broadcaster_htlc_base_ref.compressed_form, broadcaster_htlc_base->elems, 33); FREE(broadcaster_htlc_base);
34073         LDKPublicKey countersignatory_revocation_base_ref;
34074         CHECK(countersignatory_revocation_base->arr_len == 33);
34075         memcpy(countersignatory_revocation_base_ref.compressed_form, countersignatory_revocation_base->elems, 33); FREE(countersignatory_revocation_base);
34076         LDKPublicKey countersignatory_htlc_base_ref;
34077         CHECK(countersignatory_htlc_base->arr_len == 33);
34078         memcpy(countersignatory_htlc_base_ref.compressed_form, countersignatory_htlc_base->elems, 33); FREE(countersignatory_htlc_base);
34079         LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
34080         *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);
34081         return tag_ptr(ret_conv, true);
34082 }
34083
34084 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) {
34085         LDKPublicKey per_commitment_point_ref;
34086         CHECK(per_commitment_point->arr_len == 33);
34087         memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33); FREE(per_commitment_point);
34088         LDKChannelPublicKeys broadcaster_keys_conv;
34089         broadcaster_keys_conv.inner = untag_ptr(broadcaster_keys);
34090         broadcaster_keys_conv.is_owned = ptr_is_owned(broadcaster_keys);
34091         CHECK_INNER_FIELD_ACCESS_OR_NULL(broadcaster_keys_conv);
34092         broadcaster_keys_conv.is_owned = false;
34093         LDKChannelPublicKeys countersignatory_keys_conv;
34094         countersignatory_keys_conv.inner = untag_ptr(countersignatory_keys);
34095         countersignatory_keys_conv.is_owned = ptr_is_owned(countersignatory_keys);
34096         CHECK_INNER_FIELD_ACCESS_OR_NULL(countersignatory_keys_conv);
34097         countersignatory_keys_conv.is_owned = false;
34098         LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
34099         *ret_conv = TxCreationKeys_from_channel_static_keys(per_commitment_point_ref, &broadcaster_keys_conv, &countersignatory_keys_conv);
34100         return tag_ptr(ret_conv, true);
34101 }
34102
34103 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) {
34104         LDKPublicKey revocation_key_ref;
34105         CHECK(revocation_key->arr_len == 33);
34106         memcpy(revocation_key_ref.compressed_form, revocation_key->elems, 33); FREE(revocation_key);
34107         LDKPublicKey broadcaster_delayed_payment_key_ref;
34108         CHECK(broadcaster_delayed_payment_key->arr_len == 33);
34109         memcpy(broadcaster_delayed_payment_key_ref.compressed_form, broadcaster_delayed_payment_key->elems, 33); FREE(broadcaster_delayed_payment_key);
34110         LDKCVec_u8Z ret_var = get_revokeable_redeemscript(revocation_key_ref, contest_delay, broadcaster_delayed_payment_key_ref);
34111         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
34112         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
34113         CVec_u8Z_free(ret_var);
34114         return ret_arr;
34115 }
34116
34117 void  __attribute__((export_name("TS_HTLCOutputInCommitment_free"))) TS_HTLCOutputInCommitment_free(uint64_t this_obj) {
34118         LDKHTLCOutputInCommitment this_obj_conv;
34119         this_obj_conv.inner = untag_ptr(this_obj);
34120         this_obj_conv.is_owned = ptr_is_owned(this_obj);
34121         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34122         HTLCOutputInCommitment_free(this_obj_conv);
34123 }
34124
34125 jboolean  __attribute__((export_name("TS_HTLCOutputInCommitment_get_offered"))) TS_HTLCOutputInCommitment_get_offered(uint64_t this_ptr) {
34126         LDKHTLCOutputInCommitment this_ptr_conv;
34127         this_ptr_conv.inner = untag_ptr(this_ptr);
34128         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34129         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34130         this_ptr_conv.is_owned = false;
34131         jboolean ret_conv = HTLCOutputInCommitment_get_offered(&this_ptr_conv);
34132         return ret_conv;
34133 }
34134
34135 void  __attribute__((export_name("TS_HTLCOutputInCommitment_set_offered"))) TS_HTLCOutputInCommitment_set_offered(uint64_t this_ptr, jboolean val) {
34136         LDKHTLCOutputInCommitment this_ptr_conv;
34137         this_ptr_conv.inner = untag_ptr(this_ptr);
34138         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34139         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34140         this_ptr_conv.is_owned = false;
34141         HTLCOutputInCommitment_set_offered(&this_ptr_conv, val);
34142 }
34143
34144 int64_t  __attribute__((export_name("TS_HTLCOutputInCommitment_get_amount_msat"))) TS_HTLCOutputInCommitment_get_amount_msat(uint64_t this_ptr) {
34145         LDKHTLCOutputInCommitment this_ptr_conv;
34146         this_ptr_conv.inner = untag_ptr(this_ptr);
34147         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34148         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34149         this_ptr_conv.is_owned = false;
34150         int64_t ret_conv = HTLCOutputInCommitment_get_amount_msat(&this_ptr_conv);
34151         return ret_conv;
34152 }
34153
34154 void  __attribute__((export_name("TS_HTLCOutputInCommitment_set_amount_msat"))) TS_HTLCOutputInCommitment_set_amount_msat(uint64_t this_ptr, int64_t val) {
34155         LDKHTLCOutputInCommitment this_ptr_conv;
34156         this_ptr_conv.inner = untag_ptr(this_ptr);
34157         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34158         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34159         this_ptr_conv.is_owned = false;
34160         HTLCOutputInCommitment_set_amount_msat(&this_ptr_conv, val);
34161 }
34162
34163 int32_t  __attribute__((export_name("TS_HTLCOutputInCommitment_get_cltv_expiry"))) TS_HTLCOutputInCommitment_get_cltv_expiry(uint64_t this_ptr) {
34164         LDKHTLCOutputInCommitment this_ptr_conv;
34165         this_ptr_conv.inner = untag_ptr(this_ptr);
34166         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34167         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34168         this_ptr_conv.is_owned = false;
34169         int32_t ret_conv = HTLCOutputInCommitment_get_cltv_expiry(&this_ptr_conv);
34170         return ret_conv;
34171 }
34172
34173 void  __attribute__((export_name("TS_HTLCOutputInCommitment_set_cltv_expiry"))) TS_HTLCOutputInCommitment_set_cltv_expiry(uint64_t this_ptr, int32_t val) {
34174         LDKHTLCOutputInCommitment this_ptr_conv;
34175         this_ptr_conv.inner = untag_ptr(this_ptr);
34176         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34177         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34178         this_ptr_conv.is_owned = false;
34179         HTLCOutputInCommitment_set_cltv_expiry(&this_ptr_conv, val);
34180 }
34181
34182 int8_tArray  __attribute__((export_name("TS_HTLCOutputInCommitment_get_payment_hash"))) TS_HTLCOutputInCommitment_get_payment_hash(uint64_t this_ptr) {
34183         LDKHTLCOutputInCommitment this_ptr_conv;
34184         this_ptr_conv.inner = untag_ptr(this_ptr);
34185         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34186         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34187         this_ptr_conv.is_owned = false;
34188         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
34189         memcpy(ret_arr->elems, *HTLCOutputInCommitment_get_payment_hash(&this_ptr_conv), 32);
34190         return ret_arr;
34191 }
34192
34193 void  __attribute__((export_name("TS_HTLCOutputInCommitment_set_payment_hash"))) TS_HTLCOutputInCommitment_set_payment_hash(uint64_t this_ptr, int8_tArray val) {
34194         LDKHTLCOutputInCommitment this_ptr_conv;
34195         this_ptr_conv.inner = untag_ptr(this_ptr);
34196         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34197         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34198         this_ptr_conv.is_owned = false;
34199         LDKThirtyTwoBytes val_ref;
34200         CHECK(val->arr_len == 32);
34201         memcpy(val_ref.data, val->elems, 32); FREE(val);
34202         HTLCOutputInCommitment_set_payment_hash(&this_ptr_conv, val_ref);
34203 }
34204
34205 uint64_t  __attribute__((export_name("TS_HTLCOutputInCommitment_get_transaction_output_index"))) TS_HTLCOutputInCommitment_get_transaction_output_index(uint64_t this_ptr) {
34206         LDKHTLCOutputInCommitment this_ptr_conv;
34207         this_ptr_conv.inner = untag_ptr(this_ptr);
34208         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34209         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34210         this_ptr_conv.is_owned = false;
34211         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
34212         *ret_copy = HTLCOutputInCommitment_get_transaction_output_index(&this_ptr_conv);
34213         uint64_t ret_ref = tag_ptr(ret_copy, true);
34214         return ret_ref;
34215 }
34216
34217 void  __attribute__((export_name("TS_HTLCOutputInCommitment_set_transaction_output_index"))) TS_HTLCOutputInCommitment_set_transaction_output_index(uint64_t this_ptr, uint64_t val) {
34218         LDKHTLCOutputInCommitment this_ptr_conv;
34219         this_ptr_conv.inner = untag_ptr(this_ptr);
34220         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34221         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34222         this_ptr_conv.is_owned = false;
34223         void* val_ptr = untag_ptr(val);
34224         CHECK_ACCESS(val_ptr);
34225         LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
34226         val_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(val));
34227         HTLCOutputInCommitment_set_transaction_output_index(&this_ptr_conv, val_conv);
34228 }
34229
34230 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) {
34231         LDKThirtyTwoBytes payment_hash_arg_ref;
34232         CHECK(payment_hash_arg->arr_len == 32);
34233         memcpy(payment_hash_arg_ref.data, payment_hash_arg->elems, 32); FREE(payment_hash_arg);
34234         void* transaction_output_index_arg_ptr = untag_ptr(transaction_output_index_arg);
34235         CHECK_ACCESS(transaction_output_index_arg_ptr);
34236         LDKCOption_u32Z transaction_output_index_arg_conv = *(LDKCOption_u32Z*)(transaction_output_index_arg_ptr);
34237         transaction_output_index_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(transaction_output_index_arg));
34238         LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_new(offered_arg, amount_msat_arg, cltv_expiry_arg, payment_hash_arg_ref, transaction_output_index_arg_conv);
34239         uint64_t ret_ref = 0;
34240         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34241         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34242         return ret_ref;
34243 }
34244
34245 static inline uint64_t HTLCOutputInCommitment_clone_ptr(LDKHTLCOutputInCommitment *NONNULL_PTR arg) {
34246         LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_clone(arg);
34247         uint64_t ret_ref = 0;
34248         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34249         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34250         return ret_ref;
34251 }
34252 int64_t  __attribute__((export_name("TS_HTLCOutputInCommitment_clone_ptr"))) TS_HTLCOutputInCommitment_clone_ptr(uint64_t arg) {
34253         LDKHTLCOutputInCommitment arg_conv;
34254         arg_conv.inner = untag_ptr(arg);
34255         arg_conv.is_owned = ptr_is_owned(arg);
34256         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34257         arg_conv.is_owned = false;
34258         int64_t ret_conv = HTLCOutputInCommitment_clone_ptr(&arg_conv);
34259         return ret_conv;
34260 }
34261
34262 uint64_t  __attribute__((export_name("TS_HTLCOutputInCommitment_clone"))) TS_HTLCOutputInCommitment_clone(uint64_t orig) {
34263         LDKHTLCOutputInCommitment orig_conv;
34264         orig_conv.inner = untag_ptr(orig);
34265         orig_conv.is_owned = ptr_is_owned(orig);
34266         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34267         orig_conv.is_owned = false;
34268         LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_clone(&orig_conv);
34269         uint64_t ret_ref = 0;
34270         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34271         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34272         return ret_ref;
34273 }
34274
34275 int8_tArray  __attribute__((export_name("TS_HTLCOutputInCommitment_write"))) TS_HTLCOutputInCommitment_write(uint64_t obj) {
34276         LDKHTLCOutputInCommitment obj_conv;
34277         obj_conv.inner = untag_ptr(obj);
34278         obj_conv.is_owned = ptr_is_owned(obj);
34279         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
34280         obj_conv.is_owned = false;
34281         LDKCVec_u8Z ret_var = HTLCOutputInCommitment_write(&obj_conv);
34282         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
34283         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
34284         CVec_u8Z_free(ret_var);
34285         return ret_arr;
34286 }
34287
34288 uint64_t  __attribute__((export_name("TS_HTLCOutputInCommitment_read"))) TS_HTLCOutputInCommitment_read(int8_tArray ser) {
34289         LDKu8slice ser_ref;
34290         ser_ref.datalen = ser->arr_len;
34291         ser_ref.data = ser->elems;
34292         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
34293         *ret_conv = HTLCOutputInCommitment_read(ser_ref);
34294         FREE(ser);
34295         return tag_ptr(ret_conv, true);
34296 }
34297
34298 int8_tArray  __attribute__((export_name("TS_get_htlc_redeemscript"))) TS_get_htlc_redeemscript(uint64_t htlc, jboolean opt_anchors, uint64_t keys) {
34299         LDKHTLCOutputInCommitment htlc_conv;
34300         htlc_conv.inner = untag_ptr(htlc);
34301         htlc_conv.is_owned = ptr_is_owned(htlc);
34302         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
34303         htlc_conv.is_owned = false;
34304         LDKTxCreationKeys keys_conv;
34305         keys_conv.inner = untag_ptr(keys);
34306         keys_conv.is_owned = ptr_is_owned(keys);
34307         CHECK_INNER_FIELD_ACCESS_OR_NULL(keys_conv);
34308         keys_conv.is_owned = false;
34309         LDKCVec_u8Z ret_var = get_htlc_redeemscript(&htlc_conv, opt_anchors, &keys_conv);
34310         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
34311         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
34312         CVec_u8Z_free(ret_var);
34313         return ret_arr;
34314 }
34315
34316 int8_tArray  __attribute__((export_name("TS_make_funding_redeemscript"))) TS_make_funding_redeemscript(int8_tArray broadcaster, int8_tArray countersignatory) {
34317         LDKPublicKey broadcaster_ref;
34318         CHECK(broadcaster->arr_len == 33);
34319         memcpy(broadcaster_ref.compressed_form, broadcaster->elems, 33); FREE(broadcaster);
34320         LDKPublicKey countersignatory_ref;
34321         CHECK(countersignatory->arr_len == 33);
34322         memcpy(countersignatory_ref.compressed_form, countersignatory->elems, 33); FREE(countersignatory);
34323         LDKCVec_u8Z ret_var = make_funding_redeemscript(broadcaster_ref, countersignatory_ref);
34324         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
34325         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
34326         CVec_u8Z_free(ret_var);
34327         return ret_arr;
34328 }
34329
34330 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) {
34331         unsigned char commitment_txid_arr[32];
34332         CHECK(commitment_txid->arr_len == 32);
34333         memcpy(commitment_txid_arr, commitment_txid->elems, 32); FREE(commitment_txid);
34334         unsigned char (*commitment_txid_ref)[32] = &commitment_txid_arr;
34335         LDKHTLCOutputInCommitment htlc_conv;
34336         htlc_conv.inner = untag_ptr(htlc);
34337         htlc_conv.is_owned = ptr_is_owned(htlc);
34338         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
34339         htlc_conv.is_owned = false;
34340         LDKPublicKey broadcaster_delayed_payment_key_ref;
34341         CHECK(broadcaster_delayed_payment_key->arr_len == 33);
34342         memcpy(broadcaster_delayed_payment_key_ref.compressed_form, broadcaster_delayed_payment_key->elems, 33); FREE(broadcaster_delayed_payment_key);
34343         LDKPublicKey revocation_key_ref;
34344         CHECK(revocation_key->arr_len == 33);
34345         memcpy(revocation_key_ref.compressed_form, revocation_key->elems, 33); FREE(revocation_key);
34346         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);
34347         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
34348         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
34349         Transaction_free(ret_var);
34350         return ret_arr;
34351 }
34352
34353 int8_tArray  __attribute__((export_name("TS_get_anchor_redeemscript"))) TS_get_anchor_redeemscript(int8_tArray funding_pubkey) {
34354         LDKPublicKey funding_pubkey_ref;
34355         CHECK(funding_pubkey->arr_len == 33);
34356         memcpy(funding_pubkey_ref.compressed_form, funding_pubkey->elems, 33); FREE(funding_pubkey);
34357         LDKCVec_u8Z ret_var = get_anchor_redeemscript(funding_pubkey_ref);
34358         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
34359         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
34360         CVec_u8Z_free(ret_var);
34361         return ret_arr;
34362 }
34363
34364 void  __attribute__((export_name("TS_ChannelTransactionParameters_free"))) TS_ChannelTransactionParameters_free(uint64_t this_obj) {
34365         LDKChannelTransactionParameters this_obj_conv;
34366         this_obj_conv.inner = untag_ptr(this_obj);
34367         this_obj_conv.is_owned = ptr_is_owned(this_obj);
34368         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34369         ChannelTransactionParameters_free(this_obj_conv);
34370 }
34371
34372 uint64_t  __attribute__((export_name("TS_ChannelTransactionParameters_get_holder_pubkeys"))) TS_ChannelTransactionParameters_get_holder_pubkeys(uint64_t this_ptr) {
34373         LDKChannelTransactionParameters this_ptr_conv;
34374         this_ptr_conv.inner = untag_ptr(this_ptr);
34375         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34376         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34377         this_ptr_conv.is_owned = false;
34378         LDKChannelPublicKeys ret_var = ChannelTransactionParameters_get_holder_pubkeys(&this_ptr_conv);
34379         uint64_t ret_ref = 0;
34380         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34381         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34382         return ret_ref;
34383 }
34384
34385 void  __attribute__((export_name("TS_ChannelTransactionParameters_set_holder_pubkeys"))) TS_ChannelTransactionParameters_set_holder_pubkeys(uint64_t this_ptr, uint64_t val) {
34386         LDKChannelTransactionParameters this_ptr_conv;
34387         this_ptr_conv.inner = untag_ptr(this_ptr);
34388         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34389         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34390         this_ptr_conv.is_owned = false;
34391         LDKChannelPublicKeys val_conv;
34392         val_conv.inner = untag_ptr(val);
34393         val_conv.is_owned = ptr_is_owned(val);
34394         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
34395         val_conv = ChannelPublicKeys_clone(&val_conv);
34396         ChannelTransactionParameters_set_holder_pubkeys(&this_ptr_conv, val_conv);
34397 }
34398
34399 int16_t  __attribute__((export_name("TS_ChannelTransactionParameters_get_holder_selected_contest_delay"))) TS_ChannelTransactionParameters_get_holder_selected_contest_delay(uint64_t this_ptr) {
34400         LDKChannelTransactionParameters this_ptr_conv;
34401         this_ptr_conv.inner = untag_ptr(this_ptr);
34402         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34403         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34404         this_ptr_conv.is_owned = false;
34405         int16_t ret_conv = ChannelTransactionParameters_get_holder_selected_contest_delay(&this_ptr_conv);
34406         return ret_conv;
34407 }
34408
34409 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) {
34410         LDKChannelTransactionParameters this_ptr_conv;
34411         this_ptr_conv.inner = untag_ptr(this_ptr);
34412         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34413         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34414         this_ptr_conv.is_owned = false;
34415         ChannelTransactionParameters_set_holder_selected_contest_delay(&this_ptr_conv, val);
34416 }
34417
34418 jboolean  __attribute__((export_name("TS_ChannelTransactionParameters_get_is_outbound_from_holder"))) TS_ChannelTransactionParameters_get_is_outbound_from_holder(uint64_t this_ptr) {
34419         LDKChannelTransactionParameters 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         jboolean ret_conv = ChannelTransactionParameters_get_is_outbound_from_holder(&this_ptr_conv);
34425         return ret_conv;
34426 }
34427
34428 void  __attribute__((export_name("TS_ChannelTransactionParameters_set_is_outbound_from_holder"))) TS_ChannelTransactionParameters_set_is_outbound_from_holder(uint64_t this_ptr, jboolean val) {
34429         LDKChannelTransactionParameters this_ptr_conv;
34430         this_ptr_conv.inner = untag_ptr(this_ptr);
34431         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34432         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34433         this_ptr_conv.is_owned = false;
34434         ChannelTransactionParameters_set_is_outbound_from_holder(&this_ptr_conv, val);
34435 }
34436
34437 uint64_t  __attribute__((export_name("TS_ChannelTransactionParameters_get_counterparty_parameters"))) TS_ChannelTransactionParameters_get_counterparty_parameters(uint64_t this_ptr) {
34438         LDKChannelTransactionParameters this_ptr_conv;
34439         this_ptr_conv.inner = untag_ptr(this_ptr);
34440         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34441         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34442         this_ptr_conv.is_owned = false;
34443         LDKCounterpartyChannelTransactionParameters ret_var = ChannelTransactionParameters_get_counterparty_parameters(&this_ptr_conv);
34444         uint64_t ret_ref = 0;
34445         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34446         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34447         return ret_ref;
34448 }
34449
34450 void  __attribute__((export_name("TS_ChannelTransactionParameters_set_counterparty_parameters"))) TS_ChannelTransactionParameters_set_counterparty_parameters(uint64_t this_ptr, uint64_t val) {
34451         LDKChannelTransactionParameters this_ptr_conv;
34452         this_ptr_conv.inner = untag_ptr(this_ptr);
34453         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34454         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34455         this_ptr_conv.is_owned = false;
34456         LDKCounterpartyChannelTransactionParameters val_conv;
34457         val_conv.inner = untag_ptr(val);
34458         val_conv.is_owned = ptr_is_owned(val);
34459         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
34460         val_conv = CounterpartyChannelTransactionParameters_clone(&val_conv);
34461         ChannelTransactionParameters_set_counterparty_parameters(&this_ptr_conv, val_conv);
34462 }
34463
34464 uint64_t  __attribute__((export_name("TS_ChannelTransactionParameters_get_funding_outpoint"))) TS_ChannelTransactionParameters_get_funding_outpoint(uint64_t this_ptr) {
34465         LDKChannelTransactionParameters this_ptr_conv;
34466         this_ptr_conv.inner = untag_ptr(this_ptr);
34467         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34468         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34469         this_ptr_conv.is_owned = false;
34470         LDKOutPoint ret_var = ChannelTransactionParameters_get_funding_outpoint(&this_ptr_conv);
34471         uint64_t ret_ref = 0;
34472         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34473         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34474         return ret_ref;
34475 }
34476
34477 void  __attribute__((export_name("TS_ChannelTransactionParameters_set_funding_outpoint"))) TS_ChannelTransactionParameters_set_funding_outpoint(uint64_t this_ptr, uint64_t val) {
34478         LDKChannelTransactionParameters this_ptr_conv;
34479         this_ptr_conv.inner = untag_ptr(this_ptr);
34480         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34481         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34482         this_ptr_conv.is_owned = false;
34483         LDKOutPoint val_conv;
34484         val_conv.inner = untag_ptr(val);
34485         val_conv.is_owned = ptr_is_owned(val);
34486         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
34487         val_conv = OutPoint_clone(&val_conv);
34488         ChannelTransactionParameters_set_funding_outpoint(&this_ptr_conv, val_conv);
34489 }
34490
34491 uint32_t  __attribute__((export_name("TS_ChannelTransactionParameters_get_opt_anchors"))) TS_ChannelTransactionParameters_get_opt_anchors(uint64_t this_ptr) {
34492         LDKChannelTransactionParameters this_ptr_conv;
34493         this_ptr_conv.inner = untag_ptr(this_ptr);
34494         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34495         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34496         this_ptr_conv.is_owned = false;
34497         uint32_t ret_conv = LDKCOption_NoneZ_to_js(ChannelTransactionParameters_get_opt_anchors(&this_ptr_conv));
34498         return ret_conv;
34499 }
34500
34501 void  __attribute__((export_name("TS_ChannelTransactionParameters_set_opt_anchors"))) TS_ChannelTransactionParameters_set_opt_anchors(uint64_t this_ptr, uint32_t val) {
34502         LDKChannelTransactionParameters this_ptr_conv;
34503         this_ptr_conv.inner = untag_ptr(this_ptr);
34504         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34505         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34506         this_ptr_conv.is_owned = false;
34507         LDKCOption_NoneZ val_conv = LDKCOption_NoneZ_from_js(val);
34508         ChannelTransactionParameters_set_opt_anchors(&this_ptr_conv, val_conv);
34509 }
34510
34511 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) {
34512         LDKChannelPublicKeys holder_pubkeys_arg_conv;
34513         holder_pubkeys_arg_conv.inner = untag_ptr(holder_pubkeys_arg);
34514         holder_pubkeys_arg_conv.is_owned = ptr_is_owned(holder_pubkeys_arg);
34515         CHECK_INNER_FIELD_ACCESS_OR_NULL(holder_pubkeys_arg_conv);
34516         holder_pubkeys_arg_conv = ChannelPublicKeys_clone(&holder_pubkeys_arg_conv);
34517         LDKCounterpartyChannelTransactionParameters counterparty_parameters_arg_conv;
34518         counterparty_parameters_arg_conv.inner = untag_ptr(counterparty_parameters_arg);
34519         counterparty_parameters_arg_conv.is_owned = ptr_is_owned(counterparty_parameters_arg);
34520         CHECK_INNER_FIELD_ACCESS_OR_NULL(counterparty_parameters_arg_conv);
34521         counterparty_parameters_arg_conv = CounterpartyChannelTransactionParameters_clone(&counterparty_parameters_arg_conv);
34522         LDKOutPoint funding_outpoint_arg_conv;
34523         funding_outpoint_arg_conv.inner = untag_ptr(funding_outpoint_arg);
34524         funding_outpoint_arg_conv.is_owned = ptr_is_owned(funding_outpoint_arg);
34525         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_arg_conv);
34526         funding_outpoint_arg_conv = OutPoint_clone(&funding_outpoint_arg_conv);
34527         LDKCOption_NoneZ opt_anchors_arg_conv = LDKCOption_NoneZ_from_js(opt_anchors_arg);
34528         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);
34529         uint64_t ret_ref = 0;
34530         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34531         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34532         return ret_ref;
34533 }
34534
34535 static inline uint64_t ChannelTransactionParameters_clone_ptr(LDKChannelTransactionParameters *NONNULL_PTR arg) {
34536         LDKChannelTransactionParameters ret_var = ChannelTransactionParameters_clone(arg);
34537         uint64_t ret_ref = 0;
34538         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34539         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34540         return ret_ref;
34541 }
34542 int64_t  __attribute__((export_name("TS_ChannelTransactionParameters_clone_ptr"))) TS_ChannelTransactionParameters_clone_ptr(uint64_t arg) {
34543         LDKChannelTransactionParameters arg_conv;
34544         arg_conv.inner = untag_ptr(arg);
34545         arg_conv.is_owned = ptr_is_owned(arg);
34546         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34547         arg_conv.is_owned = false;
34548         int64_t ret_conv = ChannelTransactionParameters_clone_ptr(&arg_conv);
34549         return ret_conv;
34550 }
34551
34552 uint64_t  __attribute__((export_name("TS_ChannelTransactionParameters_clone"))) TS_ChannelTransactionParameters_clone(uint64_t orig) {
34553         LDKChannelTransactionParameters orig_conv;
34554         orig_conv.inner = untag_ptr(orig);
34555         orig_conv.is_owned = ptr_is_owned(orig);
34556         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34557         orig_conv.is_owned = false;
34558         LDKChannelTransactionParameters ret_var = ChannelTransactionParameters_clone(&orig_conv);
34559         uint64_t ret_ref = 0;
34560         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34561         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34562         return ret_ref;
34563 }
34564
34565 void  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_free"))) TS_CounterpartyChannelTransactionParameters_free(uint64_t this_obj) {
34566         LDKCounterpartyChannelTransactionParameters 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         CounterpartyChannelTransactionParameters_free(this_obj_conv);
34571 }
34572
34573 uint64_t  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_get_pubkeys"))) TS_CounterpartyChannelTransactionParameters_get_pubkeys(uint64_t this_ptr) {
34574         LDKCounterpartyChannelTransactionParameters 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 = CounterpartyChannelTransactionParameters_get_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_CounterpartyChannelTransactionParameters_set_pubkeys"))) TS_CounterpartyChannelTransactionParameters_set_pubkeys(uint64_t this_ptr, uint64_t val) {
34587         LDKCounterpartyChannelTransactionParameters 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         CounterpartyChannelTransactionParameters_set_pubkeys(&this_ptr_conv, val_conv);
34598 }
34599
34600 int16_t  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_get_selected_contest_delay"))) TS_CounterpartyChannelTransactionParameters_get_selected_contest_delay(uint64_t this_ptr) {
34601         LDKCounterpartyChannelTransactionParameters 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 = CounterpartyChannelTransactionParameters_get_selected_contest_delay(&this_ptr_conv);
34607         return ret_conv;
34608 }
34609
34610 void  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_set_selected_contest_delay"))) TS_CounterpartyChannelTransactionParameters_set_selected_contest_delay(uint64_t this_ptr, int16_t val) {
34611         LDKCounterpartyChannelTransactionParameters 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         CounterpartyChannelTransactionParameters_set_selected_contest_delay(&this_ptr_conv, val);
34617 }
34618
34619 uint64_t  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_new"))) TS_CounterpartyChannelTransactionParameters_new(uint64_t pubkeys_arg, int16_t selected_contest_delay_arg) {
34620         LDKChannelPublicKeys pubkeys_arg_conv;
34621         pubkeys_arg_conv.inner = untag_ptr(pubkeys_arg);
34622         pubkeys_arg_conv.is_owned = ptr_is_owned(pubkeys_arg);
34623         CHECK_INNER_FIELD_ACCESS_OR_NULL(pubkeys_arg_conv);
34624         pubkeys_arg_conv = ChannelPublicKeys_clone(&pubkeys_arg_conv);
34625         LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_new(pubkeys_arg_conv, selected_contest_delay_arg);
34626         uint64_t ret_ref = 0;
34627         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34628         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34629         return ret_ref;
34630 }
34631
34632 static inline uint64_t CounterpartyChannelTransactionParameters_clone_ptr(LDKCounterpartyChannelTransactionParameters *NONNULL_PTR arg) {
34633         LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_clone(arg);
34634         uint64_t ret_ref = 0;
34635         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34636         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34637         return ret_ref;
34638 }
34639 int64_t  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_clone_ptr"))) TS_CounterpartyChannelTransactionParameters_clone_ptr(uint64_t arg) {
34640         LDKCounterpartyChannelTransactionParameters arg_conv;
34641         arg_conv.inner = untag_ptr(arg);
34642         arg_conv.is_owned = ptr_is_owned(arg);
34643         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34644         arg_conv.is_owned = false;
34645         int64_t ret_conv = CounterpartyChannelTransactionParameters_clone_ptr(&arg_conv);
34646         return ret_conv;
34647 }
34648
34649 uint64_t  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_clone"))) TS_CounterpartyChannelTransactionParameters_clone(uint64_t orig) {
34650         LDKCounterpartyChannelTransactionParameters orig_conv;
34651         orig_conv.inner = untag_ptr(orig);
34652         orig_conv.is_owned = ptr_is_owned(orig);
34653         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34654         orig_conv.is_owned = false;
34655         LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_clone(&orig_conv);
34656         uint64_t ret_ref = 0;
34657         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34658         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34659         return ret_ref;
34660 }
34661
34662 jboolean  __attribute__((export_name("TS_ChannelTransactionParameters_is_populated"))) TS_ChannelTransactionParameters_is_populated(uint64_t this_arg) {
34663         LDKChannelTransactionParameters this_arg_conv;
34664         this_arg_conv.inner = untag_ptr(this_arg);
34665         this_arg_conv.is_owned = ptr_is_owned(this_arg);
34666         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34667         this_arg_conv.is_owned = false;
34668         jboolean ret_conv = ChannelTransactionParameters_is_populated(&this_arg_conv);
34669         return ret_conv;
34670 }
34671
34672 uint64_t  __attribute__((export_name("TS_ChannelTransactionParameters_as_holder_broadcastable"))) TS_ChannelTransactionParameters_as_holder_broadcastable(uint64_t this_arg) {
34673         LDKChannelTransactionParameters this_arg_conv;
34674         this_arg_conv.inner = untag_ptr(this_arg);
34675         this_arg_conv.is_owned = ptr_is_owned(this_arg);
34676         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34677         this_arg_conv.is_owned = false;
34678         LDKDirectedChannelTransactionParameters ret_var = ChannelTransactionParameters_as_holder_broadcastable(&this_arg_conv);
34679         uint64_t ret_ref = 0;
34680         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34681         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34682         return ret_ref;
34683 }
34684
34685 uint64_t  __attribute__((export_name("TS_ChannelTransactionParameters_as_counterparty_broadcastable"))) TS_ChannelTransactionParameters_as_counterparty_broadcastable(uint64_t this_arg) {
34686         LDKChannelTransactionParameters this_arg_conv;
34687         this_arg_conv.inner = untag_ptr(this_arg);
34688         this_arg_conv.is_owned = ptr_is_owned(this_arg);
34689         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34690         this_arg_conv.is_owned = false;
34691         LDKDirectedChannelTransactionParameters ret_var = ChannelTransactionParameters_as_counterparty_broadcastable(&this_arg_conv);
34692         uint64_t ret_ref = 0;
34693         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34694         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34695         return ret_ref;
34696 }
34697
34698 int8_tArray  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_write"))) TS_CounterpartyChannelTransactionParameters_write(uint64_t obj) {
34699         LDKCounterpartyChannelTransactionParameters obj_conv;
34700         obj_conv.inner = untag_ptr(obj);
34701         obj_conv.is_owned = ptr_is_owned(obj);
34702         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
34703         obj_conv.is_owned = false;
34704         LDKCVec_u8Z ret_var = CounterpartyChannelTransactionParameters_write(&obj_conv);
34705         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
34706         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
34707         CVec_u8Z_free(ret_var);
34708         return ret_arr;
34709 }
34710
34711 uint64_t  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_read"))) TS_CounterpartyChannelTransactionParameters_read(int8_tArray ser) {
34712         LDKu8slice ser_ref;
34713         ser_ref.datalen = ser->arr_len;
34714         ser_ref.data = ser->elems;
34715         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
34716         *ret_conv = CounterpartyChannelTransactionParameters_read(ser_ref);
34717         FREE(ser);
34718         return tag_ptr(ret_conv, true);
34719 }
34720
34721 int8_tArray  __attribute__((export_name("TS_ChannelTransactionParameters_write"))) TS_ChannelTransactionParameters_write(uint64_t obj) {
34722         LDKChannelTransactionParameters obj_conv;
34723         obj_conv.inner = untag_ptr(obj);
34724         obj_conv.is_owned = ptr_is_owned(obj);
34725         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
34726         obj_conv.is_owned = false;
34727         LDKCVec_u8Z ret_var = ChannelTransactionParameters_write(&obj_conv);
34728         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
34729         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
34730         CVec_u8Z_free(ret_var);
34731         return ret_arr;
34732 }
34733
34734 uint64_t  __attribute__((export_name("TS_ChannelTransactionParameters_read"))) TS_ChannelTransactionParameters_read(int8_tArray ser) {
34735         LDKu8slice ser_ref;
34736         ser_ref.datalen = ser->arr_len;
34737         ser_ref.data = ser->elems;
34738         LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
34739         *ret_conv = ChannelTransactionParameters_read(ser_ref);
34740         FREE(ser);
34741         return tag_ptr(ret_conv, true);
34742 }
34743
34744 void  __attribute__((export_name("TS_DirectedChannelTransactionParameters_free"))) TS_DirectedChannelTransactionParameters_free(uint64_t this_obj) {
34745         LDKDirectedChannelTransactionParameters this_obj_conv;
34746         this_obj_conv.inner = untag_ptr(this_obj);
34747         this_obj_conv.is_owned = ptr_is_owned(this_obj);
34748         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34749         DirectedChannelTransactionParameters_free(this_obj_conv);
34750 }
34751
34752 uint64_t  __attribute__((export_name("TS_DirectedChannelTransactionParameters_broadcaster_pubkeys"))) TS_DirectedChannelTransactionParameters_broadcaster_pubkeys(uint64_t this_arg) {
34753         LDKDirectedChannelTransactionParameters this_arg_conv;
34754         this_arg_conv.inner = untag_ptr(this_arg);
34755         this_arg_conv.is_owned = ptr_is_owned(this_arg);
34756         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34757         this_arg_conv.is_owned = false;
34758         LDKChannelPublicKeys ret_var = DirectedChannelTransactionParameters_broadcaster_pubkeys(&this_arg_conv);
34759         uint64_t ret_ref = 0;
34760         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34761         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34762         return ret_ref;
34763 }
34764
34765 uint64_t  __attribute__((export_name("TS_DirectedChannelTransactionParameters_countersignatory_pubkeys"))) TS_DirectedChannelTransactionParameters_countersignatory_pubkeys(uint64_t this_arg) {
34766         LDKDirectedChannelTransactionParameters this_arg_conv;
34767         this_arg_conv.inner = untag_ptr(this_arg);
34768         this_arg_conv.is_owned = ptr_is_owned(this_arg);
34769         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34770         this_arg_conv.is_owned = false;
34771         LDKChannelPublicKeys ret_var = DirectedChannelTransactionParameters_countersignatory_pubkeys(&this_arg_conv);
34772         uint64_t ret_ref = 0;
34773         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34774         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34775         return ret_ref;
34776 }
34777
34778 int16_t  __attribute__((export_name("TS_DirectedChannelTransactionParameters_contest_delay"))) TS_DirectedChannelTransactionParameters_contest_delay(uint64_t this_arg) {
34779         LDKDirectedChannelTransactionParameters this_arg_conv;
34780         this_arg_conv.inner = untag_ptr(this_arg);
34781         this_arg_conv.is_owned = ptr_is_owned(this_arg);
34782         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34783         this_arg_conv.is_owned = false;
34784         int16_t ret_conv = DirectedChannelTransactionParameters_contest_delay(&this_arg_conv);
34785         return ret_conv;
34786 }
34787
34788 jboolean  __attribute__((export_name("TS_DirectedChannelTransactionParameters_is_outbound"))) TS_DirectedChannelTransactionParameters_is_outbound(uint64_t this_arg) {
34789         LDKDirectedChannelTransactionParameters this_arg_conv;
34790         this_arg_conv.inner = untag_ptr(this_arg);
34791         this_arg_conv.is_owned = ptr_is_owned(this_arg);
34792         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34793         this_arg_conv.is_owned = false;
34794         jboolean ret_conv = DirectedChannelTransactionParameters_is_outbound(&this_arg_conv);
34795         return ret_conv;
34796 }
34797
34798 uint64_t  __attribute__((export_name("TS_DirectedChannelTransactionParameters_funding_outpoint"))) TS_DirectedChannelTransactionParameters_funding_outpoint(uint64_t this_arg) {
34799         LDKDirectedChannelTransactionParameters this_arg_conv;
34800         this_arg_conv.inner = untag_ptr(this_arg);
34801         this_arg_conv.is_owned = ptr_is_owned(this_arg);
34802         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34803         this_arg_conv.is_owned = false;
34804         LDKOutPoint ret_var = DirectedChannelTransactionParameters_funding_outpoint(&this_arg_conv);
34805         uint64_t ret_ref = 0;
34806         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34807         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34808         return ret_ref;
34809 }
34810
34811 jboolean  __attribute__((export_name("TS_DirectedChannelTransactionParameters_opt_anchors"))) TS_DirectedChannelTransactionParameters_opt_anchors(uint64_t this_arg) {
34812         LDKDirectedChannelTransactionParameters this_arg_conv;
34813         this_arg_conv.inner = untag_ptr(this_arg);
34814         this_arg_conv.is_owned = ptr_is_owned(this_arg);
34815         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34816         this_arg_conv.is_owned = false;
34817         jboolean ret_conv = DirectedChannelTransactionParameters_opt_anchors(&this_arg_conv);
34818         return ret_conv;
34819 }
34820
34821 void  __attribute__((export_name("TS_HolderCommitmentTransaction_free"))) TS_HolderCommitmentTransaction_free(uint64_t this_obj) {
34822         LDKHolderCommitmentTransaction this_obj_conv;
34823         this_obj_conv.inner = untag_ptr(this_obj);
34824         this_obj_conv.is_owned = ptr_is_owned(this_obj);
34825         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34826         HolderCommitmentTransaction_free(this_obj_conv);
34827 }
34828
34829 int8_tArray  __attribute__((export_name("TS_HolderCommitmentTransaction_get_counterparty_sig"))) TS_HolderCommitmentTransaction_get_counterparty_sig(uint64_t this_ptr) {
34830         LDKHolderCommitmentTransaction this_ptr_conv;
34831         this_ptr_conv.inner = untag_ptr(this_ptr);
34832         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34833         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34834         this_ptr_conv.is_owned = false;
34835         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
34836         memcpy(ret_arr->elems, HolderCommitmentTransaction_get_counterparty_sig(&this_ptr_conv).compact_form, 64);
34837         return ret_arr;
34838 }
34839
34840 void  __attribute__((export_name("TS_HolderCommitmentTransaction_set_counterparty_sig"))) TS_HolderCommitmentTransaction_set_counterparty_sig(uint64_t this_ptr, int8_tArray val) {
34841         LDKHolderCommitmentTransaction this_ptr_conv;
34842         this_ptr_conv.inner = untag_ptr(this_ptr);
34843         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34844         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34845         this_ptr_conv.is_owned = false;
34846         LDKSignature val_ref;
34847         CHECK(val->arr_len == 64);
34848         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
34849         HolderCommitmentTransaction_set_counterparty_sig(&this_ptr_conv, val_ref);
34850 }
34851
34852 ptrArray  __attribute__((export_name("TS_HolderCommitmentTransaction_get_counterparty_htlc_sigs"))) TS_HolderCommitmentTransaction_get_counterparty_htlc_sigs(uint64_t this_ptr) {
34853         LDKHolderCommitmentTransaction this_ptr_conv;
34854         this_ptr_conv.inner = untag_ptr(this_ptr);
34855         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34856         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34857         this_ptr_conv.is_owned = false;
34858         LDKCVec_SignatureZ ret_var = HolderCommitmentTransaction_get_counterparty_htlc_sigs(&this_ptr_conv);
34859         ptrArray ret_arr = NULL;
34860         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
34861         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
34862         for (size_t m = 0; m < ret_var.datalen; m++) {
34863                 int8_tArray ret_conv_12_arr = init_int8_tArray(64, __LINE__);
34864                 memcpy(ret_conv_12_arr->elems, ret_var.data[m].compact_form, 64);
34865                 ret_arr_ptr[m] = ret_conv_12_arr;
34866         }
34867         
34868         FREE(ret_var.data);
34869         return ret_arr;
34870 }
34871
34872 void  __attribute__((export_name("TS_HolderCommitmentTransaction_set_counterparty_htlc_sigs"))) TS_HolderCommitmentTransaction_set_counterparty_htlc_sigs(uint64_t this_ptr, ptrArray val) {
34873         LDKHolderCommitmentTransaction this_ptr_conv;
34874         this_ptr_conv.inner = untag_ptr(this_ptr);
34875         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34876         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34877         this_ptr_conv.is_owned = false;
34878         LDKCVec_SignatureZ val_constr;
34879         val_constr.datalen = val->arr_len;
34880         if (val_constr.datalen > 0)
34881                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
34882         else
34883                 val_constr.data = NULL;
34884         int8_tArray* val_vals = (void*) val->elems;
34885         for (size_t m = 0; m < val_constr.datalen; m++) {
34886                 int8_tArray val_conv_12 = val_vals[m];
34887                 LDKSignature val_conv_12_ref;
34888                 CHECK(val_conv_12->arr_len == 64);
34889                 memcpy(val_conv_12_ref.compact_form, val_conv_12->elems, 64); FREE(val_conv_12);
34890                 val_constr.data[m] = val_conv_12_ref;
34891         }
34892         FREE(val);
34893         HolderCommitmentTransaction_set_counterparty_htlc_sigs(&this_ptr_conv, val_constr);
34894 }
34895
34896 static inline uint64_t HolderCommitmentTransaction_clone_ptr(LDKHolderCommitmentTransaction *NONNULL_PTR arg) {
34897         LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_clone(arg);
34898         uint64_t ret_ref = 0;
34899         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34900         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34901         return ret_ref;
34902 }
34903 int64_t  __attribute__((export_name("TS_HolderCommitmentTransaction_clone_ptr"))) TS_HolderCommitmentTransaction_clone_ptr(uint64_t arg) {
34904         LDKHolderCommitmentTransaction arg_conv;
34905         arg_conv.inner = untag_ptr(arg);
34906         arg_conv.is_owned = ptr_is_owned(arg);
34907         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34908         arg_conv.is_owned = false;
34909         int64_t ret_conv = HolderCommitmentTransaction_clone_ptr(&arg_conv);
34910         return ret_conv;
34911 }
34912
34913 uint64_t  __attribute__((export_name("TS_HolderCommitmentTransaction_clone"))) TS_HolderCommitmentTransaction_clone(uint64_t orig) {
34914         LDKHolderCommitmentTransaction orig_conv;
34915         orig_conv.inner = untag_ptr(orig);
34916         orig_conv.is_owned = ptr_is_owned(orig);
34917         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34918         orig_conv.is_owned = false;
34919         LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_clone(&orig_conv);
34920         uint64_t ret_ref = 0;
34921         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34922         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34923         return ret_ref;
34924 }
34925
34926 int8_tArray  __attribute__((export_name("TS_HolderCommitmentTransaction_write"))) TS_HolderCommitmentTransaction_write(uint64_t obj) {
34927         LDKHolderCommitmentTransaction obj_conv;
34928         obj_conv.inner = untag_ptr(obj);
34929         obj_conv.is_owned = ptr_is_owned(obj);
34930         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
34931         obj_conv.is_owned = false;
34932         LDKCVec_u8Z ret_var = HolderCommitmentTransaction_write(&obj_conv);
34933         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
34934         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
34935         CVec_u8Z_free(ret_var);
34936         return ret_arr;
34937 }
34938
34939 uint64_t  __attribute__((export_name("TS_HolderCommitmentTransaction_read"))) TS_HolderCommitmentTransaction_read(int8_tArray ser) {
34940         LDKu8slice ser_ref;
34941         ser_ref.datalen = ser->arr_len;
34942         ser_ref.data = ser->elems;
34943         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
34944         *ret_conv = HolderCommitmentTransaction_read(ser_ref);
34945         FREE(ser);
34946         return tag_ptr(ret_conv, true);
34947 }
34948
34949 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) {
34950         LDKCommitmentTransaction commitment_tx_conv;
34951         commitment_tx_conv.inner = untag_ptr(commitment_tx);
34952         commitment_tx_conv.is_owned = ptr_is_owned(commitment_tx);
34953         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_conv);
34954         commitment_tx_conv = CommitmentTransaction_clone(&commitment_tx_conv);
34955         LDKSignature counterparty_sig_ref;
34956         CHECK(counterparty_sig->arr_len == 64);
34957         memcpy(counterparty_sig_ref.compact_form, counterparty_sig->elems, 64); FREE(counterparty_sig);
34958         LDKCVec_SignatureZ counterparty_htlc_sigs_constr;
34959         counterparty_htlc_sigs_constr.datalen = counterparty_htlc_sigs->arr_len;
34960         if (counterparty_htlc_sigs_constr.datalen > 0)
34961                 counterparty_htlc_sigs_constr.data = MALLOC(counterparty_htlc_sigs_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
34962         else
34963                 counterparty_htlc_sigs_constr.data = NULL;
34964         int8_tArray* counterparty_htlc_sigs_vals = (void*) counterparty_htlc_sigs->elems;
34965         for (size_t m = 0; m < counterparty_htlc_sigs_constr.datalen; m++) {
34966                 int8_tArray counterparty_htlc_sigs_conv_12 = counterparty_htlc_sigs_vals[m];
34967                 LDKSignature counterparty_htlc_sigs_conv_12_ref;
34968                 CHECK(counterparty_htlc_sigs_conv_12->arr_len == 64);
34969                 memcpy(counterparty_htlc_sigs_conv_12_ref.compact_form, counterparty_htlc_sigs_conv_12->elems, 64); FREE(counterparty_htlc_sigs_conv_12);
34970                 counterparty_htlc_sigs_constr.data[m] = counterparty_htlc_sigs_conv_12_ref;
34971         }
34972         FREE(counterparty_htlc_sigs);
34973         LDKPublicKey holder_funding_key_ref;
34974         CHECK(holder_funding_key->arr_len == 33);
34975         memcpy(holder_funding_key_ref.compressed_form, holder_funding_key->elems, 33); FREE(holder_funding_key);
34976         LDKPublicKey counterparty_funding_key_ref;
34977         CHECK(counterparty_funding_key->arr_len == 33);
34978         memcpy(counterparty_funding_key_ref.compressed_form, counterparty_funding_key->elems, 33); FREE(counterparty_funding_key);
34979         LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_new(commitment_tx_conv, counterparty_sig_ref, counterparty_htlc_sigs_constr, holder_funding_key_ref, counterparty_funding_key_ref);
34980         uint64_t ret_ref = 0;
34981         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34982         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34983         return ret_ref;
34984 }
34985
34986 void  __attribute__((export_name("TS_BuiltCommitmentTransaction_free"))) TS_BuiltCommitmentTransaction_free(uint64_t this_obj) {
34987         LDKBuiltCommitmentTransaction this_obj_conv;
34988         this_obj_conv.inner = untag_ptr(this_obj);
34989         this_obj_conv.is_owned = ptr_is_owned(this_obj);
34990         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34991         BuiltCommitmentTransaction_free(this_obj_conv);
34992 }
34993
34994 int8_tArray  __attribute__((export_name("TS_BuiltCommitmentTransaction_get_transaction"))) TS_BuiltCommitmentTransaction_get_transaction(uint64_t this_ptr) {
34995         LDKBuiltCommitmentTransaction this_ptr_conv;
34996         this_ptr_conv.inner = untag_ptr(this_ptr);
34997         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34998         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34999         this_ptr_conv.is_owned = false;
35000         LDKTransaction ret_var = BuiltCommitmentTransaction_get_transaction(&this_ptr_conv);
35001         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
35002         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
35003         Transaction_free(ret_var);
35004         return ret_arr;
35005 }
35006
35007 void  __attribute__((export_name("TS_BuiltCommitmentTransaction_set_transaction"))) TS_BuiltCommitmentTransaction_set_transaction(uint64_t this_ptr, int8_tArray val) {
35008         LDKBuiltCommitmentTransaction this_ptr_conv;
35009         this_ptr_conv.inner = untag_ptr(this_ptr);
35010         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35011         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35012         this_ptr_conv.is_owned = false;
35013         LDKTransaction val_ref;
35014         val_ref.datalen = val->arr_len;
35015         val_ref.data = MALLOC(val_ref.datalen, "LDKTransaction Bytes");
35016         memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
35017         val_ref.data_is_owned = true;
35018         BuiltCommitmentTransaction_set_transaction(&this_ptr_conv, val_ref);
35019 }
35020
35021 int8_tArray  __attribute__((export_name("TS_BuiltCommitmentTransaction_get_txid"))) TS_BuiltCommitmentTransaction_get_txid(uint64_t this_ptr) {
35022         LDKBuiltCommitmentTransaction this_ptr_conv;
35023         this_ptr_conv.inner = untag_ptr(this_ptr);
35024         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35025         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35026         this_ptr_conv.is_owned = false;
35027         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
35028         memcpy(ret_arr->elems, *BuiltCommitmentTransaction_get_txid(&this_ptr_conv), 32);
35029         return ret_arr;
35030 }
35031
35032 void  __attribute__((export_name("TS_BuiltCommitmentTransaction_set_txid"))) TS_BuiltCommitmentTransaction_set_txid(uint64_t this_ptr, int8_tArray val) {
35033         LDKBuiltCommitmentTransaction this_ptr_conv;
35034         this_ptr_conv.inner = untag_ptr(this_ptr);
35035         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35036         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35037         this_ptr_conv.is_owned = false;
35038         LDKThirtyTwoBytes val_ref;
35039         CHECK(val->arr_len == 32);
35040         memcpy(val_ref.data, val->elems, 32); FREE(val);
35041         BuiltCommitmentTransaction_set_txid(&this_ptr_conv, val_ref);
35042 }
35043
35044 uint64_t  __attribute__((export_name("TS_BuiltCommitmentTransaction_new"))) TS_BuiltCommitmentTransaction_new(int8_tArray transaction_arg, int8_tArray txid_arg) {
35045         LDKTransaction transaction_arg_ref;
35046         transaction_arg_ref.datalen = transaction_arg->arr_len;
35047         transaction_arg_ref.data = MALLOC(transaction_arg_ref.datalen, "LDKTransaction Bytes");
35048         memcpy(transaction_arg_ref.data, transaction_arg->elems, transaction_arg_ref.datalen); FREE(transaction_arg);
35049         transaction_arg_ref.data_is_owned = true;
35050         LDKThirtyTwoBytes txid_arg_ref;
35051         CHECK(txid_arg->arr_len == 32);
35052         memcpy(txid_arg_ref.data, txid_arg->elems, 32); FREE(txid_arg);
35053         LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_new(transaction_arg_ref, txid_arg_ref);
35054         uint64_t ret_ref = 0;
35055         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35056         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35057         return ret_ref;
35058 }
35059
35060 static inline uint64_t BuiltCommitmentTransaction_clone_ptr(LDKBuiltCommitmentTransaction *NONNULL_PTR arg) {
35061         LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_clone(arg);
35062         uint64_t ret_ref = 0;
35063         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35064         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35065         return ret_ref;
35066 }
35067 int64_t  __attribute__((export_name("TS_BuiltCommitmentTransaction_clone_ptr"))) TS_BuiltCommitmentTransaction_clone_ptr(uint64_t arg) {
35068         LDKBuiltCommitmentTransaction arg_conv;
35069         arg_conv.inner = untag_ptr(arg);
35070         arg_conv.is_owned = ptr_is_owned(arg);
35071         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35072         arg_conv.is_owned = false;
35073         int64_t ret_conv = BuiltCommitmentTransaction_clone_ptr(&arg_conv);
35074         return ret_conv;
35075 }
35076
35077 uint64_t  __attribute__((export_name("TS_BuiltCommitmentTransaction_clone"))) TS_BuiltCommitmentTransaction_clone(uint64_t orig) {
35078         LDKBuiltCommitmentTransaction orig_conv;
35079         orig_conv.inner = untag_ptr(orig);
35080         orig_conv.is_owned = ptr_is_owned(orig);
35081         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35082         orig_conv.is_owned = false;
35083         LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_clone(&orig_conv);
35084         uint64_t ret_ref = 0;
35085         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35086         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35087         return ret_ref;
35088 }
35089
35090 int8_tArray  __attribute__((export_name("TS_BuiltCommitmentTransaction_write"))) TS_BuiltCommitmentTransaction_write(uint64_t obj) {
35091         LDKBuiltCommitmentTransaction obj_conv;
35092         obj_conv.inner = untag_ptr(obj);
35093         obj_conv.is_owned = ptr_is_owned(obj);
35094         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35095         obj_conv.is_owned = false;
35096         LDKCVec_u8Z ret_var = BuiltCommitmentTransaction_write(&obj_conv);
35097         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
35098         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
35099         CVec_u8Z_free(ret_var);
35100         return ret_arr;
35101 }
35102
35103 uint64_t  __attribute__((export_name("TS_BuiltCommitmentTransaction_read"))) TS_BuiltCommitmentTransaction_read(int8_tArray ser) {
35104         LDKu8slice ser_ref;
35105         ser_ref.datalen = ser->arr_len;
35106         ser_ref.data = ser->elems;
35107         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
35108         *ret_conv = BuiltCommitmentTransaction_read(ser_ref);
35109         FREE(ser);
35110         return tag_ptr(ret_conv, true);
35111 }
35112
35113 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) {
35114         LDKBuiltCommitmentTransaction this_arg_conv;
35115         this_arg_conv.inner = untag_ptr(this_arg);
35116         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35117         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35118         this_arg_conv.is_owned = false;
35119         LDKu8slice funding_redeemscript_ref;
35120         funding_redeemscript_ref.datalen = funding_redeemscript->arr_len;
35121         funding_redeemscript_ref.data = funding_redeemscript->elems;
35122         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
35123         memcpy(ret_arr->elems, BuiltCommitmentTransaction_get_sighash_all(&this_arg_conv, funding_redeemscript_ref, channel_value_satoshis).data, 32);
35124         FREE(funding_redeemscript);
35125         return ret_arr;
35126 }
35127
35128 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) {
35129         LDKBuiltCommitmentTransaction this_arg_conv;
35130         this_arg_conv.inner = untag_ptr(this_arg);
35131         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35132         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35133         this_arg_conv.is_owned = false;
35134         unsigned char funding_key_arr[32];
35135         CHECK(funding_key->arr_len == 32);
35136         memcpy(funding_key_arr, funding_key->elems, 32); FREE(funding_key);
35137         unsigned char (*funding_key_ref)[32] = &funding_key_arr;
35138         LDKu8slice funding_redeemscript_ref;
35139         funding_redeemscript_ref.datalen = funding_redeemscript->arr_len;
35140         funding_redeemscript_ref.data = funding_redeemscript->elems;
35141         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
35142         memcpy(ret_arr->elems, BuiltCommitmentTransaction_sign(&this_arg_conv, funding_key_ref, funding_redeemscript_ref, channel_value_satoshis).compact_form, 64);
35143         FREE(funding_redeemscript);
35144         return ret_arr;
35145 }
35146
35147 void  __attribute__((export_name("TS_ClosingTransaction_free"))) TS_ClosingTransaction_free(uint64_t this_obj) {
35148         LDKClosingTransaction this_obj_conv;
35149         this_obj_conv.inner = untag_ptr(this_obj);
35150         this_obj_conv.is_owned = ptr_is_owned(this_obj);
35151         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35152         ClosingTransaction_free(this_obj_conv);
35153 }
35154
35155 static inline uint64_t ClosingTransaction_clone_ptr(LDKClosingTransaction *NONNULL_PTR arg) {
35156         LDKClosingTransaction ret_var = ClosingTransaction_clone(arg);
35157         uint64_t ret_ref = 0;
35158         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35159         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35160         return ret_ref;
35161 }
35162 int64_t  __attribute__((export_name("TS_ClosingTransaction_clone_ptr"))) TS_ClosingTransaction_clone_ptr(uint64_t arg) {
35163         LDKClosingTransaction arg_conv;
35164         arg_conv.inner = untag_ptr(arg);
35165         arg_conv.is_owned = ptr_is_owned(arg);
35166         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35167         arg_conv.is_owned = false;
35168         int64_t ret_conv = ClosingTransaction_clone_ptr(&arg_conv);
35169         return ret_conv;
35170 }
35171
35172 uint64_t  __attribute__((export_name("TS_ClosingTransaction_clone"))) TS_ClosingTransaction_clone(uint64_t orig) {
35173         LDKClosingTransaction orig_conv;
35174         orig_conv.inner = untag_ptr(orig);
35175         orig_conv.is_owned = ptr_is_owned(orig);
35176         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35177         orig_conv.is_owned = false;
35178         LDKClosingTransaction ret_var = ClosingTransaction_clone(&orig_conv);
35179         uint64_t ret_ref = 0;
35180         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35181         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35182         return ret_ref;
35183 }
35184
35185 int64_t  __attribute__((export_name("TS_ClosingTransaction_hash"))) TS_ClosingTransaction_hash(uint64_t o) {
35186         LDKClosingTransaction o_conv;
35187         o_conv.inner = untag_ptr(o);
35188         o_conv.is_owned = ptr_is_owned(o);
35189         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
35190         o_conv.is_owned = false;
35191         int64_t ret_conv = ClosingTransaction_hash(&o_conv);
35192         return ret_conv;
35193 }
35194
35195 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) {
35196         LDKCVec_u8Z to_holder_script_ref;
35197         to_holder_script_ref.datalen = to_holder_script->arr_len;
35198         to_holder_script_ref.data = MALLOC(to_holder_script_ref.datalen, "LDKCVec_u8Z Bytes");
35199         memcpy(to_holder_script_ref.data, to_holder_script->elems, to_holder_script_ref.datalen); FREE(to_holder_script);
35200         LDKCVec_u8Z to_counterparty_script_ref;
35201         to_counterparty_script_ref.datalen = to_counterparty_script->arr_len;
35202         to_counterparty_script_ref.data = MALLOC(to_counterparty_script_ref.datalen, "LDKCVec_u8Z Bytes");
35203         memcpy(to_counterparty_script_ref.data, to_counterparty_script->elems, to_counterparty_script_ref.datalen); FREE(to_counterparty_script);
35204         LDKOutPoint funding_outpoint_conv;
35205         funding_outpoint_conv.inner = untag_ptr(funding_outpoint);
35206         funding_outpoint_conv.is_owned = ptr_is_owned(funding_outpoint);
35207         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_conv);
35208         funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
35209         LDKClosingTransaction ret_var = ClosingTransaction_new(to_holder_value_sat, to_counterparty_value_sat, to_holder_script_ref, to_counterparty_script_ref, funding_outpoint_conv);
35210         uint64_t ret_ref = 0;
35211         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35212         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35213         return ret_ref;
35214 }
35215
35216 uint64_t  __attribute__((export_name("TS_ClosingTransaction_trust"))) TS_ClosingTransaction_trust(uint64_t this_arg) {
35217         LDKClosingTransaction this_arg_conv;
35218         this_arg_conv.inner = untag_ptr(this_arg);
35219         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35220         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35221         this_arg_conv.is_owned = false;
35222         LDKTrustedClosingTransaction ret_var = ClosingTransaction_trust(&this_arg_conv);
35223         uint64_t ret_ref = 0;
35224         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35225         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35226         return ret_ref;
35227 }
35228
35229 uint64_t  __attribute__((export_name("TS_ClosingTransaction_verify"))) TS_ClosingTransaction_verify(uint64_t this_arg, uint64_t funding_outpoint) {
35230         LDKClosingTransaction this_arg_conv;
35231         this_arg_conv.inner = untag_ptr(this_arg);
35232         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35233         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35234         this_arg_conv.is_owned = false;
35235         LDKOutPoint funding_outpoint_conv;
35236         funding_outpoint_conv.inner = untag_ptr(funding_outpoint);
35237         funding_outpoint_conv.is_owned = ptr_is_owned(funding_outpoint);
35238         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_conv);
35239         funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
35240         LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
35241         *ret_conv = ClosingTransaction_verify(&this_arg_conv, funding_outpoint_conv);
35242         return tag_ptr(ret_conv, true);
35243 }
35244
35245 int64_t  __attribute__((export_name("TS_ClosingTransaction_to_holder_value_sat"))) TS_ClosingTransaction_to_holder_value_sat(uint64_t this_arg) {
35246         LDKClosingTransaction this_arg_conv;
35247         this_arg_conv.inner = untag_ptr(this_arg);
35248         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35249         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35250         this_arg_conv.is_owned = false;
35251         int64_t ret_conv = ClosingTransaction_to_holder_value_sat(&this_arg_conv);
35252         return ret_conv;
35253 }
35254
35255 int64_t  __attribute__((export_name("TS_ClosingTransaction_to_counterparty_value_sat"))) TS_ClosingTransaction_to_counterparty_value_sat(uint64_t this_arg) {
35256         LDKClosingTransaction this_arg_conv;
35257         this_arg_conv.inner = untag_ptr(this_arg);
35258         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35259         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35260         this_arg_conv.is_owned = false;
35261         int64_t ret_conv = ClosingTransaction_to_counterparty_value_sat(&this_arg_conv);
35262         return ret_conv;
35263 }
35264
35265 int8_tArray  __attribute__((export_name("TS_ClosingTransaction_to_holder_script"))) TS_ClosingTransaction_to_holder_script(uint64_t this_arg) {
35266         LDKClosingTransaction this_arg_conv;
35267         this_arg_conv.inner = untag_ptr(this_arg);
35268         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35269         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35270         this_arg_conv.is_owned = false;
35271         LDKu8slice ret_var = ClosingTransaction_to_holder_script(&this_arg_conv);
35272         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
35273         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
35274         return ret_arr;
35275 }
35276
35277 int8_tArray  __attribute__((export_name("TS_ClosingTransaction_to_counterparty_script"))) TS_ClosingTransaction_to_counterparty_script(uint64_t this_arg) {
35278         LDKClosingTransaction this_arg_conv;
35279         this_arg_conv.inner = untag_ptr(this_arg);
35280         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35281         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35282         this_arg_conv.is_owned = false;
35283         LDKu8slice ret_var = ClosingTransaction_to_counterparty_script(&this_arg_conv);
35284         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
35285         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
35286         return ret_arr;
35287 }
35288
35289 void  __attribute__((export_name("TS_TrustedClosingTransaction_free"))) TS_TrustedClosingTransaction_free(uint64_t this_obj) {
35290         LDKTrustedClosingTransaction this_obj_conv;
35291         this_obj_conv.inner = untag_ptr(this_obj);
35292         this_obj_conv.is_owned = ptr_is_owned(this_obj);
35293         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35294         TrustedClosingTransaction_free(this_obj_conv);
35295 }
35296
35297 int8_tArray  __attribute__((export_name("TS_TrustedClosingTransaction_built_transaction"))) TS_TrustedClosingTransaction_built_transaction(uint64_t this_arg) {
35298         LDKTrustedClosingTransaction this_arg_conv;
35299         this_arg_conv.inner = untag_ptr(this_arg);
35300         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35301         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35302         this_arg_conv.is_owned = false;
35303         LDKTransaction ret_var = TrustedClosingTransaction_built_transaction(&this_arg_conv);
35304         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
35305         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
35306         Transaction_free(ret_var);
35307         return ret_arr;
35308 }
35309
35310 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) {
35311         LDKTrustedClosingTransaction this_arg_conv;
35312         this_arg_conv.inner = untag_ptr(this_arg);
35313         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35314         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35315         this_arg_conv.is_owned = false;
35316         LDKu8slice funding_redeemscript_ref;
35317         funding_redeemscript_ref.datalen = funding_redeemscript->arr_len;
35318         funding_redeemscript_ref.data = funding_redeemscript->elems;
35319         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
35320         memcpy(ret_arr->elems, TrustedClosingTransaction_get_sighash_all(&this_arg_conv, funding_redeemscript_ref, channel_value_satoshis).data, 32);
35321         FREE(funding_redeemscript);
35322         return ret_arr;
35323 }
35324
35325 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) {
35326         LDKTrustedClosingTransaction this_arg_conv;
35327         this_arg_conv.inner = untag_ptr(this_arg);
35328         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35329         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35330         this_arg_conv.is_owned = false;
35331         unsigned char funding_key_arr[32];
35332         CHECK(funding_key->arr_len == 32);
35333         memcpy(funding_key_arr, funding_key->elems, 32); FREE(funding_key);
35334         unsigned char (*funding_key_ref)[32] = &funding_key_arr;
35335         LDKu8slice funding_redeemscript_ref;
35336         funding_redeemscript_ref.datalen = funding_redeemscript->arr_len;
35337         funding_redeemscript_ref.data = funding_redeemscript->elems;
35338         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
35339         memcpy(ret_arr->elems, TrustedClosingTransaction_sign(&this_arg_conv, funding_key_ref, funding_redeemscript_ref, channel_value_satoshis).compact_form, 64);
35340         FREE(funding_redeemscript);
35341         return ret_arr;
35342 }
35343
35344 void  __attribute__((export_name("TS_CommitmentTransaction_free"))) TS_CommitmentTransaction_free(uint64_t this_obj) {
35345         LDKCommitmentTransaction this_obj_conv;
35346         this_obj_conv.inner = untag_ptr(this_obj);
35347         this_obj_conv.is_owned = ptr_is_owned(this_obj);
35348         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35349         CommitmentTransaction_free(this_obj_conv);
35350 }
35351
35352 static inline uint64_t CommitmentTransaction_clone_ptr(LDKCommitmentTransaction *NONNULL_PTR arg) {
35353         LDKCommitmentTransaction ret_var = CommitmentTransaction_clone(arg);
35354         uint64_t ret_ref = 0;
35355         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35356         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35357         return ret_ref;
35358 }
35359 int64_t  __attribute__((export_name("TS_CommitmentTransaction_clone_ptr"))) TS_CommitmentTransaction_clone_ptr(uint64_t arg) {
35360         LDKCommitmentTransaction arg_conv;
35361         arg_conv.inner = untag_ptr(arg);
35362         arg_conv.is_owned = ptr_is_owned(arg);
35363         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35364         arg_conv.is_owned = false;
35365         int64_t ret_conv = CommitmentTransaction_clone_ptr(&arg_conv);
35366         return ret_conv;
35367 }
35368
35369 uint64_t  __attribute__((export_name("TS_CommitmentTransaction_clone"))) TS_CommitmentTransaction_clone(uint64_t orig) {
35370         LDKCommitmentTransaction orig_conv;
35371         orig_conv.inner = untag_ptr(orig);
35372         orig_conv.is_owned = ptr_is_owned(orig);
35373         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35374         orig_conv.is_owned = false;
35375         LDKCommitmentTransaction ret_var = CommitmentTransaction_clone(&orig_conv);
35376         uint64_t ret_ref = 0;
35377         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35378         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35379         return ret_ref;
35380 }
35381
35382 int8_tArray  __attribute__((export_name("TS_CommitmentTransaction_write"))) TS_CommitmentTransaction_write(uint64_t obj) {
35383         LDKCommitmentTransaction obj_conv;
35384         obj_conv.inner = untag_ptr(obj);
35385         obj_conv.is_owned = ptr_is_owned(obj);
35386         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35387         obj_conv.is_owned = false;
35388         LDKCVec_u8Z ret_var = CommitmentTransaction_write(&obj_conv);
35389         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
35390         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
35391         CVec_u8Z_free(ret_var);
35392         return ret_arr;
35393 }
35394
35395 uint64_t  __attribute__((export_name("TS_CommitmentTransaction_read"))) TS_CommitmentTransaction_read(int8_tArray ser) {
35396         LDKu8slice ser_ref;
35397         ser_ref.datalen = ser->arr_len;
35398         ser_ref.data = ser->elems;
35399         LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
35400         *ret_conv = CommitmentTransaction_read(ser_ref);
35401         FREE(ser);
35402         return tag_ptr(ret_conv, true);
35403 }
35404
35405 int64_t  __attribute__((export_name("TS_CommitmentTransaction_commitment_number"))) TS_CommitmentTransaction_commitment_number(uint64_t this_arg) {
35406         LDKCommitmentTransaction this_arg_conv;
35407         this_arg_conv.inner = untag_ptr(this_arg);
35408         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35409         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35410         this_arg_conv.is_owned = false;
35411         int64_t ret_conv = CommitmentTransaction_commitment_number(&this_arg_conv);
35412         return ret_conv;
35413 }
35414
35415 int64_t  __attribute__((export_name("TS_CommitmentTransaction_to_broadcaster_value_sat"))) TS_CommitmentTransaction_to_broadcaster_value_sat(uint64_t this_arg) {
35416         LDKCommitmentTransaction this_arg_conv;
35417         this_arg_conv.inner = untag_ptr(this_arg);
35418         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35419         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35420         this_arg_conv.is_owned = false;
35421         int64_t ret_conv = CommitmentTransaction_to_broadcaster_value_sat(&this_arg_conv);
35422         return ret_conv;
35423 }
35424
35425 int64_t  __attribute__((export_name("TS_CommitmentTransaction_to_countersignatory_value_sat"))) TS_CommitmentTransaction_to_countersignatory_value_sat(uint64_t this_arg) {
35426         LDKCommitmentTransaction this_arg_conv;
35427         this_arg_conv.inner = untag_ptr(this_arg);
35428         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35429         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35430         this_arg_conv.is_owned = false;
35431         int64_t ret_conv = CommitmentTransaction_to_countersignatory_value_sat(&this_arg_conv);
35432         return ret_conv;
35433 }
35434
35435 int32_t  __attribute__((export_name("TS_CommitmentTransaction_feerate_per_kw"))) TS_CommitmentTransaction_feerate_per_kw(uint64_t this_arg) {
35436         LDKCommitmentTransaction this_arg_conv;
35437         this_arg_conv.inner = untag_ptr(this_arg);
35438         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35439         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35440         this_arg_conv.is_owned = false;
35441         int32_t ret_conv = CommitmentTransaction_feerate_per_kw(&this_arg_conv);
35442         return ret_conv;
35443 }
35444
35445 uint64_t  __attribute__((export_name("TS_CommitmentTransaction_trust"))) TS_CommitmentTransaction_trust(uint64_t this_arg) {
35446         LDKCommitmentTransaction this_arg_conv;
35447         this_arg_conv.inner = untag_ptr(this_arg);
35448         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35449         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35450         this_arg_conv.is_owned = false;
35451         LDKTrustedCommitmentTransaction ret_var = CommitmentTransaction_trust(&this_arg_conv);
35452         uint64_t ret_ref = 0;
35453         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35454         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35455         return ret_ref;
35456 }
35457
35458 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) {
35459         LDKCommitmentTransaction this_arg_conv;
35460         this_arg_conv.inner = untag_ptr(this_arg);
35461         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35462         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35463         this_arg_conv.is_owned = false;
35464         LDKDirectedChannelTransactionParameters channel_parameters_conv;
35465         channel_parameters_conv.inner = untag_ptr(channel_parameters);
35466         channel_parameters_conv.is_owned = ptr_is_owned(channel_parameters);
35467         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_conv);
35468         channel_parameters_conv.is_owned = false;
35469         LDKChannelPublicKeys broadcaster_keys_conv;
35470         broadcaster_keys_conv.inner = untag_ptr(broadcaster_keys);
35471         broadcaster_keys_conv.is_owned = ptr_is_owned(broadcaster_keys);
35472         CHECK_INNER_FIELD_ACCESS_OR_NULL(broadcaster_keys_conv);
35473         broadcaster_keys_conv.is_owned = false;
35474         LDKChannelPublicKeys countersignatory_keys_conv;
35475         countersignatory_keys_conv.inner = untag_ptr(countersignatory_keys);
35476         countersignatory_keys_conv.is_owned = ptr_is_owned(countersignatory_keys);
35477         CHECK_INNER_FIELD_ACCESS_OR_NULL(countersignatory_keys_conv);
35478         countersignatory_keys_conv.is_owned = false;
35479         LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
35480         *ret_conv = CommitmentTransaction_verify(&this_arg_conv, &channel_parameters_conv, &broadcaster_keys_conv, &countersignatory_keys_conv);
35481         return tag_ptr(ret_conv, true);
35482 }
35483
35484 void  __attribute__((export_name("TS_TrustedCommitmentTransaction_free"))) TS_TrustedCommitmentTransaction_free(uint64_t this_obj) {
35485         LDKTrustedCommitmentTransaction this_obj_conv;
35486         this_obj_conv.inner = untag_ptr(this_obj);
35487         this_obj_conv.is_owned = ptr_is_owned(this_obj);
35488         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35489         TrustedCommitmentTransaction_free(this_obj_conv);
35490 }
35491
35492 int8_tArray  __attribute__((export_name("TS_TrustedCommitmentTransaction_txid"))) TS_TrustedCommitmentTransaction_txid(uint64_t this_arg) {
35493         LDKTrustedCommitmentTransaction this_arg_conv;
35494         this_arg_conv.inner = untag_ptr(this_arg);
35495         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35496         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35497         this_arg_conv.is_owned = false;
35498         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
35499         memcpy(ret_arr->elems, TrustedCommitmentTransaction_txid(&this_arg_conv).data, 32);
35500         return ret_arr;
35501 }
35502
35503 uint64_t  __attribute__((export_name("TS_TrustedCommitmentTransaction_built_transaction"))) TS_TrustedCommitmentTransaction_built_transaction(uint64_t this_arg) {
35504         LDKTrustedCommitmentTransaction this_arg_conv;
35505         this_arg_conv.inner = untag_ptr(this_arg);
35506         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35507         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35508         this_arg_conv.is_owned = false;
35509         LDKBuiltCommitmentTransaction ret_var = TrustedCommitmentTransaction_built_transaction(&this_arg_conv);
35510         uint64_t ret_ref = 0;
35511         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35512         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35513         return ret_ref;
35514 }
35515
35516 uint64_t  __attribute__((export_name("TS_TrustedCommitmentTransaction_keys"))) TS_TrustedCommitmentTransaction_keys(uint64_t this_arg) {
35517         LDKTrustedCommitmentTransaction this_arg_conv;
35518         this_arg_conv.inner = untag_ptr(this_arg);
35519         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35520         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35521         this_arg_conv.is_owned = false;
35522         LDKTxCreationKeys ret_var = TrustedCommitmentTransaction_keys(&this_arg_conv);
35523         uint64_t ret_ref = 0;
35524         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35525         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35526         return ret_ref;
35527 }
35528
35529 jboolean  __attribute__((export_name("TS_TrustedCommitmentTransaction_opt_anchors"))) TS_TrustedCommitmentTransaction_opt_anchors(uint64_t this_arg) {
35530         LDKTrustedCommitmentTransaction this_arg_conv;
35531         this_arg_conv.inner = untag_ptr(this_arg);
35532         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35533         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35534         this_arg_conv.is_owned = false;
35535         jboolean ret_conv = TrustedCommitmentTransaction_opt_anchors(&this_arg_conv);
35536         return ret_conv;
35537 }
35538
35539 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) {
35540         LDKTrustedCommitmentTransaction this_arg_conv;
35541         this_arg_conv.inner = untag_ptr(this_arg);
35542         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35543         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35544         this_arg_conv.is_owned = false;
35545         unsigned char htlc_base_key_arr[32];
35546         CHECK(htlc_base_key->arr_len == 32);
35547         memcpy(htlc_base_key_arr, htlc_base_key->elems, 32); FREE(htlc_base_key);
35548         unsigned char (*htlc_base_key_ref)[32] = &htlc_base_key_arr;
35549         LDKDirectedChannelTransactionParameters channel_parameters_conv;
35550         channel_parameters_conv.inner = untag_ptr(channel_parameters);
35551         channel_parameters_conv.is_owned = ptr_is_owned(channel_parameters);
35552         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_conv);
35553         channel_parameters_conv.is_owned = false;
35554         LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
35555         *ret_conv = TrustedCommitmentTransaction_get_htlc_sigs(&this_arg_conv, htlc_base_key_ref, &channel_parameters_conv);
35556         return tag_ptr(ret_conv, true);
35557 }
35558
35559 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) {
35560         LDKPublicKey broadcaster_payment_basepoint_ref;
35561         CHECK(broadcaster_payment_basepoint->arr_len == 33);
35562         memcpy(broadcaster_payment_basepoint_ref.compressed_form, broadcaster_payment_basepoint->elems, 33); FREE(broadcaster_payment_basepoint);
35563         LDKPublicKey countersignatory_payment_basepoint_ref;
35564         CHECK(countersignatory_payment_basepoint->arr_len == 33);
35565         memcpy(countersignatory_payment_basepoint_ref.compressed_form, countersignatory_payment_basepoint->elems, 33); FREE(countersignatory_payment_basepoint);
35566         int64_t ret_conv = get_commitment_transaction_number_obscure_factor(broadcaster_payment_basepoint_ref, countersignatory_payment_basepoint_ref, outbound_from_broadcaster);
35567         return ret_conv;
35568 }
35569
35570 jboolean  __attribute__((export_name("TS_InitFeatures_eq"))) TS_InitFeatures_eq(uint64_t a, uint64_t b) {
35571         LDKInitFeatures a_conv;
35572         a_conv.inner = untag_ptr(a);
35573         a_conv.is_owned = ptr_is_owned(a);
35574         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
35575         a_conv.is_owned = false;
35576         LDKInitFeatures b_conv;
35577         b_conv.inner = untag_ptr(b);
35578         b_conv.is_owned = ptr_is_owned(b);
35579         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
35580         b_conv.is_owned = false;
35581         jboolean ret_conv = InitFeatures_eq(&a_conv, &b_conv);
35582         return ret_conv;
35583 }
35584
35585 jboolean  __attribute__((export_name("TS_NodeFeatures_eq"))) TS_NodeFeatures_eq(uint64_t a, uint64_t b) {
35586         LDKNodeFeatures a_conv;
35587         a_conv.inner = untag_ptr(a);
35588         a_conv.is_owned = ptr_is_owned(a);
35589         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
35590         a_conv.is_owned = false;
35591         LDKNodeFeatures b_conv;
35592         b_conv.inner = untag_ptr(b);
35593         b_conv.is_owned = ptr_is_owned(b);
35594         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
35595         b_conv.is_owned = false;
35596         jboolean ret_conv = NodeFeatures_eq(&a_conv, &b_conv);
35597         return ret_conv;
35598 }
35599
35600 jboolean  __attribute__((export_name("TS_ChannelFeatures_eq"))) TS_ChannelFeatures_eq(uint64_t a, uint64_t b) {
35601         LDKChannelFeatures a_conv;
35602         a_conv.inner = untag_ptr(a);
35603         a_conv.is_owned = ptr_is_owned(a);
35604         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
35605         a_conv.is_owned = false;
35606         LDKChannelFeatures b_conv;
35607         b_conv.inner = untag_ptr(b);
35608         b_conv.is_owned = ptr_is_owned(b);
35609         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
35610         b_conv.is_owned = false;
35611         jboolean ret_conv = ChannelFeatures_eq(&a_conv, &b_conv);
35612         return ret_conv;
35613 }
35614
35615 jboolean  __attribute__((export_name("TS_InvoiceFeatures_eq"))) TS_InvoiceFeatures_eq(uint64_t a, uint64_t b) {
35616         LDKInvoiceFeatures a_conv;
35617         a_conv.inner = untag_ptr(a);
35618         a_conv.is_owned = ptr_is_owned(a);
35619         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
35620         a_conv.is_owned = false;
35621         LDKInvoiceFeatures b_conv;
35622         b_conv.inner = untag_ptr(b);
35623         b_conv.is_owned = ptr_is_owned(b);
35624         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
35625         b_conv.is_owned = false;
35626         jboolean ret_conv = InvoiceFeatures_eq(&a_conv, &b_conv);
35627         return ret_conv;
35628 }
35629
35630 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_eq"))) TS_ChannelTypeFeatures_eq(uint64_t a, uint64_t b) {
35631         LDKChannelTypeFeatures a_conv;
35632         a_conv.inner = untag_ptr(a);
35633         a_conv.is_owned = ptr_is_owned(a);
35634         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
35635         a_conv.is_owned = false;
35636         LDKChannelTypeFeatures b_conv;
35637         b_conv.inner = untag_ptr(b);
35638         b_conv.is_owned = ptr_is_owned(b);
35639         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
35640         b_conv.is_owned = false;
35641         jboolean ret_conv = ChannelTypeFeatures_eq(&a_conv, &b_conv);
35642         return ret_conv;
35643 }
35644
35645 static inline uint64_t InitFeatures_clone_ptr(LDKInitFeatures *NONNULL_PTR arg) {
35646         LDKInitFeatures ret_var = InitFeatures_clone(arg);
35647         uint64_t ret_ref = 0;
35648         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35649         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35650         return ret_ref;
35651 }
35652 int64_t  __attribute__((export_name("TS_InitFeatures_clone_ptr"))) TS_InitFeatures_clone_ptr(uint64_t arg) {
35653         LDKInitFeatures arg_conv;
35654         arg_conv.inner = untag_ptr(arg);
35655         arg_conv.is_owned = ptr_is_owned(arg);
35656         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35657         arg_conv.is_owned = false;
35658         int64_t ret_conv = InitFeatures_clone_ptr(&arg_conv);
35659         return ret_conv;
35660 }
35661
35662 uint64_t  __attribute__((export_name("TS_InitFeatures_clone"))) TS_InitFeatures_clone(uint64_t orig) {
35663         LDKInitFeatures orig_conv;
35664         orig_conv.inner = untag_ptr(orig);
35665         orig_conv.is_owned = ptr_is_owned(orig);
35666         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35667         orig_conv.is_owned = false;
35668         LDKInitFeatures ret_var = InitFeatures_clone(&orig_conv);
35669         uint64_t ret_ref = 0;
35670         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35671         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35672         return ret_ref;
35673 }
35674
35675 static inline uint64_t NodeFeatures_clone_ptr(LDKNodeFeatures *NONNULL_PTR arg) {
35676         LDKNodeFeatures ret_var = NodeFeatures_clone(arg);
35677         uint64_t ret_ref = 0;
35678         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35679         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35680         return ret_ref;
35681 }
35682 int64_t  __attribute__((export_name("TS_NodeFeatures_clone_ptr"))) TS_NodeFeatures_clone_ptr(uint64_t arg) {
35683         LDKNodeFeatures arg_conv;
35684         arg_conv.inner = untag_ptr(arg);
35685         arg_conv.is_owned = ptr_is_owned(arg);
35686         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35687         arg_conv.is_owned = false;
35688         int64_t ret_conv = NodeFeatures_clone_ptr(&arg_conv);
35689         return ret_conv;
35690 }
35691
35692 uint64_t  __attribute__((export_name("TS_NodeFeatures_clone"))) TS_NodeFeatures_clone(uint64_t orig) {
35693         LDKNodeFeatures orig_conv;
35694         orig_conv.inner = untag_ptr(orig);
35695         orig_conv.is_owned = ptr_is_owned(orig);
35696         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35697         orig_conv.is_owned = false;
35698         LDKNodeFeatures ret_var = NodeFeatures_clone(&orig_conv);
35699         uint64_t ret_ref = 0;
35700         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35701         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35702         return ret_ref;
35703 }
35704
35705 static inline uint64_t ChannelFeatures_clone_ptr(LDKChannelFeatures *NONNULL_PTR arg) {
35706         LDKChannelFeatures ret_var = ChannelFeatures_clone(arg);
35707         uint64_t ret_ref = 0;
35708         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35709         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35710         return ret_ref;
35711 }
35712 int64_t  __attribute__((export_name("TS_ChannelFeatures_clone_ptr"))) TS_ChannelFeatures_clone_ptr(uint64_t arg) {
35713         LDKChannelFeatures arg_conv;
35714         arg_conv.inner = untag_ptr(arg);
35715         arg_conv.is_owned = ptr_is_owned(arg);
35716         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35717         arg_conv.is_owned = false;
35718         int64_t ret_conv = ChannelFeatures_clone_ptr(&arg_conv);
35719         return ret_conv;
35720 }
35721
35722 uint64_t  __attribute__((export_name("TS_ChannelFeatures_clone"))) TS_ChannelFeatures_clone(uint64_t orig) {
35723         LDKChannelFeatures orig_conv;
35724         orig_conv.inner = untag_ptr(orig);
35725         orig_conv.is_owned = ptr_is_owned(orig);
35726         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35727         orig_conv.is_owned = false;
35728         LDKChannelFeatures ret_var = ChannelFeatures_clone(&orig_conv);
35729         uint64_t ret_ref = 0;
35730         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35731         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35732         return ret_ref;
35733 }
35734
35735 static inline uint64_t InvoiceFeatures_clone_ptr(LDKInvoiceFeatures *NONNULL_PTR arg) {
35736         LDKInvoiceFeatures ret_var = InvoiceFeatures_clone(arg);
35737         uint64_t ret_ref = 0;
35738         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35739         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35740         return ret_ref;
35741 }
35742 int64_t  __attribute__((export_name("TS_InvoiceFeatures_clone_ptr"))) TS_InvoiceFeatures_clone_ptr(uint64_t arg) {
35743         LDKInvoiceFeatures arg_conv;
35744         arg_conv.inner = untag_ptr(arg);
35745         arg_conv.is_owned = ptr_is_owned(arg);
35746         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35747         arg_conv.is_owned = false;
35748         int64_t ret_conv = InvoiceFeatures_clone_ptr(&arg_conv);
35749         return ret_conv;
35750 }
35751
35752 uint64_t  __attribute__((export_name("TS_InvoiceFeatures_clone"))) TS_InvoiceFeatures_clone(uint64_t orig) {
35753         LDKInvoiceFeatures orig_conv;
35754         orig_conv.inner = untag_ptr(orig);
35755         orig_conv.is_owned = ptr_is_owned(orig);
35756         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35757         orig_conv.is_owned = false;
35758         LDKInvoiceFeatures ret_var = InvoiceFeatures_clone(&orig_conv);
35759         uint64_t ret_ref = 0;
35760         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35761         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35762         return ret_ref;
35763 }
35764
35765 static inline uint64_t ChannelTypeFeatures_clone_ptr(LDKChannelTypeFeatures *NONNULL_PTR arg) {
35766         LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_clone(arg);
35767         uint64_t ret_ref = 0;
35768         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35769         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35770         return ret_ref;
35771 }
35772 int64_t  __attribute__((export_name("TS_ChannelTypeFeatures_clone_ptr"))) TS_ChannelTypeFeatures_clone_ptr(uint64_t arg) {
35773         LDKChannelTypeFeatures arg_conv;
35774         arg_conv.inner = untag_ptr(arg);
35775         arg_conv.is_owned = ptr_is_owned(arg);
35776         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35777         arg_conv.is_owned = false;
35778         int64_t ret_conv = ChannelTypeFeatures_clone_ptr(&arg_conv);
35779         return ret_conv;
35780 }
35781
35782 uint64_t  __attribute__((export_name("TS_ChannelTypeFeatures_clone"))) TS_ChannelTypeFeatures_clone(uint64_t orig) {
35783         LDKChannelTypeFeatures orig_conv;
35784         orig_conv.inner = untag_ptr(orig);
35785         orig_conv.is_owned = ptr_is_owned(orig);
35786         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35787         orig_conv.is_owned = false;
35788         LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_clone(&orig_conv);
35789         uint64_t ret_ref = 0;
35790         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35791         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35792         return ret_ref;
35793 }
35794
35795 void  __attribute__((export_name("TS_InitFeatures_free"))) TS_InitFeatures_free(uint64_t this_obj) {
35796         LDKInitFeatures this_obj_conv;
35797         this_obj_conv.inner = untag_ptr(this_obj);
35798         this_obj_conv.is_owned = ptr_is_owned(this_obj);
35799         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35800         InitFeatures_free(this_obj_conv);
35801 }
35802
35803 void  __attribute__((export_name("TS_NodeFeatures_free"))) TS_NodeFeatures_free(uint64_t this_obj) {
35804         LDKNodeFeatures this_obj_conv;
35805         this_obj_conv.inner = untag_ptr(this_obj);
35806         this_obj_conv.is_owned = ptr_is_owned(this_obj);
35807         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35808         NodeFeatures_free(this_obj_conv);
35809 }
35810
35811 void  __attribute__((export_name("TS_ChannelFeatures_free"))) TS_ChannelFeatures_free(uint64_t this_obj) {
35812         LDKChannelFeatures this_obj_conv;
35813         this_obj_conv.inner = untag_ptr(this_obj);
35814         this_obj_conv.is_owned = ptr_is_owned(this_obj);
35815         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35816         ChannelFeatures_free(this_obj_conv);
35817 }
35818
35819 void  __attribute__((export_name("TS_InvoiceFeatures_free"))) TS_InvoiceFeatures_free(uint64_t this_obj) {
35820         LDKInvoiceFeatures this_obj_conv;
35821         this_obj_conv.inner = untag_ptr(this_obj);
35822         this_obj_conv.is_owned = ptr_is_owned(this_obj);
35823         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35824         InvoiceFeatures_free(this_obj_conv);
35825 }
35826
35827 void  __attribute__((export_name("TS_ChannelTypeFeatures_free"))) TS_ChannelTypeFeatures_free(uint64_t this_obj) {
35828         LDKChannelTypeFeatures this_obj_conv;
35829         this_obj_conv.inner = untag_ptr(this_obj);
35830         this_obj_conv.is_owned = ptr_is_owned(this_obj);
35831         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35832         ChannelTypeFeatures_free(this_obj_conv);
35833 }
35834
35835 uint64_t  __attribute__((export_name("TS_InitFeatures_empty"))) TS_InitFeatures_empty() {
35836         LDKInitFeatures ret_var = InitFeatures_empty();
35837         uint64_t ret_ref = 0;
35838         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35839         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35840         return ret_ref;
35841 }
35842
35843 uint64_t  __attribute__((export_name("TS_InitFeatures_known"))) TS_InitFeatures_known() {
35844         LDKInitFeatures ret_var = InitFeatures_known();
35845         uint64_t ret_ref = 0;
35846         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35847         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35848         return ret_ref;
35849 }
35850
35851 jboolean  __attribute__((export_name("TS_InitFeatures_requires_unknown_bits"))) TS_InitFeatures_requires_unknown_bits(uint64_t this_arg) {
35852         LDKInitFeatures this_arg_conv;
35853         this_arg_conv.inner = untag_ptr(this_arg);
35854         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35855         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35856         this_arg_conv.is_owned = false;
35857         jboolean ret_conv = InitFeatures_requires_unknown_bits(&this_arg_conv);
35858         return ret_conv;
35859 }
35860
35861 uint64_t  __attribute__((export_name("TS_NodeFeatures_empty"))) TS_NodeFeatures_empty() {
35862         LDKNodeFeatures ret_var = NodeFeatures_empty();
35863         uint64_t ret_ref = 0;
35864         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35865         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35866         return ret_ref;
35867 }
35868
35869 uint64_t  __attribute__((export_name("TS_NodeFeatures_known"))) TS_NodeFeatures_known() {
35870         LDKNodeFeatures ret_var = NodeFeatures_known();
35871         uint64_t ret_ref = 0;
35872         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35873         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35874         return ret_ref;
35875 }
35876
35877 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_unknown_bits"))) TS_NodeFeatures_requires_unknown_bits(uint64_t this_arg) {
35878         LDKNodeFeatures this_arg_conv;
35879         this_arg_conv.inner = untag_ptr(this_arg);
35880         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35881         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35882         this_arg_conv.is_owned = false;
35883         jboolean ret_conv = NodeFeatures_requires_unknown_bits(&this_arg_conv);
35884         return ret_conv;
35885 }
35886
35887 uint64_t  __attribute__((export_name("TS_ChannelFeatures_empty"))) TS_ChannelFeatures_empty() {
35888         LDKChannelFeatures ret_var = ChannelFeatures_empty();
35889         uint64_t ret_ref = 0;
35890         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35891         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35892         return ret_ref;
35893 }
35894
35895 uint64_t  __attribute__((export_name("TS_ChannelFeatures_known"))) TS_ChannelFeatures_known() {
35896         LDKChannelFeatures ret_var = ChannelFeatures_known();
35897         uint64_t ret_ref = 0;
35898         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35899         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35900         return ret_ref;
35901 }
35902
35903 jboolean  __attribute__((export_name("TS_ChannelFeatures_requires_unknown_bits"))) TS_ChannelFeatures_requires_unknown_bits(uint64_t this_arg) {
35904         LDKChannelFeatures this_arg_conv;
35905         this_arg_conv.inner = untag_ptr(this_arg);
35906         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35907         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35908         this_arg_conv.is_owned = false;
35909         jboolean ret_conv = ChannelFeatures_requires_unknown_bits(&this_arg_conv);
35910         return ret_conv;
35911 }
35912
35913 uint64_t  __attribute__((export_name("TS_InvoiceFeatures_empty"))) TS_InvoiceFeatures_empty() {
35914         LDKInvoiceFeatures ret_var = InvoiceFeatures_empty();
35915         uint64_t ret_ref = 0;
35916         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35917         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35918         return ret_ref;
35919 }
35920
35921 uint64_t  __attribute__((export_name("TS_InvoiceFeatures_known"))) TS_InvoiceFeatures_known() {
35922         LDKInvoiceFeatures ret_var = InvoiceFeatures_known();
35923         uint64_t ret_ref = 0;
35924         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35925         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35926         return ret_ref;
35927 }
35928
35929 jboolean  __attribute__((export_name("TS_InvoiceFeatures_requires_unknown_bits"))) TS_InvoiceFeatures_requires_unknown_bits(uint64_t this_arg) {
35930         LDKInvoiceFeatures this_arg_conv;
35931         this_arg_conv.inner = untag_ptr(this_arg);
35932         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35933         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35934         this_arg_conv.is_owned = false;
35935         jboolean ret_conv = InvoiceFeatures_requires_unknown_bits(&this_arg_conv);
35936         return ret_conv;
35937 }
35938
35939 uint64_t  __attribute__((export_name("TS_ChannelTypeFeatures_empty"))) TS_ChannelTypeFeatures_empty() {
35940         LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_empty();
35941         uint64_t ret_ref = 0;
35942         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35943         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35944         return ret_ref;
35945 }
35946
35947 uint64_t  __attribute__((export_name("TS_ChannelTypeFeatures_known"))) TS_ChannelTypeFeatures_known() {
35948         LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_known();
35949         uint64_t ret_ref = 0;
35950         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35951         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35952         return ret_ref;
35953 }
35954
35955 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_requires_unknown_bits"))) TS_ChannelTypeFeatures_requires_unknown_bits(uint64_t this_arg) {
35956         LDKChannelTypeFeatures this_arg_conv;
35957         this_arg_conv.inner = untag_ptr(this_arg);
35958         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35959         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35960         this_arg_conv.is_owned = false;
35961         jboolean ret_conv = ChannelTypeFeatures_requires_unknown_bits(&this_arg_conv);
35962         return ret_conv;
35963 }
35964
35965 int8_tArray  __attribute__((export_name("TS_InitFeatures_write"))) TS_InitFeatures_write(uint64_t obj) {
35966         LDKInitFeatures obj_conv;
35967         obj_conv.inner = untag_ptr(obj);
35968         obj_conv.is_owned = ptr_is_owned(obj);
35969         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35970         obj_conv.is_owned = false;
35971         LDKCVec_u8Z ret_var = InitFeatures_write(&obj_conv);
35972         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
35973         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
35974         CVec_u8Z_free(ret_var);
35975         return ret_arr;
35976 }
35977
35978 uint64_t  __attribute__((export_name("TS_InitFeatures_read"))) TS_InitFeatures_read(int8_tArray ser) {
35979         LDKu8slice ser_ref;
35980         ser_ref.datalen = ser->arr_len;
35981         ser_ref.data = ser->elems;
35982         LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
35983         *ret_conv = InitFeatures_read(ser_ref);
35984         FREE(ser);
35985         return tag_ptr(ret_conv, true);
35986 }
35987
35988 int8_tArray  __attribute__((export_name("TS_ChannelFeatures_write"))) TS_ChannelFeatures_write(uint64_t obj) {
35989         LDKChannelFeatures obj_conv;
35990         obj_conv.inner = untag_ptr(obj);
35991         obj_conv.is_owned = ptr_is_owned(obj);
35992         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35993         obj_conv.is_owned = false;
35994         LDKCVec_u8Z ret_var = ChannelFeatures_write(&obj_conv);
35995         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
35996         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
35997         CVec_u8Z_free(ret_var);
35998         return ret_arr;
35999 }
36000
36001 uint64_t  __attribute__((export_name("TS_ChannelFeatures_read"))) TS_ChannelFeatures_read(int8_tArray ser) {
36002         LDKu8slice ser_ref;
36003         ser_ref.datalen = ser->arr_len;
36004         ser_ref.data = ser->elems;
36005         LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
36006         *ret_conv = ChannelFeatures_read(ser_ref);
36007         FREE(ser);
36008         return tag_ptr(ret_conv, true);
36009 }
36010
36011 int8_tArray  __attribute__((export_name("TS_NodeFeatures_write"))) TS_NodeFeatures_write(uint64_t obj) {
36012         LDKNodeFeatures obj_conv;
36013         obj_conv.inner = untag_ptr(obj);
36014         obj_conv.is_owned = ptr_is_owned(obj);
36015         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36016         obj_conv.is_owned = false;
36017         LDKCVec_u8Z ret_var = NodeFeatures_write(&obj_conv);
36018         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36019         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36020         CVec_u8Z_free(ret_var);
36021         return ret_arr;
36022 }
36023
36024 uint64_t  __attribute__((export_name("TS_NodeFeatures_read"))) TS_NodeFeatures_read(int8_tArray ser) {
36025         LDKu8slice ser_ref;
36026         ser_ref.datalen = ser->arr_len;
36027         ser_ref.data = ser->elems;
36028         LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
36029         *ret_conv = NodeFeatures_read(ser_ref);
36030         FREE(ser);
36031         return tag_ptr(ret_conv, true);
36032 }
36033
36034 int8_tArray  __attribute__((export_name("TS_InvoiceFeatures_write"))) TS_InvoiceFeatures_write(uint64_t obj) {
36035         LDKInvoiceFeatures obj_conv;
36036         obj_conv.inner = untag_ptr(obj);
36037         obj_conv.is_owned = ptr_is_owned(obj);
36038         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36039         obj_conv.is_owned = false;
36040         LDKCVec_u8Z ret_var = InvoiceFeatures_write(&obj_conv);
36041         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36042         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36043         CVec_u8Z_free(ret_var);
36044         return ret_arr;
36045 }
36046
36047 uint64_t  __attribute__((export_name("TS_InvoiceFeatures_read"))) TS_InvoiceFeatures_read(int8_tArray ser) {
36048         LDKu8slice ser_ref;
36049         ser_ref.datalen = ser->arr_len;
36050         ser_ref.data = ser->elems;
36051         LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
36052         *ret_conv = InvoiceFeatures_read(ser_ref);
36053         FREE(ser);
36054         return tag_ptr(ret_conv, true);
36055 }
36056
36057 int8_tArray  __attribute__((export_name("TS_ChannelTypeFeatures_write"))) TS_ChannelTypeFeatures_write(uint64_t obj) {
36058         LDKChannelTypeFeatures obj_conv;
36059         obj_conv.inner = untag_ptr(obj);
36060         obj_conv.is_owned = ptr_is_owned(obj);
36061         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36062         obj_conv.is_owned = false;
36063         LDKCVec_u8Z ret_var = ChannelTypeFeatures_write(&obj_conv);
36064         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36065         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36066         CVec_u8Z_free(ret_var);
36067         return ret_arr;
36068 }
36069
36070 uint64_t  __attribute__((export_name("TS_ChannelTypeFeatures_read"))) TS_ChannelTypeFeatures_read(int8_tArray ser) {
36071         LDKu8slice ser_ref;
36072         ser_ref.datalen = ser->arr_len;
36073         ser_ref.data = ser->elems;
36074         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
36075         *ret_conv = ChannelTypeFeatures_read(ser_ref);
36076         FREE(ser);
36077         return tag_ptr(ret_conv, true);
36078 }
36079
36080 void  __attribute__((export_name("TS_InitFeatures_set_data_loss_protect_optional"))) TS_InitFeatures_set_data_loss_protect_optional(uint64_t this_arg) {
36081         LDKInitFeatures this_arg_conv;
36082         this_arg_conv.inner = untag_ptr(this_arg);
36083         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36084         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36085         this_arg_conv.is_owned = false;
36086         InitFeatures_set_data_loss_protect_optional(&this_arg_conv);
36087 }
36088
36089 void  __attribute__((export_name("TS_InitFeatures_set_data_loss_protect_required"))) TS_InitFeatures_set_data_loss_protect_required(uint64_t this_arg) {
36090         LDKInitFeatures this_arg_conv;
36091         this_arg_conv.inner = untag_ptr(this_arg);
36092         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36093         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36094         this_arg_conv.is_owned = false;
36095         InitFeatures_set_data_loss_protect_required(&this_arg_conv);
36096 }
36097
36098 jboolean  __attribute__((export_name("TS_InitFeatures_supports_data_loss_protect"))) TS_InitFeatures_supports_data_loss_protect(uint64_t this_arg) {
36099         LDKInitFeatures this_arg_conv;
36100         this_arg_conv.inner = untag_ptr(this_arg);
36101         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36102         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36103         this_arg_conv.is_owned = false;
36104         jboolean ret_conv = InitFeatures_supports_data_loss_protect(&this_arg_conv);
36105         return ret_conv;
36106 }
36107
36108 void  __attribute__((export_name("TS_NodeFeatures_set_data_loss_protect_optional"))) TS_NodeFeatures_set_data_loss_protect_optional(uint64_t this_arg) {
36109         LDKNodeFeatures this_arg_conv;
36110         this_arg_conv.inner = untag_ptr(this_arg);
36111         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36112         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36113         this_arg_conv.is_owned = false;
36114         NodeFeatures_set_data_loss_protect_optional(&this_arg_conv);
36115 }
36116
36117 void  __attribute__((export_name("TS_NodeFeatures_set_data_loss_protect_required"))) TS_NodeFeatures_set_data_loss_protect_required(uint64_t this_arg) {
36118         LDKNodeFeatures this_arg_conv;
36119         this_arg_conv.inner = untag_ptr(this_arg);
36120         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36121         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36122         this_arg_conv.is_owned = false;
36123         NodeFeatures_set_data_loss_protect_required(&this_arg_conv);
36124 }
36125
36126 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_data_loss_protect"))) TS_NodeFeatures_supports_data_loss_protect(uint64_t this_arg) {
36127         LDKNodeFeatures this_arg_conv;
36128         this_arg_conv.inner = untag_ptr(this_arg);
36129         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36130         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36131         this_arg_conv.is_owned = false;
36132         jboolean ret_conv = NodeFeatures_supports_data_loss_protect(&this_arg_conv);
36133         return ret_conv;
36134 }
36135
36136 jboolean  __attribute__((export_name("TS_InitFeatures_requires_data_loss_protect"))) TS_InitFeatures_requires_data_loss_protect(uint64_t this_arg) {
36137         LDKInitFeatures this_arg_conv;
36138         this_arg_conv.inner = untag_ptr(this_arg);
36139         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36140         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36141         this_arg_conv.is_owned = false;
36142         jboolean ret_conv = InitFeatures_requires_data_loss_protect(&this_arg_conv);
36143         return ret_conv;
36144 }
36145
36146 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_data_loss_protect"))) TS_NodeFeatures_requires_data_loss_protect(uint64_t this_arg) {
36147         LDKNodeFeatures this_arg_conv;
36148         this_arg_conv.inner = untag_ptr(this_arg);
36149         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36150         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36151         this_arg_conv.is_owned = false;
36152         jboolean ret_conv = NodeFeatures_requires_data_loss_protect(&this_arg_conv);
36153         return ret_conv;
36154 }
36155
36156 void  __attribute__((export_name("TS_InitFeatures_set_initial_routing_sync_optional"))) TS_InitFeatures_set_initial_routing_sync_optional(uint64_t this_arg) {
36157         LDKInitFeatures 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         InitFeatures_set_initial_routing_sync_optional(&this_arg_conv);
36163 }
36164
36165 void  __attribute__((export_name("TS_InitFeatures_set_initial_routing_sync_required"))) TS_InitFeatures_set_initial_routing_sync_required(uint64_t this_arg) {
36166         LDKInitFeatures this_arg_conv;
36167         this_arg_conv.inner = untag_ptr(this_arg);
36168         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36169         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36170         this_arg_conv.is_owned = false;
36171         InitFeatures_set_initial_routing_sync_required(&this_arg_conv);
36172 }
36173
36174 jboolean  __attribute__((export_name("TS_InitFeatures_initial_routing_sync"))) TS_InitFeatures_initial_routing_sync(uint64_t this_arg) {
36175         LDKInitFeatures this_arg_conv;
36176         this_arg_conv.inner = untag_ptr(this_arg);
36177         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36178         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36179         this_arg_conv.is_owned = false;
36180         jboolean ret_conv = InitFeatures_initial_routing_sync(&this_arg_conv);
36181         return ret_conv;
36182 }
36183
36184 void  __attribute__((export_name("TS_InitFeatures_set_upfront_shutdown_script_optional"))) TS_InitFeatures_set_upfront_shutdown_script_optional(uint64_t this_arg) {
36185         LDKInitFeatures this_arg_conv;
36186         this_arg_conv.inner = untag_ptr(this_arg);
36187         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36188         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36189         this_arg_conv.is_owned = false;
36190         InitFeatures_set_upfront_shutdown_script_optional(&this_arg_conv);
36191 }
36192
36193 void  __attribute__((export_name("TS_InitFeatures_set_upfront_shutdown_script_required"))) TS_InitFeatures_set_upfront_shutdown_script_required(uint64_t this_arg) {
36194         LDKInitFeatures this_arg_conv;
36195         this_arg_conv.inner = untag_ptr(this_arg);
36196         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36197         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36198         this_arg_conv.is_owned = false;
36199         InitFeatures_set_upfront_shutdown_script_required(&this_arg_conv);
36200 }
36201
36202 jboolean  __attribute__((export_name("TS_InitFeatures_supports_upfront_shutdown_script"))) TS_InitFeatures_supports_upfront_shutdown_script(uint64_t this_arg) {
36203         LDKInitFeatures this_arg_conv;
36204         this_arg_conv.inner = untag_ptr(this_arg);
36205         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36206         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36207         this_arg_conv.is_owned = false;
36208         jboolean ret_conv = InitFeatures_supports_upfront_shutdown_script(&this_arg_conv);
36209         return ret_conv;
36210 }
36211
36212 void  __attribute__((export_name("TS_NodeFeatures_set_upfront_shutdown_script_optional"))) TS_NodeFeatures_set_upfront_shutdown_script_optional(uint64_t this_arg) {
36213         LDKNodeFeatures this_arg_conv;
36214         this_arg_conv.inner = untag_ptr(this_arg);
36215         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36216         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36217         this_arg_conv.is_owned = false;
36218         NodeFeatures_set_upfront_shutdown_script_optional(&this_arg_conv);
36219 }
36220
36221 void  __attribute__((export_name("TS_NodeFeatures_set_upfront_shutdown_script_required"))) TS_NodeFeatures_set_upfront_shutdown_script_required(uint64_t this_arg) {
36222         LDKNodeFeatures this_arg_conv;
36223         this_arg_conv.inner = untag_ptr(this_arg);
36224         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36225         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36226         this_arg_conv.is_owned = false;
36227         NodeFeatures_set_upfront_shutdown_script_required(&this_arg_conv);
36228 }
36229
36230 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_upfront_shutdown_script"))) TS_NodeFeatures_supports_upfront_shutdown_script(uint64_t this_arg) {
36231         LDKNodeFeatures this_arg_conv;
36232         this_arg_conv.inner = untag_ptr(this_arg);
36233         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36234         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36235         this_arg_conv.is_owned = false;
36236         jboolean ret_conv = NodeFeatures_supports_upfront_shutdown_script(&this_arg_conv);
36237         return ret_conv;
36238 }
36239
36240 jboolean  __attribute__((export_name("TS_InitFeatures_requires_upfront_shutdown_script"))) TS_InitFeatures_requires_upfront_shutdown_script(uint64_t this_arg) {
36241         LDKInitFeatures this_arg_conv;
36242         this_arg_conv.inner = untag_ptr(this_arg);
36243         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36244         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36245         this_arg_conv.is_owned = false;
36246         jboolean ret_conv = InitFeatures_requires_upfront_shutdown_script(&this_arg_conv);
36247         return ret_conv;
36248 }
36249
36250 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_upfront_shutdown_script"))) TS_NodeFeatures_requires_upfront_shutdown_script(uint64_t this_arg) {
36251         LDKNodeFeatures this_arg_conv;
36252         this_arg_conv.inner = untag_ptr(this_arg);
36253         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36254         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36255         this_arg_conv.is_owned = false;
36256         jboolean ret_conv = NodeFeatures_requires_upfront_shutdown_script(&this_arg_conv);
36257         return ret_conv;
36258 }
36259
36260 void  __attribute__((export_name("TS_InitFeatures_set_gossip_queries_optional"))) TS_InitFeatures_set_gossip_queries_optional(uint64_t this_arg) {
36261         LDKInitFeatures this_arg_conv;
36262         this_arg_conv.inner = untag_ptr(this_arg);
36263         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36264         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36265         this_arg_conv.is_owned = false;
36266         InitFeatures_set_gossip_queries_optional(&this_arg_conv);
36267 }
36268
36269 void  __attribute__((export_name("TS_InitFeatures_set_gossip_queries_required"))) TS_InitFeatures_set_gossip_queries_required(uint64_t this_arg) {
36270         LDKInitFeatures this_arg_conv;
36271         this_arg_conv.inner = untag_ptr(this_arg);
36272         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36273         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36274         this_arg_conv.is_owned = false;
36275         InitFeatures_set_gossip_queries_required(&this_arg_conv);
36276 }
36277
36278 jboolean  __attribute__((export_name("TS_InitFeatures_supports_gossip_queries"))) TS_InitFeatures_supports_gossip_queries(uint64_t this_arg) {
36279         LDKInitFeatures this_arg_conv;
36280         this_arg_conv.inner = untag_ptr(this_arg);
36281         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36282         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36283         this_arg_conv.is_owned = false;
36284         jboolean ret_conv = InitFeatures_supports_gossip_queries(&this_arg_conv);
36285         return ret_conv;
36286 }
36287
36288 void  __attribute__((export_name("TS_NodeFeatures_set_gossip_queries_optional"))) TS_NodeFeatures_set_gossip_queries_optional(uint64_t this_arg) {
36289         LDKNodeFeatures this_arg_conv;
36290         this_arg_conv.inner = untag_ptr(this_arg);
36291         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36292         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36293         this_arg_conv.is_owned = false;
36294         NodeFeatures_set_gossip_queries_optional(&this_arg_conv);
36295 }
36296
36297 void  __attribute__((export_name("TS_NodeFeatures_set_gossip_queries_required"))) TS_NodeFeatures_set_gossip_queries_required(uint64_t this_arg) {
36298         LDKNodeFeatures this_arg_conv;
36299         this_arg_conv.inner = untag_ptr(this_arg);
36300         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36301         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36302         this_arg_conv.is_owned = false;
36303         NodeFeatures_set_gossip_queries_required(&this_arg_conv);
36304 }
36305
36306 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_gossip_queries"))) TS_NodeFeatures_supports_gossip_queries(uint64_t this_arg) {
36307         LDKNodeFeatures this_arg_conv;
36308         this_arg_conv.inner = untag_ptr(this_arg);
36309         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36310         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36311         this_arg_conv.is_owned = false;
36312         jboolean ret_conv = NodeFeatures_supports_gossip_queries(&this_arg_conv);
36313         return ret_conv;
36314 }
36315
36316 jboolean  __attribute__((export_name("TS_InitFeatures_requires_gossip_queries"))) TS_InitFeatures_requires_gossip_queries(uint64_t this_arg) {
36317         LDKInitFeatures this_arg_conv;
36318         this_arg_conv.inner = untag_ptr(this_arg);
36319         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36320         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36321         this_arg_conv.is_owned = false;
36322         jboolean ret_conv = InitFeatures_requires_gossip_queries(&this_arg_conv);
36323         return ret_conv;
36324 }
36325
36326 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_gossip_queries"))) TS_NodeFeatures_requires_gossip_queries(uint64_t this_arg) {
36327         LDKNodeFeatures this_arg_conv;
36328         this_arg_conv.inner = untag_ptr(this_arg);
36329         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36330         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36331         this_arg_conv.is_owned = false;
36332         jboolean ret_conv = NodeFeatures_requires_gossip_queries(&this_arg_conv);
36333         return ret_conv;
36334 }
36335
36336 void  __attribute__((export_name("TS_InitFeatures_set_variable_length_onion_optional"))) TS_InitFeatures_set_variable_length_onion_optional(uint64_t this_arg) {
36337         LDKInitFeatures this_arg_conv;
36338         this_arg_conv.inner = untag_ptr(this_arg);
36339         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36340         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36341         this_arg_conv.is_owned = false;
36342         InitFeatures_set_variable_length_onion_optional(&this_arg_conv);
36343 }
36344
36345 void  __attribute__((export_name("TS_InitFeatures_set_variable_length_onion_required"))) TS_InitFeatures_set_variable_length_onion_required(uint64_t this_arg) {
36346         LDKInitFeatures this_arg_conv;
36347         this_arg_conv.inner = untag_ptr(this_arg);
36348         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36349         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36350         this_arg_conv.is_owned = false;
36351         InitFeatures_set_variable_length_onion_required(&this_arg_conv);
36352 }
36353
36354 jboolean  __attribute__((export_name("TS_InitFeatures_supports_variable_length_onion"))) TS_InitFeatures_supports_variable_length_onion(uint64_t this_arg) {
36355         LDKInitFeatures this_arg_conv;
36356         this_arg_conv.inner = untag_ptr(this_arg);
36357         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36358         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36359         this_arg_conv.is_owned = false;
36360         jboolean ret_conv = InitFeatures_supports_variable_length_onion(&this_arg_conv);
36361         return ret_conv;
36362 }
36363
36364 void  __attribute__((export_name("TS_NodeFeatures_set_variable_length_onion_optional"))) TS_NodeFeatures_set_variable_length_onion_optional(uint64_t this_arg) {
36365         LDKNodeFeatures this_arg_conv;
36366         this_arg_conv.inner = untag_ptr(this_arg);
36367         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36368         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36369         this_arg_conv.is_owned = false;
36370         NodeFeatures_set_variable_length_onion_optional(&this_arg_conv);
36371 }
36372
36373 void  __attribute__((export_name("TS_NodeFeatures_set_variable_length_onion_required"))) TS_NodeFeatures_set_variable_length_onion_required(uint64_t this_arg) {
36374         LDKNodeFeatures this_arg_conv;
36375         this_arg_conv.inner = untag_ptr(this_arg);
36376         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36377         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36378         this_arg_conv.is_owned = false;
36379         NodeFeatures_set_variable_length_onion_required(&this_arg_conv);
36380 }
36381
36382 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_variable_length_onion"))) TS_NodeFeatures_supports_variable_length_onion(uint64_t this_arg) {
36383         LDKNodeFeatures this_arg_conv;
36384         this_arg_conv.inner = untag_ptr(this_arg);
36385         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36386         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36387         this_arg_conv.is_owned = false;
36388         jboolean ret_conv = NodeFeatures_supports_variable_length_onion(&this_arg_conv);
36389         return ret_conv;
36390 }
36391
36392 void  __attribute__((export_name("TS_InvoiceFeatures_set_variable_length_onion_optional"))) TS_InvoiceFeatures_set_variable_length_onion_optional(uint64_t this_arg) {
36393         LDKInvoiceFeatures this_arg_conv;
36394         this_arg_conv.inner = untag_ptr(this_arg);
36395         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36396         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36397         this_arg_conv.is_owned = false;
36398         InvoiceFeatures_set_variable_length_onion_optional(&this_arg_conv);
36399 }
36400
36401 void  __attribute__((export_name("TS_InvoiceFeatures_set_variable_length_onion_required"))) TS_InvoiceFeatures_set_variable_length_onion_required(uint64_t this_arg) {
36402         LDKInvoiceFeatures this_arg_conv;
36403         this_arg_conv.inner = untag_ptr(this_arg);
36404         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36405         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36406         this_arg_conv.is_owned = false;
36407         InvoiceFeatures_set_variable_length_onion_required(&this_arg_conv);
36408 }
36409
36410 jboolean  __attribute__((export_name("TS_InvoiceFeatures_supports_variable_length_onion"))) TS_InvoiceFeatures_supports_variable_length_onion(uint64_t this_arg) {
36411         LDKInvoiceFeatures this_arg_conv;
36412         this_arg_conv.inner = untag_ptr(this_arg);
36413         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36414         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36415         this_arg_conv.is_owned = false;
36416         jboolean ret_conv = InvoiceFeatures_supports_variable_length_onion(&this_arg_conv);
36417         return ret_conv;
36418 }
36419
36420 jboolean  __attribute__((export_name("TS_InitFeatures_requires_variable_length_onion"))) TS_InitFeatures_requires_variable_length_onion(uint64_t this_arg) {
36421         LDKInitFeatures this_arg_conv;
36422         this_arg_conv.inner = untag_ptr(this_arg);
36423         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36424         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36425         this_arg_conv.is_owned = false;
36426         jboolean ret_conv = InitFeatures_requires_variable_length_onion(&this_arg_conv);
36427         return ret_conv;
36428 }
36429
36430 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_variable_length_onion"))) TS_NodeFeatures_requires_variable_length_onion(uint64_t this_arg) {
36431         LDKNodeFeatures this_arg_conv;
36432         this_arg_conv.inner = untag_ptr(this_arg);
36433         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36434         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36435         this_arg_conv.is_owned = false;
36436         jboolean ret_conv = NodeFeatures_requires_variable_length_onion(&this_arg_conv);
36437         return ret_conv;
36438 }
36439
36440 jboolean  __attribute__((export_name("TS_InvoiceFeatures_requires_variable_length_onion"))) TS_InvoiceFeatures_requires_variable_length_onion(uint64_t this_arg) {
36441         LDKInvoiceFeatures this_arg_conv;
36442         this_arg_conv.inner = untag_ptr(this_arg);
36443         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36444         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36445         this_arg_conv.is_owned = false;
36446         jboolean ret_conv = InvoiceFeatures_requires_variable_length_onion(&this_arg_conv);
36447         return ret_conv;
36448 }
36449
36450 void  __attribute__((export_name("TS_InitFeatures_set_static_remote_key_optional"))) TS_InitFeatures_set_static_remote_key_optional(uint64_t this_arg) {
36451         LDKInitFeatures this_arg_conv;
36452         this_arg_conv.inner = untag_ptr(this_arg);
36453         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36454         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36455         this_arg_conv.is_owned = false;
36456         InitFeatures_set_static_remote_key_optional(&this_arg_conv);
36457 }
36458
36459 void  __attribute__((export_name("TS_InitFeatures_set_static_remote_key_required"))) TS_InitFeatures_set_static_remote_key_required(uint64_t this_arg) {
36460         LDKInitFeatures this_arg_conv;
36461         this_arg_conv.inner = untag_ptr(this_arg);
36462         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36463         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36464         this_arg_conv.is_owned = false;
36465         InitFeatures_set_static_remote_key_required(&this_arg_conv);
36466 }
36467
36468 jboolean  __attribute__((export_name("TS_InitFeatures_supports_static_remote_key"))) TS_InitFeatures_supports_static_remote_key(uint64_t this_arg) {
36469         LDKInitFeatures this_arg_conv;
36470         this_arg_conv.inner = untag_ptr(this_arg);
36471         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36472         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36473         this_arg_conv.is_owned = false;
36474         jboolean ret_conv = InitFeatures_supports_static_remote_key(&this_arg_conv);
36475         return ret_conv;
36476 }
36477
36478 void  __attribute__((export_name("TS_NodeFeatures_set_static_remote_key_optional"))) TS_NodeFeatures_set_static_remote_key_optional(uint64_t this_arg) {
36479         LDKNodeFeatures this_arg_conv;
36480         this_arg_conv.inner = untag_ptr(this_arg);
36481         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36482         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36483         this_arg_conv.is_owned = false;
36484         NodeFeatures_set_static_remote_key_optional(&this_arg_conv);
36485 }
36486
36487 void  __attribute__((export_name("TS_NodeFeatures_set_static_remote_key_required"))) TS_NodeFeatures_set_static_remote_key_required(uint64_t this_arg) {
36488         LDKNodeFeatures this_arg_conv;
36489         this_arg_conv.inner = untag_ptr(this_arg);
36490         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36491         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36492         this_arg_conv.is_owned = false;
36493         NodeFeatures_set_static_remote_key_required(&this_arg_conv);
36494 }
36495
36496 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_static_remote_key"))) TS_NodeFeatures_supports_static_remote_key(uint64_t this_arg) {
36497         LDKNodeFeatures this_arg_conv;
36498         this_arg_conv.inner = untag_ptr(this_arg);
36499         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36500         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36501         this_arg_conv.is_owned = false;
36502         jboolean ret_conv = NodeFeatures_supports_static_remote_key(&this_arg_conv);
36503         return ret_conv;
36504 }
36505
36506 void  __attribute__((export_name("TS_ChannelTypeFeatures_set_static_remote_key_optional"))) TS_ChannelTypeFeatures_set_static_remote_key_optional(uint64_t this_arg) {
36507         LDKChannelTypeFeatures this_arg_conv;
36508         this_arg_conv.inner = untag_ptr(this_arg);
36509         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36510         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36511         this_arg_conv.is_owned = false;
36512         ChannelTypeFeatures_set_static_remote_key_optional(&this_arg_conv);
36513 }
36514
36515 void  __attribute__((export_name("TS_ChannelTypeFeatures_set_static_remote_key_required"))) TS_ChannelTypeFeatures_set_static_remote_key_required(uint64_t this_arg) {
36516         LDKChannelTypeFeatures this_arg_conv;
36517         this_arg_conv.inner = untag_ptr(this_arg);
36518         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36519         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36520         this_arg_conv.is_owned = false;
36521         ChannelTypeFeatures_set_static_remote_key_required(&this_arg_conv);
36522 }
36523
36524 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_supports_static_remote_key"))) TS_ChannelTypeFeatures_supports_static_remote_key(uint64_t this_arg) {
36525         LDKChannelTypeFeatures this_arg_conv;
36526         this_arg_conv.inner = untag_ptr(this_arg);
36527         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36528         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36529         this_arg_conv.is_owned = false;
36530         jboolean ret_conv = ChannelTypeFeatures_supports_static_remote_key(&this_arg_conv);
36531         return ret_conv;
36532 }
36533
36534 jboolean  __attribute__((export_name("TS_InitFeatures_requires_static_remote_key"))) TS_InitFeatures_requires_static_remote_key(uint64_t this_arg) {
36535         LDKInitFeatures this_arg_conv;
36536         this_arg_conv.inner = untag_ptr(this_arg);
36537         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36538         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36539         this_arg_conv.is_owned = false;
36540         jboolean ret_conv = InitFeatures_requires_static_remote_key(&this_arg_conv);
36541         return ret_conv;
36542 }
36543
36544 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_static_remote_key"))) TS_NodeFeatures_requires_static_remote_key(uint64_t this_arg) {
36545         LDKNodeFeatures this_arg_conv;
36546         this_arg_conv.inner = untag_ptr(this_arg);
36547         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36548         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36549         this_arg_conv.is_owned = false;
36550         jboolean ret_conv = NodeFeatures_requires_static_remote_key(&this_arg_conv);
36551         return ret_conv;
36552 }
36553
36554 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_requires_static_remote_key"))) TS_ChannelTypeFeatures_requires_static_remote_key(uint64_t this_arg) {
36555         LDKChannelTypeFeatures this_arg_conv;
36556         this_arg_conv.inner = untag_ptr(this_arg);
36557         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36558         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36559         this_arg_conv.is_owned = false;
36560         jboolean ret_conv = ChannelTypeFeatures_requires_static_remote_key(&this_arg_conv);
36561         return ret_conv;
36562 }
36563
36564 void  __attribute__((export_name("TS_InitFeatures_set_payment_secret_optional"))) TS_InitFeatures_set_payment_secret_optional(uint64_t this_arg) {
36565         LDKInitFeatures this_arg_conv;
36566         this_arg_conv.inner = untag_ptr(this_arg);
36567         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36568         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36569         this_arg_conv.is_owned = false;
36570         InitFeatures_set_payment_secret_optional(&this_arg_conv);
36571 }
36572
36573 void  __attribute__((export_name("TS_InitFeatures_set_payment_secret_required"))) TS_InitFeatures_set_payment_secret_required(uint64_t this_arg) {
36574         LDKInitFeatures this_arg_conv;
36575         this_arg_conv.inner = untag_ptr(this_arg);
36576         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36577         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36578         this_arg_conv.is_owned = false;
36579         InitFeatures_set_payment_secret_required(&this_arg_conv);
36580 }
36581
36582 jboolean  __attribute__((export_name("TS_InitFeatures_supports_payment_secret"))) TS_InitFeatures_supports_payment_secret(uint64_t this_arg) {
36583         LDKInitFeatures this_arg_conv;
36584         this_arg_conv.inner = untag_ptr(this_arg);
36585         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36586         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36587         this_arg_conv.is_owned = false;
36588         jboolean ret_conv = InitFeatures_supports_payment_secret(&this_arg_conv);
36589         return ret_conv;
36590 }
36591
36592 void  __attribute__((export_name("TS_NodeFeatures_set_payment_secret_optional"))) TS_NodeFeatures_set_payment_secret_optional(uint64_t this_arg) {
36593         LDKNodeFeatures this_arg_conv;
36594         this_arg_conv.inner = untag_ptr(this_arg);
36595         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36596         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36597         this_arg_conv.is_owned = false;
36598         NodeFeatures_set_payment_secret_optional(&this_arg_conv);
36599 }
36600
36601 void  __attribute__((export_name("TS_NodeFeatures_set_payment_secret_required"))) TS_NodeFeatures_set_payment_secret_required(uint64_t this_arg) {
36602         LDKNodeFeatures this_arg_conv;
36603         this_arg_conv.inner = untag_ptr(this_arg);
36604         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36605         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36606         this_arg_conv.is_owned = false;
36607         NodeFeatures_set_payment_secret_required(&this_arg_conv);
36608 }
36609
36610 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_payment_secret"))) TS_NodeFeatures_supports_payment_secret(uint64_t this_arg) {
36611         LDKNodeFeatures this_arg_conv;
36612         this_arg_conv.inner = untag_ptr(this_arg);
36613         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36614         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36615         this_arg_conv.is_owned = false;
36616         jboolean ret_conv = NodeFeatures_supports_payment_secret(&this_arg_conv);
36617         return ret_conv;
36618 }
36619
36620 void  __attribute__((export_name("TS_InvoiceFeatures_set_payment_secret_optional"))) TS_InvoiceFeatures_set_payment_secret_optional(uint64_t this_arg) {
36621         LDKInvoiceFeatures this_arg_conv;
36622         this_arg_conv.inner = untag_ptr(this_arg);
36623         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36624         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36625         this_arg_conv.is_owned = false;
36626         InvoiceFeatures_set_payment_secret_optional(&this_arg_conv);
36627 }
36628
36629 void  __attribute__((export_name("TS_InvoiceFeatures_set_payment_secret_required"))) TS_InvoiceFeatures_set_payment_secret_required(uint64_t this_arg) {
36630         LDKInvoiceFeatures this_arg_conv;
36631         this_arg_conv.inner = untag_ptr(this_arg);
36632         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36633         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36634         this_arg_conv.is_owned = false;
36635         InvoiceFeatures_set_payment_secret_required(&this_arg_conv);
36636 }
36637
36638 jboolean  __attribute__((export_name("TS_InvoiceFeatures_supports_payment_secret"))) TS_InvoiceFeatures_supports_payment_secret(uint64_t this_arg) {
36639         LDKInvoiceFeatures this_arg_conv;
36640         this_arg_conv.inner = untag_ptr(this_arg);
36641         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36642         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36643         this_arg_conv.is_owned = false;
36644         jboolean ret_conv = InvoiceFeatures_supports_payment_secret(&this_arg_conv);
36645         return ret_conv;
36646 }
36647
36648 jboolean  __attribute__((export_name("TS_InitFeatures_requires_payment_secret"))) TS_InitFeatures_requires_payment_secret(uint64_t this_arg) {
36649         LDKInitFeatures this_arg_conv;
36650         this_arg_conv.inner = untag_ptr(this_arg);
36651         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36652         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36653         this_arg_conv.is_owned = false;
36654         jboolean ret_conv = InitFeatures_requires_payment_secret(&this_arg_conv);
36655         return ret_conv;
36656 }
36657
36658 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_payment_secret"))) TS_NodeFeatures_requires_payment_secret(uint64_t this_arg) {
36659         LDKNodeFeatures this_arg_conv;
36660         this_arg_conv.inner = untag_ptr(this_arg);
36661         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36662         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36663         this_arg_conv.is_owned = false;
36664         jboolean ret_conv = NodeFeatures_requires_payment_secret(&this_arg_conv);
36665         return ret_conv;
36666 }
36667
36668 jboolean  __attribute__((export_name("TS_InvoiceFeatures_requires_payment_secret"))) TS_InvoiceFeatures_requires_payment_secret(uint64_t this_arg) {
36669         LDKInvoiceFeatures this_arg_conv;
36670         this_arg_conv.inner = untag_ptr(this_arg);
36671         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36672         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36673         this_arg_conv.is_owned = false;
36674         jboolean ret_conv = InvoiceFeatures_requires_payment_secret(&this_arg_conv);
36675         return ret_conv;
36676 }
36677
36678 void  __attribute__((export_name("TS_InitFeatures_set_basic_mpp_optional"))) TS_InitFeatures_set_basic_mpp_optional(uint64_t this_arg) {
36679         LDKInitFeatures this_arg_conv;
36680         this_arg_conv.inner = untag_ptr(this_arg);
36681         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36682         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36683         this_arg_conv.is_owned = false;
36684         InitFeatures_set_basic_mpp_optional(&this_arg_conv);
36685 }
36686
36687 void  __attribute__((export_name("TS_InitFeatures_set_basic_mpp_required"))) TS_InitFeatures_set_basic_mpp_required(uint64_t this_arg) {
36688         LDKInitFeatures this_arg_conv;
36689         this_arg_conv.inner = untag_ptr(this_arg);
36690         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36691         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36692         this_arg_conv.is_owned = false;
36693         InitFeatures_set_basic_mpp_required(&this_arg_conv);
36694 }
36695
36696 jboolean  __attribute__((export_name("TS_InitFeatures_supports_basic_mpp"))) TS_InitFeatures_supports_basic_mpp(uint64_t this_arg) {
36697         LDKInitFeatures this_arg_conv;
36698         this_arg_conv.inner = untag_ptr(this_arg);
36699         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36700         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36701         this_arg_conv.is_owned = false;
36702         jboolean ret_conv = InitFeatures_supports_basic_mpp(&this_arg_conv);
36703         return ret_conv;
36704 }
36705
36706 void  __attribute__((export_name("TS_NodeFeatures_set_basic_mpp_optional"))) TS_NodeFeatures_set_basic_mpp_optional(uint64_t this_arg) {
36707         LDKNodeFeatures this_arg_conv;
36708         this_arg_conv.inner = untag_ptr(this_arg);
36709         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36710         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36711         this_arg_conv.is_owned = false;
36712         NodeFeatures_set_basic_mpp_optional(&this_arg_conv);
36713 }
36714
36715 void  __attribute__((export_name("TS_NodeFeatures_set_basic_mpp_required"))) TS_NodeFeatures_set_basic_mpp_required(uint64_t this_arg) {
36716         LDKNodeFeatures this_arg_conv;
36717         this_arg_conv.inner = untag_ptr(this_arg);
36718         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36719         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36720         this_arg_conv.is_owned = false;
36721         NodeFeatures_set_basic_mpp_required(&this_arg_conv);
36722 }
36723
36724 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_basic_mpp"))) TS_NodeFeatures_supports_basic_mpp(uint64_t this_arg) {
36725         LDKNodeFeatures this_arg_conv;
36726         this_arg_conv.inner = untag_ptr(this_arg);
36727         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36728         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36729         this_arg_conv.is_owned = false;
36730         jboolean ret_conv = NodeFeatures_supports_basic_mpp(&this_arg_conv);
36731         return ret_conv;
36732 }
36733
36734 void  __attribute__((export_name("TS_InvoiceFeatures_set_basic_mpp_optional"))) TS_InvoiceFeatures_set_basic_mpp_optional(uint64_t this_arg) {
36735         LDKInvoiceFeatures this_arg_conv;
36736         this_arg_conv.inner = untag_ptr(this_arg);
36737         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36738         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36739         this_arg_conv.is_owned = false;
36740         InvoiceFeatures_set_basic_mpp_optional(&this_arg_conv);
36741 }
36742
36743 void  __attribute__((export_name("TS_InvoiceFeatures_set_basic_mpp_required"))) TS_InvoiceFeatures_set_basic_mpp_required(uint64_t this_arg) {
36744         LDKInvoiceFeatures this_arg_conv;
36745         this_arg_conv.inner = untag_ptr(this_arg);
36746         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36747         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36748         this_arg_conv.is_owned = false;
36749         InvoiceFeatures_set_basic_mpp_required(&this_arg_conv);
36750 }
36751
36752 jboolean  __attribute__((export_name("TS_InvoiceFeatures_supports_basic_mpp"))) TS_InvoiceFeatures_supports_basic_mpp(uint64_t this_arg) {
36753         LDKInvoiceFeatures this_arg_conv;
36754         this_arg_conv.inner = untag_ptr(this_arg);
36755         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36756         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36757         this_arg_conv.is_owned = false;
36758         jboolean ret_conv = InvoiceFeatures_supports_basic_mpp(&this_arg_conv);
36759         return ret_conv;
36760 }
36761
36762 jboolean  __attribute__((export_name("TS_InitFeatures_requires_basic_mpp"))) TS_InitFeatures_requires_basic_mpp(uint64_t this_arg) {
36763         LDKInitFeatures this_arg_conv;
36764         this_arg_conv.inner = untag_ptr(this_arg);
36765         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36766         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36767         this_arg_conv.is_owned = false;
36768         jboolean ret_conv = InitFeatures_requires_basic_mpp(&this_arg_conv);
36769         return ret_conv;
36770 }
36771
36772 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_basic_mpp"))) TS_NodeFeatures_requires_basic_mpp(uint64_t this_arg) {
36773         LDKNodeFeatures this_arg_conv;
36774         this_arg_conv.inner = untag_ptr(this_arg);
36775         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36776         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36777         this_arg_conv.is_owned = false;
36778         jboolean ret_conv = NodeFeatures_requires_basic_mpp(&this_arg_conv);
36779         return ret_conv;
36780 }
36781
36782 jboolean  __attribute__((export_name("TS_InvoiceFeatures_requires_basic_mpp"))) TS_InvoiceFeatures_requires_basic_mpp(uint64_t this_arg) {
36783         LDKInvoiceFeatures this_arg_conv;
36784         this_arg_conv.inner = untag_ptr(this_arg);
36785         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36786         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36787         this_arg_conv.is_owned = false;
36788         jboolean ret_conv = InvoiceFeatures_requires_basic_mpp(&this_arg_conv);
36789         return ret_conv;
36790 }
36791
36792 void  __attribute__((export_name("TS_InitFeatures_set_wumbo_optional"))) TS_InitFeatures_set_wumbo_optional(uint64_t this_arg) {
36793         LDKInitFeatures this_arg_conv;
36794         this_arg_conv.inner = untag_ptr(this_arg);
36795         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36796         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36797         this_arg_conv.is_owned = false;
36798         InitFeatures_set_wumbo_optional(&this_arg_conv);
36799 }
36800
36801 void  __attribute__((export_name("TS_InitFeatures_set_wumbo_required"))) TS_InitFeatures_set_wumbo_required(uint64_t this_arg) {
36802         LDKInitFeatures this_arg_conv;
36803         this_arg_conv.inner = untag_ptr(this_arg);
36804         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36805         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36806         this_arg_conv.is_owned = false;
36807         InitFeatures_set_wumbo_required(&this_arg_conv);
36808 }
36809
36810 jboolean  __attribute__((export_name("TS_InitFeatures_supports_wumbo"))) TS_InitFeatures_supports_wumbo(uint64_t this_arg) {
36811         LDKInitFeatures this_arg_conv;
36812         this_arg_conv.inner = untag_ptr(this_arg);
36813         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36814         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36815         this_arg_conv.is_owned = false;
36816         jboolean ret_conv = InitFeatures_supports_wumbo(&this_arg_conv);
36817         return ret_conv;
36818 }
36819
36820 void  __attribute__((export_name("TS_NodeFeatures_set_wumbo_optional"))) TS_NodeFeatures_set_wumbo_optional(uint64_t this_arg) {
36821         LDKNodeFeatures this_arg_conv;
36822         this_arg_conv.inner = untag_ptr(this_arg);
36823         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36824         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36825         this_arg_conv.is_owned = false;
36826         NodeFeatures_set_wumbo_optional(&this_arg_conv);
36827 }
36828
36829 void  __attribute__((export_name("TS_NodeFeatures_set_wumbo_required"))) TS_NodeFeatures_set_wumbo_required(uint64_t this_arg) {
36830         LDKNodeFeatures this_arg_conv;
36831         this_arg_conv.inner = untag_ptr(this_arg);
36832         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36833         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36834         this_arg_conv.is_owned = false;
36835         NodeFeatures_set_wumbo_required(&this_arg_conv);
36836 }
36837
36838 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_wumbo"))) TS_NodeFeatures_supports_wumbo(uint64_t this_arg) {
36839         LDKNodeFeatures this_arg_conv;
36840         this_arg_conv.inner = untag_ptr(this_arg);
36841         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36842         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36843         this_arg_conv.is_owned = false;
36844         jboolean ret_conv = NodeFeatures_supports_wumbo(&this_arg_conv);
36845         return ret_conv;
36846 }
36847
36848 jboolean  __attribute__((export_name("TS_InitFeatures_requires_wumbo"))) TS_InitFeatures_requires_wumbo(uint64_t this_arg) {
36849         LDKInitFeatures this_arg_conv;
36850         this_arg_conv.inner = untag_ptr(this_arg);
36851         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36852         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36853         this_arg_conv.is_owned = false;
36854         jboolean ret_conv = InitFeatures_requires_wumbo(&this_arg_conv);
36855         return ret_conv;
36856 }
36857
36858 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_wumbo"))) TS_NodeFeatures_requires_wumbo(uint64_t this_arg) {
36859         LDKNodeFeatures this_arg_conv;
36860         this_arg_conv.inner = untag_ptr(this_arg);
36861         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36862         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36863         this_arg_conv.is_owned = false;
36864         jboolean ret_conv = NodeFeatures_requires_wumbo(&this_arg_conv);
36865         return ret_conv;
36866 }
36867
36868 void  __attribute__((export_name("TS_InitFeatures_set_shutdown_any_segwit_optional"))) TS_InitFeatures_set_shutdown_any_segwit_optional(uint64_t this_arg) {
36869         LDKInitFeatures this_arg_conv;
36870         this_arg_conv.inner = untag_ptr(this_arg);
36871         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36872         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36873         this_arg_conv.is_owned = false;
36874         InitFeatures_set_shutdown_any_segwit_optional(&this_arg_conv);
36875 }
36876
36877 void  __attribute__((export_name("TS_InitFeatures_set_shutdown_any_segwit_required"))) TS_InitFeatures_set_shutdown_any_segwit_required(uint64_t this_arg) {
36878         LDKInitFeatures this_arg_conv;
36879         this_arg_conv.inner = untag_ptr(this_arg);
36880         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36881         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36882         this_arg_conv.is_owned = false;
36883         InitFeatures_set_shutdown_any_segwit_required(&this_arg_conv);
36884 }
36885
36886 jboolean  __attribute__((export_name("TS_InitFeatures_supports_shutdown_anysegwit"))) TS_InitFeatures_supports_shutdown_anysegwit(uint64_t this_arg) {
36887         LDKInitFeatures this_arg_conv;
36888         this_arg_conv.inner = untag_ptr(this_arg);
36889         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36890         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36891         this_arg_conv.is_owned = false;
36892         jboolean ret_conv = InitFeatures_supports_shutdown_anysegwit(&this_arg_conv);
36893         return ret_conv;
36894 }
36895
36896 void  __attribute__((export_name("TS_NodeFeatures_set_shutdown_any_segwit_optional"))) TS_NodeFeatures_set_shutdown_any_segwit_optional(uint64_t this_arg) {
36897         LDKNodeFeatures this_arg_conv;
36898         this_arg_conv.inner = untag_ptr(this_arg);
36899         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36900         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36901         this_arg_conv.is_owned = false;
36902         NodeFeatures_set_shutdown_any_segwit_optional(&this_arg_conv);
36903 }
36904
36905 void  __attribute__((export_name("TS_NodeFeatures_set_shutdown_any_segwit_required"))) TS_NodeFeatures_set_shutdown_any_segwit_required(uint64_t this_arg) {
36906         LDKNodeFeatures this_arg_conv;
36907         this_arg_conv.inner = untag_ptr(this_arg);
36908         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36909         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36910         this_arg_conv.is_owned = false;
36911         NodeFeatures_set_shutdown_any_segwit_required(&this_arg_conv);
36912 }
36913
36914 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_shutdown_anysegwit"))) TS_NodeFeatures_supports_shutdown_anysegwit(uint64_t this_arg) {
36915         LDKNodeFeatures this_arg_conv;
36916         this_arg_conv.inner = untag_ptr(this_arg);
36917         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36918         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36919         this_arg_conv.is_owned = false;
36920         jboolean ret_conv = NodeFeatures_supports_shutdown_anysegwit(&this_arg_conv);
36921         return ret_conv;
36922 }
36923
36924 jboolean  __attribute__((export_name("TS_InitFeatures_requires_shutdown_anysegwit"))) TS_InitFeatures_requires_shutdown_anysegwit(uint64_t this_arg) {
36925         LDKInitFeatures this_arg_conv;
36926         this_arg_conv.inner = untag_ptr(this_arg);
36927         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36928         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36929         this_arg_conv.is_owned = false;
36930         jboolean ret_conv = InitFeatures_requires_shutdown_anysegwit(&this_arg_conv);
36931         return ret_conv;
36932 }
36933
36934 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_shutdown_anysegwit"))) TS_NodeFeatures_requires_shutdown_anysegwit(uint64_t this_arg) {
36935         LDKNodeFeatures this_arg_conv;
36936         this_arg_conv.inner = untag_ptr(this_arg);
36937         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36938         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36939         this_arg_conv.is_owned = false;
36940         jboolean ret_conv = NodeFeatures_requires_shutdown_anysegwit(&this_arg_conv);
36941         return ret_conv;
36942 }
36943
36944 void  __attribute__((export_name("TS_InitFeatures_set_channel_type_optional"))) TS_InitFeatures_set_channel_type_optional(uint64_t this_arg) {
36945         LDKInitFeatures 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         InitFeatures_set_channel_type_optional(&this_arg_conv);
36951 }
36952
36953 void  __attribute__((export_name("TS_InitFeatures_set_channel_type_required"))) TS_InitFeatures_set_channel_type_required(uint64_t this_arg) {
36954         LDKInitFeatures 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         InitFeatures_set_channel_type_required(&this_arg_conv);
36960 }
36961
36962 jboolean  __attribute__((export_name("TS_InitFeatures_supports_channel_type"))) TS_InitFeatures_supports_channel_type(uint64_t this_arg) {
36963         LDKInitFeatures this_arg_conv;
36964         this_arg_conv.inner = untag_ptr(this_arg);
36965         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36966         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36967         this_arg_conv.is_owned = false;
36968         jboolean ret_conv = InitFeatures_supports_channel_type(&this_arg_conv);
36969         return ret_conv;
36970 }
36971
36972 void  __attribute__((export_name("TS_NodeFeatures_set_channel_type_optional"))) TS_NodeFeatures_set_channel_type_optional(uint64_t this_arg) {
36973         LDKNodeFeatures this_arg_conv;
36974         this_arg_conv.inner = untag_ptr(this_arg);
36975         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36976         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36977         this_arg_conv.is_owned = false;
36978         NodeFeatures_set_channel_type_optional(&this_arg_conv);
36979 }
36980
36981 void  __attribute__((export_name("TS_NodeFeatures_set_channel_type_required"))) TS_NodeFeatures_set_channel_type_required(uint64_t this_arg) {
36982         LDKNodeFeatures this_arg_conv;
36983         this_arg_conv.inner = untag_ptr(this_arg);
36984         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36985         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36986         this_arg_conv.is_owned = false;
36987         NodeFeatures_set_channel_type_required(&this_arg_conv);
36988 }
36989
36990 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_channel_type"))) TS_NodeFeatures_supports_channel_type(uint64_t this_arg) {
36991         LDKNodeFeatures this_arg_conv;
36992         this_arg_conv.inner = untag_ptr(this_arg);
36993         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36994         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36995         this_arg_conv.is_owned = false;
36996         jboolean ret_conv = NodeFeatures_supports_channel_type(&this_arg_conv);
36997         return ret_conv;
36998 }
36999
37000 jboolean  __attribute__((export_name("TS_InitFeatures_requires_channel_type"))) TS_InitFeatures_requires_channel_type(uint64_t this_arg) {
37001         LDKInitFeatures this_arg_conv;
37002         this_arg_conv.inner = untag_ptr(this_arg);
37003         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37004         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37005         this_arg_conv.is_owned = false;
37006         jboolean ret_conv = InitFeatures_requires_channel_type(&this_arg_conv);
37007         return ret_conv;
37008 }
37009
37010 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_channel_type"))) TS_NodeFeatures_requires_channel_type(uint64_t this_arg) {
37011         LDKNodeFeatures this_arg_conv;
37012         this_arg_conv.inner = untag_ptr(this_arg);
37013         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37014         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37015         this_arg_conv.is_owned = false;
37016         jboolean ret_conv = NodeFeatures_requires_channel_type(&this_arg_conv);
37017         return ret_conv;
37018 }
37019
37020 void  __attribute__((export_name("TS_InitFeatures_set_scid_privacy_optional"))) TS_InitFeatures_set_scid_privacy_optional(uint64_t this_arg) {
37021         LDKInitFeatures this_arg_conv;
37022         this_arg_conv.inner = untag_ptr(this_arg);
37023         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37024         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37025         this_arg_conv.is_owned = false;
37026         InitFeatures_set_scid_privacy_optional(&this_arg_conv);
37027 }
37028
37029 void  __attribute__((export_name("TS_InitFeatures_set_scid_privacy_required"))) TS_InitFeatures_set_scid_privacy_required(uint64_t this_arg) {
37030         LDKInitFeatures this_arg_conv;
37031         this_arg_conv.inner = untag_ptr(this_arg);
37032         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37033         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37034         this_arg_conv.is_owned = false;
37035         InitFeatures_set_scid_privacy_required(&this_arg_conv);
37036 }
37037
37038 jboolean  __attribute__((export_name("TS_InitFeatures_supports_scid_privacy"))) TS_InitFeatures_supports_scid_privacy(uint64_t this_arg) {
37039         LDKInitFeatures this_arg_conv;
37040         this_arg_conv.inner = untag_ptr(this_arg);
37041         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37042         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37043         this_arg_conv.is_owned = false;
37044         jboolean ret_conv = InitFeatures_supports_scid_privacy(&this_arg_conv);
37045         return ret_conv;
37046 }
37047
37048 void  __attribute__((export_name("TS_NodeFeatures_set_scid_privacy_optional"))) TS_NodeFeatures_set_scid_privacy_optional(uint64_t this_arg) {
37049         LDKNodeFeatures this_arg_conv;
37050         this_arg_conv.inner = untag_ptr(this_arg);
37051         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37052         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37053         this_arg_conv.is_owned = false;
37054         NodeFeatures_set_scid_privacy_optional(&this_arg_conv);
37055 }
37056
37057 void  __attribute__((export_name("TS_NodeFeatures_set_scid_privacy_required"))) TS_NodeFeatures_set_scid_privacy_required(uint64_t this_arg) {
37058         LDKNodeFeatures this_arg_conv;
37059         this_arg_conv.inner = untag_ptr(this_arg);
37060         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37061         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37062         this_arg_conv.is_owned = false;
37063         NodeFeatures_set_scid_privacy_required(&this_arg_conv);
37064 }
37065
37066 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_scid_privacy"))) TS_NodeFeatures_supports_scid_privacy(uint64_t this_arg) {
37067         LDKNodeFeatures this_arg_conv;
37068         this_arg_conv.inner = untag_ptr(this_arg);
37069         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37070         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37071         this_arg_conv.is_owned = false;
37072         jboolean ret_conv = NodeFeatures_supports_scid_privacy(&this_arg_conv);
37073         return ret_conv;
37074 }
37075
37076 void  __attribute__((export_name("TS_ChannelTypeFeatures_set_scid_privacy_optional"))) TS_ChannelTypeFeatures_set_scid_privacy_optional(uint64_t this_arg) {
37077         LDKChannelTypeFeatures this_arg_conv;
37078         this_arg_conv.inner = untag_ptr(this_arg);
37079         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37080         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37081         this_arg_conv.is_owned = false;
37082         ChannelTypeFeatures_set_scid_privacy_optional(&this_arg_conv);
37083 }
37084
37085 void  __attribute__((export_name("TS_ChannelTypeFeatures_set_scid_privacy_required"))) TS_ChannelTypeFeatures_set_scid_privacy_required(uint64_t this_arg) {
37086         LDKChannelTypeFeatures this_arg_conv;
37087         this_arg_conv.inner = untag_ptr(this_arg);
37088         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37089         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37090         this_arg_conv.is_owned = false;
37091         ChannelTypeFeatures_set_scid_privacy_required(&this_arg_conv);
37092 }
37093
37094 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_supports_scid_privacy"))) TS_ChannelTypeFeatures_supports_scid_privacy(uint64_t this_arg) {
37095         LDKChannelTypeFeatures this_arg_conv;
37096         this_arg_conv.inner = untag_ptr(this_arg);
37097         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37098         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37099         this_arg_conv.is_owned = false;
37100         jboolean ret_conv = ChannelTypeFeatures_supports_scid_privacy(&this_arg_conv);
37101         return ret_conv;
37102 }
37103
37104 jboolean  __attribute__((export_name("TS_InitFeatures_requires_scid_privacy"))) TS_InitFeatures_requires_scid_privacy(uint64_t this_arg) {
37105         LDKInitFeatures this_arg_conv;
37106         this_arg_conv.inner = untag_ptr(this_arg);
37107         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37108         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37109         this_arg_conv.is_owned = false;
37110         jboolean ret_conv = InitFeatures_requires_scid_privacy(&this_arg_conv);
37111         return ret_conv;
37112 }
37113
37114 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_scid_privacy"))) TS_NodeFeatures_requires_scid_privacy(uint64_t this_arg) {
37115         LDKNodeFeatures this_arg_conv;
37116         this_arg_conv.inner = untag_ptr(this_arg);
37117         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37118         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37119         this_arg_conv.is_owned = false;
37120         jboolean ret_conv = NodeFeatures_requires_scid_privacy(&this_arg_conv);
37121         return ret_conv;
37122 }
37123
37124 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_requires_scid_privacy"))) TS_ChannelTypeFeatures_requires_scid_privacy(uint64_t this_arg) {
37125         LDKChannelTypeFeatures this_arg_conv;
37126         this_arg_conv.inner = untag_ptr(this_arg);
37127         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37128         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37129         this_arg_conv.is_owned = false;
37130         jboolean ret_conv = ChannelTypeFeatures_requires_scid_privacy(&this_arg_conv);
37131         return ret_conv;
37132 }
37133
37134 void  __attribute__((export_name("TS_InitFeatures_set_zero_conf_optional"))) TS_InitFeatures_set_zero_conf_optional(uint64_t this_arg) {
37135         LDKInitFeatures this_arg_conv;
37136         this_arg_conv.inner = untag_ptr(this_arg);
37137         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37138         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37139         this_arg_conv.is_owned = false;
37140         InitFeatures_set_zero_conf_optional(&this_arg_conv);
37141 }
37142
37143 void  __attribute__((export_name("TS_InitFeatures_set_zero_conf_required"))) TS_InitFeatures_set_zero_conf_required(uint64_t this_arg) {
37144         LDKInitFeatures this_arg_conv;
37145         this_arg_conv.inner = untag_ptr(this_arg);
37146         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37147         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37148         this_arg_conv.is_owned = false;
37149         InitFeatures_set_zero_conf_required(&this_arg_conv);
37150 }
37151
37152 jboolean  __attribute__((export_name("TS_InitFeatures_supports_zero_conf"))) TS_InitFeatures_supports_zero_conf(uint64_t this_arg) {
37153         LDKInitFeatures this_arg_conv;
37154         this_arg_conv.inner = untag_ptr(this_arg);
37155         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37156         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37157         this_arg_conv.is_owned = false;
37158         jboolean ret_conv = InitFeatures_supports_zero_conf(&this_arg_conv);
37159         return ret_conv;
37160 }
37161
37162 void  __attribute__((export_name("TS_NodeFeatures_set_zero_conf_optional"))) TS_NodeFeatures_set_zero_conf_optional(uint64_t this_arg) {
37163         LDKNodeFeatures this_arg_conv;
37164         this_arg_conv.inner = untag_ptr(this_arg);
37165         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37166         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37167         this_arg_conv.is_owned = false;
37168         NodeFeatures_set_zero_conf_optional(&this_arg_conv);
37169 }
37170
37171 void  __attribute__((export_name("TS_NodeFeatures_set_zero_conf_required"))) TS_NodeFeatures_set_zero_conf_required(uint64_t this_arg) {
37172         LDKNodeFeatures this_arg_conv;
37173         this_arg_conv.inner = untag_ptr(this_arg);
37174         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37175         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37176         this_arg_conv.is_owned = false;
37177         NodeFeatures_set_zero_conf_required(&this_arg_conv);
37178 }
37179
37180 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_zero_conf"))) TS_NodeFeatures_supports_zero_conf(uint64_t this_arg) {
37181         LDKNodeFeatures this_arg_conv;
37182         this_arg_conv.inner = untag_ptr(this_arg);
37183         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37184         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37185         this_arg_conv.is_owned = false;
37186         jboolean ret_conv = NodeFeatures_supports_zero_conf(&this_arg_conv);
37187         return ret_conv;
37188 }
37189
37190 void  __attribute__((export_name("TS_ChannelTypeFeatures_set_zero_conf_optional"))) TS_ChannelTypeFeatures_set_zero_conf_optional(uint64_t this_arg) {
37191         LDKChannelTypeFeatures this_arg_conv;
37192         this_arg_conv.inner = untag_ptr(this_arg);
37193         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37194         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37195         this_arg_conv.is_owned = false;
37196         ChannelTypeFeatures_set_zero_conf_optional(&this_arg_conv);
37197 }
37198
37199 void  __attribute__((export_name("TS_ChannelTypeFeatures_set_zero_conf_required"))) TS_ChannelTypeFeatures_set_zero_conf_required(uint64_t this_arg) {
37200         LDKChannelTypeFeatures this_arg_conv;
37201         this_arg_conv.inner = untag_ptr(this_arg);
37202         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37203         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37204         this_arg_conv.is_owned = false;
37205         ChannelTypeFeatures_set_zero_conf_required(&this_arg_conv);
37206 }
37207
37208 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_supports_zero_conf"))) TS_ChannelTypeFeatures_supports_zero_conf(uint64_t this_arg) {
37209         LDKChannelTypeFeatures this_arg_conv;
37210         this_arg_conv.inner = untag_ptr(this_arg);
37211         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37212         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37213         this_arg_conv.is_owned = false;
37214         jboolean ret_conv = ChannelTypeFeatures_supports_zero_conf(&this_arg_conv);
37215         return ret_conv;
37216 }
37217
37218 jboolean  __attribute__((export_name("TS_InitFeatures_requires_zero_conf"))) TS_InitFeatures_requires_zero_conf(uint64_t this_arg) {
37219         LDKInitFeatures this_arg_conv;
37220         this_arg_conv.inner = untag_ptr(this_arg);
37221         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37222         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37223         this_arg_conv.is_owned = false;
37224         jboolean ret_conv = InitFeatures_requires_zero_conf(&this_arg_conv);
37225         return ret_conv;
37226 }
37227
37228 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_zero_conf"))) TS_NodeFeatures_requires_zero_conf(uint64_t this_arg) {
37229         LDKNodeFeatures this_arg_conv;
37230         this_arg_conv.inner = untag_ptr(this_arg);
37231         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37232         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37233         this_arg_conv.is_owned = false;
37234         jboolean ret_conv = NodeFeatures_requires_zero_conf(&this_arg_conv);
37235         return ret_conv;
37236 }
37237
37238 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_requires_zero_conf"))) TS_ChannelTypeFeatures_requires_zero_conf(uint64_t this_arg) {
37239         LDKChannelTypeFeatures this_arg_conv;
37240         this_arg_conv.inner = untag_ptr(this_arg);
37241         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37242         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37243         this_arg_conv.is_owned = false;
37244         jboolean ret_conv = ChannelTypeFeatures_requires_zero_conf(&this_arg_conv);
37245         return ret_conv;
37246 }
37247
37248 void  __attribute__((export_name("TS_NodeFeatures_set_keysend_optional"))) TS_NodeFeatures_set_keysend_optional(uint64_t this_arg) {
37249         LDKNodeFeatures this_arg_conv;
37250         this_arg_conv.inner = untag_ptr(this_arg);
37251         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37252         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37253         this_arg_conv.is_owned = false;
37254         NodeFeatures_set_keysend_optional(&this_arg_conv);
37255 }
37256
37257 void  __attribute__((export_name("TS_NodeFeatures_set_keysend_required"))) TS_NodeFeatures_set_keysend_required(uint64_t this_arg) {
37258         LDKNodeFeatures this_arg_conv;
37259         this_arg_conv.inner = untag_ptr(this_arg);
37260         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37261         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37262         this_arg_conv.is_owned = false;
37263         NodeFeatures_set_keysend_required(&this_arg_conv);
37264 }
37265
37266 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_keysend"))) TS_NodeFeatures_supports_keysend(uint64_t this_arg) {
37267         LDKNodeFeatures this_arg_conv;
37268         this_arg_conv.inner = untag_ptr(this_arg);
37269         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37270         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37271         this_arg_conv.is_owned = false;
37272         jboolean ret_conv = NodeFeatures_supports_keysend(&this_arg_conv);
37273         return ret_conv;
37274 }
37275
37276 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_keysend"))) TS_NodeFeatures_requires_keysend(uint64_t this_arg) {
37277         LDKNodeFeatures this_arg_conv;
37278         this_arg_conv.inner = untag_ptr(this_arg);
37279         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37280         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37281         this_arg_conv.is_owned = false;
37282         jboolean ret_conv = NodeFeatures_requires_keysend(&this_arg_conv);
37283         return ret_conv;
37284 }
37285
37286 void  __attribute__((export_name("TS_ShutdownScript_free"))) TS_ShutdownScript_free(uint64_t this_obj) {
37287         LDKShutdownScript this_obj_conv;
37288         this_obj_conv.inner = untag_ptr(this_obj);
37289         this_obj_conv.is_owned = ptr_is_owned(this_obj);
37290         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37291         ShutdownScript_free(this_obj_conv);
37292 }
37293
37294 static inline uint64_t ShutdownScript_clone_ptr(LDKShutdownScript *NONNULL_PTR arg) {
37295         LDKShutdownScript ret_var = ShutdownScript_clone(arg);
37296         uint64_t ret_ref = 0;
37297         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37298         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37299         return ret_ref;
37300 }
37301 int64_t  __attribute__((export_name("TS_ShutdownScript_clone_ptr"))) TS_ShutdownScript_clone_ptr(uint64_t arg) {
37302         LDKShutdownScript arg_conv;
37303         arg_conv.inner = untag_ptr(arg);
37304         arg_conv.is_owned = ptr_is_owned(arg);
37305         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
37306         arg_conv.is_owned = false;
37307         int64_t ret_conv = ShutdownScript_clone_ptr(&arg_conv);
37308         return ret_conv;
37309 }
37310
37311 uint64_t  __attribute__((export_name("TS_ShutdownScript_clone"))) TS_ShutdownScript_clone(uint64_t orig) {
37312         LDKShutdownScript orig_conv;
37313         orig_conv.inner = untag_ptr(orig);
37314         orig_conv.is_owned = ptr_is_owned(orig);
37315         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
37316         orig_conv.is_owned = false;
37317         LDKShutdownScript ret_var = ShutdownScript_clone(&orig_conv);
37318         uint64_t ret_ref = 0;
37319         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37320         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37321         return ret_ref;
37322 }
37323
37324 void  __attribute__((export_name("TS_InvalidShutdownScript_free"))) TS_InvalidShutdownScript_free(uint64_t this_obj) {
37325         LDKInvalidShutdownScript this_obj_conv;
37326         this_obj_conv.inner = untag_ptr(this_obj);
37327         this_obj_conv.is_owned = ptr_is_owned(this_obj);
37328         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37329         InvalidShutdownScript_free(this_obj_conv);
37330 }
37331
37332 int8_tArray  __attribute__((export_name("TS_InvalidShutdownScript_get_script"))) TS_InvalidShutdownScript_get_script(uint64_t this_ptr) {
37333         LDKInvalidShutdownScript this_ptr_conv;
37334         this_ptr_conv.inner = untag_ptr(this_ptr);
37335         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37336         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37337         this_ptr_conv.is_owned = false;
37338         LDKu8slice ret_var = InvalidShutdownScript_get_script(&this_ptr_conv);
37339         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
37340         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
37341         return ret_arr;
37342 }
37343
37344 void  __attribute__((export_name("TS_InvalidShutdownScript_set_script"))) TS_InvalidShutdownScript_set_script(uint64_t this_ptr, int8_tArray val) {
37345         LDKInvalidShutdownScript this_ptr_conv;
37346         this_ptr_conv.inner = untag_ptr(this_ptr);
37347         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37348         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37349         this_ptr_conv.is_owned = false;
37350         LDKCVec_u8Z val_ref;
37351         val_ref.datalen = val->arr_len;
37352         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
37353         memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
37354         InvalidShutdownScript_set_script(&this_ptr_conv, val_ref);
37355 }
37356
37357 uint64_t  __attribute__((export_name("TS_InvalidShutdownScript_new"))) TS_InvalidShutdownScript_new(int8_tArray script_arg) {
37358         LDKCVec_u8Z script_arg_ref;
37359         script_arg_ref.datalen = script_arg->arr_len;
37360         script_arg_ref.data = MALLOC(script_arg_ref.datalen, "LDKCVec_u8Z Bytes");
37361         memcpy(script_arg_ref.data, script_arg->elems, script_arg_ref.datalen); FREE(script_arg);
37362         LDKInvalidShutdownScript ret_var = InvalidShutdownScript_new(script_arg_ref);
37363         uint64_t ret_ref = 0;
37364         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37365         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37366         return ret_ref;
37367 }
37368
37369 static inline uint64_t InvalidShutdownScript_clone_ptr(LDKInvalidShutdownScript *NONNULL_PTR arg) {
37370         LDKInvalidShutdownScript ret_var = InvalidShutdownScript_clone(arg);
37371         uint64_t ret_ref = 0;
37372         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37373         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37374         return ret_ref;
37375 }
37376 int64_t  __attribute__((export_name("TS_InvalidShutdownScript_clone_ptr"))) TS_InvalidShutdownScript_clone_ptr(uint64_t arg) {
37377         LDKInvalidShutdownScript arg_conv;
37378         arg_conv.inner = untag_ptr(arg);
37379         arg_conv.is_owned = ptr_is_owned(arg);
37380         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
37381         arg_conv.is_owned = false;
37382         int64_t ret_conv = InvalidShutdownScript_clone_ptr(&arg_conv);
37383         return ret_conv;
37384 }
37385
37386 uint64_t  __attribute__((export_name("TS_InvalidShutdownScript_clone"))) TS_InvalidShutdownScript_clone(uint64_t orig) {
37387         LDKInvalidShutdownScript orig_conv;
37388         orig_conv.inner = untag_ptr(orig);
37389         orig_conv.is_owned = ptr_is_owned(orig);
37390         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
37391         orig_conv.is_owned = false;
37392         LDKInvalidShutdownScript ret_var = InvalidShutdownScript_clone(&orig_conv);
37393         uint64_t ret_ref = 0;
37394         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37395         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37396         return ret_ref;
37397 }
37398
37399 int8_tArray  __attribute__((export_name("TS_ShutdownScript_write"))) TS_ShutdownScript_write(uint64_t obj) {
37400         LDKShutdownScript obj_conv;
37401         obj_conv.inner = untag_ptr(obj);
37402         obj_conv.is_owned = ptr_is_owned(obj);
37403         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
37404         obj_conv.is_owned = false;
37405         LDKCVec_u8Z ret_var = ShutdownScript_write(&obj_conv);
37406         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
37407         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
37408         CVec_u8Z_free(ret_var);
37409         return ret_arr;
37410 }
37411
37412 uint64_t  __attribute__((export_name("TS_ShutdownScript_read"))) TS_ShutdownScript_read(int8_tArray ser) {
37413         LDKu8slice ser_ref;
37414         ser_ref.datalen = ser->arr_len;
37415         ser_ref.data = ser->elems;
37416         LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
37417         *ret_conv = ShutdownScript_read(ser_ref);
37418         FREE(ser);
37419         return tag_ptr(ret_conv, true);
37420 }
37421
37422 uint64_t  __attribute__((export_name("TS_ShutdownScript_new_p2wpkh"))) TS_ShutdownScript_new_p2wpkh(int8_tArray pubkey_hash) {
37423         unsigned char pubkey_hash_arr[20];
37424         CHECK(pubkey_hash->arr_len == 20);
37425         memcpy(pubkey_hash_arr, pubkey_hash->elems, 20); FREE(pubkey_hash);
37426         unsigned char (*pubkey_hash_ref)[20] = &pubkey_hash_arr;
37427         LDKShutdownScript ret_var = ShutdownScript_new_p2wpkh(pubkey_hash_ref);
37428         uint64_t ret_ref = 0;
37429         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37430         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37431         return ret_ref;
37432 }
37433
37434 uint64_t  __attribute__((export_name("TS_ShutdownScript_new_p2wsh"))) TS_ShutdownScript_new_p2wsh(int8_tArray script_hash) {
37435         unsigned char script_hash_arr[32];
37436         CHECK(script_hash->arr_len == 32);
37437         memcpy(script_hash_arr, script_hash->elems, 32); FREE(script_hash);
37438         unsigned char (*script_hash_ref)[32] = &script_hash_arr;
37439         LDKShutdownScript ret_var = ShutdownScript_new_p2wsh(script_hash_ref);
37440         uint64_t ret_ref = 0;
37441         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37442         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37443         return ret_ref;
37444 }
37445
37446 uint64_t  __attribute__((export_name("TS_ShutdownScript_new_witness_program"))) TS_ShutdownScript_new_witness_program(int8_t version, int8_tArray program) {
37447         
37448         LDKu8slice program_ref;
37449         program_ref.datalen = program->arr_len;
37450         program_ref.data = program->elems;
37451         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
37452         *ret_conv = ShutdownScript_new_witness_program((LDKWitnessVersion){ ._0 = version }, program_ref);
37453         FREE(program);
37454         return tag_ptr(ret_conv, true);
37455 }
37456
37457 int8_tArray  __attribute__((export_name("TS_ShutdownScript_into_inner"))) TS_ShutdownScript_into_inner(uint64_t this_arg) {
37458         LDKShutdownScript this_arg_conv;
37459         this_arg_conv.inner = untag_ptr(this_arg);
37460         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37461         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37462         this_arg_conv = ShutdownScript_clone(&this_arg_conv);
37463         LDKCVec_u8Z ret_var = ShutdownScript_into_inner(this_arg_conv);
37464         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
37465         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
37466         CVec_u8Z_free(ret_var);
37467         return ret_arr;
37468 }
37469
37470 int8_tArray  __attribute__((export_name("TS_ShutdownScript_as_legacy_pubkey"))) TS_ShutdownScript_as_legacy_pubkey(uint64_t this_arg) {
37471         LDKShutdownScript this_arg_conv;
37472         this_arg_conv.inner = untag_ptr(this_arg);
37473         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37474         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37475         this_arg_conv.is_owned = false;
37476         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
37477         memcpy(ret_arr->elems, ShutdownScript_as_legacy_pubkey(&this_arg_conv).compressed_form, 33);
37478         return ret_arr;
37479 }
37480
37481 jboolean  __attribute__((export_name("TS_ShutdownScript_is_compatible"))) TS_ShutdownScript_is_compatible(uint64_t this_arg, uint64_t features) {
37482         LDKShutdownScript this_arg_conv;
37483         this_arg_conv.inner = untag_ptr(this_arg);
37484         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37485         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37486         this_arg_conv.is_owned = false;
37487         LDKInitFeatures features_conv;
37488         features_conv.inner = untag_ptr(features);
37489         features_conv.is_owned = ptr_is_owned(features);
37490         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_conv);
37491         features_conv.is_owned = false;
37492         jboolean ret_conv = ShutdownScript_is_compatible(&this_arg_conv, &features_conv);
37493         return ret_conv;
37494 }
37495
37496 void  __attribute__((export_name("TS_CustomMessageReader_free"))) TS_CustomMessageReader_free(uint64_t this_ptr) {
37497         if (!ptr_is_owned(this_ptr)) return;
37498         void* this_ptr_ptr = untag_ptr(this_ptr);
37499         CHECK_ACCESS(this_ptr_ptr);
37500         LDKCustomMessageReader this_ptr_conv = *(LDKCustomMessageReader*)(this_ptr_ptr);
37501         FREE(untag_ptr(this_ptr));
37502         CustomMessageReader_free(this_ptr_conv);
37503 }
37504
37505 static inline uint64_t Type_clone_ptr(LDKType *NONNULL_PTR arg) {
37506         LDKType* ret_ret = MALLOC(sizeof(LDKType), "LDKType");
37507         *ret_ret = Type_clone(arg);
37508         return tag_ptr(ret_ret, true);
37509 }
37510 int64_t  __attribute__((export_name("TS_Type_clone_ptr"))) TS_Type_clone_ptr(uint64_t arg) {
37511         void* arg_ptr = untag_ptr(arg);
37512         if (ptr_is_owned(arg)) { CHECK_ACCESS(arg_ptr); }
37513         LDKType* arg_conv = (LDKType*)arg_ptr;
37514         int64_t ret_conv = Type_clone_ptr(arg_conv);
37515         return ret_conv;
37516 }
37517
37518 uint64_t  __attribute__((export_name("TS_Type_clone"))) TS_Type_clone(uint64_t orig) {
37519         void* orig_ptr = untag_ptr(orig);
37520         if (ptr_is_owned(orig)) { CHECK_ACCESS(orig_ptr); }
37521         LDKType* orig_conv = (LDKType*)orig_ptr;
37522         LDKType* ret_ret = MALLOC(sizeof(LDKType), "LDKType");
37523         *ret_ret = Type_clone(orig_conv);
37524         return tag_ptr(ret_ret, true);
37525 }
37526
37527 void  __attribute__((export_name("TS_Type_free"))) TS_Type_free(uint64_t this_ptr) {
37528         if (!ptr_is_owned(this_ptr)) return;
37529         void* this_ptr_ptr = untag_ptr(this_ptr);
37530         CHECK_ACCESS(this_ptr_ptr);
37531         LDKType this_ptr_conv = *(LDKType*)(this_ptr_ptr);
37532         FREE(untag_ptr(this_ptr));
37533         Type_free(this_ptr_conv);
37534 }
37535
37536 void  __attribute__((export_name("TS_NodeId_free"))) TS_NodeId_free(uint64_t this_obj) {
37537         LDKNodeId this_obj_conv;
37538         this_obj_conv.inner = untag_ptr(this_obj);
37539         this_obj_conv.is_owned = ptr_is_owned(this_obj);
37540         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37541         NodeId_free(this_obj_conv);
37542 }
37543
37544 static inline uint64_t NodeId_clone_ptr(LDKNodeId *NONNULL_PTR arg) {
37545         LDKNodeId ret_var = NodeId_clone(arg);
37546         uint64_t ret_ref = 0;
37547         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37548         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37549         return ret_ref;
37550 }
37551 int64_t  __attribute__((export_name("TS_NodeId_clone_ptr"))) TS_NodeId_clone_ptr(uint64_t arg) {
37552         LDKNodeId arg_conv;
37553         arg_conv.inner = untag_ptr(arg);
37554         arg_conv.is_owned = ptr_is_owned(arg);
37555         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
37556         arg_conv.is_owned = false;
37557         int64_t ret_conv = NodeId_clone_ptr(&arg_conv);
37558         return ret_conv;
37559 }
37560
37561 uint64_t  __attribute__((export_name("TS_NodeId_clone"))) TS_NodeId_clone(uint64_t orig) {
37562         LDKNodeId orig_conv;
37563         orig_conv.inner = untag_ptr(orig);
37564         orig_conv.is_owned = ptr_is_owned(orig);
37565         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
37566         orig_conv.is_owned = false;
37567         LDKNodeId ret_var = NodeId_clone(&orig_conv);
37568         uint64_t ret_ref = 0;
37569         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37570         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37571         return ret_ref;
37572 }
37573
37574 uint64_t  __attribute__((export_name("TS_NodeId_from_pubkey"))) TS_NodeId_from_pubkey(int8_tArray pubkey) {
37575         LDKPublicKey pubkey_ref;
37576         CHECK(pubkey->arr_len == 33);
37577         memcpy(pubkey_ref.compressed_form, pubkey->elems, 33); FREE(pubkey);
37578         LDKNodeId ret_var = NodeId_from_pubkey(pubkey_ref);
37579         uint64_t ret_ref = 0;
37580         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37581         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37582         return ret_ref;
37583 }
37584
37585 int8_tArray  __attribute__((export_name("TS_NodeId_as_slice"))) TS_NodeId_as_slice(uint64_t this_arg) {
37586         LDKNodeId this_arg_conv;
37587         this_arg_conv.inner = untag_ptr(this_arg);
37588         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37589         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37590         this_arg_conv.is_owned = false;
37591         LDKu8slice ret_var = NodeId_as_slice(&this_arg_conv);
37592         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
37593         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
37594         return ret_arr;
37595 }
37596
37597 int64_t  __attribute__((export_name("TS_NodeId_hash"))) TS_NodeId_hash(uint64_t o) {
37598         LDKNodeId o_conv;
37599         o_conv.inner = untag_ptr(o);
37600         o_conv.is_owned = ptr_is_owned(o);
37601         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
37602         o_conv.is_owned = false;
37603         int64_t ret_conv = NodeId_hash(&o_conv);
37604         return ret_conv;
37605 }
37606
37607 int8_tArray  __attribute__((export_name("TS_NodeId_write"))) TS_NodeId_write(uint64_t obj) {
37608         LDKNodeId obj_conv;
37609         obj_conv.inner = untag_ptr(obj);
37610         obj_conv.is_owned = ptr_is_owned(obj);
37611         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
37612         obj_conv.is_owned = false;
37613         LDKCVec_u8Z ret_var = NodeId_write(&obj_conv);
37614         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
37615         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
37616         CVec_u8Z_free(ret_var);
37617         return ret_arr;
37618 }
37619
37620 uint64_t  __attribute__((export_name("TS_NodeId_read"))) TS_NodeId_read(int8_tArray ser) {
37621         LDKu8slice ser_ref;
37622         ser_ref.datalen = ser->arr_len;
37623         ser_ref.data = ser->elems;
37624         LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
37625         *ret_conv = NodeId_read(ser_ref);
37626         FREE(ser);
37627         return tag_ptr(ret_conv, true);
37628 }
37629
37630 void  __attribute__((export_name("TS_NetworkGraph_free"))) TS_NetworkGraph_free(uint64_t this_obj) {
37631         LDKNetworkGraph this_obj_conv;
37632         this_obj_conv.inner = untag_ptr(this_obj);
37633         this_obj_conv.is_owned = ptr_is_owned(this_obj);
37634         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37635         NetworkGraph_free(this_obj_conv);
37636 }
37637
37638 void  __attribute__((export_name("TS_ReadOnlyNetworkGraph_free"))) TS_ReadOnlyNetworkGraph_free(uint64_t this_obj) {
37639         LDKReadOnlyNetworkGraph this_obj_conv;
37640         this_obj_conv.inner = untag_ptr(this_obj);
37641         this_obj_conv.is_owned = ptr_is_owned(this_obj);
37642         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37643         ReadOnlyNetworkGraph_free(this_obj_conv);
37644 }
37645
37646 void  __attribute__((export_name("TS_NetworkUpdate_free"))) TS_NetworkUpdate_free(uint64_t this_ptr) {
37647         if (!ptr_is_owned(this_ptr)) return;
37648         void* this_ptr_ptr = untag_ptr(this_ptr);
37649         CHECK_ACCESS(this_ptr_ptr);
37650         LDKNetworkUpdate this_ptr_conv = *(LDKNetworkUpdate*)(this_ptr_ptr);
37651         FREE(untag_ptr(this_ptr));
37652         NetworkUpdate_free(this_ptr_conv);
37653 }
37654
37655 static inline uint64_t NetworkUpdate_clone_ptr(LDKNetworkUpdate *NONNULL_PTR arg) {
37656         LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
37657         *ret_copy = NetworkUpdate_clone(arg);
37658         uint64_t ret_ref = tag_ptr(ret_copy, true);
37659         return ret_ref;
37660 }
37661 int64_t  __attribute__((export_name("TS_NetworkUpdate_clone_ptr"))) TS_NetworkUpdate_clone_ptr(uint64_t arg) {
37662         LDKNetworkUpdate* arg_conv = (LDKNetworkUpdate*)untag_ptr(arg);
37663         int64_t ret_conv = NetworkUpdate_clone_ptr(arg_conv);
37664         return ret_conv;
37665 }
37666
37667 uint64_t  __attribute__((export_name("TS_NetworkUpdate_clone"))) TS_NetworkUpdate_clone(uint64_t orig) {
37668         LDKNetworkUpdate* orig_conv = (LDKNetworkUpdate*)untag_ptr(orig);
37669         LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
37670         *ret_copy = NetworkUpdate_clone(orig_conv);
37671         uint64_t ret_ref = tag_ptr(ret_copy, true);
37672         return ret_ref;
37673 }
37674
37675 uint64_t  __attribute__((export_name("TS_NetworkUpdate_channel_update_message"))) TS_NetworkUpdate_channel_update_message(uint64_t msg) {
37676         LDKChannelUpdate msg_conv;
37677         msg_conv.inner = untag_ptr(msg);
37678         msg_conv.is_owned = ptr_is_owned(msg);
37679         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
37680         msg_conv = ChannelUpdate_clone(&msg_conv);
37681         LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
37682         *ret_copy = NetworkUpdate_channel_update_message(msg_conv);
37683         uint64_t ret_ref = tag_ptr(ret_copy, true);
37684         return ret_ref;
37685 }
37686
37687 uint64_t  __attribute__((export_name("TS_NetworkUpdate_channel_failure"))) TS_NetworkUpdate_channel_failure(int64_t short_channel_id, jboolean is_permanent) {
37688         LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
37689         *ret_copy = NetworkUpdate_channel_failure(short_channel_id, is_permanent);
37690         uint64_t ret_ref = tag_ptr(ret_copy, true);
37691         return ret_ref;
37692 }
37693
37694 uint64_t  __attribute__((export_name("TS_NetworkUpdate_node_failure"))) TS_NetworkUpdate_node_failure(int8_tArray node_id, jboolean is_permanent) {
37695         LDKPublicKey node_id_ref;
37696         CHECK(node_id->arr_len == 33);
37697         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
37698         LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
37699         *ret_copy = NetworkUpdate_node_failure(node_id_ref, is_permanent);
37700         uint64_t ret_ref = tag_ptr(ret_copy, true);
37701         return ret_ref;
37702 }
37703
37704 int8_tArray  __attribute__((export_name("TS_NetworkUpdate_write"))) TS_NetworkUpdate_write(uint64_t obj) {
37705         LDKNetworkUpdate* obj_conv = (LDKNetworkUpdate*)untag_ptr(obj);
37706         LDKCVec_u8Z ret_var = NetworkUpdate_write(obj_conv);
37707         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
37708         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
37709         CVec_u8Z_free(ret_var);
37710         return ret_arr;
37711 }
37712
37713 uint64_t  __attribute__((export_name("TS_NetworkUpdate_read"))) TS_NetworkUpdate_read(int8_tArray ser) {
37714         LDKu8slice ser_ref;
37715         ser_ref.datalen = ser->arr_len;
37716         ser_ref.data = ser->elems;
37717         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
37718         *ret_conv = NetworkUpdate_read(ser_ref);
37719         FREE(ser);
37720         return tag_ptr(ret_conv, true);
37721 }
37722
37723 void  __attribute__((export_name("TS_P2PGossipSync_free"))) TS_P2PGossipSync_free(uint64_t this_obj) {
37724         LDKP2PGossipSync this_obj_conv;
37725         this_obj_conv.inner = untag_ptr(this_obj);
37726         this_obj_conv.is_owned = ptr_is_owned(this_obj);
37727         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37728         P2PGossipSync_free(this_obj_conv);
37729 }
37730
37731 uint64_t  __attribute__((export_name("TS_P2PGossipSync_new"))) TS_P2PGossipSync_new(uint64_t network_graph, uint64_t chain_access, uint64_t logger) {
37732         LDKNetworkGraph network_graph_conv;
37733         network_graph_conv.inner = untag_ptr(network_graph);
37734         network_graph_conv.is_owned = ptr_is_owned(network_graph);
37735         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
37736         network_graph_conv.is_owned = false;
37737         void* chain_access_ptr = untag_ptr(chain_access);
37738         CHECK_ACCESS(chain_access_ptr);
37739         LDKCOption_AccessZ chain_access_conv = *(LDKCOption_AccessZ*)(chain_access_ptr);
37740         // WARNING: we may need a move here but no clone is available for LDKCOption_AccessZ
37741         if (chain_access_conv.tag == LDKCOption_AccessZ_Some) {
37742                 // Manually implement clone for Java trait instances
37743                 if (chain_access_conv.some.free == LDKAccess_JCalls_free) {
37744                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
37745                         LDKAccess_JCalls_cloned(&chain_access_conv.some);
37746                 }
37747         }
37748         void* logger_ptr = untag_ptr(logger);
37749         CHECK_ACCESS(logger_ptr);
37750         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
37751         if (logger_conv.free == LDKLogger_JCalls_free) {
37752                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
37753                 LDKLogger_JCalls_cloned(&logger_conv);
37754         }
37755         LDKP2PGossipSync ret_var = P2PGossipSync_new(&network_graph_conv, chain_access_conv, logger_conv);
37756         uint64_t ret_ref = 0;
37757         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37758         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37759         return ret_ref;
37760 }
37761
37762 void  __attribute__((export_name("TS_P2PGossipSync_add_chain_access"))) TS_P2PGossipSync_add_chain_access(uint64_t this_arg, uint64_t chain_access) {
37763         LDKP2PGossipSync this_arg_conv;
37764         this_arg_conv.inner = untag_ptr(this_arg);
37765         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37766         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37767         this_arg_conv.is_owned = false;
37768         void* chain_access_ptr = untag_ptr(chain_access);
37769         CHECK_ACCESS(chain_access_ptr);
37770         LDKCOption_AccessZ chain_access_conv = *(LDKCOption_AccessZ*)(chain_access_ptr);
37771         // WARNING: we may need a move here but no clone is available for LDKCOption_AccessZ
37772         if (chain_access_conv.tag == LDKCOption_AccessZ_Some) {
37773                 // Manually implement clone for Java trait instances
37774                 if (chain_access_conv.some.free == LDKAccess_JCalls_free) {
37775                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
37776                         LDKAccess_JCalls_cloned(&chain_access_conv.some);
37777                 }
37778         }
37779         P2PGossipSync_add_chain_access(&this_arg_conv, chain_access_conv);
37780 }
37781
37782 uint64_t  __attribute__((export_name("TS_NetworkGraph_as_EventHandler"))) TS_NetworkGraph_as_EventHandler(uint64_t this_arg) {
37783         LDKNetworkGraph this_arg_conv;
37784         this_arg_conv.inner = untag_ptr(this_arg);
37785         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37786         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37787         this_arg_conv.is_owned = false;
37788         LDKEventHandler* ret_ret = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
37789         *ret_ret = NetworkGraph_as_EventHandler(&this_arg_conv);
37790         return tag_ptr(ret_ret, true);
37791 }
37792
37793 uint64_t  __attribute__((export_name("TS_P2PGossipSync_as_RoutingMessageHandler"))) TS_P2PGossipSync_as_RoutingMessageHandler(uint64_t this_arg) {
37794         LDKP2PGossipSync this_arg_conv;
37795         this_arg_conv.inner = untag_ptr(this_arg);
37796         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37797         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37798         this_arg_conv.is_owned = false;
37799         LDKRoutingMessageHandler* ret_ret = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
37800         *ret_ret = P2PGossipSync_as_RoutingMessageHandler(&this_arg_conv);
37801         return tag_ptr(ret_ret, true);
37802 }
37803
37804 uint64_t  __attribute__((export_name("TS_P2PGossipSync_as_MessageSendEventsProvider"))) TS_P2PGossipSync_as_MessageSendEventsProvider(uint64_t this_arg) {
37805         LDKP2PGossipSync this_arg_conv;
37806         this_arg_conv.inner = untag_ptr(this_arg);
37807         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37808         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37809         this_arg_conv.is_owned = false;
37810         LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
37811         *ret_ret = P2PGossipSync_as_MessageSendEventsProvider(&this_arg_conv);
37812         return tag_ptr(ret_ret, true);
37813 }
37814
37815 void  __attribute__((export_name("TS_ChannelUpdateInfo_free"))) TS_ChannelUpdateInfo_free(uint64_t this_obj) {
37816         LDKChannelUpdateInfo this_obj_conv;
37817         this_obj_conv.inner = untag_ptr(this_obj);
37818         this_obj_conv.is_owned = ptr_is_owned(this_obj);
37819         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37820         ChannelUpdateInfo_free(this_obj_conv);
37821 }
37822
37823 int32_t  __attribute__((export_name("TS_ChannelUpdateInfo_get_last_update"))) TS_ChannelUpdateInfo_get_last_update(uint64_t this_ptr) {
37824         LDKChannelUpdateInfo this_ptr_conv;
37825         this_ptr_conv.inner = untag_ptr(this_ptr);
37826         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37827         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37828         this_ptr_conv.is_owned = false;
37829         int32_t ret_conv = ChannelUpdateInfo_get_last_update(&this_ptr_conv);
37830         return ret_conv;
37831 }
37832
37833 void  __attribute__((export_name("TS_ChannelUpdateInfo_set_last_update"))) TS_ChannelUpdateInfo_set_last_update(uint64_t this_ptr, int32_t val) {
37834         LDKChannelUpdateInfo this_ptr_conv;
37835         this_ptr_conv.inner = untag_ptr(this_ptr);
37836         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37837         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37838         this_ptr_conv.is_owned = false;
37839         ChannelUpdateInfo_set_last_update(&this_ptr_conv, val);
37840 }
37841
37842 jboolean  __attribute__((export_name("TS_ChannelUpdateInfo_get_enabled"))) TS_ChannelUpdateInfo_get_enabled(uint64_t this_ptr) {
37843         LDKChannelUpdateInfo this_ptr_conv;
37844         this_ptr_conv.inner = untag_ptr(this_ptr);
37845         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37846         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37847         this_ptr_conv.is_owned = false;
37848         jboolean ret_conv = ChannelUpdateInfo_get_enabled(&this_ptr_conv);
37849         return ret_conv;
37850 }
37851
37852 void  __attribute__((export_name("TS_ChannelUpdateInfo_set_enabled"))) TS_ChannelUpdateInfo_set_enabled(uint64_t this_ptr, jboolean val) {
37853         LDKChannelUpdateInfo this_ptr_conv;
37854         this_ptr_conv.inner = untag_ptr(this_ptr);
37855         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37856         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37857         this_ptr_conv.is_owned = false;
37858         ChannelUpdateInfo_set_enabled(&this_ptr_conv, val);
37859 }
37860
37861 int16_t  __attribute__((export_name("TS_ChannelUpdateInfo_get_cltv_expiry_delta"))) TS_ChannelUpdateInfo_get_cltv_expiry_delta(uint64_t this_ptr) {
37862         LDKChannelUpdateInfo this_ptr_conv;
37863         this_ptr_conv.inner = untag_ptr(this_ptr);
37864         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37865         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37866         this_ptr_conv.is_owned = false;
37867         int16_t ret_conv = ChannelUpdateInfo_get_cltv_expiry_delta(&this_ptr_conv);
37868         return ret_conv;
37869 }
37870
37871 void  __attribute__((export_name("TS_ChannelUpdateInfo_set_cltv_expiry_delta"))) TS_ChannelUpdateInfo_set_cltv_expiry_delta(uint64_t this_ptr, int16_t val) {
37872         LDKChannelUpdateInfo this_ptr_conv;
37873         this_ptr_conv.inner = untag_ptr(this_ptr);
37874         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37875         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37876         this_ptr_conv.is_owned = false;
37877         ChannelUpdateInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
37878 }
37879
37880 int64_t  __attribute__((export_name("TS_ChannelUpdateInfo_get_htlc_minimum_msat"))) TS_ChannelUpdateInfo_get_htlc_minimum_msat(uint64_t this_ptr) {
37881         LDKChannelUpdateInfo this_ptr_conv;
37882         this_ptr_conv.inner = untag_ptr(this_ptr);
37883         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37884         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37885         this_ptr_conv.is_owned = false;
37886         int64_t ret_conv = ChannelUpdateInfo_get_htlc_minimum_msat(&this_ptr_conv);
37887         return ret_conv;
37888 }
37889
37890 void  __attribute__((export_name("TS_ChannelUpdateInfo_set_htlc_minimum_msat"))) TS_ChannelUpdateInfo_set_htlc_minimum_msat(uint64_t this_ptr, int64_t val) {
37891         LDKChannelUpdateInfo this_ptr_conv;
37892         this_ptr_conv.inner = untag_ptr(this_ptr);
37893         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37894         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37895         this_ptr_conv.is_owned = false;
37896         ChannelUpdateInfo_set_htlc_minimum_msat(&this_ptr_conv, val);
37897 }
37898
37899 int64_t  __attribute__((export_name("TS_ChannelUpdateInfo_get_htlc_maximum_msat"))) TS_ChannelUpdateInfo_get_htlc_maximum_msat(uint64_t this_ptr) {
37900         LDKChannelUpdateInfo this_ptr_conv;
37901         this_ptr_conv.inner = untag_ptr(this_ptr);
37902         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37903         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37904         this_ptr_conv.is_owned = false;
37905         int64_t ret_conv = ChannelUpdateInfo_get_htlc_maximum_msat(&this_ptr_conv);
37906         return ret_conv;
37907 }
37908
37909 void  __attribute__((export_name("TS_ChannelUpdateInfo_set_htlc_maximum_msat"))) TS_ChannelUpdateInfo_set_htlc_maximum_msat(uint64_t this_ptr, int64_t val) {
37910         LDKChannelUpdateInfo this_ptr_conv;
37911         this_ptr_conv.inner = untag_ptr(this_ptr);
37912         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37913         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37914         this_ptr_conv.is_owned = false;
37915         ChannelUpdateInfo_set_htlc_maximum_msat(&this_ptr_conv, val);
37916 }
37917
37918 uint64_t  __attribute__((export_name("TS_ChannelUpdateInfo_get_fees"))) TS_ChannelUpdateInfo_get_fees(uint64_t this_ptr) {
37919         LDKChannelUpdateInfo this_ptr_conv;
37920         this_ptr_conv.inner = untag_ptr(this_ptr);
37921         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37922         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37923         this_ptr_conv.is_owned = false;
37924         LDKRoutingFees ret_var = ChannelUpdateInfo_get_fees(&this_ptr_conv);
37925         uint64_t ret_ref = 0;
37926         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37927         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37928         return ret_ref;
37929 }
37930
37931 void  __attribute__((export_name("TS_ChannelUpdateInfo_set_fees"))) TS_ChannelUpdateInfo_set_fees(uint64_t this_ptr, uint64_t val) {
37932         LDKChannelUpdateInfo this_ptr_conv;
37933         this_ptr_conv.inner = untag_ptr(this_ptr);
37934         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37935         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37936         this_ptr_conv.is_owned = false;
37937         LDKRoutingFees val_conv;
37938         val_conv.inner = untag_ptr(val);
37939         val_conv.is_owned = ptr_is_owned(val);
37940         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
37941         val_conv = RoutingFees_clone(&val_conv);
37942         ChannelUpdateInfo_set_fees(&this_ptr_conv, val_conv);
37943 }
37944
37945 uint64_t  __attribute__((export_name("TS_ChannelUpdateInfo_get_last_update_message"))) TS_ChannelUpdateInfo_get_last_update_message(uint64_t this_ptr) {
37946         LDKChannelUpdateInfo this_ptr_conv;
37947         this_ptr_conv.inner = untag_ptr(this_ptr);
37948         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37949         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37950         this_ptr_conv.is_owned = false;
37951         LDKChannelUpdate ret_var = ChannelUpdateInfo_get_last_update_message(&this_ptr_conv);
37952         uint64_t ret_ref = 0;
37953         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37954         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37955         return ret_ref;
37956 }
37957
37958 void  __attribute__((export_name("TS_ChannelUpdateInfo_set_last_update_message"))) TS_ChannelUpdateInfo_set_last_update_message(uint64_t this_ptr, uint64_t val) {
37959         LDKChannelUpdateInfo this_ptr_conv;
37960         this_ptr_conv.inner = untag_ptr(this_ptr);
37961         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37962         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37963         this_ptr_conv.is_owned = false;
37964         LDKChannelUpdate val_conv;
37965         val_conv.inner = untag_ptr(val);
37966         val_conv.is_owned = ptr_is_owned(val);
37967         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
37968         val_conv = ChannelUpdate_clone(&val_conv);
37969         ChannelUpdateInfo_set_last_update_message(&this_ptr_conv, val_conv);
37970 }
37971
37972 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) {
37973         LDKRoutingFees fees_arg_conv;
37974         fees_arg_conv.inner = untag_ptr(fees_arg);
37975         fees_arg_conv.is_owned = ptr_is_owned(fees_arg);
37976         CHECK_INNER_FIELD_ACCESS_OR_NULL(fees_arg_conv);
37977         fees_arg_conv = RoutingFees_clone(&fees_arg_conv);
37978         LDKChannelUpdate last_update_message_arg_conv;
37979         last_update_message_arg_conv.inner = untag_ptr(last_update_message_arg);
37980         last_update_message_arg_conv.is_owned = ptr_is_owned(last_update_message_arg);
37981         CHECK_INNER_FIELD_ACCESS_OR_NULL(last_update_message_arg_conv);
37982         last_update_message_arg_conv = ChannelUpdate_clone(&last_update_message_arg_conv);
37983         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);
37984         uint64_t ret_ref = 0;
37985         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37986         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37987         return ret_ref;
37988 }
37989
37990 static inline uint64_t ChannelUpdateInfo_clone_ptr(LDKChannelUpdateInfo *NONNULL_PTR arg) {
37991         LDKChannelUpdateInfo ret_var = ChannelUpdateInfo_clone(arg);
37992         uint64_t ret_ref = 0;
37993         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37994         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37995         return ret_ref;
37996 }
37997 int64_t  __attribute__((export_name("TS_ChannelUpdateInfo_clone_ptr"))) TS_ChannelUpdateInfo_clone_ptr(uint64_t arg) {
37998         LDKChannelUpdateInfo arg_conv;
37999         arg_conv.inner = untag_ptr(arg);
38000         arg_conv.is_owned = ptr_is_owned(arg);
38001         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
38002         arg_conv.is_owned = false;
38003         int64_t ret_conv = ChannelUpdateInfo_clone_ptr(&arg_conv);
38004         return ret_conv;
38005 }
38006
38007 uint64_t  __attribute__((export_name("TS_ChannelUpdateInfo_clone"))) TS_ChannelUpdateInfo_clone(uint64_t orig) {
38008         LDKChannelUpdateInfo orig_conv;
38009         orig_conv.inner = untag_ptr(orig);
38010         orig_conv.is_owned = ptr_is_owned(orig);
38011         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
38012         orig_conv.is_owned = false;
38013         LDKChannelUpdateInfo ret_var = ChannelUpdateInfo_clone(&orig_conv);
38014         uint64_t ret_ref = 0;
38015         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38016         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38017         return ret_ref;
38018 }
38019
38020 int8_tArray  __attribute__((export_name("TS_ChannelUpdateInfo_write"))) TS_ChannelUpdateInfo_write(uint64_t obj) {
38021         LDKChannelUpdateInfo obj_conv;
38022         obj_conv.inner = untag_ptr(obj);
38023         obj_conv.is_owned = ptr_is_owned(obj);
38024         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
38025         obj_conv.is_owned = false;
38026         LDKCVec_u8Z ret_var = ChannelUpdateInfo_write(&obj_conv);
38027         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
38028         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
38029         CVec_u8Z_free(ret_var);
38030         return ret_arr;
38031 }
38032
38033 uint64_t  __attribute__((export_name("TS_ChannelUpdateInfo_read"))) TS_ChannelUpdateInfo_read(int8_tArray ser) {
38034         LDKu8slice ser_ref;
38035         ser_ref.datalen = ser->arr_len;
38036         ser_ref.data = ser->elems;
38037         LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
38038         *ret_conv = ChannelUpdateInfo_read(ser_ref);
38039         FREE(ser);
38040         return tag_ptr(ret_conv, true);
38041 }
38042
38043 void  __attribute__((export_name("TS_ChannelInfo_free"))) TS_ChannelInfo_free(uint64_t this_obj) {
38044         LDKChannelInfo this_obj_conv;
38045         this_obj_conv.inner = untag_ptr(this_obj);
38046         this_obj_conv.is_owned = ptr_is_owned(this_obj);
38047         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38048         ChannelInfo_free(this_obj_conv);
38049 }
38050
38051 uint64_t  __attribute__((export_name("TS_ChannelInfo_get_features"))) TS_ChannelInfo_get_features(uint64_t this_ptr) {
38052         LDKChannelInfo this_ptr_conv;
38053         this_ptr_conv.inner = untag_ptr(this_ptr);
38054         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38055         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38056         this_ptr_conv.is_owned = false;
38057         LDKChannelFeatures ret_var = ChannelInfo_get_features(&this_ptr_conv);
38058         uint64_t ret_ref = 0;
38059         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38060         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38061         return ret_ref;
38062 }
38063
38064 void  __attribute__((export_name("TS_ChannelInfo_set_features"))) TS_ChannelInfo_set_features(uint64_t this_ptr, uint64_t val) {
38065         LDKChannelInfo this_ptr_conv;
38066         this_ptr_conv.inner = untag_ptr(this_ptr);
38067         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38068         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38069         this_ptr_conv.is_owned = false;
38070         LDKChannelFeatures val_conv;
38071         val_conv.inner = untag_ptr(val);
38072         val_conv.is_owned = ptr_is_owned(val);
38073         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
38074         val_conv = ChannelFeatures_clone(&val_conv);
38075         ChannelInfo_set_features(&this_ptr_conv, val_conv);
38076 }
38077
38078 uint64_t  __attribute__((export_name("TS_ChannelInfo_get_node_one"))) TS_ChannelInfo_get_node_one(uint64_t this_ptr) {
38079         LDKChannelInfo this_ptr_conv;
38080         this_ptr_conv.inner = untag_ptr(this_ptr);
38081         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38082         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38083         this_ptr_conv.is_owned = false;
38084         LDKNodeId ret_var = ChannelInfo_get_node_one(&this_ptr_conv);
38085         uint64_t ret_ref = 0;
38086         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38087         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38088         return ret_ref;
38089 }
38090
38091 void  __attribute__((export_name("TS_ChannelInfo_set_node_one"))) TS_ChannelInfo_set_node_one(uint64_t this_ptr, uint64_t val) {
38092         LDKChannelInfo 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         LDKNodeId val_conv;
38098         val_conv.inner = untag_ptr(val);
38099         val_conv.is_owned = ptr_is_owned(val);
38100         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
38101         val_conv = NodeId_clone(&val_conv);
38102         ChannelInfo_set_node_one(&this_ptr_conv, val_conv);
38103 }
38104
38105 uint64_t  __attribute__((export_name("TS_ChannelInfo_get_one_to_two"))) TS_ChannelInfo_get_one_to_two(uint64_t this_ptr) {
38106         LDKChannelInfo this_ptr_conv;
38107         this_ptr_conv.inner = untag_ptr(this_ptr);
38108         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38109         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38110         this_ptr_conv.is_owned = false;
38111         LDKChannelUpdateInfo ret_var = ChannelInfo_get_one_to_two(&this_ptr_conv);
38112         uint64_t ret_ref = 0;
38113         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38114         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38115         return ret_ref;
38116 }
38117
38118 void  __attribute__((export_name("TS_ChannelInfo_set_one_to_two"))) TS_ChannelInfo_set_one_to_two(uint64_t this_ptr, uint64_t val) {
38119         LDKChannelInfo this_ptr_conv;
38120         this_ptr_conv.inner = untag_ptr(this_ptr);
38121         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38122         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38123         this_ptr_conv.is_owned = false;
38124         LDKChannelUpdateInfo val_conv;
38125         val_conv.inner = untag_ptr(val);
38126         val_conv.is_owned = ptr_is_owned(val);
38127         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
38128         val_conv = ChannelUpdateInfo_clone(&val_conv);
38129         ChannelInfo_set_one_to_two(&this_ptr_conv, val_conv);
38130 }
38131
38132 uint64_t  __attribute__((export_name("TS_ChannelInfo_get_node_two"))) TS_ChannelInfo_get_node_two(uint64_t this_ptr) {
38133         LDKChannelInfo 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         LDKNodeId ret_var = ChannelInfo_get_node_two(&this_ptr_conv);
38139         uint64_t ret_ref = 0;
38140         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38141         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38142         return ret_ref;
38143 }
38144
38145 void  __attribute__((export_name("TS_ChannelInfo_set_node_two"))) TS_ChannelInfo_set_node_two(uint64_t this_ptr, uint64_t val) {
38146         LDKChannelInfo this_ptr_conv;
38147         this_ptr_conv.inner = untag_ptr(this_ptr);
38148         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38149         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38150         this_ptr_conv.is_owned = false;
38151         LDKNodeId val_conv;
38152         val_conv.inner = untag_ptr(val);
38153         val_conv.is_owned = ptr_is_owned(val);
38154         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
38155         val_conv = NodeId_clone(&val_conv);
38156         ChannelInfo_set_node_two(&this_ptr_conv, val_conv);
38157 }
38158
38159 uint64_t  __attribute__((export_name("TS_ChannelInfo_get_two_to_one"))) TS_ChannelInfo_get_two_to_one(uint64_t this_ptr) {
38160         LDKChannelInfo 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         LDKChannelUpdateInfo ret_var = ChannelInfo_get_two_to_one(&this_ptr_conv);
38166         uint64_t ret_ref = 0;
38167         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38168         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38169         return ret_ref;
38170 }
38171
38172 void  __attribute__((export_name("TS_ChannelInfo_set_two_to_one"))) TS_ChannelInfo_set_two_to_one(uint64_t this_ptr, uint64_t val) {
38173         LDKChannelInfo this_ptr_conv;
38174         this_ptr_conv.inner = untag_ptr(this_ptr);
38175         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38176         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38177         this_ptr_conv.is_owned = false;
38178         LDKChannelUpdateInfo val_conv;
38179         val_conv.inner = untag_ptr(val);
38180         val_conv.is_owned = ptr_is_owned(val);
38181         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
38182         val_conv = ChannelUpdateInfo_clone(&val_conv);
38183         ChannelInfo_set_two_to_one(&this_ptr_conv, val_conv);
38184 }
38185
38186 uint64_t  __attribute__((export_name("TS_ChannelInfo_get_capacity_sats"))) TS_ChannelInfo_get_capacity_sats(uint64_t this_ptr) {
38187         LDKChannelInfo this_ptr_conv;
38188         this_ptr_conv.inner = untag_ptr(this_ptr);
38189         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38190         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38191         this_ptr_conv.is_owned = false;
38192         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
38193         *ret_copy = ChannelInfo_get_capacity_sats(&this_ptr_conv);
38194         uint64_t ret_ref = tag_ptr(ret_copy, true);
38195         return ret_ref;
38196 }
38197
38198 void  __attribute__((export_name("TS_ChannelInfo_set_capacity_sats"))) TS_ChannelInfo_set_capacity_sats(uint64_t this_ptr, uint64_t val) {
38199         LDKChannelInfo this_ptr_conv;
38200         this_ptr_conv.inner = untag_ptr(this_ptr);
38201         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38202         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38203         this_ptr_conv.is_owned = false;
38204         void* val_ptr = untag_ptr(val);
38205         CHECK_ACCESS(val_ptr);
38206         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
38207         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
38208         ChannelInfo_set_capacity_sats(&this_ptr_conv, val_conv);
38209 }
38210
38211 uint64_t  __attribute__((export_name("TS_ChannelInfo_get_announcement_message"))) TS_ChannelInfo_get_announcement_message(uint64_t this_ptr) {
38212         LDKChannelInfo this_ptr_conv;
38213         this_ptr_conv.inner = untag_ptr(this_ptr);
38214         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38215         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38216         this_ptr_conv.is_owned = false;
38217         LDKChannelAnnouncement ret_var = ChannelInfo_get_announcement_message(&this_ptr_conv);
38218         uint64_t ret_ref = 0;
38219         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38220         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38221         return ret_ref;
38222 }
38223
38224 void  __attribute__((export_name("TS_ChannelInfo_set_announcement_message"))) TS_ChannelInfo_set_announcement_message(uint64_t this_ptr, uint64_t val) {
38225         LDKChannelInfo this_ptr_conv;
38226         this_ptr_conv.inner = untag_ptr(this_ptr);
38227         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38228         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38229         this_ptr_conv.is_owned = false;
38230         LDKChannelAnnouncement val_conv;
38231         val_conv.inner = untag_ptr(val);
38232         val_conv.is_owned = ptr_is_owned(val);
38233         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
38234         val_conv = ChannelAnnouncement_clone(&val_conv);
38235         ChannelInfo_set_announcement_message(&this_ptr_conv, val_conv);
38236 }
38237
38238 static inline uint64_t ChannelInfo_clone_ptr(LDKChannelInfo *NONNULL_PTR arg) {
38239         LDKChannelInfo ret_var = ChannelInfo_clone(arg);
38240         uint64_t ret_ref = 0;
38241         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38242         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38243         return ret_ref;
38244 }
38245 int64_t  __attribute__((export_name("TS_ChannelInfo_clone_ptr"))) TS_ChannelInfo_clone_ptr(uint64_t arg) {
38246         LDKChannelInfo arg_conv;
38247         arg_conv.inner = untag_ptr(arg);
38248         arg_conv.is_owned = ptr_is_owned(arg);
38249         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
38250         arg_conv.is_owned = false;
38251         int64_t ret_conv = ChannelInfo_clone_ptr(&arg_conv);
38252         return ret_conv;
38253 }
38254
38255 uint64_t  __attribute__((export_name("TS_ChannelInfo_clone"))) TS_ChannelInfo_clone(uint64_t orig) {
38256         LDKChannelInfo orig_conv;
38257         orig_conv.inner = untag_ptr(orig);
38258         orig_conv.is_owned = ptr_is_owned(orig);
38259         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
38260         orig_conv.is_owned = false;
38261         LDKChannelInfo ret_var = ChannelInfo_clone(&orig_conv);
38262         uint64_t ret_ref = 0;
38263         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38264         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38265         return ret_ref;
38266 }
38267
38268 uint64_t  __attribute__((export_name("TS_ChannelInfo_get_directional_info"))) TS_ChannelInfo_get_directional_info(uint64_t this_arg, int8_t channel_flags) {
38269         LDKChannelInfo this_arg_conv;
38270         this_arg_conv.inner = untag_ptr(this_arg);
38271         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38272         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38273         this_arg_conv.is_owned = false;
38274         LDKChannelUpdateInfo ret_var = ChannelInfo_get_directional_info(&this_arg_conv, channel_flags);
38275         uint64_t ret_ref = 0;
38276         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38277         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38278         return ret_ref;
38279 }
38280
38281 int8_tArray  __attribute__((export_name("TS_ChannelInfo_write"))) TS_ChannelInfo_write(uint64_t obj) {
38282         LDKChannelInfo obj_conv;
38283         obj_conv.inner = untag_ptr(obj);
38284         obj_conv.is_owned = ptr_is_owned(obj);
38285         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
38286         obj_conv.is_owned = false;
38287         LDKCVec_u8Z ret_var = ChannelInfo_write(&obj_conv);
38288         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
38289         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
38290         CVec_u8Z_free(ret_var);
38291         return ret_arr;
38292 }
38293
38294 uint64_t  __attribute__((export_name("TS_ChannelInfo_read"))) TS_ChannelInfo_read(int8_tArray ser) {
38295         LDKu8slice ser_ref;
38296         ser_ref.datalen = ser->arr_len;
38297         ser_ref.data = ser->elems;
38298         LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
38299         *ret_conv = ChannelInfo_read(ser_ref);
38300         FREE(ser);
38301         return tag_ptr(ret_conv, true);
38302 }
38303
38304 void  __attribute__((export_name("TS_DirectedChannelInfo_free"))) TS_DirectedChannelInfo_free(uint64_t this_obj) {
38305         LDKDirectedChannelInfo this_obj_conv;
38306         this_obj_conv.inner = untag_ptr(this_obj);
38307         this_obj_conv.is_owned = ptr_is_owned(this_obj);
38308         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38309         DirectedChannelInfo_free(this_obj_conv);
38310 }
38311
38312 static inline uint64_t DirectedChannelInfo_clone_ptr(LDKDirectedChannelInfo *NONNULL_PTR arg) {
38313         LDKDirectedChannelInfo ret_var = DirectedChannelInfo_clone(arg);
38314         uint64_t ret_ref = 0;
38315         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38316         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38317         return ret_ref;
38318 }
38319 int64_t  __attribute__((export_name("TS_DirectedChannelInfo_clone_ptr"))) TS_DirectedChannelInfo_clone_ptr(uint64_t arg) {
38320         LDKDirectedChannelInfo arg_conv;
38321         arg_conv.inner = untag_ptr(arg);
38322         arg_conv.is_owned = ptr_is_owned(arg);
38323         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
38324         arg_conv.is_owned = false;
38325         int64_t ret_conv = DirectedChannelInfo_clone_ptr(&arg_conv);
38326         return ret_conv;
38327 }
38328
38329 uint64_t  __attribute__((export_name("TS_DirectedChannelInfo_clone"))) TS_DirectedChannelInfo_clone(uint64_t orig) {
38330         LDKDirectedChannelInfo orig_conv;
38331         orig_conv.inner = untag_ptr(orig);
38332         orig_conv.is_owned = ptr_is_owned(orig);
38333         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
38334         orig_conv.is_owned = false;
38335         LDKDirectedChannelInfo ret_var = DirectedChannelInfo_clone(&orig_conv);
38336         uint64_t ret_ref = 0;
38337         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38338         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38339         return ret_ref;
38340 }
38341
38342 uint64_t  __attribute__((export_name("TS_DirectedChannelInfo_channel"))) TS_DirectedChannelInfo_channel(uint64_t this_arg) {
38343         LDKDirectedChannelInfo this_arg_conv;
38344         this_arg_conv.inner = untag_ptr(this_arg);
38345         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38346         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38347         this_arg_conv.is_owned = false;
38348         LDKChannelInfo ret_var = DirectedChannelInfo_channel(&this_arg_conv);
38349         uint64_t ret_ref = 0;
38350         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38351         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38352         return ret_ref;
38353 }
38354
38355 uint64_t  __attribute__((export_name("TS_DirectedChannelInfo_direction"))) TS_DirectedChannelInfo_direction(uint64_t this_arg) {
38356         LDKDirectedChannelInfo this_arg_conv;
38357         this_arg_conv.inner = untag_ptr(this_arg);
38358         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38359         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38360         this_arg_conv.is_owned = false;
38361         LDKChannelUpdateInfo ret_var = DirectedChannelInfo_direction(&this_arg_conv);
38362         uint64_t ret_ref = 0;
38363         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38364         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38365         return ret_ref;
38366 }
38367
38368 int64_t  __attribute__((export_name("TS_DirectedChannelInfo_htlc_maximum_msat"))) TS_DirectedChannelInfo_htlc_maximum_msat(uint64_t this_arg) {
38369         LDKDirectedChannelInfo this_arg_conv;
38370         this_arg_conv.inner = untag_ptr(this_arg);
38371         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38372         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38373         this_arg_conv.is_owned = false;
38374         int64_t ret_conv = DirectedChannelInfo_htlc_maximum_msat(&this_arg_conv);
38375         return ret_conv;
38376 }
38377
38378 uint64_t  __attribute__((export_name("TS_DirectedChannelInfo_effective_capacity"))) TS_DirectedChannelInfo_effective_capacity(uint64_t this_arg) {
38379         LDKDirectedChannelInfo this_arg_conv;
38380         this_arg_conv.inner = untag_ptr(this_arg);
38381         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38382         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38383         this_arg_conv.is_owned = false;
38384         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
38385         *ret_copy = DirectedChannelInfo_effective_capacity(&this_arg_conv);
38386         uint64_t ret_ref = tag_ptr(ret_copy, true);
38387         return ret_ref;
38388 }
38389
38390 void  __attribute__((export_name("TS_EffectiveCapacity_free"))) TS_EffectiveCapacity_free(uint64_t this_ptr) {
38391         if (!ptr_is_owned(this_ptr)) return;
38392         void* this_ptr_ptr = untag_ptr(this_ptr);
38393         CHECK_ACCESS(this_ptr_ptr);
38394         LDKEffectiveCapacity this_ptr_conv = *(LDKEffectiveCapacity*)(this_ptr_ptr);
38395         FREE(untag_ptr(this_ptr));
38396         EffectiveCapacity_free(this_ptr_conv);
38397 }
38398
38399 static inline uint64_t EffectiveCapacity_clone_ptr(LDKEffectiveCapacity *NONNULL_PTR arg) {
38400         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
38401         *ret_copy = EffectiveCapacity_clone(arg);
38402         uint64_t ret_ref = tag_ptr(ret_copy, true);
38403         return ret_ref;
38404 }
38405 int64_t  __attribute__((export_name("TS_EffectiveCapacity_clone_ptr"))) TS_EffectiveCapacity_clone_ptr(uint64_t arg) {
38406         LDKEffectiveCapacity* arg_conv = (LDKEffectiveCapacity*)untag_ptr(arg);
38407         int64_t ret_conv = EffectiveCapacity_clone_ptr(arg_conv);
38408         return ret_conv;
38409 }
38410
38411 uint64_t  __attribute__((export_name("TS_EffectiveCapacity_clone"))) TS_EffectiveCapacity_clone(uint64_t orig) {
38412         LDKEffectiveCapacity* orig_conv = (LDKEffectiveCapacity*)untag_ptr(orig);
38413         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
38414         *ret_copy = EffectiveCapacity_clone(orig_conv);
38415         uint64_t ret_ref = tag_ptr(ret_copy, true);
38416         return ret_ref;
38417 }
38418
38419 uint64_t  __attribute__((export_name("TS_EffectiveCapacity_exact_liquidity"))) TS_EffectiveCapacity_exact_liquidity(int64_t liquidity_msat) {
38420         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
38421         *ret_copy = EffectiveCapacity_exact_liquidity(liquidity_msat);
38422         uint64_t ret_ref = tag_ptr(ret_copy, true);
38423         return ret_ref;
38424 }
38425
38426 uint64_t  __attribute__((export_name("TS_EffectiveCapacity_maximum_htlc"))) TS_EffectiveCapacity_maximum_htlc(int64_t amount_msat) {
38427         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
38428         *ret_copy = EffectiveCapacity_maximum_htlc(amount_msat);
38429         uint64_t ret_ref = tag_ptr(ret_copy, true);
38430         return ret_ref;
38431 }
38432
38433 uint64_t  __attribute__((export_name("TS_EffectiveCapacity_total"))) TS_EffectiveCapacity_total(int64_t capacity_msat, uint64_t htlc_maximum_msat) {
38434         void* htlc_maximum_msat_ptr = untag_ptr(htlc_maximum_msat);
38435         CHECK_ACCESS(htlc_maximum_msat_ptr);
38436         LDKCOption_u64Z htlc_maximum_msat_conv = *(LDKCOption_u64Z*)(htlc_maximum_msat_ptr);
38437         htlc_maximum_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(htlc_maximum_msat));
38438         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
38439         *ret_copy = EffectiveCapacity_total(capacity_msat, htlc_maximum_msat_conv);
38440         uint64_t ret_ref = tag_ptr(ret_copy, true);
38441         return ret_ref;
38442 }
38443
38444 uint64_t  __attribute__((export_name("TS_EffectiveCapacity_infinite"))) TS_EffectiveCapacity_infinite() {
38445         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
38446         *ret_copy = EffectiveCapacity_infinite();
38447         uint64_t ret_ref = tag_ptr(ret_copy, true);
38448         return ret_ref;
38449 }
38450
38451 uint64_t  __attribute__((export_name("TS_EffectiveCapacity_unknown"))) TS_EffectiveCapacity_unknown() {
38452         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
38453         *ret_copy = EffectiveCapacity_unknown();
38454         uint64_t ret_ref = tag_ptr(ret_copy, true);
38455         return ret_ref;
38456 }
38457
38458 int64_t  __attribute__((export_name("TS_EffectiveCapacity_as_msat"))) TS_EffectiveCapacity_as_msat(uint64_t this_arg) {
38459         LDKEffectiveCapacity* this_arg_conv = (LDKEffectiveCapacity*)untag_ptr(this_arg);
38460         int64_t ret_conv = EffectiveCapacity_as_msat(this_arg_conv);
38461         return ret_conv;
38462 }
38463
38464 void  __attribute__((export_name("TS_RoutingFees_free"))) TS_RoutingFees_free(uint64_t this_obj) {
38465         LDKRoutingFees this_obj_conv;
38466         this_obj_conv.inner = untag_ptr(this_obj);
38467         this_obj_conv.is_owned = ptr_is_owned(this_obj);
38468         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38469         RoutingFees_free(this_obj_conv);
38470 }
38471
38472 int32_t  __attribute__((export_name("TS_RoutingFees_get_base_msat"))) TS_RoutingFees_get_base_msat(uint64_t this_ptr) {
38473         LDKRoutingFees this_ptr_conv;
38474         this_ptr_conv.inner = untag_ptr(this_ptr);
38475         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38476         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38477         this_ptr_conv.is_owned = false;
38478         int32_t ret_conv = RoutingFees_get_base_msat(&this_ptr_conv);
38479         return ret_conv;
38480 }
38481
38482 void  __attribute__((export_name("TS_RoutingFees_set_base_msat"))) TS_RoutingFees_set_base_msat(uint64_t this_ptr, int32_t val) {
38483         LDKRoutingFees this_ptr_conv;
38484         this_ptr_conv.inner = untag_ptr(this_ptr);
38485         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38486         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38487         this_ptr_conv.is_owned = false;
38488         RoutingFees_set_base_msat(&this_ptr_conv, val);
38489 }
38490
38491 int32_t  __attribute__((export_name("TS_RoutingFees_get_proportional_millionths"))) TS_RoutingFees_get_proportional_millionths(uint64_t this_ptr) {
38492         LDKRoutingFees this_ptr_conv;
38493         this_ptr_conv.inner = untag_ptr(this_ptr);
38494         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38495         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38496         this_ptr_conv.is_owned = false;
38497         int32_t ret_conv = RoutingFees_get_proportional_millionths(&this_ptr_conv);
38498         return ret_conv;
38499 }
38500
38501 void  __attribute__((export_name("TS_RoutingFees_set_proportional_millionths"))) TS_RoutingFees_set_proportional_millionths(uint64_t this_ptr, int32_t val) {
38502         LDKRoutingFees this_ptr_conv;
38503         this_ptr_conv.inner = untag_ptr(this_ptr);
38504         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38505         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38506         this_ptr_conv.is_owned = false;
38507         RoutingFees_set_proportional_millionths(&this_ptr_conv, val);
38508 }
38509
38510 uint64_t  __attribute__((export_name("TS_RoutingFees_new"))) TS_RoutingFees_new(int32_t base_msat_arg, int32_t proportional_millionths_arg) {
38511         LDKRoutingFees ret_var = RoutingFees_new(base_msat_arg, proportional_millionths_arg);
38512         uint64_t ret_ref = 0;
38513         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38514         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38515         return ret_ref;
38516 }
38517
38518 jboolean  __attribute__((export_name("TS_RoutingFees_eq"))) TS_RoutingFees_eq(uint64_t a, uint64_t b) {
38519         LDKRoutingFees a_conv;
38520         a_conv.inner = untag_ptr(a);
38521         a_conv.is_owned = ptr_is_owned(a);
38522         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
38523         a_conv.is_owned = false;
38524         LDKRoutingFees b_conv;
38525         b_conv.inner = untag_ptr(b);
38526         b_conv.is_owned = ptr_is_owned(b);
38527         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
38528         b_conv.is_owned = false;
38529         jboolean ret_conv = RoutingFees_eq(&a_conv, &b_conv);
38530         return ret_conv;
38531 }
38532
38533 static inline uint64_t RoutingFees_clone_ptr(LDKRoutingFees *NONNULL_PTR arg) {
38534         LDKRoutingFees ret_var = RoutingFees_clone(arg);
38535         uint64_t ret_ref = 0;
38536         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38537         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38538         return ret_ref;
38539 }
38540 int64_t  __attribute__((export_name("TS_RoutingFees_clone_ptr"))) TS_RoutingFees_clone_ptr(uint64_t arg) {
38541         LDKRoutingFees arg_conv;
38542         arg_conv.inner = untag_ptr(arg);
38543         arg_conv.is_owned = ptr_is_owned(arg);
38544         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
38545         arg_conv.is_owned = false;
38546         int64_t ret_conv = RoutingFees_clone_ptr(&arg_conv);
38547         return ret_conv;
38548 }
38549
38550 uint64_t  __attribute__((export_name("TS_RoutingFees_clone"))) TS_RoutingFees_clone(uint64_t orig) {
38551         LDKRoutingFees orig_conv;
38552         orig_conv.inner = untag_ptr(orig);
38553         orig_conv.is_owned = ptr_is_owned(orig);
38554         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
38555         orig_conv.is_owned = false;
38556         LDKRoutingFees ret_var = RoutingFees_clone(&orig_conv);
38557         uint64_t ret_ref = 0;
38558         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38559         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38560         return ret_ref;
38561 }
38562
38563 int64_t  __attribute__((export_name("TS_RoutingFees_hash"))) TS_RoutingFees_hash(uint64_t o) {
38564         LDKRoutingFees o_conv;
38565         o_conv.inner = untag_ptr(o);
38566         o_conv.is_owned = ptr_is_owned(o);
38567         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
38568         o_conv.is_owned = false;
38569         int64_t ret_conv = RoutingFees_hash(&o_conv);
38570         return ret_conv;
38571 }
38572
38573 int8_tArray  __attribute__((export_name("TS_RoutingFees_write"))) TS_RoutingFees_write(uint64_t obj) {
38574         LDKRoutingFees obj_conv;
38575         obj_conv.inner = untag_ptr(obj);
38576         obj_conv.is_owned = ptr_is_owned(obj);
38577         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
38578         obj_conv.is_owned = false;
38579         LDKCVec_u8Z ret_var = RoutingFees_write(&obj_conv);
38580         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
38581         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
38582         CVec_u8Z_free(ret_var);
38583         return ret_arr;
38584 }
38585
38586 uint64_t  __attribute__((export_name("TS_RoutingFees_read"))) TS_RoutingFees_read(int8_tArray ser) {
38587         LDKu8slice ser_ref;
38588         ser_ref.datalen = ser->arr_len;
38589         ser_ref.data = ser->elems;
38590         LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
38591         *ret_conv = RoutingFees_read(ser_ref);
38592         FREE(ser);
38593         return tag_ptr(ret_conv, true);
38594 }
38595
38596 void  __attribute__((export_name("TS_NodeAnnouncementInfo_free"))) TS_NodeAnnouncementInfo_free(uint64_t this_obj) {
38597         LDKNodeAnnouncementInfo this_obj_conv;
38598         this_obj_conv.inner = untag_ptr(this_obj);
38599         this_obj_conv.is_owned = ptr_is_owned(this_obj);
38600         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38601         NodeAnnouncementInfo_free(this_obj_conv);
38602 }
38603
38604 uint64_t  __attribute__((export_name("TS_NodeAnnouncementInfo_get_features"))) TS_NodeAnnouncementInfo_get_features(uint64_t this_ptr) {
38605         LDKNodeAnnouncementInfo this_ptr_conv;
38606         this_ptr_conv.inner = untag_ptr(this_ptr);
38607         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38608         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38609         this_ptr_conv.is_owned = false;
38610         LDKNodeFeatures ret_var = NodeAnnouncementInfo_get_features(&this_ptr_conv);
38611         uint64_t ret_ref = 0;
38612         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38613         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38614         return ret_ref;
38615 }
38616
38617 void  __attribute__((export_name("TS_NodeAnnouncementInfo_set_features"))) TS_NodeAnnouncementInfo_set_features(uint64_t this_ptr, uint64_t val) {
38618         LDKNodeAnnouncementInfo this_ptr_conv;
38619         this_ptr_conv.inner = untag_ptr(this_ptr);
38620         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38621         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38622         this_ptr_conv.is_owned = false;
38623         LDKNodeFeatures val_conv;
38624         val_conv.inner = untag_ptr(val);
38625         val_conv.is_owned = ptr_is_owned(val);
38626         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
38627         val_conv = NodeFeatures_clone(&val_conv);
38628         NodeAnnouncementInfo_set_features(&this_ptr_conv, val_conv);
38629 }
38630
38631 int32_t  __attribute__((export_name("TS_NodeAnnouncementInfo_get_last_update"))) TS_NodeAnnouncementInfo_get_last_update(uint64_t this_ptr) {
38632         LDKNodeAnnouncementInfo this_ptr_conv;
38633         this_ptr_conv.inner = untag_ptr(this_ptr);
38634         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38635         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38636         this_ptr_conv.is_owned = false;
38637         int32_t ret_conv = NodeAnnouncementInfo_get_last_update(&this_ptr_conv);
38638         return ret_conv;
38639 }
38640
38641 void  __attribute__((export_name("TS_NodeAnnouncementInfo_set_last_update"))) TS_NodeAnnouncementInfo_set_last_update(uint64_t this_ptr, int32_t val) {
38642         LDKNodeAnnouncementInfo this_ptr_conv;
38643         this_ptr_conv.inner = untag_ptr(this_ptr);
38644         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38645         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38646         this_ptr_conv.is_owned = false;
38647         NodeAnnouncementInfo_set_last_update(&this_ptr_conv, val);
38648 }
38649
38650 int8_tArray  __attribute__((export_name("TS_NodeAnnouncementInfo_get_rgb"))) TS_NodeAnnouncementInfo_get_rgb(uint64_t this_ptr) {
38651         LDKNodeAnnouncementInfo this_ptr_conv;
38652         this_ptr_conv.inner = untag_ptr(this_ptr);
38653         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38654         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38655         this_ptr_conv.is_owned = false;
38656         int8_tArray ret_arr = init_int8_tArray(3, __LINE__);
38657         memcpy(ret_arr->elems, *NodeAnnouncementInfo_get_rgb(&this_ptr_conv), 3);
38658         return ret_arr;
38659 }
38660
38661 void  __attribute__((export_name("TS_NodeAnnouncementInfo_set_rgb"))) TS_NodeAnnouncementInfo_set_rgb(uint64_t this_ptr, int8_tArray val) {
38662         LDKNodeAnnouncementInfo this_ptr_conv;
38663         this_ptr_conv.inner = untag_ptr(this_ptr);
38664         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38665         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38666         this_ptr_conv.is_owned = false;
38667         LDKThreeBytes val_ref;
38668         CHECK(val->arr_len == 3);
38669         memcpy(val_ref.data, val->elems, 3); FREE(val);
38670         NodeAnnouncementInfo_set_rgb(&this_ptr_conv, val_ref);
38671 }
38672
38673 uint64_t  __attribute__((export_name("TS_NodeAnnouncementInfo_get_alias"))) TS_NodeAnnouncementInfo_get_alias(uint64_t this_ptr) {
38674         LDKNodeAnnouncementInfo 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         LDKNodeAlias ret_var = NodeAnnouncementInfo_get_alias(&this_ptr_conv);
38680         uint64_t ret_ref = 0;
38681         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38682         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38683         return ret_ref;
38684 }
38685
38686 void  __attribute__((export_name("TS_NodeAnnouncementInfo_set_alias"))) TS_NodeAnnouncementInfo_set_alias(uint64_t this_ptr, uint64_t val) {
38687         LDKNodeAnnouncementInfo this_ptr_conv;
38688         this_ptr_conv.inner = untag_ptr(this_ptr);
38689         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38690         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38691         this_ptr_conv.is_owned = false;
38692         LDKNodeAlias val_conv;
38693         val_conv.inner = untag_ptr(val);
38694         val_conv.is_owned = ptr_is_owned(val);
38695         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
38696         val_conv = NodeAlias_clone(&val_conv);
38697         NodeAnnouncementInfo_set_alias(&this_ptr_conv, val_conv);
38698 }
38699
38700 uint64_tArray  __attribute__((export_name("TS_NodeAnnouncementInfo_get_addresses"))) TS_NodeAnnouncementInfo_get_addresses(uint64_t this_ptr) {
38701         LDKNodeAnnouncementInfo this_ptr_conv;
38702         this_ptr_conv.inner = untag_ptr(this_ptr);
38703         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38704         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38705         this_ptr_conv.is_owned = false;
38706         LDKCVec_NetAddressZ ret_var = NodeAnnouncementInfo_get_addresses(&this_ptr_conv);
38707         uint64_tArray ret_arr = NULL;
38708         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
38709         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
38710         for (size_t m = 0; m < ret_var.datalen; m++) {
38711                 LDKNetAddress *ret_conv_12_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
38712                 *ret_conv_12_copy = ret_var.data[m];
38713                 uint64_t ret_conv_12_ref = tag_ptr(ret_conv_12_copy, true);
38714                 ret_arr_ptr[m] = ret_conv_12_ref;
38715         }
38716         
38717         FREE(ret_var.data);
38718         return ret_arr;
38719 }
38720
38721 void  __attribute__((export_name("TS_NodeAnnouncementInfo_set_addresses"))) TS_NodeAnnouncementInfo_set_addresses(uint64_t this_ptr, uint64_tArray val) {
38722         LDKNodeAnnouncementInfo this_ptr_conv;
38723         this_ptr_conv.inner = untag_ptr(this_ptr);
38724         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38725         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38726         this_ptr_conv.is_owned = false;
38727         LDKCVec_NetAddressZ val_constr;
38728         val_constr.datalen = val->arr_len;
38729         if (val_constr.datalen > 0)
38730                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
38731         else
38732                 val_constr.data = NULL;
38733         uint64_t* val_vals = val->elems;
38734         for (size_t m = 0; m < val_constr.datalen; m++) {
38735                 uint64_t val_conv_12 = val_vals[m];
38736                 void* val_conv_12_ptr = untag_ptr(val_conv_12);
38737                 CHECK_ACCESS(val_conv_12_ptr);
38738                 LDKNetAddress val_conv_12_conv = *(LDKNetAddress*)(val_conv_12_ptr);
38739                 val_conv_12_conv = NetAddress_clone((LDKNetAddress*)untag_ptr(val_conv_12));
38740                 val_constr.data[m] = val_conv_12_conv;
38741         }
38742         FREE(val);
38743         NodeAnnouncementInfo_set_addresses(&this_ptr_conv, val_constr);
38744 }
38745
38746 uint64_t  __attribute__((export_name("TS_NodeAnnouncementInfo_get_announcement_message"))) TS_NodeAnnouncementInfo_get_announcement_message(uint64_t this_ptr) {
38747         LDKNodeAnnouncementInfo this_ptr_conv;
38748         this_ptr_conv.inner = untag_ptr(this_ptr);
38749         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38750         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38751         this_ptr_conv.is_owned = false;
38752         LDKNodeAnnouncement ret_var = NodeAnnouncementInfo_get_announcement_message(&this_ptr_conv);
38753         uint64_t ret_ref = 0;
38754         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38755         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38756         return ret_ref;
38757 }
38758
38759 void  __attribute__((export_name("TS_NodeAnnouncementInfo_set_announcement_message"))) TS_NodeAnnouncementInfo_set_announcement_message(uint64_t this_ptr, uint64_t val) {
38760         LDKNodeAnnouncementInfo this_ptr_conv;
38761         this_ptr_conv.inner = untag_ptr(this_ptr);
38762         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38763         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38764         this_ptr_conv.is_owned = false;
38765         LDKNodeAnnouncement val_conv;
38766         val_conv.inner = untag_ptr(val);
38767         val_conv.is_owned = ptr_is_owned(val);
38768         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
38769         val_conv = NodeAnnouncement_clone(&val_conv);
38770         NodeAnnouncementInfo_set_announcement_message(&this_ptr_conv, val_conv);
38771 }
38772
38773 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) {
38774         LDKNodeFeatures features_arg_conv;
38775         features_arg_conv.inner = untag_ptr(features_arg);
38776         features_arg_conv.is_owned = ptr_is_owned(features_arg);
38777         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
38778         features_arg_conv = NodeFeatures_clone(&features_arg_conv);
38779         LDKThreeBytes rgb_arg_ref;
38780         CHECK(rgb_arg->arr_len == 3);
38781         memcpy(rgb_arg_ref.data, rgb_arg->elems, 3); FREE(rgb_arg);
38782         LDKNodeAlias alias_arg_conv;
38783         alias_arg_conv.inner = untag_ptr(alias_arg);
38784         alias_arg_conv.is_owned = ptr_is_owned(alias_arg);
38785         CHECK_INNER_FIELD_ACCESS_OR_NULL(alias_arg_conv);
38786         alias_arg_conv = NodeAlias_clone(&alias_arg_conv);
38787         LDKCVec_NetAddressZ addresses_arg_constr;
38788         addresses_arg_constr.datalen = addresses_arg->arr_len;
38789         if (addresses_arg_constr.datalen > 0)
38790                 addresses_arg_constr.data = MALLOC(addresses_arg_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
38791         else
38792                 addresses_arg_constr.data = NULL;
38793         uint64_t* addresses_arg_vals = addresses_arg->elems;
38794         for (size_t m = 0; m < addresses_arg_constr.datalen; m++) {
38795                 uint64_t addresses_arg_conv_12 = addresses_arg_vals[m];
38796                 void* addresses_arg_conv_12_ptr = untag_ptr(addresses_arg_conv_12);
38797                 CHECK_ACCESS(addresses_arg_conv_12_ptr);
38798                 LDKNetAddress addresses_arg_conv_12_conv = *(LDKNetAddress*)(addresses_arg_conv_12_ptr);
38799                 addresses_arg_constr.data[m] = addresses_arg_conv_12_conv;
38800         }
38801         FREE(addresses_arg);
38802         LDKNodeAnnouncement announcement_message_arg_conv;
38803         announcement_message_arg_conv.inner = untag_ptr(announcement_message_arg);
38804         announcement_message_arg_conv.is_owned = ptr_is_owned(announcement_message_arg);
38805         CHECK_INNER_FIELD_ACCESS_OR_NULL(announcement_message_arg_conv);
38806         announcement_message_arg_conv = NodeAnnouncement_clone(&announcement_message_arg_conv);
38807         LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_new(features_arg_conv, last_update_arg, rgb_arg_ref, alias_arg_conv, addresses_arg_constr, announcement_message_arg_conv);
38808         uint64_t ret_ref = 0;
38809         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38810         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38811         return ret_ref;
38812 }
38813
38814 static inline uint64_t NodeAnnouncementInfo_clone_ptr(LDKNodeAnnouncementInfo *NONNULL_PTR arg) {
38815         LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_clone(arg);
38816         uint64_t ret_ref = 0;
38817         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38818         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38819         return ret_ref;
38820 }
38821 int64_t  __attribute__((export_name("TS_NodeAnnouncementInfo_clone_ptr"))) TS_NodeAnnouncementInfo_clone_ptr(uint64_t arg) {
38822         LDKNodeAnnouncementInfo arg_conv;
38823         arg_conv.inner = untag_ptr(arg);
38824         arg_conv.is_owned = ptr_is_owned(arg);
38825         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
38826         arg_conv.is_owned = false;
38827         int64_t ret_conv = NodeAnnouncementInfo_clone_ptr(&arg_conv);
38828         return ret_conv;
38829 }
38830
38831 uint64_t  __attribute__((export_name("TS_NodeAnnouncementInfo_clone"))) TS_NodeAnnouncementInfo_clone(uint64_t orig) {
38832         LDKNodeAnnouncementInfo orig_conv;
38833         orig_conv.inner = untag_ptr(orig);
38834         orig_conv.is_owned = ptr_is_owned(orig);
38835         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
38836         orig_conv.is_owned = false;
38837         LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_clone(&orig_conv);
38838         uint64_t ret_ref = 0;
38839         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38840         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38841         return ret_ref;
38842 }
38843
38844 int8_tArray  __attribute__((export_name("TS_NodeAnnouncementInfo_write"))) TS_NodeAnnouncementInfo_write(uint64_t obj) {
38845         LDKNodeAnnouncementInfo obj_conv;
38846         obj_conv.inner = untag_ptr(obj);
38847         obj_conv.is_owned = ptr_is_owned(obj);
38848         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
38849         obj_conv.is_owned = false;
38850         LDKCVec_u8Z ret_var = NodeAnnouncementInfo_write(&obj_conv);
38851         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
38852         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
38853         CVec_u8Z_free(ret_var);
38854         return ret_arr;
38855 }
38856
38857 uint64_t  __attribute__((export_name("TS_NodeAnnouncementInfo_read"))) TS_NodeAnnouncementInfo_read(int8_tArray ser) {
38858         LDKu8slice ser_ref;
38859         ser_ref.datalen = ser->arr_len;
38860         ser_ref.data = ser->elems;
38861         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
38862         *ret_conv = NodeAnnouncementInfo_read(ser_ref);
38863         FREE(ser);
38864         return tag_ptr(ret_conv, true);
38865 }
38866
38867 void  __attribute__((export_name("TS_NodeAlias_free"))) TS_NodeAlias_free(uint64_t this_obj) {
38868         LDKNodeAlias this_obj_conv;
38869         this_obj_conv.inner = untag_ptr(this_obj);
38870         this_obj_conv.is_owned = ptr_is_owned(this_obj);
38871         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38872         NodeAlias_free(this_obj_conv);
38873 }
38874
38875 int8_tArray  __attribute__((export_name("TS_NodeAlias_get_a"))) TS_NodeAlias_get_a(uint64_t this_ptr) {
38876         LDKNodeAlias this_ptr_conv;
38877         this_ptr_conv.inner = untag_ptr(this_ptr);
38878         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38879         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38880         this_ptr_conv.is_owned = false;
38881         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
38882         memcpy(ret_arr->elems, *NodeAlias_get_a(&this_ptr_conv), 32);
38883         return ret_arr;
38884 }
38885
38886 void  __attribute__((export_name("TS_NodeAlias_set_a"))) TS_NodeAlias_set_a(uint64_t this_ptr, int8_tArray val) {
38887         LDKNodeAlias this_ptr_conv;
38888         this_ptr_conv.inner = untag_ptr(this_ptr);
38889         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38890         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38891         this_ptr_conv.is_owned = false;
38892         LDKThirtyTwoBytes val_ref;
38893         CHECK(val->arr_len == 32);
38894         memcpy(val_ref.data, val->elems, 32); FREE(val);
38895         NodeAlias_set_a(&this_ptr_conv, val_ref);
38896 }
38897
38898 uint64_t  __attribute__((export_name("TS_NodeAlias_new"))) TS_NodeAlias_new(int8_tArray a_arg) {
38899         LDKThirtyTwoBytes a_arg_ref;
38900         CHECK(a_arg->arr_len == 32);
38901         memcpy(a_arg_ref.data, a_arg->elems, 32); FREE(a_arg);
38902         LDKNodeAlias ret_var = NodeAlias_new(a_arg_ref);
38903         uint64_t ret_ref = 0;
38904         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38905         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38906         return ret_ref;
38907 }
38908
38909 static inline uint64_t NodeAlias_clone_ptr(LDKNodeAlias *NONNULL_PTR arg) {
38910         LDKNodeAlias ret_var = NodeAlias_clone(arg);
38911         uint64_t ret_ref = 0;
38912         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38913         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38914         return ret_ref;
38915 }
38916 int64_t  __attribute__((export_name("TS_NodeAlias_clone_ptr"))) TS_NodeAlias_clone_ptr(uint64_t arg) {
38917         LDKNodeAlias arg_conv;
38918         arg_conv.inner = untag_ptr(arg);
38919         arg_conv.is_owned = ptr_is_owned(arg);
38920         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
38921         arg_conv.is_owned = false;
38922         int64_t ret_conv = NodeAlias_clone_ptr(&arg_conv);
38923         return ret_conv;
38924 }
38925
38926 uint64_t  __attribute__((export_name("TS_NodeAlias_clone"))) TS_NodeAlias_clone(uint64_t orig) {
38927         LDKNodeAlias orig_conv;
38928         orig_conv.inner = untag_ptr(orig);
38929         orig_conv.is_owned = ptr_is_owned(orig);
38930         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
38931         orig_conv.is_owned = false;
38932         LDKNodeAlias ret_var = NodeAlias_clone(&orig_conv);
38933         uint64_t ret_ref = 0;
38934         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38935         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38936         return ret_ref;
38937 }
38938
38939 int8_tArray  __attribute__((export_name("TS_NodeAlias_write"))) TS_NodeAlias_write(uint64_t obj) {
38940         LDKNodeAlias obj_conv;
38941         obj_conv.inner = untag_ptr(obj);
38942         obj_conv.is_owned = ptr_is_owned(obj);
38943         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
38944         obj_conv.is_owned = false;
38945         LDKCVec_u8Z ret_var = NodeAlias_write(&obj_conv);
38946         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
38947         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
38948         CVec_u8Z_free(ret_var);
38949         return ret_arr;
38950 }
38951
38952 uint64_t  __attribute__((export_name("TS_NodeAlias_read"))) TS_NodeAlias_read(int8_tArray ser) {
38953         LDKu8slice ser_ref;
38954         ser_ref.datalen = ser->arr_len;
38955         ser_ref.data = ser->elems;
38956         LDKCResult_NodeAliasDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAliasDecodeErrorZ), "LDKCResult_NodeAliasDecodeErrorZ");
38957         *ret_conv = NodeAlias_read(ser_ref);
38958         FREE(ser);
38959         return tag_ptr(ret_conv, true);
38960 }
38961
38962 void  __attribute__((export_name("TS_NodeInfo_free"))) TS_NodeInfo_free(uint64_t this_obj) {
38963         LDKNodeInfo this_obj_conv;
38964         this_obj_conv.inner = untag_ptr(this_obj);
38965         this_obj_conv.is_owned = ptr_is_owned(this_obj);
38966         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38967         NodeInfo_free(this_obj_conv);
38968 }
38969
38970 int64_tArray  __attribute__((export_name("TS_NodeInfo_get_channels"))) TS_NodeInfo_get_channels(uint64_t this_ptr) {
38971         LDKNodeInfo this_ptr_conv;
38972         this_ptr_conv.inner = untag_ptr(this_ptr);
38973         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38974         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38975         this_ptr_conv.is_owned = false;
38976         LDKCVec_u64Z ret_var = NodeInfo_get_channels(&this_ptr_conv);
38977         int64_tArray ret_arr = NULL;
38978         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
38979         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
38980         for (size_t i = 0; i < ret_var.datalen; i++) {
38981                 int64_t ret_conv_8_conv = ret_var.data[i];
38982                 ret_arr_ptr[i] = ret_conv_8_conv;
38983         }
38984         
38985         FREE(ret_var.data);
38986         return ret_arr;
38987 }
38988
38989 void  __attribute__((export_name("TS_NodeInfo_set_channels"))) TS_NodeInfo_set_channels(uint64_t this_ptr, int64_tArray val) {
38990         LDKNodeInfo this_ptr_conv;
38991         this_ptr_conv.inner = untag_ptr(this_ptr);
38992         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38993         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38994         this_ptr_conv.is_owned = false;
38995         LDKCVec_u64Z val_constr;
38996         val_constr.datalen = val->arr_len;
38997         if (val_constr.datalen > 0)
38998                 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
38999         else
39000                 val_constr.data = NULL;
39001         int64_t* val_vals = val->elems;
39002         for (size_t i = 0; i < val_constr.datalen; i++) {
39003                 int64_t val_conv_8 = val_vals[i];
39004                 val_constr.data[i] = val_conv_8;
39005         }
39006         FREE(val);
39007         NodeInfo_set_channels(&this_ptr_conv, val_constr);
39008 }
39009
39010 uint64_t  __attribute__((export_name("TS_NodeInfo_get_lowest_inbound_channel_fees"))) TS_NodeInfo_get_lowest_inbound_channel_fees(uint64_t this_ptr) {
39011         LDKNodeInfo this_ptr_conv;
39012         this_ptr_conv.inner = untag_ptr(this_ptr);
39013         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39014         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39015         this_ptr_conv.is_owned = false;
39016         LDKRoutingFees ret_var = NodeInfo_get_lowest_inbound_channel_fees(&this_ptr_conv);
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
39023 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) {
39024         LDKNodeInfo this_ptr_conv;
39025         this_ptr_conv.inner = untag_ptr(this_ptr);
39026         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39027         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39028         this_ptr_conv.is_owned = false;
39029         LDKRoutingFees val_conv;
39030         val_conv.inner = untag_ptr(val);
39031         val_conv.is_owned = ptr_is_owned(val);
39032         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
39033         val_conv = RoutingFees_clone(&val_conv);
39034         NodeInfo_set_lowest_inbound_channel_fees(&this_ptr_conv, val_conv);
39035 }
39036
39037 uint64_t  __attribute__((export_name("TS_NodeInfo_get_announcement_info"))) TS_NodeInfo_get_announcement_info(uint64_t this_ptr) {
39038         LDKNodeInfo this_ptr_conv;
39039         this_ptr_conv.inner = untag_ptr(this_ptr);
39040         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39041         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39042         this_ptr_conv.is_owned = false;
39043         LDKNodeAnnouncementInfo ret_var = NodeInfo_get_announcement_info(&this_ptr_conv);
39044         uint64_t ret_ref = 0;
39045         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39046         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39047         return ret_ref;
39048 }
39049
39050 void  __attribute__((export_name("TS_NodeInfo_set_announcement_info"))) TS_NodeInfo_set_announcement_info(uint64_t this_ptr, uint64_t val) {
39051         LDKNodeInfo this_ptr_conv;
39052         this_ptr_conv.inner = untag_ptr(this_ptr);
39053         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39054         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39055         this_ptr_conv.is_owned = false;
39056         LDKNodeAnnouncementInfo val_conv;
39057         val_conv.inner = untag_ptr(val);
39058         val_conv.is_owned = ptr_is_owned(val);
39059         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
39060         val_conv = NodeAnnouncementInfo_clone(&val_conv);
39061         NodeInfo_set_announcement_info(&this_ptr_conv, val_conv);
39062 }
39063
39064 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) {
39065         LDKCVec_u64Z channels_arg_constr;
39066         channels_arg_constr.datalen = channels_arg->arr_len;
39067         if (channels_arg_constr.datalen > 0)
39068                 channels_arg_constr.data = MALLOC(channels_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
39069         else
39070                 channels_arg_constr.data = NULL;
39071         int64_t* channels_arg_vals = channels_arg->elems;
39072         for (size_t i = 0; i < channels_arg_constr.datalen; i++) {
39073                 int64_t channels_arg_conv_8 = channels_arg_vals[i];
39074                 channels_arg_constr.data[i] = channels_arg_conv_8;
39075         }
39076         FREE(channels_arg);
39077         LDKRoutingFees lowest_inbound_channel_fees_arg_conv;
39078         lowest_inbound_channel_fees_arg_conv.inner = untag_ptr(lowest_inbound_channel_fees_arg);
39079         lowest_inbound_channel_fees_arg_conv.is_owned = ptr_is_owned(lowest_inbound_channel_fees_arg);
39080         CHECK_INNER_FIELD_ACCESS_OR_NULL(lowest_inbound_channel_fees_arg_conv);
39081         lowest_inbound_channel_fees_arg_conv = RoutingFees_clone(&lowest_inbound_channel_fees_arg_conv);
39082         LDKNodeAnnouncementInfo announcement_info_arg_conv;
39083         announcement_info_arg_conv.inner = untag_ptr(announcement_info_arg);
39084         announcement_info_arg_conv.is_owned = ptr_is_owned(announcement_info_arg);
39085         CHECK_INNER_FIELD_ACCESS_OR_NULL(announcement_info_arg_conv);
39086         announcement_info_arg_conv = NodeAnnouncementInfo_clone(&announcement_info_arg_conv);
39087         LDKNodeInfo ret_var = NodeInfo_new(channels_arg_constr, lowest_inbound_channel_fees_arg_conv, announcement_info_arg_conv);
39088         uint64_t ret_ref = 0;
39089         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39090         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39091         return ret_ref;
39092 }
39093
39094 static inline uint64_t NodeInfo_clone_ptr(LDKNodeInfo *NONNULL_PTR arg) {
39095         LDKNodeInfo ret_var = NodeInfo_clone(arg);
39096         uint64_t ret_ref = 0;
39097         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39098         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39099         return ret_ref;
39100 }
39101 int64_t  __attribute__((export_name("TS_NodeInfo_clone_ptr"))) TS_NodeInfo_clone_ptr(uint64_t arg) {
39102         LDKNodeInfo arg_conv;
39103         arg_conv.inner = untag_ptr(arg);
39104         arg_conv.is_owned = ptr_is_owned(arg);
39105         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39106         arg_conv.is_owned = false;
39107         int64_t ret_conv = NodeInfo_clone_ptr(&arg_conv);
39108         return ret_conv;
39109 }
39110
39111 uint64_t  __attribute__((export_name("TS_NodeInfo_clone"))) TS_NodeInfo_clone(uint64_t orig) {
39112         LDKNodeInfo orig_conv;
39113         orig_conv.inner = untag_ptr(orig);
39114         orig_conv.is_owned = ptr_is_owned(orig);
39115         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39116         orig_conv.is_owned = false;
39117         LDKNodeInfo ret_var = NodeInfo_clone(&orig_conv);
39118         uint64_t ret_ref = 0;
39119         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39120         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39121         return ret_ref;
39122 }
39123
39124 int8_tArray  __attribute__((export_name("TS_NodeInfo_write"))) TS_NodeInfo_write(uint64_t obj) {
39125         LDKNodeInfo obj_conv;
39126         obj_conv.inner = untag_ptr(obj);
39127         obj_conv.is_owned = ptr_is_owned(obj);
39128         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
39129         obj_conv.is_owned = false;
39130         LDKCVec_u8Z ret_var = NodeInfo_write(&obj_conv);
39131         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
39132         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
39133         CVec_u8Z_free(ret_var);
39134         return ret_arr;
39135 }
39136
39137 uint64_t  __attribute__((export_name("TS_NodeInfo_read"))) TS_NodeInfo_read(int8_tArray ser) {
39138         LDKu8slice ser_ref;
39139         ser_ref.datalen = ser->arr_len;
39140         ser_ref.data = ser->elems;
39141         LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
39142         *ret_conv = NodeInfo_read(ser_ref);
39143         FREE(ser);
39144         return tag_ptr(ret_conv, true);
39145 }
39146
39147 int8_tArray  __attribute__((export_name("TS_NetworkGraph_write"))) TS_NetworkGraph_write(uint64_t obj) {
39148         LDKNetworkGraph obj_conv;
39149         obj_conv.inner = untag_ptr(obj);
39150         obj_conv.is_owned = ptr_is_owned(obj);
39151         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
39152         obj_conv.is_owned = false;
39153         LDKCVec_u8Z ret_var = NetworkGraph_write(&obj_conv);
39154         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
39155         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
39156         CVec_u8Z_free(ret_var);
39157         return ret_arr;
39158 }
39159
39160 uint64_t  __attribute__((export_name("TS_NetworkGraph_read"))) TS_NetworkGraph_read(int8_tArray ser, uint64_t arg) {
39161         LDKu8slice ser_ref;
39162         ser_ref.datalen = ser->arr_len;
39163         ser_ref.data = ser->elems;
39164         void* arg_ptr = untag_ptr(arg);
39165         CHECK_ACCESS(arg_ptr);
39166         LDKLogger arg_conv = *(LDKLogger*)(arg_ptr);
39167         if (arg_conv.free == LDKLogger_JCalls_free) {
39168                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
39169                 LDKLogger_JCalls_cloned(&arg_conv);
39170         }
39171         LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
39172         *ret_conv = NetworkGraph_read(ser_ref, arg_conv);
39173         FREE(ser);
39174         return tag_ptr(ret_conv, true);
39175 }
39176
39177 uint64_t  __attribute__((export_name("TS_NetworkGraph_new"))) TS_NetworkGraph_new(int8_tArray genesis_hash, uint64_t logger) {
39178         LDKThirtyTwoBytes genesis_hash_ref;
39179         CHECK(genesis_hash->arr_len == 32);
39180         memcpy(genesis_hash_ref.data, genesis_hash->elems, 32); FREE(genesis_hash);
39181         void* logger_ptr = untag_ptr(logger);
39182         CHECK_ACCESS(logger_ptr);
39183         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
39184         if (logger_conv.free == LDKLogger_JCalls_free) {
39185                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
39186                 LDKLogger_JCalls_cloned(&logger_conv);
39187         }
39188         LDKNetworkGraph ret_var = NetworkGraph_new(genesis_hash_ref, logger_conv);
39189         uint64_t ret_ref = 0;
39190         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39191         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39192         return ret_ref;
39193 }
39194
39195 uint64_t  __attribute__((export_name("TS_NetworkGraph_read_only"))) TS_NetworkGraph_read_only(uint64_t this_arg) {
39196         LDKNetworkGraph this_arg_conv;
39197         this_arg_conv.inner = untag_ptr(this_arg);
39198         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39199         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39200         this_arg_conv.is_owned = false;
39201         LDKReadOnlyNetworkGraph ret_var = NetworkGraph_read_only(&this_arg_conv);
39202         uint64_t ret_ref = 0;
39203         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39204         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39205         return ret_ref;
39206 }
39207
39208 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) {
39209         LDKNetworkGraph this_arg_conv;
39210         this_arg_conv.inner = untag_ptr(this_arg);
39211         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39212         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39213         this_arg_conv.is_owned = false;
39214         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
39215         *ret_copy = NetworkGraph_get_last_rapid_gossip_sync_timestamp(&this_arg_conv);
39216         uint64_t ret_ref = tag_ptr(ret_copy, true);
39217         return ret_ref;
39218 }
39219
39220 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) {
39221         LDKNetworkGraph this_arg_conv;
39222         this_arg_conv.inner = untag_ptr(this_arg);
39223         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39224         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39225         this_arg_conv.is_owned = false;
39226         NetworkGraph_set_last_rapid_gossip_sync_timestamp(&this_arg_conv, last_rapid_gossip_sync_timestamp);
39227 }
39228
39229 uint64_t  __attribute__((export_name("TS_NetworkGraph_update_node_from_announcement"))) TS_NetworkGraph_update_node_from_announcement(uint64_t this_arg, uint64_t msg) {
39230         LDKNetworkGraph this_arg_conv;
39231         this_arg_conv.inner = untag_ptr(this_arg);
39232         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39233         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39234         this_arg_conv.is_owned = false;
39235         LDKNodeAnnouncement msg_conv;
39236         msg_conv.inner = untag_ptr(msg);
39237         msg_conv.is_owned = ptr_is_owned(msg);
39238         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
39239         msg_conv.is_owned = false;
39240         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
39241         *ret_conv = NetworkGraph_update_node_from_announcement(&this_arg_conv, &msg_conv);
39242         return tag_ptr(ret_conv, true);
39243 }
39244
39245 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) {
39246         LDKNetworkGraph this_arg_conv;
39247         this_arg_conv.inner = untag_ptr(this_arg);
39248         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39249         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39250         this_arg_conv.is_owned = false;
39251         LDKUnsignedNodeAnnouncement msg_conv;
39252         msg_conv.inner = untag_ptr(msg);
39253         msg_conv.is_owned = ptr_is_owned(msg);
39254         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
39255         msg_conv.is_owned = false;
39256         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
39257         *ret_conv = NetworkGraph_update_node_from_unsigned_announcement(&this_arg_conv, &msg_conv);
39258         return tag_ptr(ret_conv, true);
39259 }
39260
39261 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) {
39262         LDKNetworkGraph this_arg_conv;
39263         this_arg_conv.inner = untag_ptr(this_arg);
39264         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39265         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39266         this_arg_conv.is_owned = false;
39267         LDKChannelAnnouncement msg_conv;
39268         msg_conv.inner = untag_ptr(msg);
39269         msg_conv.is_owned = ptr_is_owned(msg);
39270         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
39271         msg_conv.is_owned = false;
39272         void* chain_access_ptr = untag_ptr(chain_access);
39273         CHECK_ACCESS(chain_access_ptr);
39274         LDKCOption_AccessZ chain_access_conv = *(LDKCOption_AccessZ*)(chain_access_ptr);
39275         // WARNING: we may need a move here but no clone is available for LDKCOption_AccessZ
39276         if (chain_access_conv.tag == LDKCOption_AccessZ_Some) {
39277                 // Manually implement clone for Java trait instances
39278                 if (chain_access_conv.some.free == LDKAccess_JCalls_free) {
39279                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
39280                         LDKAccess_JCalls_cloned(&chain_access_conv.some);
39281                 }
39282         }
39283         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
39284         *ret_conv = NetworkGraph_update_channel_from_announcement(&this_arg_conv, &msg_conv, chain_access_conv);
39285         return tag_ptr(ret_conv, true);
39286 }
39287
39288 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) {
39289         LDKNetworkGraph this_arg_conv;
39290         this_arg_conv.inner = untag_ptr(this_arg);
39291         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39292         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39293         this_arg_conv.is_owned = false;
39294         LDKUnsignedChannelAnnouncement msg_conv;
39295         msg_conv.inner = untag_ptr(msg);
39296         msg_conv.is_owned = ptr_is_owned(msg);
39297         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
39298         msg_conv.is_owned = false;
39299         void* chain_access_ptr = untag_ptr(chain_access);
39300         CHECK_ACCESS(chain_access_ptr);
39301         LDKCOption_AccessZ chain_access_conv = *(LDKCOption_AccessZ*)(chain_access_ptr);
39302         // WARNING: we may need a move here but no clone is available for LDKCOption_AccessZ
39303         if (chain_access_conv.tag == LDKCOption_AccessZ_Some) {
39304                 // Manually implement clone for Java trait instances
39305                 if (chain_access_conv.some.free == LDKAccess_JCalls_free) {
39306                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
39307                         LDKAccess_JCalls_cloned(&chain_access_conv.some);
39308                 }
39309         }
39310         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
39311         *ret_conv = NetworkGraph_update_channel_from_unsigned_announcement(&this_arg_conv, &msg_conv, chain_access_conv);
39312         return tag_ptr(ret_conv, true);
39313 }
39314
39315 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) {
39316         LDKNetworkGraph this_arg_conv;
39317         this_arg_conv.inner = untag_ptr(this_arg);
39318         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39319         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39320         this_arg_conv.is_owned = false;
39321         LDKChannelFeatures features_conv;
39322         features_conv.inner = untag_ptr(features);
39323         features_conv.is_owned = ptr_is_owned(features);
39324         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_conv);
39325         features_conv = ChannelFeatures_clone(&features_conv);
39326         LDKPublicKey node_id_1_ref;
39327         CHECK(node_id_1->arr_len == 33);
39328         memcpy(node_id_1_ref.compressed_form, node_id_1->elems, 33); FREE(node_id_1);
39329         LDKPublicKey node_id_2_ref;
39330         CHECK(node_id_2->arr_len == 33);
39331         memcpy(node_id_2_ref.compressed_form, node_id_2->elems, 33); FREE(node_id_2);
39332         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
39333         *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);
39334         return tag_ptr(ret_conv, true);
39335 }
39336
39337 void  __attribute__((export_name("TS_NetworkGraph_channel_failed"))) TS_NetworkGraph_channel_failed(uint64_t this_arg, int64_t short_channel_id, jboolean is_permanent) {
39338         LDKNetworkGraph this_arg_conv;
39339         this_arg_conv.inner = untag_ptr(this_arg);
39340         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39341         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39342         this_arg_conv.is_owned = false;
39343         NetworkGraph_channel_failed(&this_arg_conv, short_channel_id, is_permanent);
39344 }
39345
39346 void  __attribute__((export_name("TS_NetworkGraph_node_failed"))) TS_NetworkGraph_node_failed(uint64_t this_arg, int8_tArray _node_id, jboolean is_permanent) {
39347         LDKNetworkGraph this_arg_conv;
39348         this_arg_conv.inner = untag_ptr(this_arg);
39349         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39350         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39351         this_arg_conv.is_owned = false;
39352         LDKPublicKey _node_id_ref;
39353         CHECK(_node_id->arr_len == 33);
39354         memcpy(_node_id_ref.compressed_form, _node_id->elems, 33); FREE(_node_id);
39355         NetworkGraph_node_failed(&this_arg_conv, _node_id_ref, is_permanent);
39356 }
39357
39358 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) {
39359         LDKNetworkGraph this_arg_conv;
39360         this_arg_conv.inner = untag_ptr(this_arg);
39361         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39362         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39363         this_arg_conv.is_owned = false;
39364         NetworkGraph_remove_stale_channels_with_time(&this_arg_conv, current_time_unix);
39365 }
39366
39367 uint64_t  __attribute__((export_name("TS_NetworkGraph_update_channel"))) TS_NetworkGraph_update_channel(uint64_t this_arg, uint64_t msg) {
39368         LDKNetworkGraph this_arg_conv;
39369         this_arg_conv.inner = untag_ptr(this_arg);
39370         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39371         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39372         this_arg_conv.is_owned = false;
39373         LDKChannelUpdate msg_conv;
39374         msg_conv.inner = untag_ptr(msg);
39375         msg_conv.is_owned = ptr_is_owned(msg);
39376         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
39377         msg_conv.is_owned = false;
39378         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
39379         *ret_conv = NetworkGraph_update_channel(&this_arg_conv, &msg_conv);
39380         return tag_ptr(ret_conv, true);
39381 }
39382
39383 uint64_t  __attribute__((export_name("TS_NetworkGraph_update_channel_unsigned"))) TS_NetworkGraph_update_channel_unsigned(uint64_t this_arg, uint64_t msg) {
39384         LDKNetworkGraph this_arg_conv;
39385         this_arg_conv.inner = untag_ptr(this_arg);
39386         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39387         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39388         this_arg_conv.is_owned = false;
39389         LDKUnsignedChannelUpdate msg_conv;
39390         msg_conv.inner = untag_ptr(msg);
39391         msg_conv.is_owned = ptr_is_owned(msg);
39392         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
39393         msg_conv.is_owned = false;
39394         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
39395         *ret_conv = NetworkGraph_update_channel_unsigned(&this_arg_conv, &msg_conv);
39396         return tag_ptr(ret_conv, true);
39397 }
39398
39399 uint64_t  __attribute__((export_name("TS_ReadOnlyNetworkGraph_channel"))) TS_ReadOnlyNetworkGraph_channel(uint64_t this_arg, int64_t short_channel_id) {
39400         LDKReadOnlyNetworkGraph this_arg_conv;
39401         this_arg_conv.inner = untag_ptr(this_arg);
39402         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39403         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39404         this_arg_conv.is_owned = false;
39405         LDKChannelInfo ret_var = ReadOnlyNetworkGraph_channel(&this_arg_conv, short_channel_id);
39406         uint64_t ret_ref = 0;
39407         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39408         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39409         return ret_ref;
39410 }
39411
39412 int64_tArray  __attribute__((export_name("TS_ReadOnlyNetworkGraph_list_channels"))) TS_ReadOnlyNetworkGraph_list_channels(uint64_t this_arg) {
39413         LDKReadOnlyNetworkGraph this_arg_conv;
39414         this_arg_conv.inner = untag_ptr(this_arg);
39415         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39416         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39417         this_arg_conv.is_owned = false;
39418         LDKCVec_u64Z ret_var = ReadOnlyNetworkGraph_list_channels(&this_arg_conv);
39419         int64_tArray ret_arr = NULL;
39420         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
39421         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
39422         for (size_t i = 0; i < ret_var.datalen; i++) {
39423                 int64_t ret_conv_8_conv = ret_var.data[i];
39424                 ret_arr_ptr[i] = ret_conv_8_conv;
39425         }
39426         
39427         FREE(ret_var.data);
39428         return ret_arr;
39429 }
39430
39431 uint64_t  __attribute__((export_name("TS_ReadOnlyNetworkGraph_node"))) TS_ReadOnlyNetworkGraph_node(uint64_t this_arg, uint64_t node_id) {
39432         LDKReadOnlyNetworkGraph this_arg_conv;
39433         this_arg_conv.inner = untag_ptr(this_arg);
39434         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39435         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39436         this_arg_conv.is_owned = false;
39437         LDKNodeId node_id_conv;
39438         node_id_conv.inner = untag_ptr(node_id);
39439         node_id_conv.is_owned = ptr_is_owned(node_id);
39440         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv);
39441         node_id_conv.is_owned = false;
39442         LDKNodeInfo ret_var = ReadOnlyNetworkGraph_node(&this_arg_conv, &node_id_conv);
39443         uint64_t ret_ref = 0;
39444         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39445         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39446         return ret_ref;
39447 }
39448
39449 uint64_tArray  __attribute__((export_name("TS_ReadOnlyNetworkGraph_list_nodes"))) TS_ReadOnlyNetworkGraph_list_nodes(uint64_t this_arg) {
39450         LDKReadOnlyNetworkGraph this_arg_conv;
39451         this_arg_conv.inner = untag_ptr(this_arg);
39452         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39453         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39454         this_arg_conv.is_owned = false;
39455         LDKCVec_NodeIdZ ret_var = ReadOnlyNetworkGraph_list_nodes(&this_arg_conv);
39456         uint64_tArray ret_arr = NULL;
39457         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
39458         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
39459         for (size_t i = 0; i < ret_var.datalen; i++) {
39460                 LDKNodeId ret_conv_8_var = ret_var.data[i];
39461                 uint64_t ret_conv_8_ref = 0;
39462                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_8_var);
39463                 ret_conv_8_ref = tag_ptr(ret_conv_8_var.inner, ret_conv_8_var.is_owned);
39464                 ret_arr_ptr[i] = ret_conv_8_ref;
39465         }
39466         
39467         FREE(ret_var.data);
39468         return ret_arr;
39469 }
39470
39471 uint64_t  __attribute__((export_name("TS_ReadOnlyNetworkGraph_get_addresses"))) TS_ReadOnlyNetworkGraph_get_addresses(uint64_t this_arg, int8_tArray pubkey) {
39472         LDKReadOnlyNetworkGraph this_arg_conv;
39473         this_arg_conv.inner = untag_ptr(this_arg);
39474         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39475         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39476         this_arg_conv.is_owned = false;
39477         LDKPublicKey pubkey_ref;
39478         CHECK(pubkey->arr_len == 33);
39479         memcpy(pubkey_ref.compressed_form, pubkey->elems, 33); FREE(pubkey);
39480         LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
39481         *ret_copy = ReadOnlyNetworkGraph_get_addresses(&this_arg_conv, pubkey_ref);
39482         uint64_t ret_ref = tag_ptr(ret_copy, true);
39483         return ret_ref;
39484 }
39485
39486 void  __attribute__((export_name("TS_RouteHop_free"))) TS_RouteHop_free(uint64_t this_obj) {
39487         LDKRouteHop this_obj_conv;
39488         this_obj_conv.inner = untag_ptr(this_obj);
39489         this_obj_conv.is_owned = ptr_is_owned(this_obj);
39490         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39491         RouteHop_free(this_obj_conv);
39492 }
39493
39494 int8_tArray  __attribute__((export_name("TS_RouteHop_get_pubkey"))) TS_RouteHop_get_pubkey(uint64_t this_ptr) {
39495         LDKRouteHop this_ptr_conv;
39496         this_ptr_conv.inner = untag_ptr(this_ptr);
39497         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39498         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39499         this_ptr_conv.is_owned = false;
39500         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
39501         memcpy(ret_arr->elems, RouteHop_get_pubkey(&this_ptr_conv).compressed_form, 33);
39502         return ret_arr;
39503 }
39504
39505 void  __attribute__((export_name("TS_RouteHop_set_pubkey"))) TS_RouteHop_set_pubkey(uint64_t this_ptr, int8_tArray val) {
39506         LDKRouteHop this_ptr_conv;
39507         this_ptr_conv.inner = untag_ptr(this_ptr);
39508         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39509         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39510         this_ptr_conv.is_owned = false;
39511         LDKPublicKey val_ref;
39512         CHECK(val->arr_len == 33);
39513         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
39514         RouteHop_set_pubkey(&this_ptr_conv, val_ref);
39515 }
39516
39517 uint64_t  __attribute__((export_name("TS_RouteHop_get_node_features"))) TS_RouteHop_get_node_features(uint64_t this_ptr) {
39518         LDKRouteHop this_ptr_conv;
39519         this_ptr_conv.inner = untag_ptr(this_ptr);
39520         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39521         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39522         this_ptr_conv.is_owned = false;
39523         LDKNodeFeatures ret_var = RouteHop_get_node_features(&this_ptr_conv);
39524         uint64_t ret_ref = 0;
39525         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39526         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39527         return ret_ref;
39528 }
39529
39530 void  __attribute__((export_name("TS_RouteHop_set_node_features"))) TS_RouteHop_set_node_features(uint64_t this_ptr, uint64_t val) {
39531         LDKRouteHop this_ptr_conv;
39532         this_ptr_conv.inner = untag_ptr(this_ptr);
39533         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39534         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39535         this_ptr_conv.is_owned = false;
39536         LDKNodeFeatures val_conv;
39537         val_conv.inner = untag_ptr(val);
39538         val_conv.is_owned = ptr_is_owned(val);
39539         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
39540         val_conv = NodeFeatures_clone(&val_conv);
39541         RouteHop_set_node_features(&this_ptr_conv, val_conv);
39542 }
39543
39544 int64_t  __attribute__((export_name("TS_RouteHop_get_short_channel_id"))) TS_RouteHop_get_short_channel_id(uint64_t this_ptr) {
39545         LDKRouteHop this_ptr_conv;
39546         this_ptr_conv.inner = untag_ptr(this_ptr);
39547         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39548         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39549         this_ptr_conv.is_owned = false;
39550         int64_t ret_conv = RouteHop_get_short_channel_id(&this_ptr_conv);
39551         return ret_conv;
39552 }
39553
39554 void  __attribute__((export_name("TS_RouteHop_set_short_channel_id"))) TS_RouteHop_set_short_channel_id(uint64_t this_ptr, int64_t val) {
39555         LDKRouteHop this_ptr_conv;
39556         this_ptr_conv.inner = untag_ptr(this_ptr);
39557         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39558         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39559         this_ptr_conv.is_owned = false;
39560         RouteHop_set_short_channel_id(&this_ptr_conv, val);
39561 }
39562
39563 uint64_t  __attribute__((export_name("TS_RouteHop_get_channel_features"))) TS_RouteHop_get_channel_features(uint64_t this_ptr) {
39564         LDKRouteHop this_ptr_conv;
39565         this_ptr_conv.inner = untag_ptr(this_ptr);
39566         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39567         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39568         this_ptr_conv.is_owned = false;
39569         LDKChannelFeatures ret_var = RouteHop_get_channel_features(&this_ptr_conv);
39570         uint64_t ret_ref = 0;
39571         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39572         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39573         return ret_ref;
39574 }
39575
39576 void  __attribute__((export_name("TS_RouteHop_set_channel_features"))) TS_RouteHop_set_channel_features(uint64_t this_ptr, uint64_t val) {
39577         LDKRouteHop this_ptr_conv;
39578         this_ptr_conv.inner = untag_ptr(this_ptr);
39579         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39580         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39581         this_ptr_conv.is_owned = false;
39582         LDKChannelFeatures val_conv;
39583         val_conv.inner = untag_ptr(val);
39584         val_conv.is_owned = ptr_is_owned(val);
39585         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
39586         val_conv = ChannelFeatures_clone(&val_conv);
39587         RouteHop_set_channel_features(&this_ptr_conv, val_conv);
39588 }
39589
39590 int64_t  __attribute__((export_name("TS_RouteHop_get_fee_msat"))) TS_RouteHop_get_fee_msat(uint64_t this_ptr) {
39591         LDKRouteHop this_ptr_conv;
39592         this_ptr_conv.inner = untag_ptr(this_ptr);
39593         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39594         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39595         this_ptr_conv.is_owned = false;
39596         int64_t ret_conv = RouteHop_get_fee_msat(&this_ptr_conv);
39597         return ret_conv;
39598 }
39599
39600 void  __attribute__((export_name("TS_RouteHop_set_fee_msat"))) TS_RouteHop_set_fee_msat(uint64_t this_ptr, int64_t val) {
39601         LDKRouteHop this_ptr_conv;
39602         this_ptr_conv.inner = untag_ptr(this_ptr);
39603         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39604         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39605         this_ptr_conv.is_owned = false;
39606         RouteHop_set_fee_msat(&this_ptr_conv, val);
39607 }
39608
39609 int32_t  __attribute__((export_name("TS_RouteHop_get_cltv_expiry_delta"))) TS_RouteHop_get_cltv_expiry_delta(uint64_t this_ptr) {
39610         LDKRouteHop this_ptr_conv;
39611         this_ptr_conv.inner = untag_ptr(this_ptr);
39612         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39613         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39614         this_ptr_conv.is_owned = false;
39615         int32_t ret_conv = RouteHop_get_cltv_expiry_delta(&this_ptr_conv);
39616         return ret_conv;
39617 }
39618
39619 void  __attribute__((export_name("TS_RouteHop_set_cltv_expiry_delta"))) TS_RouteHop_set_cltv_expiry_delta(uint64_t this_ptr, int32_t val) {
39620         LDKRouteHop this_ptr_conv;
39621         this_ptr_conv.inner = untag_ptr(this_ptr);
39622         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39623         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39624         this_ptr_conv.is_owned = false;
39625         RouteHop_set_cltv_expiry_delta(&this_ptr_conv, val);
39626 }
39627
39628 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) {
39629         LDKPublicKey pubkey_arg_ref;
39630         CHECK(pubkey_arg->arr_len == 33);
39631         memcpy(pubkey_arg_ref.compressed_form, pubkey_arg->elems, 33); FREE(pubkey_arg);
39632         LDKNodeFeatures node_features_arg_conv;
39633         node_features_arg_conv.inner = untag_ptr(node_features_arg);
39634         node_features_arg_conv.is_owned = ptr_is_owned(node_features_arg);
39635         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_features_arg_conv);
39636         node_features_arg_conv = NodeFeatures_clone(&node_features_arg_conv);
39637         LDKChannelFeatures channel_features_arg_conv;
39638         channel_features_arg_conv.inner = untag_ptr(channel_features_arg);
39639         channel_features_arg_conv.is_owned = ptr_is_owned(channel_features_arg);
39640         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_features_arg_conv);
39641         channel_features_arg_conv = ChannelFeatures_clone(&channel_features_arg_conv);
39642         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);
39643         uint64_t ret_ref = 0;
39644         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39645         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39646         return ret_ref;
39647 }
39648
39649 static inline uint64_t RouteHop_clone_ptr(LDKRouteHop *NONNULL_PTR arg) {
39650         LDKRouteHop ret_var = RouteHop_clone(arg);
39651         uint64_t ret_ref = 0;
39652         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39653         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39654         return ret_ref;
39655 }
39656 int64_t  __attribute__((export_name("TS_RouteHop_clone_ptr"))) TS_RouteHop_clone_ptr(uint64_t arg) {
39657         LDKRouteHop arg_conv;
39658         arg_conv.inner = untag_ptr(arg);
39659         arg_conv.is_owned = ptr_is_owned(arg);
39660         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39661         arg_conv.is_owned = false;
39662         int64_t ret_conv = RouteHop_clone_ptr(&arg_conv);
39663         return ret_conv;
39664 }
39665
39666 uint64_t  __attribute__((export_name("TS_RouteHop_clone"))) TS_RouteHop_clone(uint64_t orig) {
39667         LDKRouteHop orig_conv;
39668         orig_conv.inner = untag_ptr(orig);
39669         orig_conv.is_owned = ptr_is_owned(orig);
39670         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39671         orig_conv.is_owned = false;
39672         LDKRouteHop ret_var = RouteHop_clone(&orig_conv);
39673         uint64_t ret_ref = 0;
39674         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39675         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39676         return ret_ref;
39677 }
39678
39679 int64_t  __attribute__((export_name("TS_RouteHop_hash"))) TS_RouteHop_hash(uint64_t o) {
39680         LDKRouteHop o_conv;
39681         o_conv.inner = untag_ptr(o);
39682         o_conv.is_owned = ptr_is_owned(o);
39683         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
39684         o_conv.is_owned = false;
39685         int64_t ret_conv = RouteHop_hash(&o_conv);
39686         return ret_conv;
39687 }
39688
39689 jboolean  __attribute__((export_name("TS_RouteHop_eq"))) TS_RouteHop_eq(uint64_t a, uint64_t b) {
39690         LDKRouteHop a_conv;
39691         a_conv.inner = untag_ptr(a);
39692         a_conv.is_owned = ptr_is_owned(a);
39693         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
39694         a_conv.is_owned = false;
39695         LDKRouteHop b_conv;
39696         b_conv.inner = untag_ptr(b);
39697         b_conv.is_owned = ptr_is_owned(b);
39698         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
39699         b_conv.is_owned = false;
39700         jboolean ret_conv = RouteHop_eq(&a_conv, &b_conv);
39701         return ret_conv;
39702 }
39703
39704 int8_tArray  __attribute__((export_name("TS_RouteHop_write"))) TS_RouteHop_write(uint64_t obj) {
39705         LDKRouteHop obj_conv;
39706         obj_conv.inner = untag_ptr(obj);
39707         obj_conv.is_owned = ptr_is_owned(obj);
39708         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
39709         obj_conv.is_owned = false;
39710         LDKCVec_u8Z ret_var = RouteHop_write(&obj_conv);
39711         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
39712         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
39713         CVec_u8Z_free(ret_var);
39714         return ret_arr;
39715 }
39716
39717 uint64_t  __attribute__((export_name("TS_RouteHop_read"))) TS_RouteHop_read(int8_tArray ser) {
39718         LDKu8slice ser_ref;
39719         ser_ref.datalen = ser->arr_len;
39720         ser_ref.data = ser->elems;
39721         LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
39722         *ret_conv = RouteHop_read(ser_ref);
39723         FREE(ser);
39724         return tag_ptr(ret_conv, true);
39725 }
39726
39727 void  __attribute__((export_name("TS_Route_free"))) TS_Route_free(uint64_t this_obj) {
39728         LDKRoute this_obj_conv;
39729         this_obj_conv.inner = untag_ptr(this_obj);
39730         this_obj_conv.is_owned = ptr_is_owned(this_obj);
39731         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39732         Route_free(this_obj_conv);
39733 }
39734
39735 ptrArray  __attribute__((export_name("TS_Route_get_paths"))) TS_Route_get_paths(uint64_t this_ptr) {
39736         LDKRoute this_ptr_conv;
39737         this_ptr_conv.inner = untag_ptr(this_ptr);
39738         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39739         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39740         this_ptr_conv.is_owned = false;
39741         LDKCVec_CVec_RouteHopZZ ret_var = Route_get_paths(&this_ptr_conv);
39742         ptrArray ret_arr = NULL;
39743         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
39744         uint64_tArray *ret_arr_ptr = (uint64_tArray*)(((uint8_t*)ret_arr) + 8);
39745         for (size_t m = 0; m < ret_var.datalen; m++) {
39746                 LDKCVec_RouteHopZ ret_conv_12_var = ret_var.data[m];
39747                 uint64_tArray ret_conv_12_arr = NULL;
39748                 ret_conv_12_arr = init_uint64_tArray(ret_conv_12_var.datalen, __LINE__);
39749                 uint64_t *ret_conv_12_arr_ptr = (uint64_t*)(((uint8_t*)ret_conv_12_arr) + 8);
39750                 for (size_t k = 0; k < ret_conv_12_var.datalen; k++) {
39751                         LDKRouteHop ret_conv_12_conv_10_var = ret_conv_12_var.data[k];
39752                         uint64_t ret_conv_12_conv_10_ref = 0;
39753                         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_12_conv_10_var);
39754                         ret_conv_12_conv_10_ref = tag_ptr(ret_conv_12_conv_10_var.inner, ret_conv_12_conv_10_var.is_owned);
39755                         ret_conv_12_arr_ptr[k] = ret_conv_12_conv_10_ref;
39756                 }
39757                 
39758                 FREE(ret_conv_12_var.data);
39759                 ret_arr_ptr[m] = ret_conv_12_arr;
39760         }
39761         
39762         FREE(ret_var.data);
39763         return ret_arr;
39764 }
39765
39766 void  __attribute__((export_name("TS_Route_set_paths"))) TS_Route_set_paths(uint64_t this_ptr, ptrArray val) {
39767         LDKRoute this_ptr_conv;
39768         this_ptr_conv.inner = untag_ptr(this_ptr);
39769         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39770         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39771         this_ptr_conv.is_owned = false;
39772         LDKCVec_CVec_RouteHopZZ val_constr;
39773         val_constr.datalen = val->arr_len;
39774         if (val_constr.datalen > 0)
39775                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
39776         else
39777                 val_constr.data = NULL;
39778         uint64_tArray* val_vals = (void*) val->elems;
39779         for (size_t m = 0; m < val_constr.datalen; m++) {
39780                 uint64_tArray val_conv_12 = val_vals[m];
39781                 LDKCVec_RouteHopZ val_conv_12_constr;
39782                 val_conv_12_constr.datalen = val_conv_12->arr_len;
39783                 if (val_conv_12_constr.datalen > 0)
39784                         val_conv_12_constr.data = MALLOC(val_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
39785                 else
39786                         val_conv_12_constr.data = NULL;
39787                 uint64_t* val_conv_12_vals = val_conv_12->elems;
39788                 for (size_t k = 0; k < val_conv_12_constr.datalen; k++) {
39789                         uint64_t val_conv_12_conv_10 = val_conv_12_vals[k];
39790                         LDKRouteHop val_conv_12_conv_10_conv;
39791                         val_conv_12_conv_10_conv.inner = untag_ptr(val_conv_12_conv_10);
39792                         val_conv_12_conv_10_conv.is_owned = ptr_is_owned(val_conv_12_conv_10);
39793                         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_12_conv_10_conv);
39794                         val_conv_12_conv_10_conv = RouteHop_clone(&val_conv_12_conv_10_conv);
39795                         val_conv_12_constr.data[k] = val_conv_12_conv_10_conv;
39796                 }
39797                 FREE(val_conv_12);
39798                 val_constr.data[m] = val_conv_12_constr;
39799         }
39800         FREE(val);
39801         Route_set_paths(&this_ptr_conv, val_constr);
39802 }
39803
39804 uint64_t  __attribute__((export_name("TS_Route_get_payment_params"))) TS_Route_get_payment_params(uint64_t this_ptr) {
39805         LDKRoute this_ptr_conv;
39806         this_ptr_conv.inner = untag_ptr(this_ptr);
39807         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39808         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39809         this_ptr_conv.is_owned = false;
39810         LDKPaymentParameters ret_var = Route_get_payment_params(&this_ptr_conv);
39811         uint64_t ret_ref = 0;
39812         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39813         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39814         return ret_ref;
39815 }
39816
39817 void  __attribute__((export_name("TS_Route_set_payment_params"))) TS_Route_set_payment_params(uint64_t this_ptr, uint64_t val) {
39818         LDKRoute this_ptr_conv;
39819         this_ptr_conv.inner = untag_ptr(this_ptr);
39820         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39821         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39822         this_ptr_conv.is_owned = false;
39823         LDKPaymentParameters val_conv;
39824         val_conv.inner = untag_ptr(val);
39825         val_conv.is_owned = ptr_is_owned(val);
39826         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
39827         val_conv = PaymentParameters_clone(&val_conv);
39828         Route_set_payment_params(&this_ptr_conv, val_conv);
39829 }
39830
39831 uint64_t  __attribute__((export_name("TS_Route_new"))) TS_Route_new(ptrArray paths_arg, uint64_t payment_params_arg) {
39832         LDKCVec_CVec_RouteHopZZ paths_arg_constr;
39833         paths_arg_constr.datalen = paths_arg->arr_len;
39834         if (paths_arg_constr.datalen > 0)
39835                 paths_arg_constr.data = MALLOC(paths_arg_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
39836         else
39837                 paths_arg_constr.data = NULL;
39838         uint64_tArray* paths_arg_vals = (void*) paths_arg->elems;
39839         for (size_t m = 0; m < paths_arg_constr.datalen; m++) {
39840                 uint64_tArray paths_arg_conv_12 = paths_arg_vals[m];
39841                 LDKCVec_RouteHopZ paths_arg_conv_12_constr;
39842                 paths_arg_conv_12_constr.datalen = paths_arg_conv_12->arr_len;
39843                 if (paths_arg_conv_12_constr.datalen > 0)
39844                         paths_arg_conv_12_constr.data = MALLOC(paths_arg_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
39845                 else
39846                         paths_arg_conv_12_constr.data = NULL;
39847                 uint64_t* paths_arg_conv_12_vals = paths_arg_conv_12->elems;
39848                 for (size_t k = 0; k < paths_arg_conv_12_constr.datalen; k++) {
39849                         uint64_t paths_arg_conv_12_conv_10 = paths_arg_conv_12_vals[k];
39850                         LDKRouteHop paths_arg_conv_12_conv_10_conv;
39851                         paths_arg_conv_12_conv_10_conv.inner = untag_ptr(paths_arg_conv_12_conv_10);
39852                         paths_arg_conv_12_conv_10_conv.is_owned = ptr_is_owned(paths_arg_conv_12_conv_10);
39853                         CHECK_INNER_FIELD_ACCESS_OR_NULL(paths_arg_conv_12_conv_10_conv);
39854                         paths_arg_conv_12_conv_10_conv = RouteHop_clone(&paths_arg_conv_12_conv_10_conv);
39855                         paths_arg_conv_12_constr.data[k] = paths_arg_conv_12_conv_10_conv;
39856                 }
39857                 FREE(paths_arg_conv_12);
39858                 paths_arg_constr.data[m] = paths_arg_conv_12_constr;
39859         }
39860         FREE(paths_arg);
39861         LDKPaymentParameters payment_params_arg_conv;
39862         payment_params_arg_conv.inner = untag_ptr(payment_params_arg);
39863         payment_params_arg_conv.is_owned = ptr_is_owned(payment_params_arg);
39864         CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_params_arg_conv);
39865         payment_params_arg_conv = PaymentParameters_clone(&payment_params_arg_conv);
39866         LDKRoute ret_var = Route_new(paths_arg_constr, payment_params_arg_conv);
39867         uint64_t ret_ref = 0;
39868         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39869         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39870         return ret_ref;
39871 }
39872
39873 static inline uint64_t Route_clone_ptr(LDKRoute *NONNULL_PTR arg) {
39874         LDKRoute ret_var = Route_clone(arg);
39875         uint64_t ret_ref = 0;
39876         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39877         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39878         return ret_ref;
39879 }
39880 int64_t  __attribute__((export_name("TS_Route_clone_ptr"))) TS_Route_clone_ptr(uint64_t arg) {
39881         LDKRoute arg_conv;
39882         arg_conv.inner = untag_ptr(arg);
39883         arg_conv.is_owned = ptr_is_owned(arg);
39884         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39885         arg_conv.is_owned = false;
39886         int64_t ret_conv = Route_clone_ptr(&arg_conv);
39887         return ret_conv;
39888 }
39889
39890 uint64_t  __attribute__((export_name("TS_Route_clone"))) TS_Route_clone(uint64_t orig) {
39891         LDKRoute orig_conv;
39892         orig_conv.inner = untag_ptr(orig);
39893         orig_conv.is_owned = ptr_is_owned(orig);
39894         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39895         orig_conv.is_owned = false;
39896         LDKRoute ret_var = Route_clone(&orig_conv);
39897         uint64_t ret_ref = 0;
39898         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39899         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39900         return ret_ref;
39901 }
39902
39903 int64_t  __attribute__((export_name("TS_Route_hash"))) TS_Route_hash(uint64_t o) {
39904         LDKRoute o_conv;
39905         o_conv.inner = untag_ptr(o);
39906         o_conv.is_owned = ptr_is_owned(o);
39907         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
39908         o_conv.is_owned = false;
39909         int64_t ret_conv = Route_hash(&o_conv);
39910         return ret_conv;
39911 }
39912
39913 jboolean  __attribute__((export_name("TS_Route_eq"))) TS_Route_eq(uint64_t a, uint64_t b) {
39914         LDKRoute a_conv;
39915         a_conv.inner = untag_ptr(a);
39916         a_conv.is_owned = ptr_is_owned(a);
39917         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
39918         a_conv.is_owned = false;
39919         LDKRoute b_conv;
39920         b_conv.inner = untag_ptr(b);
39921         b_conv.is_owned = ptr_is_owned(b);
39922         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
39923         b_conv.is_owned = false;
39924         jboolean ret_conv = Route_eq(&a_conv, &b_conv);
39925         return ret_conv;
39926 }
39927
39928 int64_t  __attribute__((export_name("TS_Route_get_total_fees"))) TS_Route_get_total_fees(uint64_t this_arg) {
39929         LDKRoute this_arg_conv;
39930         this_arg_conv.inner = untag_ptr(this_arg);
39931         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39932         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39933         this_arg_conv.is_owned = false;
39934         int64_t ret_conv = Route_get_total_fees(&this_arg_conv);
39935         return ret_conv;
39936 }
39937
39938 int64_t  __attribute__((export_name("TS_Route_get_total_amount"))) TS_Route_get_total_amount(uint64_t this_arg) {
39939         LDKRoute this_arg_conv;
39940         this_arg_conv.inner = untag_ptr(this_arg);
39941         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39942         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39943         this_arg_conv.is_owned = false;
39944         int64_t ret_conv = Route_get_total_amount(&this_arg_conv);
39945         return ret_conv;
39946 }
39947
39948 int8_tArray  __attribute__((export_name("TS_Route_write"))) TS_Route_write(uint64_t obj) {
39949         LDKRoute obj_conv;
39950         obj_conv.inner = untag_ptr(obj);
39951         obj_conv.is_owned = ptr_is_owned(obj);
39952         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
39953         obj_conv.is_owned = false;
39954         LDKCVec_u8Z ret_var = Route_write(&obj_conv);
39955         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
39956         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
39957         CVec_u8Z_free(ret_var);
39958         return ret_arr;
39959 }
39960
39961 uint64_t  __attribute__((export_name("TS_Route_read"))) TS_Route_read(int8_tArray ser) {
39962         LDKu8slice ser_ref;
39963         ser_ref.datalen = ser->arr_len;
39964         ser_ref.data = ser->elems;
39965         LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
39966         *ret_conv = Route_read(ser_ref);
39967         FREE(ser);
39968         return tag_ptr(ret_conv, true);
39969 }
39970
39971 void  __attribute__((export_name("TS_RouteParameters_free"))) TS_RouteParameters_free(uint64_t this_obj) {
39972         LDKRouteParameters this_obj_conv;
39973         this_obj_conv.inner = untag_ptr(this_obj);
39974         this_obj_conv.is_owned = ptr_is_owned(this_obj);
39975         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39976         RouteParameters_free(this_obj_conv);
39977 }
39978
39979 uint64_t  __attribute__((export_name("TS_RouteParameters_get_payment_params"))) TS_RouteParameters_get_payment_params(uint64_t this_ptr) {
39980         LDKRouteParameters this_ptr_conv;
39981         this_ptr_conv.inner = untag_ptr(this_ptr);
39982         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39983         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39984         this_ptr_conv.is_owned = false;
39985         LDKPaymentParameters ret_var = RouteParameters_get_payment_params(&this_ptr_conv);
39986         uint64_t ret_ref = 0;
39987         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39988         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39989         return ret_ref;
39990 }
39991
39992 void  __attribute__((export_name("TS_RouteParameters_set_payment_params"))) TS_RouteParameters_set_payment_params(uint64_t this_ptr, uint64_t val) {
39993         LDKRouteParameters this_ptr_conv;
39994         this_ptr_conv.inner = untag_ptr(this_ptr);
39995         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39996         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39997         this_ptr_conv.is_owned = false;
39998         LDKPaymentParameters val_conv;
39999         val_conv.inner = untag_ptr(val);
40000         val_conv.is_owned = ptr_is_owned(val);
40001         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
40002         val_conv = PaymentParameters_clone(&val_conv);
40003         RouteParameters_set_payment_params(&this_ptr_conv, val_conv);
40004 }
40005
40006 int64_t  __attribute__((export_name("TS_RouteParameters_get_final_value_msat"))) TS_RouteParameters_get_final_value_msat(uint64_t this_ptr) {
40007         LDKRouteParameters this_ptr_conv;
40008         this_ptr_conv.inner = untag_ptr(this_ptr);
40009         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40010         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40011         this_ptr_conv.is_owned = false;
40012         int64_t ret_conv = RouteParameters_get_final_value_msat(&this_ptr_conv);
40013         return ret_conv;
40014 }
40015
40016 void  __attribute__((export_name("TS_RouteParameters_set_final_value_msat"))) TS_RouteParameters_set_final_value_msat(uint64_t this_ptr, int64_t val) {
40017         LDKRouteParameters this_ptr_conv;
40018         this_ptr_conv.inner = untag_ptr(this_ptr);
40019         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40020         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40021         this_ptr_conv.is_owned = false;
40022         RouteParameters_set_final_value_msat(&this_ptr_conv, val);
40023 }
40024
40025 int32_t  __attribute__((export_name("TS_RouteParameters_get_final_cltv_expiry_delta"))) TS_RouteParameters_get_final_cltv_expiry_delta(uint64_t this_ptr) {
40026         LDKRouteParameters this_ptr_conv;
40027         this_ptr_conv.inner = untag_ptr(this_ptr);
40028         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40029         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40030         this_ptr_conv.is_owned = false;
40031         int32_t ret_conv = RouteParameters_get_final_cltv_expiry_delta(&this_ptr_conv);
40032         return ret_conv;
40033 }
40034
40035 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) {
40036         LDKRouteParameters this_ptr_conv;
40037         this_ptr_conv.inner = untag_ptr(this_ptr);
40038         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40039         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40040         this_ptr_conv.is_owned = false;
40041         RouteParameters_set_final_cltv_expiry_delta(&this_ptr_conv, val);
40042 }
40043
40044 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) {
40045         LDKPaymentParameters payment_params_arg_conv;
40046         payment_params_arg_conv.inner = untag_ptr(payment_params_arg);
40047         payment_params_arg_conv.is_owned = ptr_is_owned(payment_params_arg);
40048         CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_params_arg_conv);
40049         payment_params_arg_conv = PaymentParameters_clone(&payment_params_arg_conv);
40050         LDKRouteParameters ret_var = RouteParameters_new(payment_params_arg_conv, final_value_msat_arg, final_cltv_expiry_delta_arg);
40051         uint64_t ret_ref = 0;
40052         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40053         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40054         return ret_ref;
40055 }
40056
40057 static inline uint64_t RouteParameters_clone_ptr(LDKRouteParameters *NONNULL_PTR arg) {
40058         LDKRouteParameters ret_var = RouteParameters_clone(arg);
40059         uint64_t ret_ref = 0;
40060         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40061         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40062         return ret_ref;
40063 }
40064 int64_t  __attribute__((export_name("TS_RouteParameters_clone_ptr"))) TS_RouteParameters_clone_ptr(uint64_t arg) {
40065         LDKRouteParameters arg_conv;
40066         arg_conv.inner = untag_ptr(arg);
40067         arg_conv.is_owned = ptr_is_owned(arg);
40068         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40069         arg_conv.is_owned = false;
40070         int64_t ret_conv = RouteParameters_clone_ptr(&arg_conv);
40071         return ret_conv;
40072 }
40073
40074 uint64_t  __attribute__((export_name("TS_RouteParameters_clone"))) TS_RouteParameters_clone(uint64_t orig) {
40075         LDKRouteParameters orig_conv;
40076         orig_conv.inner = untag_ptr(orig);
40077         orig_conv.is_owned = ptr_is_owned(orig);
40078         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40079         orig_conv.is_owned = false;
40080         LDKRouteParameters ret_var = RouteParameters_clone(&orig_conv);
40081         uint64_t ret_ref = 0;
40082         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40083         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40084         return ret_ref;
40085 }
40086
40087 int8_tArray  __attribute__((export_name("TS_RouteParameters_write"))) TS_RouteParameters_write(uint64_t obj) {
40088         LDKRouteParameters obj_conv;
40089         obj_conv.inner = untag_ptr(obj);
40090         obj_conv.is_owned = ptr_is_owned(obj);
40091         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
40092         obj_conv.is_owned = false;
40093         LDKCVec_u8Z ret_var = RouteParameters_write(&obj_conv);
40094         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
40095         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
40096         CVec_u8Z_free(ret_var);
40097         return ret_arr;
40098 }
40099
40100 uint64_t  __attribute__((export_name("TS_RouteParameters_read"))) TS_RouteParameters_read(int8_tArray ser) {
40101         LDKu8slice ser_ref;
40102         ser_ref.datalen = ser->arr_len;
40103         ser_ref.data = ser->elems;
40104         LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
40105         *ret_conv = RouteParameters_read(ser_ref);
40106         FREE(ser);
40107         return tag_ptr(ret_conv, true);
40108 }
40109
40110 void  __attribute__((export_name("TS_PaymentParameters_free"))) TS_PaymentParameters_free(uint64_t this_obj) {
40111         LDKPaymentParameters this_obj_conv;
40112         this_obj_conv.inner = untag_ptr(this_obj);
40113         this_obj_conv.is_owned = ptr_is_owned(this_obj);
40114         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40115         PaymentParameters_free(this_obj_conv);
40116 }
40117
40118 int8_tArray  __attribute__((export_name("TS_PaymentParameters_get_payee_pubkey"))) TS_PaymentParameters_get_payee_pubkey(uint64_t this_ptr) {
40119         LDKPaymentParameters this_ptr_conv;
40120         this_ptr_conv.inner = untag_ptr(this_ptr);
40121         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40122         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40123         this_ptr_conv.is_owned = false;
40124         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
40125         memcpy(ret_arr->elems, PaymentParameters_get_payee_pubkey(&this_ptr_conv).compressed_form, 33);
40126         return ret_arr;
40127 }
40128
40129 void  __attribute__((export_name("TS_PaymentParameters_set_payee_pubkey"))) TS_PaymentParameters_set_payee_pubkey(uint64_t this_ptr, int8_tArray val) {
40130         LDKPaymentParameters this_ptr_conv;
40131         this_ptr_conv.inner = untag_ptr(this_ptr);
40132         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40133         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40134         this_ptr_conv.is_owned = false;
40135         LDKPublicKey val_ref;
40136         CHECK(val->arr_len == 33);
40137         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
40138         PaymentParameters_set_payee_pubkey(&this_ptr_conv, val_ref);
40139 }
40140
40141 uint64_t  __attribute__((export_name("TS_PaymentParameters_get_features"))) TS_PaymentParameters_get_features(uint64_t this_ptr) {
40142         LDKPaymentParameters this_ptr_conv;
40143         this_ptr_conv.inner = untag_ptr(this_ptr);
40144         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40145         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40146         this_ptr_conv.is_owned = false;
40147         LDKInvoiceFeatures ret_var = PaymentParameters_get_features(&this_ptr_conv);
40148         uint64_t ret_ref = 0;
40149         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40150         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40151         return ret_ref;
40152 }
40153
40154 void  __attribute__((export_name("TS_PaymentParameters_set_features"))) TS_PaymentParameters_set_features(uint64_t this_ptr, uint64_t val) {
40155         LDKPaymentParameters this_ptr_conv;
40156         this_ptr_conv.inner = untag_ptr(this_ptr);
40157         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40158         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40159         this_ptr_conv.is_owned = false;
40160         LDKInvoiceFeatures val_conv;
40161         val_conv.inner = untag_ptr(val);
40162         val_conv.is_owned = ptr_is_owned(val);
40163         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
40164         val_conv = InvoiceFeatures_clone(&val_conv);
40165         PaymentParameters_set_features(&this_ptr_conv, val_conv);
40166 }
40167
40168 uint64_tArray  __attribute__((export_name("TS_PaymentParameters_get_route_hints"))) TS_PaymentParameters_get_route_hints(uint64_t this_ptr) {
40169         LDKPaymentParameters this_ptr_conv;
40170         this_ptr_conv.inner = untag_ptr(this_ptr);
40171         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40172         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40173         this_ptr_conv.is_owned = false;
40174         LDKCVec_RouteHintZ ret_var = PaymentParameters_get_route_hints(&this_ptr_conv);
40175         uint64_tArray ret_arr = NULL;
40176         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
40177         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
40178         for (size_t l = 0; l < ret_var.datalen; l++) {
40179                 LDKRouteHint ret_conv_11_var = ret_var.data[l];
40180                 uint64_t ret_conv_11_ref = 0;
40181                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_11_var);
40182                 ret_conv_11_ref = tag_ptr(ret_conv_11_var.inner, ret_conv_11_var.is_owned);
40183                 ret_arr_ptr[l] = ret_conv_11_ref;
40184         }
40185         
40186         FREE(ret_var.data);
40187         return ret_arr;
40188 }
40189
40190 void  __attribute__((export_name("TS_PaymentParameters_set_route_hints"))) TS_PaymentParameters_set_route_hints(uint64_t this_ptr, uint64_tArray val) {
40191         LDKPaymentParameters this_ptr_conv;
40192         this_ptr_conv.inner = untag_ptr(this_ptr);
40193         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40194         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40195         this_ptr_conv.is_owned = false;
40196         LDKCVec_RouteHintZ val_constr;
40197         val_constr.datalen = val->arr_len;
40198         if (val_constr.datalen > 0)
40199                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
40200         else
40201                 val_constr.data = NULL;
40202         uint64_t* val_vals = val->elems;
40203         for (size_t l = 0; l < val_constr.datalen; l++) {
40204                 uint64_t val_conv_11 = val_vals[l];
40205                 LDKRouteHint val_conv_11_conv;
40206                 val_conv_11_conv.inner = untag_ptr(val_conv_11);
40207                 val_conv_11_conv.is_owned = ptr_is_owned(val_conv_11);
40208                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_11_conv);
40209                 val_conv_11_conv = RouteHint_clone(&val_conv_11_conv);
40210                 val_constr.data[l] = val_conv_11_conv;
40211         }
40212         FREE(val);
40213         PaymentParameters_set_route_hints(&this_ptr_conv, val_constr);
40214 }
40215
40216 uint64_t  __attribute__((export_name("TS_PaymentParameters_get_expiry_time"))) TS_PaymentParameters_get_expiry_time(uint64_t this_ptr) {
40217         LDKPaymentParameters this_ptr_conv;
40218         this_ptr_conv.inner = untag_ptr(this_ptr);
40219         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40220         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40221         this_ptr_conv.is_owned = false;
40222         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
40223         *ret_copy = PaymentParameters_get_expiry_time(&this_ptr_conv);
40224         uint64_t ret_ref = tag_ptr(ret_copy, true);
40225         return ret_ref;
40226 }
40227
40228 void  __attribute__((export_name("TS_PaymentParameters_set_expiry_time"))) TS_PaymentParameters_set_expiry_time(uint64_t this_ptr, uint64_t val) {
40229         LDKPaymentParameters this_ptr_conv;
40230         this_ptr_conv.inner = untag_ptr(this_ptr);
40231         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40232         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40233         this_ptr_conv.is_owned = false;
40234         void* val_ptr = untag_ptr(val);
40235         CHECK_ACCESS(val_ptr);
40236         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
40237         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
40238         PaymentParameters_set_expiry_time(&this_ptr_conv, val_conv);
40239 }
40240
40241 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) {
40242         LDKPaymentParameters this_ptr_conv;
40243         this_ptr_conv.inner = untag_ptr(this_ptr);
40244         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40245         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40246         this_ptr_conv.is_owned = false;
40247         int32_t ret_conv = PaymentParameters_get_max_total_cltv_expiry_delta(&this_ptr_conv);
40248         return ret_conv;
40249 }
40250
40251 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) {
40252         LDKPaymentParameters this_ptr_conv;
40253         this_ptr_conv.inner = untag_ptr(this_ptr);
40254         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40255         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40256         this_ptr_conv.is_owned = false;
40257         PaymentParameters_set_max_total_cltv_expiry_delta(&this_ptr_conv, val);
40258 }
40259
40260 int8_t  __attribute__((export_name("TS_PaymentParameters_get_max_path_count"))) TS_PaymentParameters_get_max_path_count(uint64_t this_ptr) {
40261         LDKPaymentParameters this_ptr_conv;
40262         this_ptr_conv.inner = untag_ptr(this_ptr);
40263         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40264         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40265         this_ptr_conv.is_owned = false;
40266         int8_t ret_conv = PaymentParameters_get_max_path_count(&this_ptr_conv);
40267         return ret_conv;
40268 }
40269
40270 void  __attribute__((export_name("TS_PaymentParameters_set_max_path_count"))) TS_PaymentParameters_set_max_path_count(uint64_t this_ptr, int8_t val) {
40271         LDKPaymentParameters this_ptr_conv;
40272         this_ptr_conv.inner = untag_ptr(this_ptr);
40273         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40274         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40275         this_ptr_conv.is_owned = false;
40276         PaymentParameters_set_max_path_count(&this_ptr_conv, val);
40277 }
40278
40279 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) {
40280         LDKPaymentParameters this_ptr_conv;
40281         this_ptr_conv.inner = untag_ptr(this_ptr);
40282         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40283         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40284         this_ptr_conv.is_owned = false;
40285         int8_t ret_conv = PaymentParameters_get_max_channel_saturation_power_of_half(&this_ptr_conv);
40286         return ret_conv;
40287 }
40288
40289 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) {
40290         LDKPaymentParameters this_ptr_conv;
40291         this_ptr_conv.inner = untag_ptr(this_ptr);
40292         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40293         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40294         this_ptr_conv.is_owned = false;
40295         PaymentParameters_set_max_channel_saturation_power_of_half(&this_ptr_conv, val);
40296 }
40297
40298 int64_tArray  __attribute__((export_name("TS_PaymentParameters_get_previously_failed_channels"))) TS_PaymentParameters_get_previously_failed_channels(uint64_t this_ptr) {
40299         LDKPaymentParameters this_ptr_conv;
40300         this_ptr_conv.inner = untag_ptr(this_ptr);
40301         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40302         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40303         this_ptr_conv.is_owned = false;
40304         LDKCVec_u64Z ret_var = PaymentParameters_get_previously_failed_channels(&this_ptr_conv);
40305         int64_tArray ret_arr = NULL;
40306         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
40307         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
40308         for (size_t i = 0; i < ret_var.datalen; i++) {
40309                 int64_t ret_conv_8_conv = ret_var.data[i];
40310                 ret_arr_ptr[i] = ret_conv_8_conv;
40311         }
40312         
40313         FREE(ret_var.data);
40314         return ret_arr;
40315 }
40316
40317 void  __attribute__((export_name("TS_PaymentParameters_set_previously_failed_channels"))) TS_PaymentParameters_set_previously_failed_channels(uint64_t this_ptr, int64_tArray val) {
40318         LDKPaymentParameters this_ptr_conv;
40319         this_ptr_conv.inner = untag_ptr(this_ptr);
40320         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40321         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40322         this_ptr_conv.is_owned = false;
40323         LDKCVec_u64Z val_constr;
40324         val_constr.datalen = val->arr_len;
40325         if (val_constr.datalen > 0)
40326                 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
40327         else
40328                 val_constr.data = NULL;
40329         int64_t* val_vals = val->elems;
40330         for (size_t i = 0; i < val_constr.datalen; i++) {
40331                 int64_t val_conv_8 = val_vals[i];
40332                 val_constr.data[i] = val_conv_8;
40333         }
40334         FREE(val);
40335         PaymentParameters_set_previously_failed_channels(&this_ptr_conv, val_constr);
40336 }
40337
40338 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) {
40339         LDKPublicKey payee_pubkey_arg_ref;
40340         CHECK(payee_pubkey_arg->arr_len == 33);
40341         memcpy(payee_pubkey_arg_ref.compressed_form, payee_pubkey_arg->elems, 33); FREE(payee_pubkey_arg);
40342         LDKInvoiceFeatures features_arg_conv;
40343         features_arg_conv.inner = untag_ptr(features_arg);
40344         features_arg_conv.is_owned = ptr_is_owned(features_arg);
40345         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
40346         features_arg_conv = InvoiceFeatures_clone(&features_arg_conv);
40347         LDKCVec_RouteHintZ route_hints_arg_constr;
40348         route_hints_arg_constr.datalen = route_hints_arg->arr_len;
40349         if (route_hints_arg_constr.datalen > 0)
40350                 route_hints_arg_constr.data = MALLOC(route_hints_arg_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
40351         else
40352                 route_hints_arg_constr.data = NULL;
40353         uint64_t* route_hints_arg_vals = route_hints_arg->elems;
40354         for (size_t l = 0; l < route_hints_arg_constr.datalen; l++) {
40355                 uint64_t route_hints_arg_conv_11 = route_hints_arg_vals[l];
40356                 LDKRouteHint route_hints_arg_conv_11_conv;
40357                 route_hints_arg_conv_11_conv.inner = untag_ptr(route_hints_arg_conv_11);
40358                 route_hints_arg_conv_11_conv.is_owned = ptr_is_owned(route_hints_arg_conv_11);
40359                 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_hints_arg_conv_11_conv);
40360                 route_hints_arg_conv_11_conv = RouteHint_clone(&route_hints_arg_conv_11_conv);
40361                 route_hints_arg_constr.data[l] = route_hints_arg_conv_11_conv;
40362         }
40363         FREE(route_hints_arg);
40364         void* expiry_time_arg_ptr = untag_ptr(expiry_time_arg);
40365         CHECK_ACCESS(expiry_time_arg_ptr);
40366         LDKCOption_u64Z expiry_time_arg_conv = *(LDKCOption_u64Z*)(expiry_time_arg_ptr);
40367         expiry_time_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(expiry_time_arg));
40368         LDKCVec_u64Z previously_failed_channels_arg_constr;
40369         previously_failed_channels_arg_constr.datalen = previously_failed_channels_arg->arr_len;
40370         if (previously_failed_channels_arg_constr.datalen > 0)
40371                 previously_failed_channels_arg_constr.data = MALLOC(previously_failed_channels_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
40372         else
40373                 previously_failed_channels_arg_constr.data = NULL;
40374         int64_t* previously_failed_channels_arg_vals = previously_failed_channels_arg->elems;
40375         for (size_t i = 0; i < previously_failed_channels_arg_constr.datalen; i++) {
40376                 int64_t previously_failed_channels_arg_conv_8 = previously_failed_channels_arg_vals[i];
40377                 previously_failed_channels_arg_constr.data[i] = previously_failed_channels_arg_conv_8;
40378         }
40379         FREE(previously_failed_channels_arg);
40380         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);
40381         uint64_t ret_ref = 0;
40382         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40383         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40384         return ret_ref;
40385 }
40386
40387 static inline uint64_t PaymentParameters_clone_ptr(LDKPaymentParameters *NONNULL_PTR arg) {
40388         LDKPaymentParameters ret_var = PaymentParameters_clone(arg);
40389         uint64_t ret_ref = 0;
40390         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40391         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40392         return ret_ref;
40393 }
40394 int64_t  __attribute__((export_name("TS_PaymentParameters_clone_ptr"))) TS_PaymentParameters_clone_ptr(uint64_t arg) {
40395         LDKPaymentParameters arg_conv;
40396         arg_conv.inner = untag_ptr(arg);
40397         arg_conv.is_owned = ptr_is_owned(arg);
40398         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40399         arg_conv.is_owned = false;
40400         int64_t ret_conv = PaymentParameters_clone_ptr(&arg_conv);
40401         return ret_conv;
40402 }
40403
40404 uint64_t  __attribute__((export_name("TS_PaymentParameters_clone"))) TS_PaymentParameters_clone(uint64_t orig) {
40405         LDKPaymentParameters orig_conv;
40406         orig_conv.inner = untag_ptr(orig);
40407         orig_conv.is_owned = ptr_is_owned(orig);
40408         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40409         orig_conv.is_owned = false;
40410         LDKPaymentParameters ret_var = PaymentParameters_clone(&orig_conv);
40411         uint64_t ret_ref = 0;
40412         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40413         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40414         return ret_ref;
40415 }
40416
40417 int64_t  __attribute__((export_name("TS_PaymentParameters_hash"))) TS_PaymentParameters_hash(uint64_t o) {
40418         LDKPaymentParameters o_conv;
40419         o_conv.inner = untag_ptr(o);
40420         o_conv.is_owned = ptr_is_owned(o);
40421         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
40422         o_conv.is_owned = false;
40423         int64_t ret_conv = PaymentParameters_hash(&o_conv);
40424         return ret_conv;
40425 }
40426
40427 jboolean  __attribute__((export_name("TS_PaymentParameters_eq"))) TS_PaymentParameters_eq(uint64_t a, uint64_t b) {
40428         LDKPaymentParameters a_conv;
40429         a_conv.inner = untag_ptr(a);
40430         a_conv.is_owned = ptr_is_owned(a);
40431         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
40432         a_conv.is_owned = false;
40433         LDKPaymentParameters b_conv;
40434         b_conv.inner = untag_ptr(b);
40435         b_conv.is_owned = ptr_is_owned(b);
40436         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
40437         b_conv.is_owned = false;
40438         jboolean ret_conv = PaymentParameters_eq(&a_conv, &b_conv);
40439         return ret_conv;
40440 }
40441
40442 int8_tArray  __attribute__((export_name("TS_PaymentParameters_write"))) TS_PaymentParameters_write(uint64_t obj) {
40443         LDKPaymentParameters obj_conv;
40444         obj_conv.inner = untag_ptr(obj);
40445         obj_conv.is_owned = ptr_is_owned(obj);
40446         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
40447         obj_conv.is_owned = false;
40448         LDKCVec_u8Z ret_var = PaymentParameters_write(&obj_conv);
40449         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
40450         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
40451         CVec_u8Z_free(ret_var);
40452         return ret_arr;
40453 }
40454
40455 uint64_t  __attribute__((export_name("TS_PaymentParameters_read"))) TS_PaymentParameters_read(int8_tArray ser) {
40456         LDKu8slice ser_ref;
40457         ser_ref.datalen = ser->arr_len;
40458         ser_ref.data = ser->elems;
40459         LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
40460         *ret_conv = PaymentParameters_read(ser_ref);
40461         FREE(ser);
40462         return tag_ptr(ret_conv, true);
40463 }
40464
40465 uint64_t  __attribute__((export_name("TS_PaymentParameters_from_node_id"))) TS_PaymentParameters_from_node_id(int8_tArray payee_pubkey) {
40466         LDKPublicKey payee_pubkey_ref;
40467         CHECK(payee_pubkey->arr_len == 33);
40468         memcpy(payee_pubkey_ref.compressed_form, payee_pubkey->elems, 33); FREE(payee_pubkey);
40469         LDKPaymentParameters ret_var = PaymentParameters_from_node_id(payee_pubkey_ref);
40470         uint64_t ret_ref = 0;
40471         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40472         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40473         return ret_ref;
40474 }
40475
40476 uint64_t  __attribute__((export_name("TS_PaymentParameters_for_keysend"))) TS_PaymentParameters_for_keysend(int8_tArray payee_pubkey) {
40477         LDKPublicKey payee_pubkey_ref;
40478         CHECK(payee_pubkey->arr_len == 33);
40479         memcpy(payee_pubkey_ref.compressed_form, payee_pubkey->elems, 33); FREE(payee_pubkey);
40480         LDKPaymentParameters ret_var = PaymentParameters_for_keysend(payee_pubkey_ref);
40481         uint64_t ret_ref = 0;
40482         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40483         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40484         return ret_ref;
40485 }
40486
40487 void  __attribute__((export_name("TS_RouteHint_free"))) TS_RouteHint_free(uint64_t this_obj) {
40488         LDKRouteHint this_obj_conv;
40489         this_obj_conv.inner = untag_ptr(this_obj);
40490         this_obj_conv.is_owned = ptr_is_owned(this_obj);
40491         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40492         RouteHint_free(this_obj_conv);
40493 }
40494
40495 uint64_tArray  __attribute__((export_name("TS_RouteHint_get_a"))) TS_RouteHint_get_a(uint64_t this_ptr) {
40496         LDKRouteHint this_ptr_conv;
40497         this_ptr_conv.inner = untag_ptr(this_ptr);
40498         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40499         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40500         this_ptr_conv.is_owned = false;
40501         LDKCVec_RouteHintHopZ ret_var = RouteHint_get_a(&this_ptr_conv);
40502         uint64_tArray ret_arr = NULL;
40503         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
40504         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
40505         for (size_t o = 0; o < ret_var.datalen; o++) {
40506                 LDKRouteHintHop ret_conv_14_var = ret_var.data[o];
40507                 uint64_t ret_conv_14_ref = 0;
40508                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_14_var);
40509                 ret_conv_14_ref = tag_ptr(ret_conv_14_var.inner, ret_conv_14_var.is_owned);
40510                 ret_arr_ptr[o] = ret_conv_14_ref;
40511         }
40512         
40513         FREE(ret_var.data);
40514         return ret_arr;
40515 }
40516
40517 void  __attribute__((export_name("TS_RouteHint_set_a"))) TS_RouteHint_set_a(uint64_t this_ptr, uint64_tArray val) {
40518         LDKRouteHint this_ptr_conv;
40519         this_ptr_conv.inner = untag_ptr(this_ptr);
40520         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40521         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40522         this_ptr_conv.is_owned = false;
40523         LDKCVec_RouteHintHopZ val_constr;
40524         val_constr.datalen = val->arr_len;
40525         if (val_constr.datalen > 0)
40526                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKRouteHintHop), "LDKCVec_RouteHintHopZ Elements");
40527         else
40528                 val_constr.data = NULL;
40529         uint64_t* val_vals = val->elems;
40530         for (size_t o = 0; o < val_constr.datalen; o++) {
40531                 uint64_t val_conv_14 = val_vals[o];
40532                 LDKRouteHintHop val_conv_14_conv;
40533                 val_conv_14_conv.inner = untag_ptr(val_conv_14);
40534                 val_conv_14_conv.is_owned = ptr_is_owned(val_conv_14);
40535                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_14_conv);
40536                 val_conv_14_conv = RouteHintHop_clone(&val_conv_14_conv);
40537                 val_constr.data[o] = val_conv_14_conv;
40538         }
40539         FREE(val);
40540         RouteHint_set_a(&this_ptr_conv, val_constr);
40541 }
40542
40543 uint64_t  __attribute__((export_name("TS_RouteHint_new"))) TS_RouteHint_new(uint64_tArray a_arg) {
40544         LDKCVec_RouteHintHopZ a_arg_constr;
40545         a_arg_constr.datalen = a_arg->arr_len;
40546         if (a_arg_constr.datalen > 0)
40547                 a_arg_constr.data = MALLOC(a_arg_constr.datalen * sizeof(LDKRouteHintHop), "LDKCVec_RouteHintHopZ Elements");
40548         else
40549                 a_arg_constr.data = NULL;
40550         uint64_t* a_arg_vals = a_arg->elems;
40551         for (size_t o = 0; o < a_arg_constr.datalen; o++) {
40552                 uint64_t a_arg_conv_14 = a_arg_vals[o];
40553                 LDKRouteHintHop a_arg_conv_14_conv;
40554                 a_arg_conv_14_conv.inner = untag_ptr(a_arg_conv_14);
40555                 a_arg_conv_14_conv.is_owned = ptr_is_owned(a_arg_conv_14);
40556                 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_arg_conv_14_conv);
40557                 a_arg_conv_14_conv = RouteHintHop_clone(&a_arg_conv_14_conv);
40558                 a_arg_constr.data[o] = a_arg_conv_14_conv;
40559         }
40560         FREE(a_arg);
40561         LDKRouteHint ret_var = RouteHint_new(a_arg_constr);
40562         uint64_t ret_ref = 0;
40563         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40564         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40565         return ret_ref;
40566 }
40567
40568 static inline uint64_t RouteHint_clone_ptr(LDKRouteHint *NONNULL_PTR arg) {
40569         LDKRouteHint ret_var = RouteHint_clone(arg);
40570         uint64_t ret_ref = 0;
40571         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40572         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40573         return ret_ref;
40574 }
40575 int64_t  __attribute__((export_name("TS_RouteHint_clone_ptr"))) TS_RouteHint_clone_ptr(uint64_t arg) {
40576         LDKRouteHint arg_conv;
40577         arg_conv.inner = untag_ptr(arg);
40578         arg_conv.is_owned = ptr_is_owned(arg);
40579         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40580         arg_conv.is_owned = false;
40581         int64_t ret_conv = RouteHint_clone_ptr(&arg_conv);
40582         return ret_conv;
40583 }
40584
40585 uint64_t  __attribute__((export_name("TS_RouteHint_clone"))) TS_RouteHint_clone(uint64_t orig) {
40586         LDKRouteHint orig_conv;
40587         orig_conv.inner = untag_ptr(orig);
40588         orig_conv.is_owned = ptr_is_owned(orig);
40589         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40590         orig_conv.is_owned = false;
40591         LDKRouteHint ret_var = RouteHint_clone(&orig_conv);
40592         uint64_t ret_ref = 0;
40593         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40594         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40595         return ret_ref;
40596 }
40597
40598 int64_t  __attribute__((export_name("TS_RouteHint_hash"))) TS_RouteHint_hash(uint64_t o) {
40599         LDKRouteHint o_conv;
40600         o_conv.inner = untag_ptr(o);
40601         o_conv.is_owned = ptr_is_owned(o);
40602         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
40603         o_conv.is_owned = false;
40604         int64_t ret_conv = RouteHint_hash(&o_conv);
40605         return ret_conv;
40606 }
40607
40608 jboolean  __attribute__((export_name("TS_RouteHint_eq"))) TS_RouteHint_eq(uint64_t a, uint64_t b) {
40609         LDKRouteHint a_conv;
40610         a_conv.inner = untag_ptr(a);
40611         a_conv.is_owned = ptr_is_owned(a);
40612         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
40613         a_conv.is_owned = false;
40614         LDKRouteHint b_conv;
40615         b_conv.inner = untag_ptr(b);
40616         b_conv.is_owned = ptr_is_owned(b);
40617         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
40618         b_conv.is_owned = false;
40619         jboolean ret_conv = RouteHint_eq(&a_conv, &b_conv);
40620         return ret_conv;
40621 }
40622
40623 int8_tArray  __attribute__((export_name("TS_RouteHint_write"))) TS_RouteHint_write(uint64_t obj) {
40624         LDKRouteHint obj_conv;
40625         obj_conv.inner = untag_ptr(obj);
40626         obj_conv.is_owned = ptr_is_owned(obj);
40627         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
40628         obj_conv.is_owned = false;
40629         LDKCVec_u8Z ret_var = RouteHint_write(&obj_conv);
40630         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
40631         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
40632         CVec_u8Z_free(ret_var);
40633         return ret_arr;
40634 }
40635
40636 uint64_t  __attribute__((export_name("TS_RouteHint_read"))) TS_RouteHint_read(int8_tArray ser) {
40637         LDKu8slice ser_ref;
40638         ser_ref.datalen = ser->arr_len;
40639         ser_ref.data = ser->elems;
40640         LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
40641         *ret_conv = RouteHint_read(ser_ref);
40642         FREE(ser);
40643         return tag_ptr(ret_conv, true);
40644 }
40645
40646 void  __attribute__((export_name("TS_RouteHintHop_free"))) TS_RouteHintHop_free(uint64_t this_obj) {
40647         LDKRouteHintHop this_obj_conv;
40648         this_obj_conv.inner = untag_ptr(this_obj);
40649         this_obj_conv.is_owned = ptr_is_owned(this_obj);
40650         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40651         RouteHintHop_free(this_obj_conv);
40652 }
40653
40654 int8_tArray  __attribute__((export_name("TS_RouteHintHop_get_src_node_id"))) TS_RouteHintHop_get_src_node_id(uint64_t this_ptr) {
40655         LDKRouteHintHop this_ptr_conv;
40656         this_ptr_conv.inner = untag_ptr(this_ptr);
40657         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40658         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40659         this_ptr_conv.is_owned = false;
40660         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
40661         memcpy(ret_arr->elems, RouteHintHop_get_src_node_id(&this_ptr_conv).compressed_form, 33);
40662         return ret_arr;
40663 }
40664
40665 void  __attribute__((export_name("TS_RouteHintHop_set_src_node_id"))) TS_RouteHintHop_set_src_node_id(uint64_t this_ptr, int8_tArray val) {
40666         LDKRouteHintHop this_ptr_conv;
40667         this_ptr_conv.inner = untag_ptr(this_ptr);
40668         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40669         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40670         this_ptr_conv.is_owned = false;
40671         LDKPublicKey val_ref;
40672         CHECK(val->arr_len == 33);
40673         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
40674         RouteHintHop_set_src_node_id(&this_ptr_conv, val_ref);
40675 }
40676
40677 int64_t  __attribute__((export_name("TS_RouteHintHop_get_short_channel_id"))) TS_RouteHintHop_get_short_channel_id(uint64_t this_ptr) {
40678         LDKRouteHintHop this_ptr_conv;
40679         this_ptr_conv.inner = untag_ptr(this_ptr);
40680         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40681         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40682         this_ptr_conv.is_owned = false;
40683         int64_t ret_conv = RouteHintHop_get_short_channel_id(&this_ptr_conv);
40684         return ret_conv;
40685 }
40686
40687 void  __attribute__((export_name("TS_RouteHintHop_set_short_channel_id"))) TS_RouteHintHop_set_short_channel_id(uint64_t this_ptr, int64_t val) {
40688         LDKRouteHintHop this_ptr_conv;
40689         this_ptr_conv.inner = untag_ptr(this_ptr);
40690         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40691         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40692         this_ptr_conv.is_owned = false;
40693         RouteHintHop_set_short_channel_id(&this_ptr_conv, val);
40694 }
40695
40696 uint64_t  __attribute__((export_name("TS_RouteHintHop_get_fees"))) TS_RouteHintHop_get_fees(uint64_t this_ptr) {
40697         LDKRouteHintHop 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         LDKRoutingFees ret_var = RouteHintHop_get_fees(&this_ptr_conv);
40703         uint64_t ret_ref = 0;
40704         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40705         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40706         return ret_ref;
40707 }
40708
40709 void  __attribute__((export_name("TS_RouteHintHop_set_fees"))) TS_RouteHintHop_set_fees(uint64_t this_ptr, uint64_t val) {
40710         LDKRouteHintHop this_ptr_conv;
40711         this_ptr_conv.inner = untag_ptr(this_ptr);
40712         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40713         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40714         this_ptr_conv.is_owned = false;
40715         LDKRoutingFees val_conv;
40716         val_conv.inner = untag_ptr(val);
40717         val_conv.is_owned = ptr_is_owned(val);
40718         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
40719         val_conv = RoutingFees_clone(&val_conv);
40720         RouteHintHop_set_fees(&this_ptr_conv, val_conv);
40721 }
40722
40723 int16_t  __attribute__((export_name("TS_RouteHintHop_get_cltv_expiry_delta"))) TS_RouteHintHop_get_cltv_expiry_delta(uint64_t this_ptr) {
40724         LDKRouteHintHop this_ptr_conv;
40725         this_ptr_conv.inner = untag_ptr(this_ptr);
40726         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40727         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40728         this_ptr_conv.is_owned = false;
40729         int16_t ret_conv = RouteHintHop_get_cltv_expiry_delta(&this_ptr_conv);
40730         return ret_conv;
40731 }
40732
40733 void  __attribute__((export_name("TS_RouteHintHop_set_cltv_expiry_delta"))) TS_RouteHintHop_set_cltv_expiry_delta(uint64_t this_ptr, int16_t val) {
40734         LDKRouteHintHop this_ptr_conv;
40735         this_ptr_conv.inner = untag_ptr(this_ptr);
40736         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40737         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40738         this_ptr_conv.is_owned = false;
40739         RouteHintHop_set_cltv_expiry_delta(&this_ptr_conv, val);
40740 }
40741
40742 uint64_t  __attribute__((export_name("TS_RouteHintHop_get_htlc_minimum_msat"))) TS_RouteHintHop_get_htlc_minimum_msat(uint64_t this_ptr) {
40743         LDKRouteHintHop this_ptr_conv;
40744         this_ptr_conv.inner = untag_ptr(this_ptr);
40745         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40746         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40747         this_ptr_conv.is_owned = false;
40748         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
40749         *ret_copy = RouteHintHop_get_htlc_minimum_msat(&this_ptr_conv);
40750         uint64_t ret_ref = tag_ptr(ret_copy, true);
40751         return ret_ref;
40752 }
40753
40754 void  __attribute__((export_name("TS_RouteHintHop_set_htlc_minimum_msat"))) TS_RouteHintHop_set_htlc_minimum_msat(uint64_t this_ptr, uint64_t val) {
40755         LDKRouteHintHop this_ptr_conv;
40756         this_ptr_conv.inner = untag_ptr(this_ptr);
40757         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40758         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40759         this_ptr_conv.is_owned = false;
40760         void* val_ptr = untag_ptr(val);
40761         CHECK_ACCESS(val_ptr);
40762         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
40763         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
40764         RouteHintHop_set_htlc_minimum_msat(&this_ptr_conv, val_conv);
40765 }
40766
40767 uint64_t  __attribute__((export_name("TS_RouteHintHop_get_htlc_maximum_msat"))) TS_RouteHintHop_get_htlc_maximum_msat(uint64_t this_ptr) {
40768         LDKRouteHintHop this_ptr_conv;
40769         this_ptr_conv.inner = untag_ptr(this_ptr);
40770         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40771         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40772         this_ptr_conv.is_owned = false;
40773         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
40774         *ret_copy = RouteHintHop_get_htlc_maximum_msat(&this_ptr_conv);
40775         uint64_t ret_ref = tag_ptr(ret_copy, true);
40776         return ret_ref;
40777 }
40778
40779 void  __attribute__((export_name("TS_RouteHintHop_set_htlc_maximum_msat"))) TS_RouteHintHop_set_htlc_maximum_msat(uint64_t this_ptr, uint64_t val) {
40780         LDKRouteHintHop this_ptr_conv;
40781         this_ptr_conv.inner = untag_ptr(this_ptr);
40782         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40783         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40784         this_ptr_conv.is_owned = false;
40785         void* val_ptr = untag_ptr(val);
40786         CHECK_ACCESS(val_ptr);
40787         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
40788         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
40789         RouteHintHop_set_htlc_maximum_msat(&this_ptr_conv, val_conv);
40790 }
40791
40792 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) {
40793         LDKPublicKey src_node_id_arg_ref;
40794         CHECK(src_node_id_arg->arr_len == 33);
40795         memcpy(src_node_id_arg_ref.compressed_form, src_node_id_arg->elems, 33); FREE(src_node_id_arg);
40796         LDKRoutingFees fees_arg_conv;
40797         fees_arg_conv.inner = untag_ptr(fees_arg);
40798         fees_arg_conv.is_owned = ptr_is_owned(fees_arg);
40799         CHECK_INNER_FIELD_ACCESS_OR_NULL(fees_arg_conv);
40800         fees_arg_conv = RoutingFees_clone(&fees_arg_conv);
40801         void* htlc_minimum_msat_arg_ptr = untag_ptr(htlc_minimum_msat_arg);
40802         CHECK_ACCESS(htlc_minimum_msat_arg_ptr);
40803         LDKCOption_u64Z htlc_minimum_msat_arg_conv = *(LDKCOption_u64Z*)(htlc_minimum_msat_arg_ptr);
40804         htlc_minimum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(htlc_minimum_msat_arg));
40805         void* htlc_maximum_msat_arg_ptr = untag_ptr(htlc_maximum_msat_arg);
40806         CHECK_ACCESS(htlc_maximum_msat_arg_ptr);
40807         LDKCOption_u64Z htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(htlc_maximum_msat_arg_ptr);
40808         htlc_maximum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(htlc_maximum_msat_arg));
40809         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);
40810         uint64_t ret_ref = 0;
40811         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40812         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40813         return ret_ref;
40814 }
40815
40816 static inline uint64_t RouteHintHop_clone_ptr(LDKRouteHintHop *NONNULL_PTR arg) {
40817         LDKRouteHintHop ret_var = RouteHintHop_clone(arg);
40818         uint64_t ret_ref = 0;
40819         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40820         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40821         return ret_ref;
40822 }
40823 int64_t  __attribute__((export_name("TS_RouteHintHop_clone_ptr"))) TS_RouteHintHop_clone_ptr(uint64_t arg) {
40824         LDKRouteHintHop arg_conv;
40825         arg_conv.inner = untag_ptr(arg);
40826         arg_conv.is_owned = ptr_is_owned(arg);
40827         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40828         arg_conv.is_owned = false;
40829         int64_t ret_conv = RouteHintHop_clone_ptr(&arg_conv);
40830         return ret_conv;
40831 }
40832
40833 uint64_t  __attribute__((export_name("TS_RouteHintHop_clone"))) TS_RouteHintHop_clone(uint64_t orig) {
40834         LDKRouteHintHop orig_conv;
40835         orig_conv.inner = untag_ptr(orig);
40836         orig_conv.is_owned = ptr_is_owned(orig);
40837         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40838         orig_conv.is_owned = false;
40839         LDKRouteHintHop ret_var = RouteHintHop_clone(&orig_conv);
40840         uint64_t ret_ref = 0;
40841         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40842         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40843         return ret_ref;
40844 }
40845
40846 int64_t  __attribute__((export_name("TS_RouteHintHop_hash"))) TS_RouteHintHop_hash(uint64_t o) {
40847         LDKRouteHintHop o_conv;
40848         o_conv.inner = untag_ptr(o);
40849         o_conv.is_owned = ptr_is_owned(o);
40850         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
40851         o_conv.is_owned = false;
40852         int64_t ret_conv = RouteHintHop_hash(&o_conv);
40853         return ret_conv;
40854 }
40855
40856 jboolean  __attribute__((export_name("TS_RouteHintHop_eq"))) TS_RouteHintHop_eq(uint64_t a, uint64_t b) {
40857         LDKRouteHintHop a_conv;
40858         a_conv.inner = untag_ptr(a);
40859         a_conv.is_owned = ptr_is_owned(a);
40860         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
40861         a_conv.is_owned = false;
40862         LDKRouteHintHop b_conv;
40863         b_conv.inner = untag_ptr(b);
40864         b_conv.is_owned = ptr_is_owned(b);
40865         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
40866         b_conv.is_owned = false;
40867         jboolean ret_conv = RouteHintHop_eq(&a_conv, &b_conv);
40868         return ret_conv;
40869 }
40870
40871 int8_tArray  __attribute__((export_name("TS_RouteHintHop_write"))) TS_RouteHintHop_write(uint64_t obj) {
40872         LDKRouteHintHop obj_conv;
40873         obj_conv.inner = untag_ptr(obj);
40874         obj_conv.is_owned = ptr_is_owned(obj);
40875         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
40876         obj_conv.is_owned = false;
40877         LDKCVec_u8Z ret_var = RouteHintHop_write(&obj_conv);
40878         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
40879         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
40880         CVec_u8Z_free(ret_var);
40881         return ret_arr;
40882 }
40883
40884 uint64_t  __attribute__((export_name("TS_RouteHintHop_read"))) TS_RouteHintHop_read(int8_tArray ser) {
40885         LDKu8slice ser_ref;
40886         ser_ref.datalen = ser->arr_len;
40887         ser_ref.data = ser->elems;
40888         LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
40889         *ret_conv = RouteHintHop_read(ser_ref);
40890         FREE(ser);
40891         return tag_ptr(ret_conv, true);
40892 }
40893
40894 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) {
40895         LDKPublicKey our_node_pubkey_ref;
40896         CHECK(our_node_pubkey->arr_len == 33);
40897         memcpy(our_node_pubkey_ref.compressed_form, our_node_pubkey->elems, 33); FREE(our_node_pubkey);
40898         LDKRouteParameters route_params_conv;
40899         route_params_conv.inner = untag_ptr(route_params);
40900         route_params_conv.is_owned = ptr_is_owned(route_params);
40901         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
40902         route_params_conv.is_owned = false;
40903         LDKNetworkGraph network_graph_conv;
40904         network_graph_conv.inner = untag_ptr(network_graph);
40905         network_graph_conv.is_owned = ptr_is_owned(network_graph);
40906         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
40907         network_graph_conv.is_owned = false;
40908         LDKCVec_ChannelDetailsZ first_hops_constr;
40909         LDKCVec_ChannelDetailsZ *first_hops_ptr = NULL;
40910         if (first_hops != 0) {
40911                 first_hops_constr.datalen = first_hops->arr_len;
40912                 if (first_hops_constr.datalen > 0)
40913                         first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
40914                 else
40915                         first_hops_constr.data = NULL;
40916                 uint64_t* first_hops_vals = first_hops->elems;
40917                 for (size_t q = 0; q < first_hops_constr.datalen; q++) {
40918                         uint64_t first_hops_conv_16 = first_hops_vals[q];
40919                         LDKChannelDetails first_hops_conv_16_conv;
40920                         first_hops_conv_16_conv.inner = untag_ptr(first_hops_conv_16);
40921                         first_hops_conv_16_conv.is_owned = ptr_is_owned(first_hops_conv_16);
40922                         CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_conv);
40923                         first_hops_conv_16_conv.is_owned = false;
40924                         first_hops_constr.data[q] = first_hops_conv_16_conv;
40925                 }
40926                 FREE(first_hops);
40927                 first_hops_ptr = &first_hops_constr;
40928         }
40929         void* logger_ptr = untag_ptr(logger);
40930         CHECK_ACCESS(logger_ptr);
40931         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
40932         if (logger_conv.free == LDKLogger_JCalls_free) {
40933                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
40934                 LDKLogger_JCalls_cloned(&logger_conv);
40935         }
40936         void* scorer_ptr = untag_ptr(scorer);
40937         if (ptr_is_owned(scorer)) { CHECK_ACCESS(scorer_ptr); }
40938         LDKScore* scorer_conv = (LDKScore*)scorer_ptr;
40939         unsigned char random_seed_bytes_arr[32];
40940         CHECK(random_seed_bytes->arr_len == 32);
40941         memcpy(random_seed_bytes_arr, random_seed_bytes->elems, 32); FREE(random_seed_bytes);
40942         unsigned char (*random_seed_bytes_ref)[32] = &random_seed_bytes_arr;
40943         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
40944         *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);
40945         if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); }
40946         return tag_ptr(ret_conv, true);
40947 }
40948
40949 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) {
40950         LDKPublicKey our_node_pubkey_ref;
40951         CHECK(our_node_pubkey->arr_len == 33);
40952         memcpy(our_node_pubkey_ref.compressed_form, our_node_pubkey->elems, 33); FREE(our_node_pubkey);
40953         LDKCVec_PublicKeyZ hops_constr;
40954         hops_constr.datalen = hops->arr_len;
40955         if (hops_constr.datalen > 0)
40956                 hops_constr.data = MALLOC(hops_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
40957         else
40958                 hops_constr.data = NULL;
40959         int8_tArray* hops_vals = (void*) hops->elems;
40960         for (size_t m = 0; m < hops_constr.datalen; m++) {
40961                 int8_tArray hops_conv_12 = hops_vals[m];
40962                 LDKPublicKey hops_conv_12_ref;
40963                 CHECK(hops_conv_12->arr_len == 33);
40964                 memcpy(hops_conv_12_ref.compressed_form, hops_conv_12->elems, 33); FREE(hops_conv_12);
40965                 hops_constr.data[m] = hops_conv_12_ref;
40966         }
40967         FREE(hops);
40968         LDKRouteParameters route_params_conv;
40969         route_params_conv.inner = untag_ptr(route_params);
40970         route_params_conv.is_owned = ptr_is_owned(route_params);
40971         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
40972         route_params_conv.is_owned = false;
40973         LDKNetworkGraph network_graph_conv;
40974         network_graph_conv.inner = untag_ptr(network_graph);
40975         network_graph_conv.is_owned = ptr_is_owned(network_graph);
40976         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
40977         network_graph_conv.is_owned = false;
40978         void* logger_ptr = untag_ptr(logger);
40979         CHECK_ACCESS(logger_ptr);
40980         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
40981         if (logger_conv.free == LDKLogger_JCalls_free) {
40982                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
40983                 LDKLogger_JCalls_cloned(&logger_conv);
40984         }
40985         unsigned char random_seed_bytes_arr[32];
40986         CHECK(random_seed_bytes->arr_len == 32);
40987         memcpy(random_seed_bytes_arr, random_seed_bytes->elems, 32); FREE(random_seed_bytes);
40988         unsigned char (*random_seed_bytes_ref)[32] = &random_seed_bytes_arr;
40989         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
40990         *ret_conv = build_route_from_hops(our_node_pubkey_ref, hops_constr, &route_params_conv, &network_graph_conv, logger_conv, random_seed_bytes_ref);
40991         return tag_ptr(ret_conv, true);
40992 }
40993
40994 void  __attribute__((export_name("TS_Score_free"))) TS_Score_free(uint64_t this_ptr) {
40995         if (!ptr_is_owned(this_ptr)) return;
40996         void* this_ptr_ptr = untag_ptr(this_ptr);
40997         CHECK_ACCESS(this_ptr_ptr);
40998         LDKScore this_ptr_conv = *(LDKScore*)(this_ptr_ptr);
40999         FREE(untag_ptr(this_ptr));
41000         Score_free(this_ptr_conv);
41001 }
41002
41003 void  __attribute__((export_name("TS_LockableScore_free"))) TS_LockableScore_free(uint64_t this_ptr) {
41004         if (!ptr_is_owned(this_ptr)) return;
41005         void* this_ptr_ptr = untag_ptr(this_ptr);
41006         CHECK_ACCESS(this_ptr_ptr);
41007         LDKLockableScore this_ptr_conv = *(LDKLockableScore*)(this_ptr_ptr);
41008         FREE(untag_ptr(this_ptr));
41009         LockableScore_free(this_ptr_conv);
41010 }
41011
41012 void  __attribute__((export_name("TS_MultiThreadedLockableScore_free"))) TS_MultiThreadedLockableScore_free(uint64_t this_obj) {
41013         LDKMultiThreadedLockableScore this_obj_conv;
41014         this_obj_conv.inner = untag_ptr(this_obj);
41015         this_obj_conv.is_owned = ptr_is_owned(this_obj);
41016         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41017         MultiThreadedLockableScore_free(this_obj_conv);
41018 }
41019
41020 int8_tArray  __attribute__((export_name("TS_MultiThreadedLockableScore_write"))) TS_MultiThreadedLockableScore_write(uint64_t obj) {
41021         LDKMultiThreadedLockableScore obj_conv;
41022         obj_conv.inner = untag_ptr(obj);
41023         obj_conv.is_owned = ptr_is_owned(obj);
41024         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
41025         obj_conv.is_owned = false;
41026         LDKCVec_u8Z ret_var = MultiThreadedLockableScore_write(&obj_conv);
41027         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
41028         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
41029         CVec_u8Z_free(ret_var);
41030         return ret_arr;
41031 }
41032
41033 uint64_t  __attribute__((export_name("TS_MultiThreadedLockableScore_new"))) TS_MultiThreadedLockableScore_new(uint64_t score) {
41034         void* score_ptr = untag_ptr(score);
41035         CHECK_ACCESS(score_ptr);
41036         LDKScore score_conv = *(LDKScore*)(score_ptr);
41037         if (score_conv.free == LDKScore_JCalls_free) {
41038                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
41039                 LDKScore_JCalls_cloned(&score_conv);
41040         }
41041         LDKMultiThreadedLockableScore ret_var = MultiThreadedLockableScore_new(score_conv);
41042         uint64_t ret_ref = 0;
41043         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41044         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41045         return ret_ref;
41046 }
41047
41048 void  __attribute__((export_name("TS_ChannelUsage_free"))) TS_ChannelUsage_free(uint64_t this_obj) {
41049         LDKChannelUsage this_obj_conv;
41050         this_obj_conv.inner = untag_ptr(this_obj);
41051         this_obj_conv.is_owned = ptr_is_owned(this_obj);
41052         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41053         ChannelUsage_free(this_obj_conv);
41054 }
41055
41056 int64_t  __attribute__((export_name("TS_ChannelUsage_get_amount_msat"))) TS_ChannelUsage_get_amount_msat(uint64_t this_ptr) {
41057         LDKChannelUsage this_ptr_conv;
41058         this_ptr_conv.inner = untag_ptr(this_ptr);
41059         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41060         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41061         this_ptr_conv.is_owned = false;
41062         int64_t ret_conv = ChannelUsage_get_amount_msat(&this_ptr_conv);
41063         return ret_conv;
41064 }
41065
41066 void  __attribute__((export_name("TS_ChannelUsage_set_amount_msat"))) TS_ChannelUsage_set_amount_msat(uint64_t this_ptr, int64_t val) {
41067         LDKChannelUsage this_ptr_conv;
41068         this_ptr_conv.inner = untag_ptr(this_ptr);
41069         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41070         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41071         this_ptr_conv.is_owned = false;
41072         ChannelUsage_set_amount_msat(&this_ptr_conv, val);
41073 }
41074
41075 int64_t  __attribute__((export_name("TS_ChannelUsage_get_inflight_htlc_msat"))) TS_ChannelUsage_get_inflight_htlc_msat(uint64_t this_ptr) {
41076         LDKChannelUsage this_ptr_conv;
41077         this_ptr_conv.inner = untag_ptr(this_ptr);
41078         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41079         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41080         this_ptr_conv.is_owned = false;
41081         int64_t ret_conv = ChannelUsage_get_inflight_htlc_msat(&this_ptr_conv);
41082         return ret_conv;
41083 }
41084
41085 void  __attribute__((export_name("TS_ChannelUsage_set_inflight_htlc_msat"))) TS_ChannelUsage_set_inflight_htlc_msat(uint64_t this_ptr, int64_t val) {
41086         LDKChannelUsage this_ptr_conv;
41087         this_ptr_conv.inner = untag_ptr(this_ptr);
41088         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41089         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41090         this_ptr_conv.is_owned = false;
41091         ChannelUsage_set_inflight_htlc_msat(&this_ptr_conv, val);
41092 }
41093
41094 uint64_t  __attribute__((export_name("TS_ChannelUsage_get_effective_capacity"))) TS_ChannelUsage_get_effective_capacity(uint64_t this_ptr) {
41095         LDKChannelUsage this_ptr_conv;
41096         this_ptr_conv.inner = untag_ptr(this_ptr);
41097         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41098         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41099         this_ptr_conv.is_owned = false;
41100         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
41101         *ret_copy = ChannelUsage_get_effective_capacity(&this_ptr_conv);
41102         uint64_t ret_ref = tag_ptr(ret_copy, true);
41103         return ret_ref;
41104 }
41105
41106 void  __attribute__((export_name("TS_ChannelUsage_set_effective_capacity"))) TS_ChannelUsage_set_effective_capacity(uint64_t this_ptr, uint64_t val) {
41107         LDKChannelUsage this_ptr_conv;
41108         this_ptr_conv.inner = untag_ptr(this_ptr);
41109         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41110         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41111         this_ptr_conv.is_owned = false;
41112         void* val_ptr = untag_ptr(val);
41113         CHECK_ACCESS(val_ptr);
41114         LDKEffectiveCapacity val_conv = *(LDKEffectiveCapacity*)(val_ptr);
41115         val_conv = EffectiveCapacity_clone((LDKEffectiveCapacity*)untag_ptr(val));
41116         ChannelUsage_set_effective_capacity(&this_ptr_conv, val_conv);
41117 }
41118
41119 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) {
41120         void* effective_capacity_arg_ptr = untag_ptr(effective_capacity_arg);
41121         CHECK_ACCESS(effective_capacity_arg_ptr);
41122         LDKEffectiveCapacity effective_capacity_arg_conv = *(LDKEffectiveCapacity*)(effective_capacity_arg_ptr);
41123         effective_capacity_arg_conv = EffectiveCapacity_clone((LDKEffectiveCapacity*)untag_ptr(effective_capacity_arg));
41124         LDKChannelUsage ret_var = ChannelUsage_new(amount_msat_arg, inflight_htlc_msat_arg, effective_capacity_arg_conv);
41125         uint64_t ret_ref = 0;
41126         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41127         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41128         return ret_ref;
41129 }
41130
41131 static inline uint64_t ChannelUsage_clone_ptr(LDKChannelUsage *NONNULL_PTR arg) {
41132         LDKChannelUsage ret_var = ChannelUsage_clone(arg);
41133         uint64_t ret_ref = 0;
41134         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41135         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41136         return ret_ref;
41137 }
41138 int64_t  __attribute__((export_name("TS_ChannelUsage_clone_ptr"))) TS_ChannelUsage_clone_ptr(uint64_t arg) {
41139         LDKChannelUsage arg_conv;
41140         arg_conv.inner = untag_ptr(arg);
41141         arg_conv.is_owned = ptr_is_owned(arg);
41142         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
41143         arg_conv.is_owned = false;
41144         int64_t ret_conv = ChannelUsage_clone_ptr(&arg_conv);
41145         return ret_conv;
41146 }
41147
41148 uint64_t  __attribute__((export_name("TS_ChannelUsage_clone"))) TS_ChannelUsage_clone(uint64_t orig) {
41149         LDKChannelUsage orig_conv;
41150         orig_conv.inner = untag_ptr(orig);
41151         orig_conv.is_owned = ptr_is_owned(orig);
41152         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
41153         orig_conv.is_owned = false;
41154         LDKChannelUsage ret_var = ChannelUsage_clone(&orig_conv);
41155         uint64_t ret_ref = 0;
41156         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41157         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41158         return ret_ref;
41159 }
41160
41161 void  __attribute__((export_name("TS_FixedPenaltyScorer_free"))) TS_FixedPenaltyScorer_free(uint64_t this_obj) {
41162         LDKFixedPenaltyScorer this_obj_conv;
41163         this_obj_conv.inner = untag_ptr(this_obj);
41164         this_obj_conv.is_owned = ptr_is_owned(this_obj);
41165         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41166         FixedPenaltyScorer_free(this_obj_conv);
41167 }
41168
41169 static inline uint64_t FixedPenaltyScorer_clone_ptr(LDKFixedPenaltyScorer *NONNULL_PTR arg) {
41170         LDKFixedPenaltyScorer ret_var = FixedPenaltyScorer_clone(arg);
41171         uint64_t ret_ref = 0;
41172         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41173         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41174         return ret_ref;
41175 }
41176 int64_t  __attribute__((export_name("TS_FixedPenaltyScorer_clone_ptr"))) TS_FixedPenaltyScorer_clone_ptr(uint64_t arg) {
41177         LDKFixedPenaltyScorer arg_conv;
41178         arg_conv.inner = untag_ptr(arg);
41179         arg_conv.is_owned = ptr_is_owned(arg);
41180         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
41181         arg_conv.is_owned = false;
41182         int64_t ret_conv = FixedPenaltyScorer_clone_ptr(&arg_conv);
41183         return ret_conv;
41184 }
41185
41186 uint64_t  __attribute__((export_name("TS_FixedPenaltyScorer_clone"))) TS_FixedPenaltyScorer_clone(uint64_t orig) {
41187         LDKFixedPenaltyScorer orig_conv;
41188         orig_conv.inner = untag_ptr(orig);
41189         orig_conv.is_owned = ptr_is_owned(orig);
41190         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
41191         orig_conv.is_owned = false;
41192         LDKFixedPenaltyScorer ret_var = FixedPenaltyScorer_clone(&orig_conv);
41193         uint64_t ret_ref = 0;
41194         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41195         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41196         return ret_ref;
41197 }
41198
41199 uint64_t  __attribute__((export_name("TS_FixedPenaltyScorer_with_penalty"))) TS_FixedPenaltyScorer_with_penalty(int64_t penalty_msat) {
41200         LDKFixedPenaltyScorer ret_var = FixedPenaltyScorer_with_penalty(penalty_msat);
41201         uint64_t ret_ref = 0;
41202         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41203         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41204         return ret_ref;
41205 }
41206
41207 uint64_t  __attribute__((export_name("TS_FixedPenaltyScorer_as_Score"))) TS_FixedPenaltyScorer_as_Score(uint64_t this_arg) {
41208         LDKFixedPenaltyScorer this_arg_conv;
41209         this_arg_conv.inner = untag_ptr(this_arg);
41210         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41211         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41212         this_arg_conv.is_owned = false;
41213         LDKScore* ret_ret = MALLOC(sizeof(LDKScore), "LDKScore");
41214         *ret_ret = FixedPenaltyScorer_as_Score(&this_arg_conv);
41215         return tag_ptr(ret_ret, true);
41216 }
41217
41218 int8_tArray  __attribute__((export_name("TS_FixedPenaltyScorer_write"))) TS_FixedPenaltyScorer_write(uint64_t obj) {
41219         LDKFixedPenaltyScorer obj_conv;
41220         obj_conv.inner = untag_ptr(obj);
41221         obj_conv.is_owned = ptr_is_owned(obj);
41222         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
41223         obj_conv.is_owned = false;
41224         LDKCVec_u8Z ret_var = FixedPenaltyScorer_write(&obj_conv);
41225         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
41226         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
41227         CVec_u8Z_free(ret_var);
41228         return ret_arr;
41229 }
41230
41231 uint64_t  __attribute__((export_name("TS_FixedPenaltyScorer_read"))) TS_FixedPenaltyScorer_read(int8_tArray ser, int64_t arg) {
41232         LDKu8slice ser_ref;
41233         ser_ref.datalen = ser->arr_len;
41234         ser_ref.data = ser->elems;
41235         LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
41236         *ret_conv = FixedPenaltyScorer_read(ser_ref, arg);
41237         FREE(ser);
41238         return tag_ptr(ret_conv, true);
41239 }
41240
41241 void  __attribute__((export_name("TS_ProbabilisticScorer_free"))) TS_ProbabilisticScorer_free(uint64_t this_obj) {
41242         LDKProbabilisticScorer this_obj_conv;
41243         this_obj_conv.inner = untag_ptr(this_obj);
41244         this_obj_conv.is_owned = ptr_is_owned(this_obj);
41245         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41246         ProbabilisticScorer_free(this_obj_conv);
41247 }
41248
41249 void  __attribute__((export_name("TS_ProbabilisticScoringParameters_free"))) TS_ProbabilisticScoringParameters_free(uint64_t this_obj) {
41250         LDKProbabilisticScoringParameters 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         ProbabilisticScoringParameters_free(this_obj_conv);
41255 }
41256
41257 int64_t  __attribute__((export_name("TS_ProbabilisticScoringParameters_get_base_penalty_msat"))) TS_ProbabilisticScoringParameters_get_base_penalty_msat(uint64_t this_ptr) {
41258         LDKProbabilisticScoringParameters 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 = ProbabilisticScoringParameters_get_base_penalty_msat(&this_ptr_conv);
41264         return ret_conv;
41265 }
41266
41267 void  __attribute__((export_name("TS_ProbabilisticScoringParameters_set_base_penalty_msat"))) TS_ProbabilisticScoringParameters_set_base_penalty_msat(uint64_t this_ptr, int64_t val) {
41268         LDKProbabilisticScoringParameters 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         ProbabilisticScoringParameters_set_base_penalty_msat(&this_ptr_conv, val);
41274 }
41275
41276 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) {
41277         LDKProbabilisticScoringParameters 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 = ProbabilisticScoringParameters_get_base_penalty_amount_multiplier_msat(&this_ptr_conv);
41283         return ret_conv;
41284 }
41285
41286 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) {
41287         LDKProbabilisticScoringParameters 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         ProbabilisticScoringParameters_set_base_penalty_amount_multiplier_msat(&this_ptr_conv, val);
41293 }
41294
41295 int64_t  __attribute__((export_name("TS_ProbabilisticScoringParameters_get_liquidity_penalty_multiplier_msat"))) TS_ProbabilisticScoringParameters_get_liquidity_penalty_multiplier_msat(uint64_t this_ptr) {
41296         LDKProbabilisticScoringParameters 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         int64_t ret_conv = ProbabilisticScoringParameters_get_liquidity_penalty_multiplier_msat(&this_ptr_conv);
41302         return ret_conv;
41303 }
41304
41305 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) {
41306         LDKProbabilisticScoringParameters this_ptr_conv;
41307         this_ptr_conv.inner = untag_ptr(this_ptr);
41308         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41309         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41310         this_ptr_conv.is_owned = false;
41311         ProbabilisticScoringParameters_set_liquidity_penalty_multiplier_msat(&this_ptr_conv, val);
41312 }
41313
41314 int64_t  __attribute__((export_name("TS_ProbabilisticScoringParameters_get_liquidity_offset_half_life"))) TS_ProbabilisticScoringParameters_get_liquidity_offset_half_life(uint64_t this_ptr) {
41315         LDKProbabilisticScoringParameters this_ptr_conv;
41316         this_ptr_conv.inner = untag_ptr(this_ptr);
41317         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41318         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41319         this_ptr_conv.is_owned = false;
41320         int64_t ret_conv = ProbabilisticScoringParameters_get_liquidity_offset_half_life(&this_ptr_conv);
41321         return ret_conv;
41322 }
41323
41324 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) {
41325         LDKProbabilisticScoringParameters this_ptr_conv;
41326         this_ptr_conv.inner = untag_ptr(this_ptr);
41327         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41328         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41329         this_ptr_conv.is_owned = false;
41330         ProbabilisticScoringParameters_set_liquidity_offset_half_life(&this_ptr_conv, val);
41331 }
41332
41333 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) {
41334         LDKProbabilisticScoringParameters this_ptr_conv;
41335         this_ptr_conv.inner = untag_ptr(this_ptr);
41336         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41337         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41338         this_ptr_conv.is_owned = false;
41339         int64_t ret_conv = ProbabilisticScoringParameters_get_liquidity_penalty_amount_multiplier_msat(&this_ptr_conv);
41340         return ret_conv;
41341 }
41342
41343 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) {
41344         LDKProbabilisticScoringParameters this_ptr_conv;
41345         this_ptr_conv.inner = untag_ptr(this_ptr);
41346         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41347         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41348         this_ptr_conv.is_owned = false;
41349         ProbabilisticScoringParameters_set_liquidity_penalty_amount_multiplier_msat(&this_ptr_conv, val);
41350 }
41351
41352 int64_t  __attribute__((export_name("TS_ProbabilisticScoringParameters_get_anti_probing_penalty_msat"))) TS_ProbabilisticScoringParameters_get_anti_probing_penalty_msat(uint64_t this_ptr) {
41353         LDKProbabilisticScoringParameters this_ptr_conv;
41354         this_ptr_conv.inner = untag_ptr(this_ptr);
41355         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41356         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41357         this_ptr_conv.is_owned = false;
41358         int64_t ret_conv = ProbabilisticScoringParameters_get_anti_probing_penalty_msat(&this_ptr_conv);
41359         return ret_conv;
41360 }
41361
41362 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) {
41363         LDKProbabilisticScoringParameters this_ptr_conv;
41364         this_ptr_conv.inner = untag_ptr(this_ptr);
41365         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41366         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41367         this_ptr_conv.is_owned = false;
41368         ProbabilisticScoringParameters_set_anti_probing_penalty_msat(&this_ptr_conv, val);
41369 }
41370
41371 int64_t  __attribute__((export_name("TS_ProbabilisticScoringParameters_get_considered_impossible_penalty_msat"))) TS_ProbabilisticScoringParameters_get_considered_impossible_penalty_msat(uint64_t this_ptr) {
41372         LDKProbabilisticScoringParameters this_ptr_conv;
41373         this_ptr_conv.inner = untag_ptr(this_ptr);
41374         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41375         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41376         this_ptr_conv.is_owned = false;
41377         int64_t ret_conv = ProbabilisticScoringParameters_get_considered_impossible_penalty_msat(&this_ptr_conv);
41378         return ret_conv;
41379 }
41380
41381 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) {
41382         LDKProbabilisticScoringParameters this_ptr_conv;
41383         this_ptr_conv.inner = untag_ptr(this_ptr);
41384         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41385         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41386         this_ptr_conv.is_owned = false;
41387         ProbabilisticScoringParameters_set_considered_impossible_penalty_msat(&this_ptr_conv, val);
41388 }
41389
41390 static inline uint64_t ProbabilisticScoringParameters_clone_ptr(LDKProbabilisticScoringParameters *NONNULL_PTR arg) {
41391         LDKProbabilisticScoringParameters ret_var = ProbabilisticScoringParameters_clone(arg);
41392         uint64_t ret_ref = 0;
41393         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41394         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41395         return ret_ref;
41396 }
41397 int64_t  __attribute__((export_name("TS_ProbabilisticScoringParameters_clone_ptr"))) TS_ProbabilisticScoringParameters_clone_ptr(uint64_t arg) {
41398         LDKProbabilisticScoringParameters arg_conv;
41399         arg_conv.inner = untag_ptr(arg);
41400         arg_conv.is_owned = ptr_is_owned(arg);
41401         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
41402         arg_conv.is_owned = false;
41403         int64_t ret_conv = ProbabilisticScoringParameters_clone_ptr(&arg_conv);
41404         return ret_conv;
41405 }
41406
41407 uint64_t  __attribute__((export_name("TS_ProbabilisticScoringParameters_clone"))) TS_ProbabilisticScoringParameters_clone(uint64_t orig) {
41408         LDKProbabilisticScoringParameters orig_conv;
41409         orig_conv.inner = untag_ptr(orig);
41410         orig_conv.is_owned = ptr_is_owned(orig);
41411         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
41412         orig_conv.is_owned = false;
41413         LDKProbabilisticScoringParameters ret_var = ProbabilisticScoringParameters_clone(&orig_conv);
41414         uint64_t ret_ref = 0;
41415         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41416         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41417         return ret_ref;
41418 }
41419
41420 uint64_t  __attribute__((export_name("TS_ProbabilisticScorer_new"))) TS_ProbabilisticScorer_new(uint64_t params, uint64_t network_graph, uint64_t logger) {
41421         LDKProbabilisticScoringParameters params_conv;
41422         params_conv.inner = untag_ptr(params);
41423         params_conv.is_owned = ptr_is_owned(params);
41424         CHECK_INNER_FIELD_ACCESS_OR_NULL(params_conv);
41425         params_conv = ProbabilisticScoringParameters_clone(&params_conv);
41426         LDKNetworkGraph network_graph_conv;
41427         network_graph_conv.inner = untag_ptr(network_graph);
41428         network_graph_conv.is_owned = ptr_is_owned(network_graph);
41429         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
41430         network_graph_conv.is_owned = false;
41431         void* logger_ptr = untag_ptr(logger);
41432         CHECK_ACCESS(logger_ptr);
41433         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
41434         if (logger_conv.free == LDKLogger_JCalls_free) {
41435                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
41436                 LDKLogger_JCalls_cloned(&logger_conv);
41437         }
41438         LDKProbabilisticScorer ret_var = ProbabilisticScorer_new(params_conv, &network_graph_conv, logger_conv);
41439         uint64_t ret_ref = 0;
41440         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41441         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41442         return ret_ref;
41443 }
41444
41445 void  __attribute__((export_name("TS_ProbabilisticScorer_debug_log_liquidity_stats"))) TS_ProbabilisticScorer_debug_log_liquidity_stats(uint64_t this_arg) {
41446         LDKProbabilisticScorer this_arg_conv;
41447         this_arg_conv.inner = untag_ptr(this_arg);
41448         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41449         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41450         this_arg_conv.is_owned = false;
41451         ProbabilisticScorer_debug_log_liquidity_stats(&this_arg_conv);
41452 }
41453
41454 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) {
41455         LDKProbabilisticScorer this_arg_conv;
41456         this_arg_conv.inner = untag_ptr(this_arg);
41457         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41458         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41459         this_arg_conv.is_owned = false;
41460         LDKNodeId target_conv;
41461         target_conv.inner = untag_ptr(target);
41462         target_conv.is_owned = ptr_is_owned(target);
41463         CHECK_INNER_FIELD_ACCESS_OR_NULL(target_conv);
41464         target_conv.is_owned = false;
41465         LDKCOption_C2Tuple_u64u64ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u64ZZ), "LDKCOption_C2Tuple_u64u64ZZ");
41466         *ret_copy = ProbabilisticScorer_estimated_channel_liquidity_range(&this_arg_conv, scid, &target_conv);
41467         uint64_t ret_ref = tag_ptr(ret_copy, true);
41468         return ret_ref;
41469 }
41470
41471 void  __attribute__((export_name("TS_ProbabilisticScorer_add_banned"))) TS_ProbabilisticScorer_add_banned(uint64_t this_arg, uint64_t node_id) {
41472         LDKProbabilisticScorer this_arg_conv;
41473         this_arg_conv.inner = untag_ptr(this_arg);
41474         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41475         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41476         this_arg_conv.is_owned = false;
41477         LDKNodeId node_id_conv;
41478         node_id_conv.inner = untag_ptr(node_id);
41479         node_id_conv.is_owned = ptr_is_owned(node_id);
41480         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv);
41481         node_id_conv.is_owned = false;
41482         ProbabilisticScorer_add_banned(&this_arg_conv, &node_id_conv);
41483 }
41484
41485 void  __attribute__((export_name("TS_ProbabilisticScorer_remove_banned"))) TS_ProbabilisticScorer_remove_banned(uint64_t this_arg, uint64_t node_id) {
41486         LDKProbabilisticScorer this_arg_conv;
41487         this_arg_conv.inner = untag_ptr(this_arg);
41488         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41489         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41490         this_arg_conv.is_owned = false;
41491         LDKNodeId node_id_conv;
41492         node_id_conv.inner = untag_ptr(node_id);
41493         node_id_conv.is_owned = ptr_is_owned(node_id);
41494         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv);
41495         node_id_conv.is_owned = false;
41496         ProbabilisticScorer_remove_banned(&this_arg_conv, &node_id_conv);
41497 }
41498
41499 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) {
41500         LDKProbabilisticScorer this_arg_conv;
41501         this_arg_conv.inner = untag_ptr(this_arg);
41502         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41503         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41504         this_arg_conv.is_owned = false;
41505         LDKNodeId node_id_conv;
41506         node_id_conv.inner = untag_ptr(node_id);
41507         node_id_conv.is_owned = ptr_is_owned(node_id);
41508         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv);
41509         node_id_conv.is_owned = false;
41510         ProbabilisticScorer_set_manual_penalty(&this_arg_conv, &node_id_conv, penalty);
41511 }
41512
41513 void  __attribute__((export_name("TS_ProbabilisticScorer_remove_manual_penalty"))) TS_ProbabilisticScorer_remove_manual_penalty(uint64_t this_arg, uint64_t node_id) {
41514         LDKProbabilisticScorer this_arg_conv;
41515         this_arg_conv.inner = untag_ptr(this_arg);
41516         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41517         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41518         this_arg_conv.is_owned = false;
41519         LDKNodeId node_id_conv;
41520         node_id_conv.inner = untag_ptr(node_id);
41521         node_id_conv.is_owned = ptr_is_owned(node_id);
41522         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv);
41523         node_id_conv.is_owned = false;
41524         ProbabilisticScorer_remove_manual_penalty(&this_arg_conv, &node_id_conv);
41525 }
41526
41527 void  __attribute__((export_name("TS_ProbabilisticScorer_clear_manual_penalties"))) TS_ProbabilisticScorer_clear_manual_penalties(uint64_t this_arg) {
41528         LDKProbabilisticScorer this_arg_conv;
41529         this_arg_conv.inner = untag_ptr(this_arg);
41530         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41531         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41532         this_arg_conv.is_owned = false;
41533         ProbabilisticScorer_clear_manual_penalties(&this_arg_conv);
41534 }
41535
41536 void  __attribute__((export_name("TS_ProbabilisticScoringParameters_add_banned_from_list"))) TS_ProbabilisticScoringParameters_add_banned_from_list(uint64_t this_arg, uint64_tArray node_ids) {
41537         LDKProbabilisticScoringParameters this_arg_conv;
41538         this_arg_conv.inner = untag_ptr(this_arg);
41539         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41540         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41541         this_arg_conv.is_owned = false;
41542         LDKCVec_NodeIdZ node_ids_constr;
41543         node_ids_constr.datalen = node_ids->arr_len;
41544         if (node_ids_constr.datalen > 0)
41545                 node_ids_constr.data = MALLOC(node_ids_constr.datalen * sizeof(LDKNodeId), "LDKCVec_NodeIdZ Elements");
41546         else
41547                 node_ids_constr.data = NULL;
41548         uint64_t* node_ids_vals = node_ids->elems;
41549         for (size_t i = 0; i < node_ids_constr.datalen; i++) {
41550                 uint64_t node_ids_conv_8 = node_ids_vals[i];
41551                 LDKNodeId node_ids_conv_8_conv;
41552                 node_ids_conv_8_conv.inner = untag_ptr(node_ids_conv_8);
41553                 node_ids_conv_8_conv.is_owned = ptr_is_owned(node_ids_conv_8);
41554                 CHECK_INNER_FIELD_ACCESS_OR_NULL(node_ids_conv_8_conv);
41555                 node_ids_conv_8_conv = NodeId_clone(&node_ids_conv_8_conv);
41556                 node_ids_constr.data[i] = node_ids_conv_8_conv;
41557         }
41558         FREE(node_ids);
41559         ProbabilisticScoringParameters_add_banned_from_list(&this_arg_conv, node_ids_constr);
41560 }
41561
41562 uint64_t  __attribute__((export_name("TS_ProbabilisticScoringParameters_default"))) TS_ProbabilisticScoringParameters_default() {
41563         LDKProbabilisticScoringParameters ret_var = ProbabilisticScoringParameters_default();
41564         uint64_t ret_ref = 0;
41565         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41566         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41567         return ret_ref;
41568 }
41569
41570 uint64_t  __attribute__((export_name("TS_ProbabilisticScorer_as_Score"))) TS_ProbabilisticScorer_as_Score(uint64_t this_arg) {
41571         LDKProbabilisticScorer this_arg_conv;
41572         this_arg_conv.inner = untag_ptr(this_arg);
41573         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41574         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41575         this_arg_conv.is_owned = false;
41576         LDKScore* ret_ret = MALLOC(sizeof(LDKScore), "LDKScore");
41577         *ret_ret = ProbabilisticScorer_as_Score(&this_arg_conv);
41578         return tag_ptr(ret_ret, true);
41579 }
41580
41581 int8_tArray  __attribute__((export_name("TS_ProbabilisticScorer_write"))) TS_ProbabilisticScorer_write(uint64_t obj) {
41582         LDKProbabilisticScorer obj_conv;
41583         obj_conv.inner = untag_ptr(obj);
41584         obj_conv.is_owned = ptr_is_owned(obj);
41585         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
41586         obj_conv.is_owned = false;
41587         LDKCVec_u8Z ret_var = ProbabilisticScorer_write(&obj_conv);
41588         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
41589         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
41590         CVec_u8Z_free(ret_var);
41591         return ret_arr;
41592 }
41593
41594 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) {
41595         LDKu8slice ser_ref;
41596         ser_ref.datalen = ser->arr_len;
41597         ser_ref.data = ser->elems;
41598         LDKProbabilisticScoringParameters arg_a_conv;
41599         arg_a_conv.inner = untag_ptr(arg_a);
41600         arg_a_conv.is_owned = ptr_is_owned(arg_a);
41601         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_a_conv);
41602         arg_a_conv = ProbabilisticScoringParameters_clone(&arg_a_conv);
41603         LDKNetworkGraph arg_b_conv;
41604         arg_b_conv.inner = untag_ptr(arg_b);
41605         arg_b_conv.is_owned = ptr_is_owned(arg_b);
41606         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_b_conv);
41607         arg_b_conv.is_owned = false;
41608         void* arg_c_ptr = untag_ptr(arg_c);
41609         CHECK_ACCESS(arg_c_ptr);
41610         LDKLogger arg_c_conv = *(LDKLogger*)(arg_c_ptr);
41611         if (arg_c_conv.free == LDKLogger_JCalls_free) {
41612                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
41613                 LDKLogger_JCalls_cloned(&arg_c_conv);
41614         }
41615         LDKCResult_ProbabilisticScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ProbabilisticScorerDecodeErrorZ), "LDKCResult_ProbabilisticScorerDecodeErrorZ");
41616         *ret_conv = ProbabilisticScorer_read(ser_ref, arg_a_conv, &arg_b_conv, arg_c_conv);
41617         FREE(ser);
41618         return tag_ptr(ret_conv, true);
41619 }
41620
41621 void  __attribute__((export_name("TS_ParseError_free"))) TS_ParseError_free(uint64_t this_ptr) {
41622         if (!ptr_is_owned(this_ptr)) return;
41623         void* this_ptr_ptr = untag_ptr(this_ptr);
41624         CHECK_ACCESS(this_ptr_ptr);
41625         LDKParseError this_ptr_conv = *(LDKParseError*)(this_ptr_ptr);
41626         FREE(untag_ptr(this_ptr));
41627         ParseError_free(this_ptr_conv);
41628 }
41629
41630 static inline uint64_t ParseError_clone_ptr(LDKParseError *NONNULL_PTR arg) {
41631         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
41632         *ret_copy = ParseError_clone(arg);
41633         uint64_t ret_ref = tag_ptr(ret_copy, true);
41634         return ret_ref;
41635 }
41636 int64_t  __attribute__((export_name("TS_ParseError_clone_ptr"))) TS_ParseError_clone_ptr(uint64_t arg) {
41637         LDKParseError* arg_conv = (LDKParseError*)untag_ptr(arg);
41638         int64_t ret_conv = ParseError_clone_ptr(arg_conv);
41639         return ret_conv;
41640 }
41641
41642 uint64_t  __attribute__((export_name("TS_ParseError_clone"))) TS_ParseError_clone(uint64_t orig) {
41643         LDKParseError* orig_conv = (LDKParseError*)untag_ptr(orig);
41644         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
41645         *ret_copy = ParseError_clone(orig_conv);
41646         uint64_t ret_ref = tag_ptr(ret_copy, true);
41647         return ret_ref;
41648 }
41649
41650 uint64_t  __attribute__((export_name("TS_ParseError_bech32_error"))) TS_ParseError_bech32_error(uint64_t a) {
41651         void* a_ptr = untag_ptr(a);
41652         CHECK_ACCESS(a_ptr);
41653         LDKBech32Error a_conv = *(LDKBech32Error*)(a_ptr);
41654         a_conv = Bech32Error_clone((LDKBech32Error*)untag_ptr(a));
41655         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
41656         *ret_copy = ParseError_bech32_error(a_conv);
41657         uint64_t ret_ref = tag_ptr(ret_copy, true);
41658         return ret_ref;
41659 }
41660
41661 uint64_t  __attribute__((export_name("TS_ParseError_parse_amount_error"))) TS_ParseError_parse_amount_error(int32_t a) {
41662         
41663         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
41664         *ret_copy = ParseError_parse_amount_error((LDKError){ ._dummy = 0 });
41665         uint64_t ret_ref = tag_ptr(ret_copy, true);
41666         return ret_ref;
41667 }
41668
41669 uint64_t  __attribute__((export_name("TS_ParseError_malformed_signature"))) TS_ParseError_malformed_signature(uint32_t a) {
41670         LDKSecp256k1Error a_conv = LDKSecp256k1Error_from_js(a);
41671         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
41672         *ret_copy = ParseError_malformed_signature(a_conv);
41673         uint64_t ret_ref = tag_ptr(ret_copy, true);
41674         return ret_ref;
41675 }
41676
41677 uint64_t  __attribute__((export_name("TS_ParseError_bad_prefix"))) TS_ParseError_bad_prefix() {
41678         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
41679         *ret_copy = ParseError_bad_prefix();
41680         uint64_t ret_ref = tag_ptr(ret_copy, true);
41681         return ret_ref;
41682 }
41683
41684 uint64_t  __attribute__((export_name("TS_ParseError_unknown_currency"))) TS_ParseError_unknown_currency() {
41685         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
41686         *ret_copy = ParseError_unknown_currency();
41687         uint64_t ret_ref = tag_ptr(ret_copy, true);
41688         return ret_ref;
41689 }
41690
41691 uint64_t  __attribute__((export_name("TS_ParseError_unknown_si_prefix"))) TS_ParseError_unknown_si_prefix() {
41692         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
41693         *ret_copy = ParseError_unknown_si_prefix();
41694         uint64_t ret_ref = tag_ptr(ret_copy, true);
41695         return ret_ref;
41696 }
41697
41698 uint64_t  __attribute__((export_name("TS_ParseError_malformed_hrp"))) TS_ParseError_malformed_hrp() {
41699         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
41700         *ret_copy = ParseError_malformed_hrp();
41701         uint64_t ret_ref = tag_ptr(ret_copy, true);
41702         return ret_ref;
41703 }
41704
41705 uint64_t  __attribute__((export_name("TS_ParseError_too_short_data_part"))) TS_ParseError_too_short_data_part() {
41706         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
41707         *ret_copy = ParseError_too_short_data_part();
41708         uint64_t ret_ref = tag_ptr(ret_copy, true);
41709         return ret_ref;
41710 }
41711
41712 uint64_t  __attribute__((export_name("TS_ParseError_unexpected_end_of_tagged_fields"))) TS_ParseError_unexpected_end_of_tagged_fields() {
41713         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
41714         *ret_copy = ParseError_unexpected_end_of_tagged_fields();
41715         uint64_t ret_ref = tag_ptr(ret_copy, true);
41716         return ret_ref;
41717 }
41718
41719 uint64_t  __attribute__((export_name("TS_ParseError_description_decode_error"))) TS_ParseError_description_decode_error(int32_t a) {
41720         
41721         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
41722         *ret_copy = ParseError_description_decode_error((LDKError){ ._dummy = 0 });
41723         uint64_t ret_ref = tag_ptr(ret_copy, true);
41724         return ret_ref;
41725 }
41726
41727 uint64_t  __attribute__((export_name("TS_ParseError_padding_error"))) TS_ParseError_padding_error() {
41728         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
41729         *ret_copy = ParseError_padding_error();
41730         uint64_t ret_ref = tag_ptr(ret_copy, true);
41731         return ret_ref;
41732 }
41733
41734 uint64_t  __attribute__((export_name("TS_ParseError_integer_overflow_error"))) TS_ParseError_integer_overflow_error() {
41735         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
41736         *ret_copy = ParseError_integer_overflow_error();
41737         uint64_t ret_ref = tag_ptr(ret_copy, true);
41738         return ret_ref;
41739 }
41740
41741 uint64_t  __attribute__((export_name("TS_ParseError_invalid_seg_wit_program_length"))) TS_ParseError_invalid_seg_wit_program_length() {
41742         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
41743         *ret_copy = ParseError_invalid_seg_wit_program_length();
41744         uint64_t ret_ref = tag_ptr(ret_copy, true);
41745         return ret_ref;
41746 }
41747
41748 uint64_t  __attribute__((export_name("TS_ParseError_invalid_pub_key_hash_length"))) TS_ParseError_invalid_pub_key_hash_length() {
41749         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
41750         *ret_copy = ParseError_invalid_pub_key_hash_length();
41751         uint64_t ret_ref = tag_ptr(ret_copy, true);
41752         return ret_ref;
41753 }
41754
41755 uint64_t  __attribute__((export_name("TS_ParseError_invalid_script_hash_length"))) TS_ParseError_invalid_script_hash_length() {
41756         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
41757         *ret_copy = ParseError_invalid_script_hash_length();
41758         uint64_t ret_ref = tag_ptr(ret_copy, true);
41759         return ret_ref;
41760 }
41761
41762 uint64_t  __attribute__((export_name("TS_ParseError_invalid_recovery_id"))) TS_ParseError_invalid_recovery_id() {
41763         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
41764         *ret_copy = ParseError_invalid_recovery_id();
41765         uint64_t ret_ref = tag_ptr(ret_copy, true);
41766         return ret_ref;
41767 }
41768
41769 uint64_t  __attribute__((export_name("TS_ParseError_invalid_slice_length"))) TS_ParseError_invalid_slice_length(jstring a) {
41770         LDKStr a_conv = str_ref_to_owned_c(a);
41771         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
41772         *ret_copy = ParseError_invalid_slice_length(a_conv);
41773         uint64_t ret_ref = tag_ptr(ret_copy, true);
41774         return ret_ref;
41775 }
41776
41777 uint64_t  __attribute__((export_name("TS_ParseError_skip"))) TS_ParseError_skip() {
41778         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
41779         *ret_copy = ParseError_skip();
41780         uint64_t ret_ref = tag_ptr(ret_copy, true);
41781         return ret_ref;
41782 }
41783
41784 void  __attribute__((export_name("TS_ParseOrSemanticError_free"))) TS_ParseOrSemanticError_free(uint64_t this_ptr) {
41785         if (!ptr_is_owned(this_ptr)) return;
41786         void* this_ptr_ptr = untag_ptr(this_ptr);
41787         CHECK_ACCESS(this_ptr_ptr);
41788         LDKParseOrSemanticError this_ptr_conv = *(LDKParseOrSemanticError*)(this_ptr_ptr);
41789         FREE(untag_ptr(this_ptr));
41790         ParseOrSemanticError_free(this_ptr_conv);
41791 }
41792
41793 static inline uint64_t ParseOrSemanticError_clone_ptr(LDKParseOrSemanticError *NONNULL_PTR arg) {
41794         LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
41795         *ret_copy = ParseOrSemanticError_clone(arg);
41796         uint64_t ret_ref = tag_ptr(ret_copy, true);
41797         return ret_ref;
41798 }
41799 int64_t  __attribute__((export_name("TS_ParseOrSemanticError_clone_ptr"))) TS_ParseOrSemanticError_clone_ptr(uint64_t arg) {
41800         LDKParseOrSemanticError* arg_conv = (LDKParseOrSemanticError*)untag_ptr(arg);
41801         int64_t ret_conv = ParseOrSemanticError_clone_ptr(arg_conv);
41802         return ret_conv;
41803 }
41804
41805 uint64_t  __attribute__((export_name("TS_ParseOrSemanticError_clone"))) TS_ParseOrSemanticError_clone(uint64_t orig) {
41806         LDKParseOrSemanticError* orig_conv = (LDKParseOrSemanticError*)untag_ptr(orig);
41807         LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
41808         *ret_copy = ParseOrSemanticError_clone(orig_conv);
41809         uint64_t ret_ref = tag_ptr(ret_copy, true);
41810         return ret_ref;
41811 }
41812
41813 uint64_t  __attribute__((export_name("TS_ParseOrSemanticError_parse_error"))) TS_ParseOrSemanticError_parse_error(uint64_t a) {
41814         void* a_ptr = untag_ptr(a);
41815         CHECK_ACCESS(a_ptr);
41816         LDKParseError a_conv = *(LDKParseError*)(a_ptr);
41817         a_conv = ParseError_clone((LDKParseError*)untag_ptr(a));
41818         LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
41819         *ret_copy = ParseOrSemanticError_parse_error(a_conv);
41820         uint64_t ret_ref = tag_ptr(ret_copy, true);
41821         return ret_ref;
41822 }
41823
41824 uint64_t  __attribute__((export_name("TS_ParseOrSemanticError_semantic_error"))) TS_ParseOrSemanticError_semantic_error(uint32_t a) {
41825         LDKSemanticError a_conv = LDKSemanticError_from_js(a);
41826         LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
41827         *ret_copy = ParseOrSemanticError_semantic_error(a_conv);
41828         uint64_t ret_ref = tag_ptr(ret_copy, true);
41829         return ret_ref;
41830 }
41831
41832 void  __attribute__((export_name("TS_Invoice_free"))) TS_Invoice_free(uint64_t this_obj) {
41833         LDKInvoice this_obj_conv;
41834         this_obj_conv.inner = untag_ptr(this_obj);
41835         this_obj_conv.is_owned = ptr_is_owned(this_obj);
41836         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41837         Invoice_free(this_obj_conv);
41838 }
41839
41840 jboolean  __attribute__((export_name("TS_Invoice_eq"))) TS_Invoice_eq(uint64_t a, uint64_t b) {
41841         LDKInvoice a_conv;
41842         a_conv.inner = untag_ptr(a);
41843         a_conv.is_owned = ptr_is_owned(a);
41844         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
41845         a_conv.is_owned = false;
41846         LDKInvoice b_conv;
41847         b_conv.inner = untag_ptr(b);
41848         b_conv.is_owned = ptr_is_owned(b);
41849         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
41850         b_conv.is_owned = false;
41851         jboolean ret_conv = Invoice_eq(&a_conv, &b_conv);
41852         return ret_conv;
41853 }
41854
41855 static inline uint64_t Invoice_clone_ptr(LDKInvoice *NONNULL_PTR arg) {
41856         LDKInvoice ret_var = Invoice_clone(arg);
41857         uint64_t ret_ref = 0;
41858         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41859         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41860         return ret_ref;
41861 }
41862 int64_t  __attribute__((export_name("TS_Invoice_clone_ptr"))) TS_Invoice_clone_ptr(uint64_t arg) {
41863         LDKInvoice arg_conv;
41864         arg_conv.inner = untag_ptr(arg);
41865         arg_conv.is_owned = ptr_is_owned(arg);
41866         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
41867         arg_conv.is_owned = false;
41868         int64_t ret_conv = Invoice_clone_ptr(&arg_conv);
41869         return ret_conv;
41870 }
41871
41872 uint64_t  __attribute__((export_name("TS_Invoice_clone"))) TS_Invoice_clone(uint64_t orig) {
41873         LDKInvoice orig_conv;
41874         orig_conv.inner = untag_ptr(orig);
41875         orig_conv.is_owned = ptr_is_owned(orig);
41876         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
41877         orig_conv.is_owned = false;
41878         LDKInvoice ret_var = Invoice_clone(&orig_conv);
41879         uint64_t ret_ref = 0;
41880         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41881         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41882         return ret_ref;
41883 }
41884
41885 void  __attribute__((export_name("TS_SignedRawInvoice_free"))) TS_SignedRawInvoice_free(uint64_t this_obj) {
41886         LDKSignedRawInvoice this_obj_conv;
41887         this_obj_conv.inner = untag_ptr(this_obj);
41888         this_obj_conv.is_owned = ptr_is_owned(this_obj);
41889         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41890         SignedRawInvoice_free(this_obj_conv);
41891 }
41892
41893 jboolean  __attribute__((export_name("TS_SignedRawInvoice_eq"))) TS_SignedRawInvoice_eq(uint64_t a, uint64_t b) {
41894         LDKSignedRawInvoice a_conv;
41895         a_conv.inner = untag_ptr(a);
41896         a_conv.is_owned = ptr_is_owned(a);
41897         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
41898         a_conv.is_owned = false;
41899         LDKSignedRawInvoice b_conv;
41900         b_conv.inner = untag_ptr(b);
41901         b_conv.is_owned = ptr_is_owned(b);
41902         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
41903         b_conv.is_owned = false;
41904         jboolean ret_conv = SignedRawInvoice_eq(&a_conv, &b_conv);
41905         return ret_conv;
41906 }
41907
41908 static inline uint64_t SignedRawInvoice_clone_ptr(LDKSignedRawInvoice *NONNULL_PTR arg) {
41909         LDKSignedRawInvoice ret_var = SignedRawInvoice_clone(arg);
41910         uint64_t ret_ref = 0;
41911         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41912         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41913         return ret_ref;
41914 }
41915 int64_t  __attribute__((export_name("TS_SignedRawInvoice_clone_ptr"))) TS_SignedRawInvoice_clone_ptr(uint64_t arg) {
41916         LDKSignedRawInvoice arg_conv;
41917         arg_conv.inner = untag_ptr(arg);
41918         arg_conv.is_owned = ptr_is_owned(arg);
41919         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
41920         arg_conv.is_owned = false;
41921         int64_t ret_conv = SignedRawInvoice_clone_ptr(&arg_conv);
41922         return ret_conv;
41923 }
41924
41925 uint64_t  __attribute__((export_name("TS_SignedRawInvoice_clone"))) TS_SignedRawInvoice_clone(uint64_t orig) {
41926         LDKSignedRawInvoice orig_conv;
41927         orig_conv.inner = untag_ptr(orig);
41928         orig_conv.is_owned = ptr_is_owned(orig);
41929         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
41930         orig_conv.is_owned = false;
41931         LDKSignedRawInvoice ret_var = SignedRawInvoice_clone(&orig_conv);
41932         uint64_t ret_ref = 0;
41933         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41934         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41935         return ret_ref;
41936 }
41937
41938 void  __attribute__((export_name("TS_RawInvoice_free"))) TS_RawInvoice_free(uint64_t this_obj) {
41939         LDKRawInvoice this_obj_conv;
41940         this_obj_conv.inner = untag_ptr(this_obj);
41941         this_obj_conv.is_owned = ptr_is_owned(this_obj);
41942         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41943         RawInvoice_free(this_obj_conv);
41944 }
41945
41946 uint64_t  __attribute__((export_name("TS_RawInvoice_get_data"))) TS_RawInvoice_get_data(uint64_t this_ptr) {
41947         LDKRawInvoice this_ptr_conv;
41948         this_ptr_conv.inner = untag_ptr(this_ptr);
41949         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41950         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41951         this_ptr_conv.is_owned = false;
41952         LDKRawDataPart ret_var = RawInvoice_get_data(&this_ptr_conv);
41953         uint64_t ret_ref = 0;
41954         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41955         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41956         return ret_ref;
41957 }
41958
41959 void  __attribute__((export_name("TS_RawInvoice_set_data"))) TS_RawInvoice_set_data(uint64_t this_ptr, uint64_t val) {
41960         LDKRawInvoice this_ptr_conv;
41961         this_ptr_conv.inner = untag_ptr(this_ptr);
41962         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41963         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41964         this_ptr_conv.is_owned = false;
41965         LDKRawDataPart val_conv;
41966         val_conv.inner = untag_ptr(val);
41967         val_conv.is_owned = ptr_is_owned(val);
41968         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
41969         val_conv = RawDataPart_clone(&val_conv);
41970         RawInvoice_set_data(&this_ptr_conv, val_conv);
41971 }
41972
41973 jboolean  __attribute__((export_name("TS_RawInvoice_eq"))) TS_RawInvoice_eq(uint64_t a, uint64_t b) {
41974         LDKRawInvoice a_conv;
41975         a_conv.inner = untag_ptr(a);
41976         a_conv.is_owned = ptr_is_owned(a);
41977         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
41978         a_conv.is_owned = false;
41979         LDKRawInvoice b_conv;
41980         b_conv.inner = untag_ptr(b);
41981         b_conv.is_owned = ptr_is_owned(b);
41982         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
41983         b_conv.is_owned = false;
41984         jboolean ret_conv = RawInvoice_eq(&a_conv, &b_conv);
41985         return ret_conv;
41986 }
41987
41988 static inline uint64_t RawInvoice_clone_ptr(LDKRawInvoice *NONNULL_PTR arg) {
41989         LDKRawInvoice ret_var = RawInvoice_clone(arg);
41990         uint64_t ret_ref = 0;
41991         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41992         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41993         return ret_ref;
41994 }
41995 int64_t  __attribute__((export_name("TS_RawInvoice_clone_ptr"))) TS_RawInvoice_clone_ptr(uint64_t arg) {
41996         LDKRawInvoice arg_conv;
41997         arg_conv.inner = untag_ptr(arg);
41998         arg_conv.is_owned = ptr_is_owned(arg);
41999         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42000         arg_conv.is_owned = false;
42001         int64_t ret_conv = RawInvoice_clone_ptr(&arg_conv);
42002         return ret_conv;
42003 }
42004
42005 uint64_t  __attribute__((export_name("TS_RawInvoice_clone"))) TS_RawInvoice_clone(uint64_t orig) {
42006         LDKRawInvoice orig_conv;
42007         orig_conv.inner = untag_ptr(orig);
42008         orig_conv.is_owned = ptr_is_owned(orig);
42009         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
42010         orig_conv.is_owned = false;
42011         LDKRawInvoice ret_var = RawInvoice_clone(&orig_conv);
42012         uint64_t ret_ref = 0;
42013         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42014         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42015         return ret_ref;
42016 }
42017
42018 void  __attribute__((export_name("TS_RawDataPart_free"))) TS_RawDataPart_free(uint64_t this_obj) {
42019         LDKRawDataPart this_obj_conv;
42020         this_obj_conv.inner = untag_ptr(this_obj);
42021         this_obj_conv.is_owned = ptr_is_owned(this_obj);
42022         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42023         RawDataPart_free(this_obj_conv);
42024 }
42025
42026 uint64_t  __attribute__((export_name("TS_RawDataPart_get_timestamp"))) TS_RawDataPart_get_timestamp(uint64_t this_ptr) {
42027         LDKRawDataPart this_ptr_conv;
42028         this_ptr_conv.inner = untag_ptr(this_ptr);
42029         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42030         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42031         this_ptr_conv.is_owned = false;
42032         LDKPositiveTimestamp ret_var = RawDataPart_get_timestamp(&this_ptr_conv);
42033         uint64_t ret_ref = 0;
42034         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42035         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42036         return ret_ref;
42037 }
42038
42039 void  __attribute__((export_name("TS_RawDataPart_set_timestamp"))) TS_RawDataPart_set_timestamp(uint64_t this_ptr, uint64_t val) {
42040         LDKRawDataPart this_ptr_conv;
42041         this_ptr_conv.inner = untag_ptr(this_ptr);
42042         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42043         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42044         this_ptr_conv.is_owned = false;
42045         LDKPositiveTimestamp val_conv;
42046         val_conv.inner = untag_ptr(val);
42047         val_conv.is_owned = ptr_is_owned(val);
42048         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
42049         val_conv = PositiveTimestamp_clone(&val_conv);
42050         RawDataPart_set_timestamp(&this_ptr_conv, val_conv);
42051 }
42052
42053 jboolean  __attribute__((export_name("TS_RawDataPart_eq"))) TS_RawDataPart_eq(uint64_t a, uint64_t b) {
42054         LDKRawDataPart a_conv;
42055         a_conv.inner = untag_ptr(a);
42056         a_conv.is_owned = ptr_is_owned(a);
42057         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
42058         a_conv.is_owned = false;
42059         LDKRawDataPart b_conv;
42060         b_conv.inner = untag_ptr(b);
42061         b_conv.is_owned = ptr_is_owned(b);
42062         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
42063         b_conv.is_owned = false;
42064         jboolean ret_conv = RawDataPart_eq(&a_conv, &b_conv);
42065         return ret_conv;
42066 }
42067
42068 static inline uint64_t RawDataPart_clone_ptr(LDKRawDataPart *NONNULL_PTR arg) {
42069         LDKRawDataPart ret_var = RawDataPart_clone(arg);
42070         uint64_t ret_ref = 0;
42071         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42072         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42073         return ret_ref;
42074 }
42075 int64_t  __attribute__((export_name("TS_RawDataPart_clone_ptr"))) TS_RawDataPart_clone_ptr(uint64_t arg) {
42076         LDKRawDataPart arg_conv;
42077         arg_conv.inner = untag_ptr(arg);
42078         arg_conv.is_owned = ptr_is_owned(arg);
42079         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42080         arg_conv.is_owned = false;
42081         int64_t ret_conv = RawDataPart_clone_ptr(&arg_conv);
42082         return ret_conv;
42083 }
42084
42085 uint64_t  __attribute__((export_name("TS_RawDataPart_clone"))) TS_RawDataPart_clone(uint64_t orig) {
42086         LDKRawDataPart orig_conv;
42087         orig_conv.inner = untag_ptr(orig);
42088         orig_conv.is_owned = ptr_is_owned(orig);
42089         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
42090         orig_conv.is_owned = false;
42091         LDKRawDataPart ret_var = RawDataPart_clone(&orig_conv);
42092         uint64_t ret_ref = 0;
42093         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42094         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42095         return ret_ref;
42096 }
42097
42098 void  __attribute__((export_name("TS_PositiveTimestamp_free"))) TS_PositiveTimestamp_free(uint64_t this_obj) {
42099         LDKPositiveTimestamp this_obj_conv;
42100         this_obj_conv.inner = untag_ptr(this_obj);
42101         this_obj_conv.is_owned = ptr_is_owned(this_obj);
42102         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42103         PositiveTimestamp_free(this_obj_conv);
42104 }
42105
42106 jboolean  __attribute__((export_name("TS_PositiveTimestamp_eq"))) TS_PositiveTimestamp_eq(uint64_t a, uint64_t b) {
42107         LDKPositiveTimestamp a_conv;
42108         a_conv.inner = untag_ptr(a);
42109         a_conv.is_owned = ptr_is_owned(a);
42110         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
42111         a_conv.is_owned = false;
42112         LDKPositiveTimestamp b_conv;
42113         b_conv.inner = untag_ptr(b);
42114         b_conv.is_owned = ptr_is_owned(b);
42115         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
42116         b_conv.is_owned = false;
42117         jboolean ret_conv = PositiveTimestamp_eq(&a_conv, &b_conv);
42118         return ret_conv;
42119 }
42120
42121 static inline uint64_t PositiveTimestamp_clone_ptr(LDKPositiveTimestamp *NONNULL_PTR arg) {
42122         LDKPositiveTimestamp ret_var = PositiveTimestamp_clone(arg);
42123         uint64_t ret_ref = 0;
42124         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42125         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42126         return ret_ref;
42127 }
42128 int64_t  __attribute__((export_name("TS_PositiveTimestamp_clone_ptr"))) TS_PositiveTimestamp_clone_ptr(uint64_t arg) {
42129         LDKPositiveTimestamp arg_conv;
42130         arg_conv.inner = untag_ptr(arg);
42131         arg_conv.is_owned = ptr_is_owned(arg);
42132         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42133         arg_conv.is_owned = false;
42134         int64_t ret_conv = PositiveTimestamp_clone_ptr(&arg_conv);
42135         return ret_conv;
42136 }
42137
42138 uint64_t  __attribute__((export_name("TS_PositiveTimestamp_clone"))) TS_PositiveTimestamp_clone(uint64_t orig) {
42139         LDKPositiveTimestamp orig_conv;
42140         orig_conv.inner = untag_ptr(orig);
42141         orig_conv.is_owned = ptr_is_owned(orig);
42142         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
42143         orig_conv.is_owned = false;
42144         LDKPositiveTimestamp ret_var = PositiveTimestamp_clone(&orig_conv);
42145         uint64_t ret_ref = 0;
42146         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42147         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42148         return ret_ref;
42149 }
42150
42151 uint32_t  __attribute__((export_name("TS_SiPrefix_clone"))) TS_SiPrefix_clone(uint64_t orig) {
42152         LDKSiPrefix* orig_conv = (LDKSiPrefix*)untag_ptr(orig);
42153         uint32_t ret_conv = LDKSiPrefix_to_js(SiPrefix_clone(orig_conv));
42154         return ret_conv;
42155 }
42156
42157 uint32_t  __attribute__((export_name("TS_SiPrefix_milli"))) TS_SiPrefix_milli() {
42158         uint32_t ret_conv = LDKSiPrefix_to_js(SiPrefix_milli());
42159         return ret_conv;
42160 }
42161
42162 uint32_t  __attribute__((export_name("TS_SiPrefix_micro"))) TS_SiPrefix_micro() {
42163         uint32_t ret_conv = LDKSiPrefix_to_js(SiPrefix_micro());
42164         return ret_conv;
42165 }
42166
42167 uint32_t  __attribute__((export_name("TS_SiPrefix_nano"))) TS_SiPrefix_nano() {
42168         uint32_t ret_conv = LDKSiPrefix_to_js(SiPrefix_nano());
42169         return ret_conv;
42170 }
42171
42172 uint32_t  __attribute__((export_name("TS_SiPrefix_pico"))) TS_SiPrefix_pico() {
42173         uint32_t ret_conv = LDKSiPrefix_to_js(SiPrefix_pico());
42174         return ret_conv;
42175 }
42176
42177 jboolean  __attribute__((export_name("TS_SiPrefix_eq"))) TS_SiPrefix_eq(uint64_t a, uint64_t b) {
42178         LDKSiPrefix* a_conv = (LDKSiPrefix*)untag_ptr(a);
42179         LDKSiPrefix* b_conv = (LDKSiPrefix*)untag_ptr(b);
42180         jboolean ret_conv = SiPrefix_eq(a_conv, b_conv);
42181         return ret_conv;
42182 }
42183
42184 int64_t  __attribute__((export_name("TS_SiPrefix_multiplier"))) TS_SiPrefix_multiplier(uint64_t this_arg) {
42185         LDKSiPrefix* this_arg_conv = (LDKSiPrefix*)untag_ptr(this_arg);
42186         int64_t ret_conv = SiPrefix_multiplier(this_arg_conv);
42187         return ret_conv;
42188 }
42189
42190 uint32_t  __attribute__((export_name("TS_Currency_clone"))) TS_Currency_clone(uint64_t orig) {
42191         LDKCurrency* orig_conv = (LDKCurrency*)untag_ptr(orig);
42192         uint32_t ret_conv = LDKCurrency_to_js(Currency_clone(orig_conv));
42193         return ret_conv;
42194 }
42195
42196 uint32_t  __attribute__((export_name("TS_Currency_bitcoin"))) TS_Currency_bitcoin() {
42197         uint32_t ret_conv = LDKCurrency_to_js(Currency_bitcoin());
42198         return ret_conv;
42199 }
42200
42201 uint32_t  __attribute__((export_name("TS_Currency_bitcoin_testnet"))) TS_Currency_bitcoin_testnet() {
42202         uint32_t ret_conv = LDKCurrency_to_js(Currency_bitcoin_testnet());
42203         return ret_conv;
42204 }
42205
42206 uint32_t  __attribute__((export_name("TS_Currency_regtest"))) TS_Currency_regtest() {
42207         uint32_t ret_conv = LDKCurrency_to_js(Currency_regtest());
42208         return ret_conv;
42209 }
42210
42211 uint32_t  __attribute__((export_name("TS_Currency_simnet"))) TS_Currency_simnet() {
42212         uint32_t ret_conv = LDKCurrency_to_js(Currency_simnet());
42213         return ret_conv;
42214 }
42215
42216 uint32_t  __attribute__((export_name("TS_Currency_signet"))) TS_Currency_signet() {
42217         uint32_t ret_conv = LDKCurrency_to_js(Currency_signet());
42218         return ret_conv;
42219 }
42220
42221 int64_t  __attribute__((export_name("TS_Currency_hash"))) TS_Currency_hash(uint64_t o) {
42222         LDKCurrency* o_conv = (LDKCurrency*)untag_ptr(o);
42223         int64_t ret_conv = Currency_hash(o_conv);
42224         return ret_conv;
42225 }
42226
42227 jboolean  __attribute__((export_name("TS_Currency_eq"))) TS_Currency_eq(uint64_t a, uint64_t b) {
42228         LDKCurrency* a_conv = (LDKCurrency*)untag_ptr(a);
42229         LDKCurrency* b_conv = (LDKCurrency*)untag_ptr(b);
42230         jboolean ret_conv = Currency_eq(a_conv, b_conv);
42231         return ret_conv;
42232 }
42233
42234 void  __attribute__((export_name("TS_Sha256_free"))) TS_Sha256_free(uint64_t this_obj) {
42235         LDKSha256 this_obj_conv;
42236         this_obj_conv.inner = untag_ptr(this_obj);
42237         this_obj_conv.is_owned = ptr_is_owned(this_obj);
42238         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42239         Sha256_free(this_obj_conv);
42240 }
42241
42242 static inline uint64_t Sha256_clone_ptr(LDKSha256 *NONNULL_PTR arg) {
42243         LDKSha256 ret_var = Sha256_clone(arg);
42244         uint64_t ret_ref = 0;
42245         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42246         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42247         return ret_ref;
42248 }
42249 int64_t  __attribute__((export_name("TS_Sha256_clone_ptr"))) TS_Sha256_clone_ptr(uint64_t arg) {
42250         LDKSha256 arg_conv;
42251         arg_conv.inner = untag_ptr(arg);
42252         arg_conv.is_owned = ptr_is_owned(arg);
42253         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42254         arg_conv.is_owned = false;
42255         int64_t ret_conv = Sha256_clone_ptr(&arg_conv);
42256         return ret_conv;
42257 }
42258
42259 uint64_t  __attribute__((export_name("TS_Sha256_clone"))) TS_Sha256_clone(uint64_t orig) {
42260         LDKSha256 orig_conv;
42261         orig_conv.inner = untag_ptr(orig);
42262         orig_conv.is_owned = ptr_is_owned(orig);
42263         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
42264         orig_conv.is_owned = false;
42265         LDKSha256 ret_var = Sha256_clone(&orig_conv);
42266         uint64_t ret_ref = 0;
42267         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42268         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42269         return ret_ref;
42270 }
42271
42272 int64_t  __attribute__((export_name("TS_Sha256_hash"))) TS_Sha256_hash(uint64_t o) {
42273         LDKSha256 o_conv;
42274         o_conv.inner = untag_ptr(o);
42275         o_conv.is_owned = ptr_is_owned(o);
42276         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
42277         o_conv.is_owned = false;
42278         int64_t ret_conv = Sha256_hash(&o_conv);
42279         return ret_conv;
42280 }
42281
42282 jboolean  __attribute__((export_name("TS_Sha256_eq"))) TS_Sha256_eq(uint64_t a, uint64_t b) {
42283         LDKSha256 a_conv;
42284         a_conv.inner = untag_ptr(a);
42285         a_conv.is_owned = ptr_is_owned(a);
42286         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
42287         a_conv.is_owned = false;
42288         LDKSha256 b_conv;
42289         b_conv.inner = untag_ptr(b);
42290         b_conv.is_owned = ptr_is_owned(b);
42291         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
42292         b_conv.is_owned = false;
42293         jboolean ret_conv = Sha256_eq(&a_conv, &b_conv);
42294         return ret_conv;
42295 }
42296
42297 void  __attribute__((export_name("TS_Description_free"))) TS_Description_free(uint64_t this_obj) {
42298         LDKDescription this_obj_conv;
42299         this_obj_conv.inner = untag_ptr(this_obj);
42300         this_obj_conv.is_owned = ptr_is_owned(this_obj);
42301         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42302         Description_free(this_obj_conv);
42303 }
42304
42305 static inline uint64_t Description_clone_ptr(LDKDescription *NONNULL_PTR arg) {
42306         LDKDescription ret_var = Description_clone(arg);
42307         uint64_t ret_ref = 0;
42308         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42309         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42310         return ret_ref;
42311 }
42312 int64_t  __attribute__((export_name("TS_Description_clone_ptr"))) TS_Description_clone_ptr(uint64_t arg) {
42313         LDKDescription arg_conv;
42314         arg_conv.inner = untag_ptr(arg);
42315         arg_conv.is_owned = ptr_is_owned(arg);
42316         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42317         arg_conv.is_owned = false;
42318         int64_t ret_conv = Description_clone_ptr(&arg_conv);
42319         return ret_conv;
42320 }
42321
42322 uint64_t  __attribute__((export_name("TS_Description_clone"))) TS_Description_clone(uint64_t orig) {
42323         LDKDescription orig_conv;
42324         orig_conv.inner = untag_ptr(orig);
42325         orig_conv.is_owned = ptr_is_owned(orig);
42326         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
42327         orig_conv.is_owned = false;
42328         LDKDescription ret_var = Description_clone(&orig_conv);
42329         uint64_t ret_ref = 0;
42330         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42331         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42332         return ret_ref;
42333 }
42334
42335 int64_t  __attribute__((export_name("TS_Description_hash"))) TS_Description_hash(uint64_t o) {
42336         LDKDescription o_conv;
42337         o_conv.inner = untag_ptr(o);
42338         o_conv.is_owned = ptr_is_owned(o);
42339         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
42340         o_conv.is_owned = false;
42341         int64_t ret_conv = Description_hash(&o_conv);
42342         return ret_conv;
42343 }
42344
42345 jboolean  __attribute__((export_name("TS_Description_eq"))) TS_Description_eq(uint64_t a, uint64_t b) {
42346         LDKDescription a_conv;
42347         a_conv.inner = untag_ptr(a);
42348         a_conv.is_owned = ptr_is_owned(a);
42349         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
42350         a_conv.is_owned = false;
42351         LDKDescription b_conv;
42352         b_conv.inner = untag_ptr(b);
42353         b_conv.is_owned = ptr_is_owned(b);
42354         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
42355         b_conv.is_owned = false;
42356         jboolean ret_conv = Description_eq(&a_conv, &b_conv);
42357         return ret_conv;
42358 }
42359
42360 void  __attribute__((export_name("TS_PayeePubKey_free"))) TS_PayeePubKey_free(uint64_t this_obj) {
42361         LDKPayeePubKey this_obj_conv;
42362         this_obj_conv.inner = untag_ptr(this_obj);
42363         this_obj_conv.is_owned = ptr_is_owned(this_obj);
42364         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42365         PayeePubKey_free(this_obj_conv);
42366 }
42367
42368 int8_tArray  __attribute__((export_name("TS_PayeePubKey_get_a"))) TS_PayeePubKey_get_a(uint64_t this_ptr) {
42369         LDKPayeePubKey this_ptr_conv;
42370         this_ptr_conv.inner = untag_ptr(this_ptr);
42371         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42372         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42373         this_ptr_conv.is_owned = false;
42374         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
42375         memcpy(ret_arr->elems, PayeePubKey_get_a(&this_ptr_conv).compressed_form, 33);
42376         return ret_arr;
42377 }
42378
42379 void  __attribute__((export_name("TS_PayeePubKey_set_a"))) TS_PayeePubKey_set_a(uint64_t this_ptr, int8_tArray val) {
42380         LDKPayeePubKey this_ptr_conv;
42381         this_ptr_conv.inner = untag_ptr(this_ptr);
42382         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42383         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42384         this_ptr_conv.is_owned = false;
42385         LDKPublicKey val_ref;
42386         CHECK(val->arr_len == 33);
42387         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
42388         PayeePubKey_set_a(&this_ptr_conv, val_ref);
42389 }
42390
42391 uint64_t  __attribute__((export_name("TS_PayeePubKey_new"))) TS_PayeePubKey_new(int8_tArray a_arg) {
42392         LDKPublicKey a_arg_ref;
42393         CHECK(a_arg->arr_len == 33);
42394         memcpy(a_arg_ref.compressed_form, a_arg->elems, 33); FREE(a_arg);
42395         LDKPayeePubKey ret_var = PayeePubKey_new(a_arg_ref);
42396         uint64_t ret_ref = 0;
42397         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42398         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42399         return ret_ref;
42400 }
42401
42402 static inline uint64_t PayeePubKey_clone_ptr(LDKPayeePubKey *NONNULL_PTR arg) {
42403         LDKPayeePubKey ret_var = PayeePubKey_clone(arg);
42404         uint64_t ret_ref = 0;
42405         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42406         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42407         return ret_ref;
42408 }
42409 int64_t  __attribute__((export_name("TS_PayeePubKey_clone_ptr"))) TS_PayeePubKey_clone_ptr(uint64_t arg) {
42410         LDKPayeePubKey arg_conv;
42411         arg_conv.inner = untag_ptr(arg);
42412         arg_conv.is_owned = ptr_is_owned(arg);
42413         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42414         arg_conv.is_owned = false;
42415         int64_t ret_conv = PayeePubKey_clone_ptr(&arg_conv);
42416         return ret_conv;
42417 }
42418
42419 uint64_t  __attribute__((export_name("TS_PayeePubKey_clone"))) TS_PayeePubKey_clone(uint64_t orig) {
42420         LDKPayeePubKey orig_conv;
42421         orig_conv.inner = untag_ptr(orig);
42422         orig_conv.is_owned = ptr_is_owned(orig);
42423         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
42424         orig_conv.is_owned = false;
42425         LDKPayeePubKey ret_var = PayeePubKey_clone(&orig_conv);
42426         uint64_t ret_ref = 0;
42427         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42428         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42429         return ret_ref;
42430 }
42431
42432 int64_t  __attribute__((export_name("TS_PayeePubKey_hash"))) TS_PayeePubKey_hash(uint64_t o) {
42433         LDKPayeePubKey o_conv;
42434         o_conv.inner = untag_ptr(o);
42435         o_conv.is_owned = ptr_is_owned(o);
42436         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
42437         o_conv.is_owned = false;
42438         int64_t ret_conv = PayeePubKey_hash(&o_conv);
42439         return ret_conv;
42440 }
42441
42442 jboolean  __attribute__((export_name("TS_PayeePubKey_eq"))) TS_PayeePubKey_eq(uint64_t a, uint64_t b) {
42443         LDKPayeePubKey a_conv;
42444         a_conv.inner = untag_ptr(a);
42445         a_conv.is_owned = ptr_is_owned(a);
42446         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
42447         a_conv.is_owned = false;
42448         LDKPayeePubKey b_conv;
42449         b_conv.inner = untag_ptr(b);
42450         b_conv.is_owned = ptr_is_owned(b);
42451         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
42452         b_conv.is_owned = false;
42453         jboolean ret_conv = PayeePubKey_eq(&a_conv, &b_conv);
42454         return ret_conv;
42455 }
42456
42457 void  __attribute__((export_name("TS_ExpiryTime_free"))) TS_ExpiryTime_free(uint64_t this_obj) {
42458         LDKExpiryTime this_obj_conv;
42459         this_obj_conv.inner = untag_ptr(this_obj);
42460         this_obj_conv.is_owned = ptr_is_owned(this_obj);
42461         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42462         ExpiryTime_free(this_obj_conv);
42463 }
42464
42465 static inline uint64_t ExpiryTime_clone_ptr(LDKExpiryTime *NONNULL_PTR arg) {
42466         LDKExpiryTime ret_var = ExpiryTime_clone(arg);
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 int64_t  __attribute__((export_name("TS_ExpiryTime_clone_ptr"))) TS_ExpiryTime_clone_ptr(uint64_t arg) {
42473         LDKExpiryTime arg_conv;
42474         arg_conv.inner = untag_ptr(arg);
42475         arg_conv.is_owned = ptr_is_owned(arg);
42476         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42477         arg_conv.is_owned = false;
42478         int64_t ret_conv = ExpiryTime_clone_ptr(&arg_conv);
42479         return ret_conv;
42480 }
42481
42482 uint64_t  __attribute__((export_name("TS_ExpiryTime_clone"))) TS_ExpiryTime_clone(uint64_t orig) {
42483         LDKExpiryTime orig_conv;
42484         orig_conv.inner = untag_ptr(orig);
42485         orig_conv.is_owned = ptr_is_owned(orig);
42486         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
42487         orig_conv.is_owned = false;
42488         LDKExpiryTime ret_var = ExpiryTime_clone(&orig_conv);
42489         uint64_t ret_ref = 0;
42490         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42491         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42492         return ret_ref;
42493 }
42494
42495 int64_t  __attribute__((export_name("TS_ExpiryTime_hash"))) TS_ExpiryTime_hash(uint64_t o) {
42496         LDKExpiryTime o_conv;
42497         o_conv.inner = untag_ptr(o);
42498         o_conv.is_owned = ptr_is_owned(o);
42499         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
42500         o_conv.is_owned = false;
42501         int64_t ret_conv = ExpiryTime_hash(&o_conv);
42502         return ret_conv;
42503 }
42504
42505 jboolean  __attribute__((export_name("TS_ExpiryTime_eq"))) TS_ExpiryTime_eq(uint64_t a, uint64_t b) {
42506         LDKExpiryTime a_conv;
42507         a_conv.inner = untag_ptr(a);
42508         a_conv.is_owned = ptr_is_owned(a);
42509         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
42510         a_conv.is_owned = false;
42511         LDKExpiryTime b_conv;
42512         b_conv.inner = untag_ptr(b);
42513         b_conv.is_owned = ptr_is_owned(b);
42514         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
42515         b_conv.is_owned = false;
42516         jboolean ret_conv = ExpiryTime_eq(&a_conv, &b_conv);
42517         return ret_conv;
42518 }
42519
42520 void  __attribute__((export_name("TS_MinFinalCltvExpiry_free"))) TS_MinFinalCltvExpiry_free(uint64_t this_obj) {
42521         LDKMinFinalCltvExpiry this_obj_conv;
42522         this_obj_conv.inner = untag_ptr(this_obj);
42523         this_obj_conv.is_owned = ptr_is_owned(this_obj);
42524         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42525         MinFinalCltvExpiry_free(this_obj_conv);
42526 }
42527
42528 int64_t  __attribute__((export_name("TS_MinFinalCltvExpiry_get_a"))) TS_MinFinalCltvExpiry_get_a(uint64_t this_ptr) {
42529         LDKMinFinalCltvExpiry this_ptr_conv;
42530         this_ptr_conv.inner = untag_ptr(this_ptr);
42531         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42532         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42533         this_ptr_conv.is_owned = false;
42534         int64_t ret_conv = MinFinalCltvExpiry_get_a(&this_ptr_conv);
42535         return ret_conv;
42536 }
42537
42538 void  __attribute__((export_name("TS_MinFinalCltvExpiry_set_a"))) TS_MinFinalCltvExpiry_set_a(uint64_t this_ptr, int64_t val) {
42539         LDKMinFinalCltvExpiry this_ptr_conv;
42540         this_ptr_conv.inner = untag_ptr(this_ptr);
42541         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42542         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42543         this_ptr_conv.is_owned = false;
42544         MinFinalCltvExpiry_set_a(&this_ptr_conv, val);
42545 }
42546
42547 uint64_t  __attribute__((export_name("TS_MinFinalCltvExpiry_new"))) TS_MinFinalCltvExpiry_new(int64_t a_arg) {
42548         LDKMinFinalCltvExpiry ret_var = MinFinalCltvExpiry_new(a_arg);
42549         uint64_t ret_ref = 0;
42550         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42551         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42552         return ret_ref;
42553 }
42554
42555 static inline uint64_t MinFinalCltvExpiry_clone_ptr(LDKMinFinalCltvExpiry *NONNULL_PTR arg) {
42556         LDKMinFinalCltvExpiry ret_var = MinFinalCltvExpiry_clone(arg);
42557         uint64_t ret_ref = 0;
42558         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42559         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42560         return ret_ref;
42561 }
42562 int64_t  __attribute__((export_name("TS_MinFinalCltvExpiry_clone_ptr"))) TS_MinFinalCltvExpiry_clone_ptr(uint64_t arg) {
42563         LDKMinFinalCltvExpiry arg_conv;
42564         arg_conv.inner = untag_ptr(arg);
42565         arg_conv.is_owned = ptr_is_owned(arg);
42566         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42567         arg_conv.is_owned = false;
42568         int64_t ret_conv = MinFinalCltvExpiry_clone_ptr(&arg_conv);
42569         return ret_conv;
42570 }
42571
42572 uint64_t  __attribute__((export_name("TS_MinFinalCltvExpiry_clone"))) TS_MinFinalCltvExpiry_clone(uint64_t orig) {
42573         LDKMinFinalCltvExpiry orig_conv;
42574         orig_conv.inner = untag_ptr(orig);
42575         orig_conv.is_owned = ptr_is_owned(orig);
42576         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
42577         orig_conv.is_owned = false;
42578         LDKMinFinalCltvExpiry ret_var = MinFinalCltvExpiry_clone(&orig_conv);
42579         uint64_t ret_ref = 0;
42580         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42581         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42582         return ret_ref;
42583 }
42584
42585 int64_t  __attribute__((export_name("TS_MinFinalCltvExpiry_hash"))) TS_MinFinalCltvExpiry_hash(uint64_t o) {
42586         LDKMinFinalCltvExpiry o_conv;
42587         o_conv.inner = untag_ptr(o);
42588         o_conv.is_owned = ptr_is_owned(o);
42589         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
42590         o_conv.is_owned = false;
42591         int64_t ret_conv = MinFinalCltvExpiry_hash(&o_conv);
42592         return ret_conv;
42593 }
42594
42595 jboolean  __attribute__((export_name("TS_MinFinalCltvExpiry_eq"))) TS_MinFinalCltvExpiry_eq(uint64_t a, uint64_t b) {
42596         LDKMinFinalCltvExpiry a_conv;
42597         a_conv.inner = untag_ptr(a);
42598         a_conv.is_owned = ptr_is_owned(a);
42599         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
42600         a_conv.is_owned = false;
42601         LDKMinFinalCltvExpiry b_conv;
42602         b_conv.inner = untag_ptr(b);
42603         b_conv.is_owned = ptr_is_owned(b);
42604         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
42605         b_conv.is_owned = false;
42606         jboolean ret_conv = MinFinalCltvExpiry_eq(&a_conv, &b_conv);
42607         return ret_conv;
42608 }
42609
42610 void  __attribute__((export_name("TS_Fallback_free"))) TS_Fallback_free(uint64_t this_ptr) {
42611         if (!ptr_is_owned(this_ptr)) return;
42612         void* this_ptr_ptr = untag_ptr(this_ptr);
42613         CHECK_ACCESS(this_ptr_ptr);
42614         LDKFallback this_ptr_conv = *(LDKFallback*)(this_ptr_ptr);
42615         FREE(untag_ptr(this_ptr));
42616         Fallback_free(this_ptr_conv);
42617 }
42618
42619 static inline uint64_t Fallback_clone_ptr(LDKFallback *NONNULL_PTR arg) {
42620         LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
42621         *ret_copy = Fallback_clone(arg);
42622         uint64_t ret_ref = tag_ptr(ret_copy, true);
42623         return ret_ref;
42624 }
42625 int64_t  __attribute__((export_name("TS_Fallback_clone_ptr"))) TS_Fallback_clone_ptr(uint64_t arg) {
42626         LDKFallback* arg_conv = (LDKFallback*)untag_ptr(arg);
42627         int64_t ret_conv = Fallback_clone_ptr(arg_conv);
42628         return ret_conv;
42629 }
42630
42631 uint64_t  __attribute__((export_name("TS_Fallback_clone"))) TS_Fallback_clone(uint64_t orig) {
42632         LDKFallback* orig_conv = (LDKFallback*)untag_ptr(orig);
42633         LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
42634         *ret_copy = Fallback_clone(orig_conv);
42635         uint64_t ret_ref = tag_ptr(ret_copy, true);
42636         return ret_ref;
42637 }
42638
42639 uint64_t  __attribute__((export_name("TS_Fallback_seg_wit_program"))) TS_Fallback_seg_wit_program(int8_t version, int8_tArray program) {
42640         
42641         LDKCVec_u8Z program_ref;
42642         program_ref.datalen = program->arr_len;
42643         program_ref.data = MALLOC(program_ref.datalen, "LDKCVec_u8Z Bytes");
42644         memcpy(program_ref.data, program->elems, program_ref.datalen); FREE(program);
42645         LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
42646         *ret_copy = Fallback_seg_wit_program((LDKu5){ ._0 = version }, program_ref);
42647         uint64_t ret_ref = tag_ptr(ret_copy, true);
42648         return ret_ref;
42649 }
42650
42651 uint64_t  __attribute__((export_name("TS_Fallback_pub_key_hash"))) TS_Fallback_pub_key_hash(int8_tArray a) {
42652         LDKTwentyBytes a_ref;
42653         CHECK(a->arr_len == 20);
42654         memcpy(a_ref.data, a->elems, 20); FREE(a);
42655         LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
42656         *ret_copy = Fallback_pub_key_hash(a_ref);
42657         uint64_t ret_ref = tag_ptr(ret_copy, true);
42658         return ret_ref;
42659 }
42660
42661 uint64_t  __attribute__((export_name("TS_Fallback_script_hash"))) TS_Fallback_script_hash(int8_tArray a) {
42662         LDKTwentyBytes a_ref;
42663         CHECK(a->arr_len == 20);
42664         memcpy(a_ref.data, a->elems, 20); FREE(a);
42665         LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
42666         *ret_copy = Fallback_script_hash(a_ref);
42667         uint64_t ret_ref = tag_ptr(ret_copy, true);
42668         return ret_ref;
42669 }
42670
42671 int64_t  __attribute__((export_name("TS_Fallback_hash"))) TS_Fallback_hash(uint64_t o) {
42672         LDKFallback* o_conv = (LDKFallback*)untag_ptr(o);
42673         int64_t ret_conv = Fallback_hash(o_conv);
42674         return ret_conv;
42675 }
42676
42677 jboolean  __attribute__((export_name("TS_Fallback_eq"))) TS_Fallback_eq(uint64_t a, uint64_t b) {
42678         LDKFallback* a_conv = (LDKFallback*)untag_ptr(a);
42679         LDKFallback* b_conv = (LDKFallback*)untag_ptr(b);
42680         jboolean ret_conv = Fallback_eq(a_conv, b_conv);
42681         return ret_conv;
42682 }
42683
42684 void  __attribute__((export_name("TS_InvoiceSignature_free"))) TS_InvoiceSignature_free(uint64_t this_obj) {
42685         LDKInvoiceSignature this_obj_conv;
42686         this_obj_conv.inner = untag_ptr(this_obj);
42687         this_obj_conv.is_owned = ptr_is_owned(this_obj);
42688         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42689         InvoiceSignature_free(this_obj_conv);
42690 }
42691
42692 static inline uint64_t InvoiceSignature_clone_ptr(LDKInvoiceSignature *NONNULL_PTR arg) {
42693         LDKInvoiceSignature ret_var = InvoiceSignature_clone(arg);
42694         uint64_t ret_ref = 0;
42695         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42696         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42697         return ret_ref;
42698 }
42699 int64_t  __attribute__((export_name("TS_InvoiceSignature_clone_ptr"))) TS_InvoiceSignature_clone_ptr(uint64_t arg) {
42700         LDKInvoiceSignature arg_conv;
42701         arg_conv.inner = untag_ptr(arg);
42702         arg_conv.is_owned = ptr_is_owned(arg);
42703         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42704         arg_conv.is_owned = false;
42705         int64_t ret_conv = InvoiceSignature_clone_ptr(&arg_conv);
42706         return ret_conv;
42707 }
42708
42709 uint64_t  __attribute__((export_name("TS_InvoiceSignature_clone"))) TS_InvoiceSignature_clone(uint64_t orig) {
42710         LDKInvoiceSignature orig_conv;
42711         orig_conv.inner = untag_ptr(orig);
42712         orig_conv.is_owned = ptr_is_owned(orig);
42713         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
42714         orig_conv.is_owned = false;
42715         LDKInvoiceSignature ret_var = InvoiceSignature_clone(&orig_conv);
42716         uint64_t ret_ref = 0;
42717         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42718         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42719         return ret_ref;
42720 }
42721
42722 jboolean  __attribute__((export_name("TS_InvoiceSignature_eq"))) TS_InvoiceSignature_eq(uint64_t a, uint64_t b) {
42723         LDKInvoiceSignature a_conv;
42724         a_conv.inner = untag_ptr(a);
42725         a_conv.is_owned = ptr_is_owned(a);
42726         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
42727         a_conv.is_owned = false;
42728         LDKInvoiceSignature b_conv;
42729         b_conv.inner = untag_ptr(b);
42730         b_conv.is_owned = ptr_is_owned(b);
42731         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
42732         b_conv.is_owned = false;
42733         jboolean ret_conv = InvoiceSignature_eq(&a_conv, &b_conv);
42734         return ret_conv;
42735 }
42736
42737 void  __attribute__((export_name("TS_PrivateRoute_free"))) TS_PrivateRoute_free(uint64_t this_obj) {
42738         LDKPrivateRoute this_obj_conv;
42739         this_obj_conv.inner = untag_ptr(this_obj);
42740         this_obj_conv.is_owned = ptr_is_owned(this_obj);
42741         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42742         PrivateRoute_free(this_obj_conv);
42743 }
42744
42745 static inline uint64_t PrivateRoute_clone_ptr(LDKPrivateRoute *NONNULL_PTR arg) {
42746         LDKPrivateRoute ret_var = PrivateRoute_clone(arg);
42747         uint64_t ret_ref = 0;
42748         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42749         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42750         return ret_ref;
42751 }
42752 int64_t  __attribute__((export_name("TS_PrivateRoute_clone_ptr"))) TS_PrivateRoute_clone_ptr(uint64_t arg) {
42753         LDKPrivateRoute arg_conv;
42754         arg_conv.inner = untag_ptr(arg);
42755         arg_conv.is_owned = ptr_is_owned(arg);
42756         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42757         arg_conv.is_owned = false;
42758         int64_t ret_conv = PrivateRoute_clone_ptr(&arg_conv);
42759         return ret_conv;
42760 }
42761
42762 uint64_t  __attribute__((export_name("TS_PrivateRoute_clone"))) TS_PrivateRoute_clone(uint64_t orig) {
42763         LDKPrivateRoute orig_conv;
42764         orig_conv.inner = untag_ptr(orig);
42765         orig_conv.is_owned = ptr_is_owned(orig);
42766         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
42767         orig_conv.is_owned = false;
42768         LDKPrivateRoute ret_var = PrivateRoute_clone(&orig_conv);
42769         uint64_t ret_ref = 0;
42770         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42771         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42772         return ret_ref;
42773 }
42774
42775 int64_t  __attribute__((export_name("TS_PrivateRoute_hash"))) TS_PrivateRoute_hash(uint64_t o) {
42776         LDKPrivateRoute o_conv;
42777         o_conv.inner = untag_ptr(o);
42778         o_conv.is_owned = ptr_is_owned(o);
42779         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
42780         o_conv.is_owned = false;
42781         int64_t ret_conv = PrivateRoute_hash(&o_conv);
42782         return ret_conv;
42783 }
42784
42785 jboolean  __attribute__((export_name("TS_PrivateRoute_eq"))) TS_PrivateRoute_eq(uint64_t a, uint64_t b) {
42786         LDKPrivateRoute a_conv;
42787         a_conv.inner = untag_ptr(a);
42788         a_conv.is_owned = ptr_is_owned(a);
42789         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
42790         a_conv.is_owned = false;
42791         LDKPrivateRoute b_conv;
42792         b_conv.inner = untag_ptr(b);
42793         b_conv.is_owned = ptr_is_owned(b);
42794         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
42795         b_conv.is_owned = false;
42796         jboolean ret_conv = PrivateRoute_eq(&a_conv, &b_conv);
42797         return ret_conv;
42798 }
42799
42800 uint64_t  __attribute__((export_name("TS_SignedRawInvoice_into_parts"))) TS_SignedRawInvoice_into_parts(uint64_t this_arg) {
42801         LDKSignedRawInvoice this_arg_conv;
42802         this_arg_conv.inner = untag_ptr(this_arg);
42803         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42804         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42805         this_arg_conv = SignedRawInvoice_clone(&this_arg_conv);
42806         LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
42807         *ret_conv = SignedRawInvoice_into_parts(this_arg_conv);
42808         return tag_ptr(ret_conv, true);
42809 }
42810
42811 uint64_t  __attribute__((export_name("TS_SignedRawInvoice_raw_invoice"))) TS_SignedRawInvoice_raw_invoice(uint64_t this_arg) {
42812         LDKSignedRawInvoice this_arg_conv;
42813         this_arg_conv.inner = untag_ptr(this_arg);
42814         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42815         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42816         this_arg_conv.is_owned = false;
42817         LDKRawInvoice ret_var = SignedRawInvoice_raw_invoice(&this_arg_conv);
42818         uint64_t ret_ref = 0;
42819         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42820         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42821         return ret_ref;
42822 }
42823
42824 int8_tArray  __attribute__((export_name("TS_SignedRawInvoice_hash"))) TS_SignedRawInvoice_hash(uint64_t this_arg) {
42825         LDKSignedRawInvoice this_arg_conv;
42826         this_arg_conv.inner = untag_ptr(this_arg);
42827         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42828         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42829         this_arg_conv.is_owned = false;
42830         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
42831         memcpy(ret_arr->elems, *SignedRawInvoice_hash(&this_arg_conv), 32);
42832         return ret_arr;
42833 }
42834
42835 uint64_t  __attribute__((export_name("TS_SignedRawInvoice_signature"))) TS_SignedRawInvoice_signature(uint64_t this_arg) {
42836         LDKSignedRawInvoice this_arg_conv;
42837         this_arg_conv.inner = untag_ptr(this_arg);
42838         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42839         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42840         this_arg_conv.is_owned = false;
42841         LDKInvoiceSignature ret_var = SignedRawInvoice_signature(&this_arg_conv);
42842         uint64_t ret_ref = 0;
42843         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42844         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42845         return ret_ref;
42846 }
42847
42848 uint64_t  __attribute__((export_name("TS_SignedRawInvoice_recover_payee_pub_key"))) TS_SignedRawInvoice_recover_payee_pub_key(uint64_t this_arg) {
42849         LDKSignedRawInvoice this_arg_conv;
42850         this_arg_conv.inner = untag_ptr(this_arg);
42851         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42852         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42853         this_arg_conv.is_owned = false;
42854         LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
42855         *ret_conv = SignedRawInvoice_recover_payee_pub_key(&this_arg_conv);
42856         return tag_ptr(ret_conv, true);
42857 }
42858
42859 jboolean  __attribute__((export_name("TS_SignedRawInvoice_check_signature"))) TS_SignedRawInvoice_check_signature(uint64_t this_arg) {
42860         LDKSignedRawInvoice this_arg_conv;
42861         this_arg_conv.inner = untag_ptr(this_arg);
42862         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42863         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42864         this_arg_conv.is_owned = false;
42865         jboolean ret_conv = SignedRawInvoice_check_signature(&this_arg_conv);
42866         return ret_conv;
42867 }
42868
42869 int8_tArray  __attribute__((export_name("TS_RawInvoice_hash"))) TS_RawInvoice_hash(uint64_t this_arg) {
42870         LDKRawInvoice this_arg_conv;
42871         this_arg_conv.inner = untag_ptr(this_arg);
42872         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42873         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42874         this_arg_conv.is_owned = false;
42875         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
42876         memcpy(ret_arr->elems, RawInvoice_hash(&this_arg_conv).data, 32);
42877         return ret_arr;
42878 }
42879
42880 uint64_t  __attribute__((export_name("TS_RawInvoice_payment_hash"))) TS_RawInvoice_payment_hash(uint64_t this_arg) {
42881         LDKRawInvoice this_arg_conv;
42882         this_arg_conv.inner = untag_ptr(this_arg);
42883         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42884         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42885         this_arg_conv.is_owned = false;
42886         LDKSha256 ret_var = RawInvoice_payment_hash(&this_arg_conv);
42887         uint64_t ret_ref = 0;
42888         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42889         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42890         return ret_ref;
42891 }
42892
42893 uint64_t  __attribute__((export_name("TS_RawInvoice_description"))) TS_RawInvoice_description(uint64_t this_arg) {
42894         LDKRawInvoice this_arg_conv;
42895         this_arg_conv.inner = untag_ptr(this_arg);
42896         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42897         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42898         this_arg_conv.is_owned = false;
42899         LDKDescription ret_var = RawInvoice_description(&this_arg_conv);
42900         uint64_t ret_ref = 0;
42901         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42902         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42903         return ret_ref;
42904 }
42905
42906 uint64_t  __attribute__((export_name("TS_RawInvoice_payee_pub_key"))) TS_RawInvoice_payee_pub_key(uint64_t this_arg) {
42907         LDKRawInvoice this_arg_conv;
42908         this_arg_conv.inner = untag_ptr(this_arg);
42909         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42910         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42911         this_arg_conv.is_owned = false;
42912         LDKPayeePubKey ret_var = RawInvoice_payee_pub_key(&this_arg_conv);
42913         uint64_t ret_ref = 0;
42914         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42915         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42916         return ret_ref;
42917 }
42918
42919 uint64_t  __attribute__((export_name("TS_RawInvoice_description_hash"))) TS_RawInvoice_description_hash(uint64_t this_arg) {
42920         LDKRawInvoice this_arg_conv;
42921         this_arg_conv.inner = untag_ptr(this_arg);
42922         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42923         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42924         this_arg_conv.is_owned = false;
42925         LDKSha256 ret_var = RawInvoice_description_hash(&this_arg_conv);
42926         uint64_t ret_ref = 0;
42927         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42928         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42929         return ret_ref;
42930 }
42931
42932 uint64_t  __attribute__((export_name("TS_RawInvoice_expiry_time"))) TS_RawInvoice_expiry_time(uint64_t this_arg) {
42933         LDKRawInvoice this_arg_conv;
42934         this_arg_conv.inner = untag_ptr(this_arg);
42935         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42936         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42937         this_arg_conv.is_owned = false;
42938         LDKExpiryTime ret_var = RawInvoice_expiry_time(&this_arg_conv);
42939         uint64_t ret_ref = 0;
42940         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42941         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42942         return ret_ref;
42943 }
42944
42945 uint64_t  __attribute__((export_name("TS_RawInvoice_min_final_cltv_expiry"))) TS_RawInvoice_min_final_cltv_expiry(uint64_t this_arg) {
42946         LDKRawInvoice this_arg_conv;
42947         this_arg_conv.inner = untag_ptr(this_arg);
42948         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42949         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42950         this_arg_conv.is_owned = false;
42951         LDKMinFinalCltvExpiry ret_var = RawInvoice_min_final_cltv_expiry(&this_arg_conv);
42952         uint64_t ret_ref = 0;
42953         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42954         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42955         return ret_ref;
42956 }
42957
42958 int8_tArray  __attribute__((export_name("TS_RawInvoice_payment_secret"))) TS_RawInvoice_payment_secret(uint64_t this_arg) {
42959         LDKRawInvoice this_arg_conv;
42960         this_arg_conv.inner = untag_ptr(this_arg);
42961         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42962         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42963         this_arg_conv.is_owned = false;
42964         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
42965         memcpy(ret_arr->elems, RawInvoice_payment_secret(&this_arg_conv).data, 32);
42966         return ret_arr;
42967 }
42968
42969 uint64_t  __attribute__((export_name("TS_RawInvoice_features"))) TS_RawInvoice_features(uint64_t this_arg) {
42970         LDKRawInvoice this_arg_conv;
42971         this_arg_conv.inner = untag_ptr(this_arg);
42972         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42973         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42974         this_arg_conv.is_owned = false;
42975         LDKInvoiceFeatures ret_var = RawInvoice_features(&this_arg_conv);
42976         uint64_t ret_ref = 0;
42977         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42978         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42979         return ret_ref;
42980 }
42981
42982 uint64_tArray  __attribute__((export_name("TS_RawInvoice_private_routes"))) TS_RawInvoice_private_routes(uint64_t this_arg) {
42983         LDKRawInvoice this_arg_conv;
42984         this_arg_conv.inner = untag_ptr(this_arg);
42985         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42986         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42987         this_arg_conv.is_owned = false;
42988         LDKCVec_PrivateRouteZ ret_var = RawInvoice_private_routes(&this_arg_conv);
42989         uint64_tArray ret_arr = NULL;
42990         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
42991         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
42992         for (size_t o = 0; o < ret_var.datalen; o++) {
42993                 LDKPrivateRoute ret_conv_14_var = ret_var.data[o];
42994                 uint64_t ret_conv_14_ref = 0;
42995                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_14_var);
42996                 ret_conv_14_ref = tag_ptr(ret_conv_14_var.inner, ret_conv_14_var.is_owned);
42997                 ret_arr_ptr[o] = ret_conv_14_ref;
42998         }
42999         
43000         FREE(ret_var.data);
43001         return ret_arr;
43002 }
43003
43004 uint64_t  __attribute__((export_name("TS_RawInvoice_amount_pico_btc"))) TS_RawInvoice_amount_pico_btc(uint64_t this_arg) {
43005         LDKRawInvoice this_arg_conv;
43006         this_arg_conv.inner = untag_ptr(this_arg);
43007         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43008         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43009         this_arg_conv.is_owned = false;
43010         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
43011         *ret_copy = RawInvoice_amount_pico_btc(&this_arg_conv);
43012         uint64_t ret_ref = tag_ptr(ret_copy, true);
43013         return ret_ref;
43014 }
43015
43016 uint32_t  __attribute__((export_name("TS_RawInvoice_currency"))) TS_RawInvoice_currency(uint64_t this_arg) {
43017         LDKRawInvoice this_arg_conv;
43018         this_arg_conv.inner = untag_ptr(this_arg);
43019         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43020         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43021         this_arg_conv.is_owned = false;
43022         uint32_t ret_conv = LDKCurrency_to_js(RawInvoice_currency(&this_arg_conv));
43023         return ret_conv;
43024 }
43025
43026 uint64_t  __attribute__((export_name("TS_PositiveTimestamp_from_unix_timestamp"))) TS_PositiveTimestamp_from_unix_timestamp(int64_t unix_seconds) {
43027         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
43028         *ret_conv = PositiveTimestamp_from_unix_timestamp(unix_seconds);
43029         return tag_ptr(ret_conv, true);
43030 }
43031
43032 uint64_t  __attribute__((export_name("TS_PositiveTimestamp_from_duration_since_epoch"))) TS_PositiveTimestamp_from_duration_since_epoch(int64_t duration) {
43033         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
43034         *ret_conv = PositiveTimestamp_from_duration_since_epoch(duration);
43035         return tag_ptr(ret_conv, true);
43036 }
43037
43038 int64_t  __attribute__((export_name("TS_PositiveTimestamp_as_unix_timestamp"))) TS_PositiveTimestamp_as_unix_timestamp(uint64_t this_arg) {
43039         LDKPositiveTimestamp this_arg_conv;
43040         this_arg_conv.inner = untag_ptr(this_arg);
43041         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43042         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43043         this_arg_conv.is_owned = false;
43044         int64_t ret_conv = PositiveTimestamp_as_unix_timestamp(&this_arg_conv);
43045         return ret_conv;
43046 }
43047
43048 int64_t  __attribute__((export_name("TS_PositiveTimestamp_as_duration_since_epoch"))) TS_PositiveTimestamp_as_duration_since_epoch(uint64_t this_arg) {
43049         LDKPositiveTimestamp this_arg_conv;
43050         this_arg_conv.inner = untag_ptr(this_arg);
43051         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43052         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43053         this_arg_conv.is_owned = false;
43054         int64_t ret_conv = PositiveTimestamp_as_duration_since_epoch(&this_arg_conv);
43055         return ret_conv;
43056 }
43057
43058 uint64_t  __attribute__((export_name("TS_Invoice_into_signed_raw"))) TS_Invoice_into_signed_raw(uint64_t this_arg) {
43059         LDKInvoice this_arg_conv;
43060         this_arg_conv.inner = untag_ptr(this_arg);
43061         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43062         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43063         this_arg_conv = Invoice_clone(&this_arg_conv);
43064         LDKSignedRawInvoice ret_var = Invoice_into_signed_raw(this_arg_conv);
43065         uint64_t ret_ref = 0;
43066         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43067         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43068         return ret_ref;
43069 }
43070
43071 uint64_t  __attribute__((export_name("TS_Invoice_check_signature"))) TS_Invoice_check_signature(uint64_t this_arg) {
43072         LDKInvoice this_arg_conv;
43073         this_arg_conv.inner = untag_ptr(this_arg);
43074         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43075         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43076         this_arg_conv.is_owned = false;
43077         LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
43078         *ret_conv = Invoice_check_signature(&this_arg_conv);
43079         return tag_ptr(ret_conv, true);
43080 }
43081
43082 uint64_t  __attribute__((export_name("TS_Invoice_from_signed"))) TS_Invoice_from_signed(uint64_t signed_invoice) {
43083         LDKSignedRawInvoice signed_invoice_conv;
43084         signed_invoice_conv.inner = untag_ptr(signed_invoice);
43085         signed_invoice_conv.is_owned = ptr_is_owned(signed_invoice);
43086         CHECK_INNER_FIELD_ACCESS_OR_NULL(signed_invoice_conv);
43087         signed_invoice_conv = SignedRawInvoice_clone(&signed_invoice_conv);
43088         LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
43089         *ret_conv = Invoice_from_signed(signed_invoice_conv);
43090         return tag_ptr(ret_conv, true);
43091 }
43092
43093 int64_t  __attribute__((export_name("TS_Invoice_duration_since_epoch"))) TS_Invoice_duration_since_epoch(uint64_t this_arg) {
43094         LDKInvoice this_arg_conv;
43095         this_arg_conv.inner = untag_ptr(this_arg);
43096         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43097         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43098         this_arg_conv.is_owned = false;
43099         int64_t ret_conv = Invoice_duration_since_epoch(&this_arg_conv);
43100         return ret_conv;
43101 }
43102
43103 int8_tArray  __attribute__((export_name("TS_Invoice_payment_hash"))) TS_Invoice_payment_hash(uint64_t this_arg) {
43104         LDKInvoice this_arg_conv;
43105         this_arg_conv.inner = untag_ptr(this_arg);
43106         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43107         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43108         this_arg_conv.is_owned = false;
43109         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
43110         memcpy(ret_arr->elems, *Invoice_payment_hash(&this_arg_conv), 32);
43111         return ret_arr;
43112 }
43113
43114 int8_tArray  __attribute__((export_name("TS_Invoice_payee_pub_key"))) TS_Invoice_payee_pub_key(uint64_t this_arg) {
43115         LDKInvoice this_arg_conv;
43116         this_arg_conv.inner = untag_ptr(this_arg);
43117         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43118         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43119         this_arg_conv.is_owned = false;
43120         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
43121         memcpy(ret_arr->elems, Invoice_payee_pub_key(&this_arg_conv).compressed_form, 33);
43122         return ret_arr;
43123 }
43124
43125 int8_tArray  __attribute__((export_name("TS_Invoice_payment_secret"))) TS_Invoice_payment_secret(uint64_t this_arg) {
43126         LDKInvoice this_arg_conv;
43127         this_arg_conv.inner = untag_ptr(this_arg);
43128         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43129         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43130         this_arg_conv.is_owned = false;
43131         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
43132         memcpy(ret_arr->elems, *Invoice_payment_secret(&this_arg_conv), 32);
43133         return ret_arr;
43134 }
43135
43136 uint64_t  __attribute__((export_name("TS_Invoice_features"))) TS_Invoice_features(uint64_t this_arg) {
43137         LDKInvoice this_arg_conv;
43138         this_arg_conv.inner = untag_ptr(this_arg);
43139         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43140         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43141         this_arg_conv.is_owned = false;
43142         LDKInvoiceFeatures ret_var = Invoice_features(&this_arg_conv);
43143         uint64_t ret_ref = 0;
43144         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43145         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43146         return ret_ref;
43147 }
43148
43149 int8_tArray  __attribute__((export_name("TS_Invoice_recover_payee_pub_key"))) TS_Invoice_recover_payee_pub_key(uint64_t this_arg) {
43150         LDKInvoice this_arg_conv;
43151         this_arg_conv.inner = untag_ptr(this_arg);
43152         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43153         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43154         this_arg_conv.is_owned = false;
43155         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
43156         memcpy(ret_arr->elems, Invoice_recover_payee_pub_key(&this_arg_conv).compressed_form, 33);
43157         return ret_arr;
43158 }
43159
43160 int64_t  __attribute__((export_name("TS_Invoice_expiry_time"))) TS_Invoice_expiry_time(uint64_t this_arg) {
43161         LDKInvoice this_arg_conv;
43162         this_arg_conv.inner = untag_ptr(this_arg);
43163         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43164         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43165         this_arg_conv.is_owned = false;
43166         int64_t ret_conv = Invoice_expiry_time(&this_arg_conv);
43167         return ret_conv;
43168 }
43169
43170 jboolean  __attribute__((export_name("TS_Invoice_would_expire"))) TS_Invoice_would_expire(uint64_t this_arg, int64_t at_time) {
43171         LDKInvoice 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         jboolean ret_conv = Invoice_would_expire(&this_arg_conv, at_time);
43177         return ret_conv;
43178 }
43179
43180 int64_t  __attribute__((export_name("TS_Invoice_min_final_cltv_expiry"))) TS_Invoice_min_final_cltv_expiry(uint64_t this_arg) {
43181         LDKInvoice this_arg_conv;
43182         this_arg_conv.inner = untag_ptr(this_arg);
43183         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43184         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43185         this_arg_conv.is_owned = false;
43186         int64_t ret_conv = Invoice_min_final_cltv_expiry(&this_arg_conv);
43187         return ret_conv;
43188 }
43189
43190 uint64_tArray  __attribute__((export_name("TS_Invoice_private_routes"))) TS_Invoice_private_routes(uint64_t this_arg) {
43191         LDKInvoice this_arg_conv;
43192         this_arg_conv.inner = untag_ptr(this_arg);
43193         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43194         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43195         this_arg_conv.is_owned = false;
43196         LDKCVec_PrivateRouteZ ret_var = Invoice_private_routes(&this_arg_conv);
43197         uint64_tArray ret_arr = NULL;
43198         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
43199         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
43200         for (size_t o = 0; o < ret_var.datalen; o++) {
43201                 LDKPrivateRoute ret_conv_14_var = ret_var.data[o];
43202                 uint64_t ret_conv_14_ref = 0;
43203                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_14_var);
43204                 ret_conv_14_ref = tag_ptr(ret_conv_14_var.inner, ret_conv_14_var.is_owned);
43205                 ret_arr_ptr[o] = ret_conv_14_ref;
43206         }
43207         
43208         FREE(ret_var.data);
43209         return ret_arr;
43210 }
43211
43212 uint64_tArray  __attribute__((export_name("TS_Invoice_route_hints"))) TS_Invoice_route_hints(uint64_t this_arg) {
43213         LDKInvoice this_arg_conv;
43214         this_arg_conv.inner = untag_ptr(this_arg);
43215         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43216         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43217         this_arg_conv.is_owned = false;
43218         LDKCVec_RouteHintZ ret_var = Invoice_route_hints(&this_arg_conv);
43219         uint64_tArray ret_arr = NULL;
43220         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
43221         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
43222         for (size_t l = 0; l < ret_var.datalen; l++) {
43223                 LDKRouteHint ret_conv_11_var = ret_var.data[l];
43224                 uint64_t ret_conv_11_ref = 0;
43225                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_11_var);
43226                 ret_conv_11_ref = tag_ptr(ret_conv_11_var.inner, ret_conv_11_var.is_owned);
43227                 ret_arr_ptr[l] = ret_conv_11_ref;
43228         }
43229         
43230         FREE(ret_var.data);
43231         return ret_arr;
43232 }
43233
43234 uint32_t  __attribute__((export_name("TS_Invoice_currency"))) TS_Invoice_currency(uint64_t this_arg) {
43235         LDKInvoice this_arg_conv;
43236         this_arg_conv.inner = untag_ptr(this_arg);
43237         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43238         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43239         this_arg_conv.is_owned = false;
43240         uint32_t ret_conv = LDKCurrency_to_js(Invoice_currency(&this_arg_conv));
43241         return ret_conv;
43242 }
43243
43244 uint64_t  __attribute__((export_name("TS_Invoice_amount_milli_satoshis"))) TS_Invoice_amount_milli_satoshis(uint64_t this_arg) {
43245         LDKInvoice this_arg_conv;
43246         this_arg_conv.inner = untag_ptr(this_arg);
43247         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43248         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43249         this_arg_conv.is_owned = false;
43250         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
43251         *ret_copy = Invoice_amount_milli_satoshis(&this_arg_conv);
43252         uint64_t ret_ref = tag_ptr(ret_copy, true);
43253         return ret_ref;
43254 }
43255
43256 uint64_t  __attribute__((export_name("TS_Description_new"))) TS_Description_new(jstring description) {
43257         LDKStr description_conv = str_ref_to_owned_c(description);
43258         LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
43259         *ret_conv = Description_new(description_conv);
43260         return tag_ptr(ret_conv, true);
43261 }
43262
43263 jstring  __attribute__((export_name("TS_Description_into_inner"))) TS_Description_into_inner(uint64_t this_arg) {
43264         LDKDescription this_arg_conv;
43265         this_arg_conv.inner = untag_ptr(this_arg);
43266         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43267         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43268         this_arg_conv = Description_clone(&this_arg_conv);
43269         LDKStr ret_str = Description_into_inner(this_arg_conv);
43270         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
43271         Str_free(ret_str);
43272         return ret_conv;
43273 }
43274
43275 uint64_t  __attribute__((export_name("TS_ExpiryTime_from_seconds"))) TS_ExpiryTime_from_seconds(int64_t seconds) {
43276         LDKExpiryTime ret_var = ExpiryTime_from_seconds(seconds);
43277         uint64_t ret_ref = 0;
43278         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43279         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43280         return ret_ref;
43281 }
43282
43283 uint64_t  __attribute__((export_name("TS_ExpiryTime_from_duration"))) TS_ExpiryTime_from_duration(int64_t duration) {
43284         LDKExpiryTime ret_var = ExpiryTime_from_duration(duration);
43285         uint64_t ret_ref = 0;
43286         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43287         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43288         return ret_ref;
43289 }
43290
43291 int64_t  __attribute__((export_name("TS_ExpiryTime_as_seconds"))) TS_ExpiryTime_as_seconds(uint64_t this_arg) {
43292         LDKExpiryTime this_arg_conv;
43293         this_arg_conv.inner = untag_ptr(this_arg);
43294         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43295         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43296         this_arg_conv.is_owned = false;
43297         int64_t ret_conv = ExpiryTime_as_seconds(&this_arg_conv);
43298         return ret_conv;
43299 }
43300
43301 int64_t  __attribute__((export_name("TS_ExpiryTime_as_duration"))) TS_ExpiryTime_as_duration(uint64_t this_arg) {
43302         LDKExpiryTime this_arg_conv;
43303         this_arg_conv.inner = untag_ptr(this_arg);
43304         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43305         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43306         this_arg_conv.is_owned = false;
43307         int64_t ret_conv = ExpiryTime_as_duration(&this_arg_conv);
43308         return ret_conv;
43309 }
43310
43311 uint64_t  __attribute__((export_name("TS_PrivateRoute_new"))) TS_PrivateRoute_new(uint64_t hops) {
43312         LDKRouteHint hops_conv;
43313         hops_conv.inner = untag_ptr(hops);
43314         hops_conv.is_owned = ptr_is_owned(hops);
43315         CHECK_INNER_FIELD_ACCESS_OR_NULL(hops_conv);
43316         hops_conv = RouteHint_clone(&hops_conv);
43317         LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
43318         *ret_conv = PrivateRoute_new(hops_conv);
43319         return tag_ptr(ret_conv, true);
43320 }
43321
43322 uint64_t  __attribute__((export_name("TS_PrivateRoute_into_inner"))) TS_PrivateRoute_into_inner(uint64_t this_arg) {
43323         LDKPrivateRoute this_arg_conv;
43324         this_arg_conv.inner = untag_ptr(this_arg);
43325         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43326         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43327         this_arg_conv = PrivateRoute_clone(&this_arg_conv);
43328         LDKRouteHint ret_var = PrivateRoute_into_inner(this_arg_conv);
43329         uint64_t ret_ref = 0;
43330         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43331         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43332         return ret_ref;
43333 }
43334
43335 uint32_t  __attribute__((export_name("TS_CreationError_clone"))) TS_CreationError_clone(uint64_t orig) {
43336         LDKCreationError* orig_conv = (LDKCreationError*)untag_ptr(orig);
43337         uint32_t ret_conv = LDKCreationError_to_js(CreationError_clone(orig_conv));
43338         return ret_conv;
43339 }
43340
43341 uint32_t  __attribute__((export_name("TS_CreationError_description_too_long"))) TS_CreationError_description_too_long() {
43342         uint32_t ret_conv = LDKCreationError_to_js(CreationError_description_too_long());
43343         return ret_conv;
43344 }
43345
43346 uint32_t  __attribute__((export_name("TS_CreationError_route_too_long"))) TS_CreationError_route_too_long() {
43347         uint32_t ret_conv = LDKCreationError_to_js(CreationError_route_too_long());
43348         return ret_conv;
43349 }
43350
43351 uint32_t  __attribute__((export_name("TS_CreationError_timestamp_out_of_bounds"))) TS_CreationError_timestamp_out_of_bounds() {
43352         uint32_t ret_conv = LDKCreationError_to_js(CreationError_timestamp_out_of_bounds());
43353         return ret_conv;
43354 }
43355
43356 uint32_t  __attribute__((export_name("TS_CreationError_invalid_amount"))) TS_CreationError_invalid_amount() {
43357         uint32_t ret_conv = LDKCreationError_to_js(CreationError_invalid_amount());
43358         return ret_conv;
43359 }
43360
43361 uint32_t  __attribute__((export_name("TS_CreationError_missing_route_hints"))) TS_CreationError_missing_route_hints() {
43362         uint32_t ret_conv = LDKCreationError_to_js(CreationError_missing_route_hints());
43363         return ret_conv;
43364 }
43365
43366 jboolean  __attribute__((export_name("TS_CreationError_eq"))) TS_CreationError_eq(uint64_t a, uint64_t b) {
43367         LDKCreationError* a_conv = (LDKCreationError*)untag_ptr(a);
43368         LDKCreationError* b_conv = (LDKCreationError*)untag_ptr(b);
43369         jboolean ret_conv = CreationError_eq(a_conv, b_conv);
43370         return ret_conv;
43371 }
43372
43373 jstring  __attribute__((export_name("TS_CreationError_to_str"))) TS_CreationError_to_str(uint64_t o) {
43374         LDKCreationError* o_conv = (LDKCreationError*)untag_ptr(o);
43375         LDKStr ret_str = CreationError_to_str(o_conv);
43376         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
43377         Str_free(ret_str);
43378         return ret_conv;
43379 }
43380
43381 uint32_t  __attribute__((export_name("TS_SemanticError_clone"))) TS_SemanticError_clone(uint64_t orig) {
43382         LDKSemanticError* orig_conv = (LDKSemanticError*)untag_ptr(orig);
43383         uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_clone(orig_conv));
43384         return ret_conv;
43385 }
43386
43387 uint32_t  __attribute__((export_name("TS_SemanticError_no_payment_hash"))) TS_SemanticError_no_payment_hash() {
43388         uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_no_payment_hash());
43389         return ret_conv;
43390 }
43391
43392 uint32_t  __attribute__((export_name("TS_SemanticError_multiple_payment_hashes"))) TS_SemanticError_multiple_payment_hashes() {
43393         uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_multiple_payment_hashes());
43394         return ret_conv;
43395 }
43396
43397 uint32_t  __attribute__((export_name("TS_SemanticError_no_description"))) TS_SemanticError_no_description() {
43398         uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_no_description());
43399         return ret_conv;
43400 }
43401
43402 uint32_t  __attribute__((export_name("TS_SemanticError_multiple_descriptions"))) TS_SemanticError_multiple_descriptions() {
43403         uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_multiple_descriptions());
43404         return ret_conv;
43405 }
43406
43407 uint32_t  __attribute__((export_name("TS_SemanticError_no_payment_secret"))) TS_SemanticError_no_payment_secret() {
43408         uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_no_payment_secret());
43409         return ret_conv;
43410 }
43411
43412 uint32_t  __attribute__((export_name("TS_SemanticError_multiple_payment_secrets"))) TS_SemanticError_multiple_payment_secrets() {
43413         uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_multiple_payment_secrets());
43414         return ret_conv;
43415 }
43416
43417 uint32_t  __attribute__((export_name("TS_SemanticError_invalid_features"))) TS_SemanticError_invalid_features() {
43418         uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_invalid_features());
43419         return ret_conv;
43420 }
43421
43422 uint32_t  __attribute__((export_name("TS_SemanticError_invalid_recovery_id"))) TS_SemanticError_invalid_recovery_id() {
43423         uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_invalid_recovery_id());
43424         return ret_conv;
43425 }
43426
43427 uint32_t  __attribute__((export_name("TS_SemanticError_invalid_signature"))) TS_SemanticError_invalid_signature() {
43428         uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_invalid_signature());
43429         return ret_conv;
43430 }
43431
43432 uint32_t  __attribute__((export_name("TS_SemanticError_imprecise_amount"))) TS_SemanticError_imprecise_amount() {
43433         uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_imprecise_amount());
43434         return ret_conv;
43435 }
43436
43437 jboolean  __attribute__((export_name("TS_SemanticError_eq"))) TS_SemanticError_eq(uint64_t a, uint64_t b) {
43438         LDKSemanticError* a_conv = (LDKSemanticError*)untag_ptr(a);
43439         LDKSemanticError* b_conv = (LDKSemanticError*)untag_ptr(b);
43440         jboolean ret_conv = SemanticError_eq(a_conv, b_conv);
43441         return ret_conv;
43442 }
43443
43444 jstring  __attribute__((export_name("TS_SemanticError_to_str"))) TS_SemanticError_to_str(uint64_t o) {
43445         LDKSemanticError* o_conv = (LDKSemanticError*)untag_ptr(o);
43446         LDKStr ret_str = SemanticError_to_str(o_conv);
43447         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
43448         Str_free(ret_str);
43449         return ret_conv;
43450 }
43451
43452 void  __attribute__((export_name("TS_SignOrCreationError_free"))) TS_SignOrCreationError_free(uint64_t this_ptr) {
43453         if (!ptr_is_owned(this_ptr)) return;
43454         void* this_ptr_ptr = untag_ptr(this_ptr);
43455         CHECK_ACCESS(this_ptr_ptr);
43456         LDKSignOrCreationError this_ptr_conv = *(LDKSignOrCreationError*)(this_ptr_ptr);
43457         FREE(untag_ptr(this_ptr));
43458         SignOrCreationError_free(this_ptr_conv);
43459 }
43460
43461 static inline uint64_t SignOrCreationError_clone_ptr(LDKSignOrCreationError *NONNULL_PTR arg) {
43462         LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
43463         *ret_copy = SignOrCreationError_clone(arg);
43464         uint64_t ret_ref = tag_ptr(ret_copy, true);
43465         return ret_ref;
43466 }
43467 int64_t  __attribute__((export_name("TS_SignOrCreationError_clone_ptr"))) TS_SignOrCreationError_clone_ptr(uint64_t arg) {
43468         LDKSignOrCreationError* arg_conv = (LDKSignOrCreationError*)untag_ptr(arg);
43469         int64_t ret_conv = SignOrCreationError_clone_ptr(arg_conv);
43470         return ret_conv;
43471 }
43472
43473 uint64_t  __attribute__((export_name("TS_SignOrCreationError_clone"))) TS_SignOrCreationError_clone(uint64_t orig) {
43474         LDKSignOrCreationError* orig_conv = (LDKSignOrCreationError*)untag_ptr(orig);
43475         LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
43476         *ret_copy = SignOrCreationError_clone(orig_conv);
43477         uint64_t ret_ref = tag_ptr(ret_copy, true);
43478         return ret_ref;
43479 }
43480
43481 uint64_t  __attribute__((export_name("TS_SignOrCreationError_sign_error"))) TS_SignOrCreationError_sign_error() {
43482         LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
43483         *ret_copy = SignOrCreationError_sign_error();
43484         uint64_t ret_ref = tag_ptr(ret_copy, true);
43485         return ret_ref;
43486 }
43487
43488 uint64_t  __attribute__((export_name("TS_SignOrCreationError_creation_error"))) TS_SignOrCreationError_creation_error(uint32_t a) {
43489         LDKCreationError a_conv = LDKCreationError_from_js(a);
43490         LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
43491         *ret_copy = SignOrCreationError_creation_error(a_conv);
43492         uint64_t ret_ref = tag_ptr(ret_copy, true);
43493         return ret_ref;
43494 }
43495
43496 jboolean  __attribute__((export_name("TS_SignOrCreationError_eq"))) TS_SignOrCreationError_eq(uint64_t a, uint64_t b) {
43497         LDKSignOrCreationError* a_conv = (LDKSignOrCreationError*)untag_ptr(a);
43498         LDKSignOrCreationError* b_conv = (LDKSignOrCreationError*)untag_ptr(b);
43499         jboolean ret_conv = SignOrCreationError_eq(a_conv, b_conv);
43500         return ret_conv;
43501 }
43502
43503 jstring  __attribute__((export_name("TS_SignOrCreationError_to_str"))) TS_SignOrCreationError_to_str(uint64_t o) {
43504         LDKSignOrCreationError* o_conv = (LDKSignOrCreationError*)untag_ptr(o);
43505         LDKStr ret_str = SignOrCreationError_to_str(o_conv);
43506         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
43507         Str_free(ret_str);
43508         return ret_conv;
43509 }
43510
43511 void  __attribute__((export_name("TS_InvoicePayer_free"))) TS_InvoicePayer_free(uint64_t this_obj) {
43512         LDKInvoicePayer this_obj_conv;
43513         this_obj_conv.inner = untag_ptr(this_obj);
43514         this_obj_conv.is_owned = ptr_is_owned(this_obj);
43515         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43516         InvoicePayer_free(this_obj_conv);
43517 }
43518
43519 void  __attribute__((export_name("TS_Payer_free"))) TS_Payer_free(uint64_t this_ptr) {
43520         if (!ptr_is_owned(this_ptr)) return;
43521         void* this_ptr_ptr = untag_ptr(this_ptr);
43522         CHECK_ACCESS(this_ptr_ptr);
43523         LDKPayer this_ptr_conv = *(LDKPayer*)(this_ptr_ptr);
43524         FREE(untag_ptr(this_ptr));
43525         Payer_free(this_ptr_conv);
43526 }
43527
43528 void  __attribute__((export_name("TS_Router_free"))) TS_Router_free(uint64_t this_ptr) {
43529         if (!ptr_is_owned(this_ptr)) return;
43530         void* this_ptr_ptr = untag_ptr(this_ptr);
43531         CHECK_ACCESS(this_ptr_ptr);
43532         LDKRouter this_ptr_conv = *(LDKRouter*)(this_ptr_ptr);
43533         FREE(untag_ptr(this_ptr));
43534         Router_free(this_ptr_conv);
43535 }
43536
43537 void  __attribute__((export_name("TS_Retry_free"))) TS_Retry_free(uint64_t this_ptr) {
43538         if (!ptr_is_owned(this_ptr)) return;
43539         void* this_ptr_ptr = untag_ptr(this_ptr);
43540         CHECK_ACCESS(this_ptr_ptr);
43541         LDKRetry this_ptr_conv = *(LDKRetry*)(this_ptr_ptr);
43542         FREE(untag_ptr(this_ptr));
43543         Retry_free(this_ptr_conv);
43544 }
43545
43546 static inline uint64_t Retry_clone_ptr(LDKRetry *NONNULL_PTR arg) {
43547         LDKRetry *ret_copy = MALLOC(sizeof(LDKRetry), "LDKRetry");
43548         *ret_copy = Retry_clone(arg);
43549         uint64_t ret_ref = tag_ptr(ret_copy, true);
43550         return ret_ref;
43551 }
43552 int64_t  __attribute__((export_name("TS_Retry_clone_ptr"))) TS_Retry_clone_ptr(uint64_t arg) {
43553         LDKRetry* arg_conv = (LDKRetry*)untag_ptr(arg);
43554         int64_t ret_conv = Retry_clone_ptr(arg_conv);
43555         return ret_conv;
43556 }
43557
43558 uint64_t  __attribute__((export_name("TS_Retry_clone"))) TS_Retry_clone(uint64_t orig) {
43559         LDKRetry* orig_conv = (LDKRetry*)untag_ptr(orig);
43560         LDKRetry *ret_copy = MALLOC(sizeof(LDKRetry), "LDKRetry");
43561         *ret_copy = Retry_clone(orig_conv);
43562         uint64_t ret_ref = tag_ptr(ret_copy, true);
43563         return ret_ref;
43564 }
43565
43566 uint64_t  __attribute__((export_name("TS_Retry_attempts"))) TS_Retry_attempts(uint32_t a) {
43567         LDKRetry *ret_copy = MALLOC(sizeof(LDKRetry), "LDKRetry");
43568         *ret_copy = Retry_attempts(a);
43569         uint64_t ret_ref = tag_ptr(ret_copy, true);
43570         return ret_ref;
43571 }
43572
43573 jboolean  __attribute__((export_name("TS_Retry_eq"))) TS_Retry_eq(uint64_t a, uint64_t b) {
43574         LDKRetry* a_conv = (LDKRetry*)untag_ptr(a);
43575         LDKRetry* b_conv = (LDKRetry*)untag_ptr(b);
43576         jboolean ret_conv = Retry_eq(a_conv, b_conv);
43577         return ret_conv;
43578 }
43579
43580 int64_t  __attribute__((export_name("TS_Retry_hash"))) TS_Retry_hash(uint64_t o) {
43581         LDKRetry* o_conv = (LDKRetry*)untag_ptr(o);
43582         int64_t ret_conv = Retry_hash(o_conv);
43583         return ret_conv;
43584 }
43585
43586 void  __attribute__((export_name("TS_PaymentError_free"))) TS_PaymentError_free(uint64_t this_ptr) {
43587         if (!ptr_is_owned(this_ptr)) return;
43588         void* this_ptr_ptr = untag_ptr(this_ptr);
43589         CHECK_ACCESS(this_ptr_ptr);
43590         LDKPaymentError this_ptr_conv = *(LDKPaymentError*)(this_ptr_ptr);
43591         FREE(untag_ptr(this_ptr));
43592         PaymentError_free(this_ptr_conv);
43593 }
43594
43595 static inline uint64_t PaymentError_clone_ptr(LDKPaymentError *NONNULL_PTR arg) {
43596         LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
43597         *ret_copy = PaymentError_clone(arg);
43598         uint64_t ret_ref = tag_ptr(ret_copy, true);
43599         return ret_ref;
43600 }
43601 int64_t  __attribute__((export_name("TS_PaymentError_clone_ptr"))) TS_PaymentError_clone_ptr(uint64_t arg) {
43602         LDKPaymentError* arg_conv = (LDKPaymentError*)untag_ptr(arg);
43603         int64_t ret_conv = PaymentError_clone_ptr(arg_conv);
43604         return ret_conv;
43605 }
43606
43607 uint64_t  __attribute__((export_name("TS_PaymentError_clone"))) TS_PaymentError_clone(uint64_t orig) {
43608         LDKPaymentError* orig_conv = (LDKPaymentError*)untag_ptr(orig);
43609         LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
43610         *ret_copy = PaymentError_clone(orig_conv);
43611         uint64_t ret_ref = tag_ptr(ret_copy, true);
43612         return ret_ref;
43613 }
43614
43615 uint64_t  __attribute__((export_name("TS_PaymentError_invoice"))) TS_PaymentError_invoice(jstring a) {
43616         LDKStr a_conv = str_ref_to_owned_c(a);
43617         LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
43618         *ret_copy = PaymentError_invoice(a_conv);
43619         uint64_t ret_ref = tag_ptr(ret_copy, true);
43620         return ret_ref;
43621 }
43622
43623 uint64_t  __attribute__((export_name("TS_PaymentError_routing"))) TS_PaymentError_routing(uint64_t a) {
43624         LDKLightningError a_conv;
43625         a_conv.inner = untag_ptr(a);
43626         a_conv.is_owned = ptr_is_owned(a);
43627         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
43628         a_conv = LightningError_clone(&a_conv);
43629         LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
43630         *ret_copy = PaymentError_routing(a_conv);
43631         uint64_t ret_ref = tag_ptr(ret_copy, true);
43632         return ret_ref;
43633 }
43634
43635 uint64_t  __attribute__((export_name("TS_PaymentError_sending"))) TS_PaymentError_sending(uint64_t a) {
43636         void* a_ptr = untag_ptr(a);
43637         CHECK_ACCESS(a_ptr);
43638         LDKPaymentSendFailure a_conv = *(LDKPaymentSendFailure*)(a_ptr);
43639         a_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)untag_ptr(a));
43640         LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
43641         *ret_copy = PaymentError_sending(a_conv);
43642         uint64_t ret_ref = tag_ptr(ret_copy, true);
43643         return ret_ref;
43644 }
43645
43646 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) {
43647         void* payer_ptr = untag_ptr(payer);
43648         CHECK_ACCESS(payer_ptr);
43649         LDKPayer payer_conv = *(LDKPayer*)(payer_ptr);
43650         if (payer_conv.free == LDKPayer_JCalls_free) {
43651                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
43652                 LDKPayer_JCalls_cloned(&payer_conv);
43653         }
43654         void* router_ptr = untag_ptr(router);
43655         CHECK_ACCESS(router_ptr);
43656         LDKRouter router_conv = *(LDKRouter*)(router_ptr);
43657         if (router_conv.free == LDKRouter_JCalls_free) {
43658                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
43659                 LDKRouter_JCalls_cloned(&router_conv);
43660         }
43661         LDKMultiThreadedLockableScore scorer_conv;
43662         scorer_conv.inner = untag_ptr(scorer);
43663         scorer_conv.is_owned = ptr_is_owned(scorer);
43664         CHECK_INNER_FIELD_ACCESS_OR_NULL(scorer_conv);
43665         scorer_conv.is_owned = false;
43666         void* logger_ptr = untag_ptr(logger);
43667         CHECK_ACCESS(logger_ptr);
43668         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
43669         if (logger_conv.free == LDKLogger_JCalls_free) {
43670                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
43671                 LDKLogger_JCalls_cloned(&logger_conv);
43672         }
43673         void* event_handler_ptr = untag_ptr(event_handler);
43674         CHECK_ACCESS(event_handler_ptr);
43675         LDKEventHandler event_handler_conv = *(LDKEventHandler*)(event_handler_ptr);
43676         if (event_handler_conv.free == LDKEventHandler_JCalls_free) {
43677                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
43678                 LDKEventHandler_JCalls_cloned(&event_handler_conv);
43679         }
43680         void* retry_ptr = untag_ptr(retry);
43681         CHECK_ACCESS(retry_ptr);
43682         LDKRetry retry_conv = *(LDKRetry*)(retry_ptr);
43683         retry_conv = Retry_clone((LDKRetry*)untag_ptr(retry));
43684         LDKInvoicePayer ret_var = InvoicePayer_new(payer_conv, router_conv, &scorer_conv, logger_conv, event_handler_conv, retry_conv);
43685         uint64_t ret_ref = 0;
43686         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43687         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43688         return ret_ref;
43689 }
43690
43691 uint64_t  __attribute__((export_name("TS_InvoicePayer_pay_invoice"))) TS_InvoicePayer_pay_invoice(uint64_t this_arg, uint64_t invoice) {
43692         LDKInvoicePayer this_arg_conv;
43693         this_arg_conv.inner = untag_ptr(this_arg);
43694         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43695         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43696         this_arg_conv.is_owned = false;
43697         LDKInvoice invoice_conv;
43698         invoice_conv.inner = untag_ptr(invoice);
43699         invoice_conv.is_owned = ptr_is_owned(invoice);
43700         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv);
43701         invoice_conv.is_owned = false;
43702         LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
43703         *ret_conv = InvoicePayer_pay_invoice(&this_arg_conv, &invoice_conv);
43704         return tag_ptr(ret_conv, true);
43705 }
43706
43707 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) {
43708         LDKInvoicePayer this_arg_conv;
43709         this_arg_conv.inner = untag_ptr(this_arg);
43710         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43711         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43712         this_arg_conv.is_owned = false;
43713         LDKInvoice invoice_conv;
43714         invoice_conv.inner = untag_ptr(invoice);
43715         invoice_conv.is_owned = ptr_is_owned(invoice);
43716         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv);
43717         invoice_conv.is_owned = false;
43718         LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
43719         *ret_conv = InvoicePayer_pay_zero_value_invoice(&this_arg_conv, &invoice_conv, amount_msats);
43720         return tag_ptr(ret_conv, true);
43721 }
43722
43723 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) {
43724         LDKInvoicePayer this_arg_conv;
43725         this_arg_conv.inner = untag_ptr(this_arg);
43726         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43727         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43728         this_arg_conv.is_owned = false;
43729         LDKPublicKey pubkey_ref;
43730         CHECK(pubkey->arr_len == 33);
43731         memcpy(pubkey_ref.compressed_form, pubkey->elems, 33); FREE(pubkey);
43732         LDKThirtyTwoBytes payment_preimage_ref;
43733         CHECK(payment_preimage->arr_len == 32);
43734         memcpy(payment_preimage_ref.data, payment_preimage->elems, 32); FREE(payment_preimage);
43735         LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
43736         *ret_conv = InvoicePayer_pay_pubkey(&this_arg_conv, pubkey_ref, payment_preimage_ref, amount_msats, final_cltv_expiry_delta);
43737         return tag_ptr(ret_conv, true);
43738 }
43739
43740 void  __attribute__((export_name("TS_InvoicePayer_remove_cached_payment"))) TS_InvoicePayer_remove_cached_payment(uint64_t this_arg, int8_tArray payment_hash) {
43741         LDKInvoicePayer this_arg_conv;
43742         this_arg_conv.inner = untag_ptr(this_arg);
43743         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43744         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43745         this_arg_conv.is_owned = false;
43746         unsigned char payment_hash_arr[32];
43747         CHECK(payment_hash->arr_len == 32);
43748         memcpy(payment_hash_arr, payment_hash->elems, 32); FREE(payment_hash);
43749         unsigned char (*payment_hash_ref)[32] = &payment_hash_arr;
43750         InvoicePayer_remove_cached_payment(&this_arg_conv, payment_hash_ref);
43751 }
43752
43753 uint64_t  __attribute__((export_name("TS_InvoicePayer_as_EventHandler"))) TS_InvoicePayer_as_EventHandler(uint64_t this_arg) {
43754         LDKInvoicePayer this_arg_conv;
43755         this_arg_conv.inner = untag_ptr(this_arg);
43756         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43757         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43758         this_arg_conv.is_owned = false;
43759         LDKEventHandler* ret_ret = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
43760         *ret_ret = InvoicePayer_as_EventHandler(&this_arg_conv);
43761         return tag_ptr(ret_ret, true);
43762 }
43763
43764 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) {
43765         LDKChannelManager channelmanager_conv;
43766         channelmanager_conv.inner = untag_ptr(channelmanager);
43767         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
43768         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
43769         channelmanager_conv.is_owned = false;
43770         void* keys_manager_ptr = untag_ptr(keys_manager);
43771         CHECK_ACCESS(keys_manager_ptr);
43772         LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr);
43773         if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
43774                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
43775                 LDKKeysInterface_JCalls_cloned(&keys_manager_conv);
43776         }
43777         LDKCurrency network_conv = LDKCurrency_from_js(network);
43778         void* amt_msat_ptr = untag_ptr(amt_msat);
43779         CHECK_ACCESS(amt_msat_ptr);
43780         LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
43781         amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amt_msat));
43782         LDKSha256 description_hash_conv;
43783         description_hash_conv.inner = untag_ptr(description_hash);
43784         description_hash_conv.is_owned = ptr_is_owned(description_hash);
43785         CHECK_INNER_FIELD_ACCESS_OR_NULL(description_hash_conv);
43786         description_hash_conv = Sha256_clone(&description_hash_conv);
43787         LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
43788         *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);
43789         return tag_ptr(ret_conv, true);
43790 }
43791
43792 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) {
43793         LDKChannelManager channelmanager_conv;
43794         channelmanager_conv.inner = untag_ptr(channelmanager);
43795         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
43796         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
43797         channelmanager_conv.is_owned = false;
43798         void* keys_manager_ptr = untag_ptr(keys_manager);
43799         CHECK_ACCESS(keys_manager_ptr);
43800         LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr);
43801         if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
43802                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
43803                 LDKKeysInterface_JCalls_cloned(&keys_manager_conv);
43804         }
43805         LDKCurrency network_conv = LDKCurrency_from_js(network);
43806         void* amt_msat_ptr = untag_ptr(amt_msat);
43807         CHECK_ACCESS(amt_msat_ptr);
43808         LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
43809         amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amt_msat));
43810         LDKStr description_conv = str_ref_to_owned_c(description);
43811         LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
43812         *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);
43813         return tag_ptr(ret_conv, true);
43814 }
43815
43816 void  __attribute__((export_name("TS_DefaultRouter_free"))) TS_DefaultRouter_free(uint64_t this_obj) {
43817         LDKDefaultRouter this_obj_conv;
43818         this_obj_conv.inner = untag_ptr(this_obj);
43819         this_obj_conv.is_owned = ptr_is_owned(this_obj);
43820         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43821         DefaultRouter_free(this_obj_conv);
43822 }
43823
43824 uint64_t  __attribute__((export_name("TS_DefaultRouter_new"))) TS_DefaultRouter_new(uint64_t network_graph, uint64_t logger, int8_tArray random_seed_bytes) {
43825         LDKNetworkGraph network_graph_conv;
43826         network_graph_conv.inner = untag_ptr(network_graph);
43827         network_graph_conv.is_owned = ptr_is_owned(network_graph);
43828         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
43829         network_graph_conv.is_owned = false;
43830         void* logger_ptr = untag_ptr(logger);
43831         CHECK_ACCESS(logger_ptr);
43832         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
43833         if (logger_conv.free == LDKLogger_JCalls_free) {
43834                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
43835                 LDKLogger_JCalls_cloned(&logger_conv);
43836         }
43837         LDKThirtyTwoBytes random_seed_bytes_ref;
43838         CHECK(random_seed_bytes->arr_len == 32);
43839         memcpy(random_seed_bytes_ref.data, random_seed_bytes->elems, 32); FREE(random_seed_bytes);
43840         LDKDefaultRouter ret_var = DefaultRouter_new(&network_graph_conv, logger_conv, random_seed_bytes_ref);
43841         uint64_t ret_ref = 0;
43842         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43843         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43844         return ret_ref;
43845 }
43846
43847 uint64_t  __attribute__((export_name("TS_DefaultRouter_as_Router"))) TS_DefaultRouter_as_Router(uint64_t this_arg) {
43848         LDKDefaultRouter this_arg_conv;
43849         this_arg_conv.inner = untag_ptr(this_arg);
43850         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43851         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43852         this_arg_conv.is_owned = false;
43853         LDKRouter* ret_ret = MALLOC(sizeof(LDKRouter), "LDKRouter");
43854         *ret_ret = DefaultRouter_as_Router(&this_arg_conv);
43855         return tag_ptr(ret_ret, true);
43856 }
43857
43858 uint64_t  __attribute__((export_name("TS_ChannelManager_as_Payer"))) TS_ChannelManager_as_Payer(uint64_t this_arg) {
43859         LDKChannelManager this_arg_conv;
43860         this_arg_conv.inner = untag_ptr(this_arg);
43861         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43862         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43863         this_arg_conv.is_owned = false;
43864         LDKPayer* ret_ret = MALLOC(sizeof(LDKPayer), "LDKPayer");
43865         *ret_ret = ChannelManager_as_Payer(&this_arg_conv);
43866         return tag_ptr(ret_ret, true);
43867 }
43868
43869 uint64_t  __attribute__((export_name("TS_SiPrefix_from_str"))) TS_SiPrefix_from_str(jstring s) {
43870         LDKStr s_conv = str_ref_to_owned_c(s);
43871         LDKCResult_SiPrefixParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixParseErrorZ), "LDKCResult_SiPrefixParseErrorZ");
43872         *ret_conv = SiPrefix_from_str(s_conv);
43873         return tag_ptr(ret_conv, true);
43874 }
43875
43876 uint64_t  __attribute__((export_name("TS_Invoice_from_str"))) TS_Invoice_from_str(jstring s) {
43877         LDKStr s_conv = str_ref_to_owned_c(s);
43878         LDKCResult_InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceParseOrSemanticErrorZ), "LDKCResult_InvoiceParseOrSemanticErrorZ");
43879         *ret_conv = Invoice_from_str(s_conv);
43880         return tag_ptr(ret_conv, true);
43881 }
43882
43883 uint64_t  __attribute__((export_name("TS_SignedRawInvoice_from_str"))) TS_SignedRawInvoice_from_str(jstring s) {
43884         LDKStr s_conv = str_ref_to_owned_c(s);
43885         LDKCResult_SignedRawInvoiceParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceParseErrorZ), "LDKCResult_SignedRawInvoiceParseErrorZ");
43886         *ret_conv = SignedRawInvoice_from_str(s_conv);
43887         return tag_ptr(ret_conv, true);
43888 }
43889
43890 jstring  __attribute__((export_name("TS_ParseError_to_str"))) TS_ParseError_to_str(uint64_t o) {
43891         LDKParseError* o_conv = (LDKParseError*)untag_ptr(o);
43892         LDKStr ret_str = ParseError_to_str(o_conv);
43893         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
43894         Str_free(ret_str);
43895         return ret_conv;
43896 }
43897
43898 jstring  __attribute__((export_name("TS_ParseOrSemanticError_to_str"))) TS_ParseOrSemanticError_to_str(uint64_t o) {
43899         LDKParseOrSemanticError* o_conv = (LDKParseOrSemanticError*)untag_ptr(o);
43900         LDKStr ret_str = ParseOrSemanticError_to_str(o_conv);
43901         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
43902         Str_free(ret_str);
43903         return ret_conv;
43904 }
43905
43906 jstring  __attribute__((export_name("TS_Invoice_to_str"))) TS_Invoice_to_str(uint64_t o) {
43907         LDKInvoice o_conv;
43908         o_conv.inner = untag_ptr(o);
43909         o_conv.is_owned = ptr_is_owned(o);
43910         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
43911         o_conv.is_owned = false;
43912         LDKStr ret_str = Invoice_to_str(&o_conv);
43913         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
43914         Str_free(ret_str);
43915         return ret_conv;
43916 }
43917
43918 jstring  __attribute__((export_name("TS_SignedRawInvoice_to_str"))) TS_SignedRawInvoice_to_str(uint64_t o) {
43919         LDKSignedRawInvoice o_conv;
43920         o_conv.inner = untag_ptr(o);
43921         o_conv.is_owned = ptr_is_owned(o);
43922         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
43923         o_conv.is_owned = false;
43924         LDKStr ret_str = SignedRawInvoice_to_str(&o_conv);
43925         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
43926         Str_free(ret_str);
43927         return ret_conv;
43928 }
43929
43930 jstring  __attribute__((export_name("TS_Currency_to_str"))) TS_Currency_to_str(uint64_t o) {
43931         LDKCurrency* o_conv = (LDKCurrency*)untag_ptr(o);
43932         LDKStr ret_str = Currency_to_str(o_conv);
43933         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
43934         Str_free(ret_str);
43935         return ret_conv;
43936 }
43937
43938 jstring  __attribute__((export_name("TS_SiPrefix_to_str"))) TS_SiPrefix_to_str(uint64_t o) {
43939         LDKSiPrefix* o_conv = (LDKSiPrefix*)untag_ptr(o);
43940         LDKStr ret_str = SiPrefix_to_str(o_conv);
43941         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
43942         Str_free(ret_str);
43943         return ret_conv;
43944 }
43945